{ "info": { "author": "Mehmet Gurdal", "author_email": "mgurdal@protonmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7" ], "description": "aegis\n=============\n\n|Python 3.6| |pypi| |travis-badge| |coveralls| |codefactor grade| |downloads|\n\n.. |Python 3.6| image:: https://img.shields.io/badge/python-3.6-brightgreen.svg\n :target: https://www.python.org/downloads/release/python-360\n.. |codefactor grade| image:: https://www.codefactor.io/repository/github/mgurdal/aegis/badge\n :target: https://www.codefactor.io/repository/github/mgurdal/aegis/badge\n.. |travis-badge| image:: https://travis-ci.org/mgurdal/aegis.svg?branch=master\n :target: https://travis-ci.org/mgurdal/aegis\n.. |coveralls| image:: https://coveralls.io/repos/github/mgurdal/aegis/badge.svg?branch=master\n :target: https://coveralls.io/github/mgurdal/aegis?branch=master\n.. |pypi| image:: https://badge.fury.io/py/aegis.svg\n :target: https://badge.fury.io/py/aegis\n.. |downloads| image:: https://img.shields.io/pypi/dm/aegis.svg\n :target: https://pypi.python.org/pypi/aegis\n\n**aegis** allows to **protect endpoints** and also provides\n**authentication scoping**.\n\n--------------\n\nInstallation\n~~~~~~~~~~~~\n.. code:: bash\n\n pip install aegis\n\n\nSimple Example\n~~~~~~~~~~~~~~\n\n.. code:: python\n\n from aiohttp import web\n from aegis import login_required, JWTAuth\n\n\n class JWTAuthenticator(JWTAuth):\n jwt_secret = \"\"\n\n async def authenticate(self, request: web.Request) -> dict:\n db = request.app[\"db\"]\n credentials = await request.json()\n id_ = credentials[\"id\"]\n user = db.get(id_)\n return user\n\n\n @login_required\n async def protected(request):\n return web.json_response({'hello': 'user'})\n\n\n def create_app():\n app = web.Application()\n app[\"db\"] = {\n 5: {\n \"name\": \"test\"\n }\n }\n app.router.add_get('/protected', protected)\n\n JWTAuthenticator.setup(app)\n\n return app\n\n\n if __name__ == \"__main__\":\n app = create_app()\n web.run_app(app)\n\n\nGet access token\n\n.. code:: bash\n\n curl -X POST http://0.0.0.0:8080/auth -d '{\"id\": 5}'\n\n\n {\"access_token\": \"\"}\n\nGet user\n\n.. code:: bash\n\n curl http://0.0.0.0:8080/protected -H 'Authorization: Bearer '\n\n\n {'hello': 'user'}\n\n\n\nTest\n~~~~~~~~~~~~~~\n\n.. code:: bash\n\n git clone https://github.com/mgurdal/aegis.git\n cd aegis\n make cov\n\nRequirements\n~~~~~~~~~~~~\n\n- Python >= 3.6\n- aiohttp\n- PyJWT\n\nLicense\n~~~~~~~~\n\n``aegis`` is offered under the Apache 2 license.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mgurdal/aegis", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "aegis", "package_url": "https://pypi.org/project/aegis/", "platform": "", "project_url": "https://pypi.org/project/aegis/", "project_urls": { "Homepage": "https://github.com/mgurdal/aegis" }, "release_url": "https://pypi.org/project/aegis/1.0.0/", "requires_dist": null, "requires_python": ">=3.6.0", "summary": "Authentication library for aiohttp", "version": "1.0.0" }, "last_serial": 5248821, "releases": { "0.3.1": [ { "comment_text": "", "digests": { "md5": "f738da4b9079d30aa4b978416bf4e858", "sha256": "43e2d0ba272ec5f169a64cb4889abd8f6064b0eea3795c59083dbdf6c5b9827f" }, "downloads": -1, "filename": "aegis-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f738da4b9079d30aa4b978416bf4e858", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": ">=3.6.0", "size": 19499, "upload_time": "2019-04-26T00:00:09", "url": "https://files.pythonhosted.org/packages/72/42/2349fbe0eb33c41c139d260aae76887efbe77863971c49c725a67c915014/aegis-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b8f0f92747316fecafed35a1fa6265ea", "sha256": "0f352a57b437e7a66c3a1fb3bc3a30565f1493b64a11ad9c7395890be215e126" }, "downloads": -1, "filename": "aegis-0.3.1.tar.gz", "has_sig": false, "md5_digest": "b8f0f92747316fecafed35a1fa6265ea", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 7706, "upload_time": "2019-04-26T00:00:15", "url": "https://files.pythonhosted.org/packages/ad/19/682600491aa0076f2a83f4d1fa2c3e35eb8efc5adcfc9751c52d1d40b8c1/aegis-0.3.1.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "d9d09e46517e53514fd8df21e789aae8", "sha256": "2f7a6b70813b1f5b60b1233f52f884353d5c2ff24c193a9b2bd068645cbb8c49" }, "downloads": -1, "filename": "aegis-0.4.0.tar.gz", "has_sig": false, "md5_digest": "d9d09e46517e53514fd8df21e789aae8", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 8183, "upload_time": "2019-04-29T06:28:14", "url": "https://files.pythonhosted.org/packages/92/d5/1494ffe7387bcd2421e24b923c3dd5a66feea18ed4c40cb05f6d8526f5ba/aegis-0.4.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "edbcb5e2716933c736e49c83be804886", "sha256": "22287ddf4334947773d49f9751e755a8854d9e1ac181b8a3aa8f843d0030c71f" }, "downloads": -1, "filename": "aegis-1.0.0.tar.gz", "has_sig": false, "md5_digest": "edbcb5e2716933c736e49c83be804886", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 8269, "upload_time": "2019-05-09T18:32:03", "url": "https://files.pythonhosted.org/packages/90/67/e1af6100994a98f6e3729288b34bf8c65d8c837d7c50139cd76587b4c132/aegis-1.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "edbcb5e2716933c736e49c83be804886", "sha256": "22287ddf4334947773d49f9751e755a8854d9e1ac181b8a3aa8f843d0030c71f" }, "downloads": -1, "filename": "aegis-1.0.0.tar.gz", "has_sig": false, "md5_digest": "edbcb5e2716933c736e49c83be804886", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6.0", "size": 8269, "upload_time": "2019-05-09T18:32:03", "url": "https://files.pythonhosted.org/packages/90/67/e1af6100994a98f6e3729288b34bf8c65d8c837d7c50139cd76587b4c132/aegis-1.0.0.tar.gz" } ] }