{ "info": { "author": "Sergei Beilin", "author_email": "saabeilin@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Utilities" ], "description": "Gotta get your API protected!\n=============================\n\nToken-based authentication is the most common way of protecting your APIs from unwanted folk.\n\nSometimes you need to do things _fast_ (you know, get it to prod _yesterday_) \nand you do not really have time to implement a proper authentication layer.\n\nOkay, are you fine with a temporary solution? There's nothing more permanent than temporary, right.\n\nIf you can:\n\n * provide a simple async token verifier (say, checking it in memcached or Redis)\n\n or\n * hard-code a token in your app prototype,\n\n and also\n\n * sent the token in a request header\n\n - then we are ready to go.\n\n\n## Usage example\n\n\n```python\nfrom sanic import Sanic\nfrom sanic.response import text\n\nfrom sanic_token_auth import SanicTokenAuth\n\napp = Sanic()\nauth = SanicTokenAuth(app, secret_key='utee3Quaaxohh1Oo', header='X-My-App-Auth-Token')\n\n\n@app.route(\"/\")\nasync def index(request):\n return text(\"Go to /protected\")\n\n\n@app.route(\"/protected\")\n@auth.auth_required\nasync def protected(request):\n return text(\"Welcome!\")\n\n\nif __name__ == \"__main__\":\n app.run(host=\"0.0.0.0\", port=8000, debug=True)\n```\n\nAnd let's try it:\n\n```bash\n$ curl http://localhost:8000/protected -H \"X-My-App-Auth-Token: utee3Quaaxohh1Oo\"\n\nWelcome!\n```\n\n\nIf you omit the `header` argument, you can instead send a token in either \n`Authorization: Bearer ` or `Authorization: Token ` \nheader.\n\n\n-----\n\nTODO:\n\n [ ] Document `token_verifier` and implement examples of using of \n\n [ ] Implement \"protect all\" behaviour\n\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/saabeilin/sanic-token-auth", "keywords": "sanic,authentication", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "sanic-token-auth", "package_url": "https://pypi.org/project/sanic-token-auth/", "platform": "", "project_url": "https://pypi.org/project/sanic-token-auth/", "project_urls": { "Homepage": "https://github.com/saabeilin/sanic-token-auth" }, "release_url": "https://pypi.org/project/sanic-token-auth/0.1.1/", "requires_dist": [ "sanic", "itsdangerous" ], "requires_python": "", "summary": "A simple token-based auth plugin for Sanic", "version": "0.1.1" }, "last_serial": 3654021, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "3b86adde0c37181da367212f3bea3d42", "sha256": "7dcd5e8eac6f1420a083bd35fc03c3631f68fd2480142b2defb0a4105dde3127" }, "downloads": -1, "filename": "sanic_token_auth-0.1.0.tar.gz", "has_sig": false, "md5_digest": "3b86adde0c37181da367212f3bea3d42", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3478, "upload_time": "2018-03-09T07:49:20", "url": "https://files.pythonhosted.org/packages/4a/fc/edbac9cbebda379f0ce522933ec22cae2a6e9aa0fd583694cb1cad504287/sanic_token_auth-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "59cda04ca00bb6e4721253bffde6ed4e", "sha256": "c8462a60e8909507aa4ff885db0eb8b33e26e2ca5fa4c10448247df49db20eb1" }, "downloads": -1, "filename": "sanic_token_auth-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "59cda04ca00bb6e4721253bffde6ed4e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5004, "upload_time": "2018-03-09T10:59:54", "url": "https://files.pythonhosted.org/packages/90/b8/68e8bd5960537b0dddbe0d07a344eec7bc96688581ac388f38b13239e61e/sanic_token_auth-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b64d3f2453aba12de5cb4a01cdf7b09b", "sha256": "50218e5fa215be21dc829d3d8927f060e67a9c69a9411f8bfa2e125517cbeb2f" }, "downloads": -1, "filename": "sanic_token_auth-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b64d3f2453aba12de5cb4a01cdf7b09b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3447, "upload_time": "2018-03-09T10:59:56", "url": "https://files.pythonhosted.org/packages/da/20/e8f0087c0d10c71b6245b39eac73725968eadcccc2be17a5cba74c82b899/sanic_token_auth-0.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "59cda04ca00bb6e4721253bffde6ed4e", "sha256": "c8462a60e8909507aa4ff885db0eb8b33e26e2ca5fa4c10448247df49db20eb1" }, "downloads": -1, "filename": "sanic_token_auth-0.1.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "59cda04ca00bb6e4721253bffde6ed4e", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5004, "upload_time": "2018-03-09T10:59:54", "url": "https://files.pythonhosted.org/packages/90/b8/68e8bd5960537b0dddbe0d07a344eec7bc96688581ac388f38b13239e61e/sanic_token_auth-0.1.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b64d3f2453aba12de5cb4a01cdf7b09b", "sha256": "50218e5fa215be21dc829d3d8927f060e67a9c69a9411f8bfa2e125517cbeb2f" }, "downloads": -1, "filename": "sanic_token_auth-0.1.1.tar.gz", "has_sig": false, "md5_digest": "b64d3f2453aba12de5cb4a01cdf7b09b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3447, "upload_time": "2018-03-09T10:59:56", "url": "https://files.pythonhosted.org/packages/da/20/e8f0087c0d10c71b6245b39eac73725968eadcccc2be17a5cba74c82b899/sanic_token_auth-0.1.1.tar.gz" } ] }