{ "info": { "author": "Andrew Grytsenko", "author_email": "darkanthey@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "# Oauth2-stateless\n\nOauth2-stateless is a framework that aims at making it easy to provide authentication\nvia [OAuth 2.0](http://tools.ietf.org/html/rfc6749) within an application stack.\nMain difference of this library is the simplicity\nand the ability to work without any database just with 'stateless'\ntokens based on **JWT** [JSON Web Tokens](https://en.wikipedia.org/wiki/JSON_Web_Token).\n\n[Documentation](http://oauth2-stateless.readthedocs.org/en/latest/index.html)\n\n\n# Status\n\n[![Travis Build Status][build-badge]][build]\n[![License](http://img.shields.io/badge/Licence-MIT-brightgreen.svg)](LICENSE)\n\nOauth2-stateless has reached its beta phase. All main parts of the [OAuth 2.0 RFC](http://tools.ietf.org/html/rfc6749) such as the various types of Grants, Refresh Token and Scopes have been implemented.\n\n\n# Installation\n\noauth2-stateless is [available on PyPI](http://pypi.python.org/pypi/oauth2-stateless/)\n\n``` bash\npip install oauth2-stateless\n```\n\n\n# Usage\n\n## Example Authorization server\n\n``` python\n from wsgiref.simple_server import make_server\n import oauth2\n import oauth2.grant\n import oauth2.error\n from oauth2.store.memory import ClientStore\n from oauth2.store.stateless import Token Store\n import oauth2.tokengenerator\n import oauth2.web.wsgi\n\n\n # Create a SiteAdapter to interact with the user.\n # This can be used to display confirmation dialogs and the like.\n class ExampleSiteAdapter(oauth2.web.AuthorizationCodeGrantSiteAdapter, oauth2.web.ImplicitGrantSiteAdapter):\n TEMPLATE = '''\n \n \n

\n confirm\n

\n

\n deny\n

\n \n '''\n\n def authenticate(self, request, environ, scopes, client):\n # Check if the user has granted access\n if request.post_param(\"confirm\") == \"confirm\":\n return {}\n\n raise oauth2.error.UserNotAuthenticated\n\n def render_auth_page(self, request, response, environ, scopes, client):\n url = request.path + \"?\" + request.query_string\n response.body = self.TEMPLATE.format(url=url)\n return response\n\n def user_has_denied_access(self, request):\n # Check if the user has denied access\n if request.post_param(\"deny\") == \"deny\":\n return True\n return False\n\n # Create an in-memory storage to store your client apps.\n client_store = ClientStore()\n # Add a client\n client_store.add_client(client_id=\"abc\", client_secret=\"xyz\", redirect_uris=[\"http://localhost/callback\"])\n\n site_adapter = ExampleSiteAdapter()\n\n # Create an in-memory storage to store issued tokens.\n # LocalTokenStore can store access and auth tokens\n stateless_token = oauth2.tokengenerator.StatelessTokenGenerator(secret_key='xxx')\n token_store = TokenStore(stateless)\n\n # Create the controller.\n provider = oauth2.Provider(\n access_token_store=token_store,\n auth_code_store=token_store,\n client_store=client_store,\n token_generator=stateless_token)\n )\n\n # Add Grants you want to support\n provider.add_grant(oauth2.grant.AuthorizationCodeGrant(site_adapter=site_adapter))\n provider.add_grant(oauth2.grant.ImplicitGrant(site_adapter=site_adapter))\n\n # Add refresh token capability and set expiration time of access tokens to 30 days\n provider.add_grant(oauth2.grant.RefreshToken(expires_in=2592000))\n\n # Wrap the controller with the Wsgi adapter\n app = oauth2.web.wsgi.Application(provider=provider)\n\n if __name__ == \"__main__\":\n httpd = make_server('', 8080, app)\n httpd.serve_forever()\n```\n\nThis example only shows how to instantiate the server.\nIt is not a working example as a client app is missing.\nTake a look at the [examples](docs/examples/) directory.\n\nOr just run this example:\n\n``` bash\npython docs/examples/stateless_client_server.py\n```\n\nThis is already a workable example. They can work without database\nbecause oauth token already contain all the necessary information like\na user_id, grant_type, data, scopes and client_id.\nIf you want to check user state like a ban, disable, etc.\nYou can check this param on server site from database. By adding this check to\n/api/me or redefine oauth2.tokengenerator and add specific logic.\n\n\n# Supported storage backends\n\nOauth2-stateless does not force you to use a specific database or you\ncan work without database with stateless token.\n\nIt currently supports these storage backends out-of-the-box:\n\n- MongoDB\n- MySQL\n- Redis\n- Memcached\n- Dynamodb\n\nHowever, you are not not bound to these implementations.\nBy adhering to the interface defined by the base classes in **oauth2.store**,\nyou can easily add an implementation of your backend.\nIt also is possible to mix different backends and e.g. read data of a client\nfrom MongoDB while saving all tokens in memcached for fast access.\n\nTake a look at the examples in the [examples](docs/examples/) directory of the project.\n\n\n# Site adapter\n\n- aiohttp\n- flask\n- tornado\n- uwsgi\n\nLike for storage, oauth2-stateless does not define how you identify a\nuser or show a confirmation dialogue.\nInstead your application should use the API defined by _oauth2.web.SiteAdapter_.\n\n\n# Contributors\n\n[\"DarkAnthey\"](https://github.com/darkanthey) |\n:---:\n|[DarkAnthey](https://github.com/darkanthey)|\n\n[build-badge]: https://travis-ci.org/darkanthey/oauth2-stateless.svg?branch=master\n[build]: https://travis-ci.org/darkanthey/oauth2-stateless.svg?branch=master\n[license-badge]: https://img.shields.io/badge/license-MIT-blue.svg?style=flat\n[license]: https://github.com/darkanthey/oauth2-stateless/blob/master/LICENSE\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/darkanthey/oauth2-stateless", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "oauth2-stateless", "package_url": "https://pypi.org/project/oauth2-stateless/", "platform": "", "project_url": "https://pypi.org/project/oauth2-stateless/", "project_urls": { "Homepage": "https://github.com/darkanthey/oauth2-stateless" }, "release_url": "https://pypi.org/project/oauth2-stateless/1.1.0/", "requires_dist": [ "ujson", "itsdangerous", "python-memcached; extra == 'memcache'", "pymongo; extra == 'mongodb'", "redis; extra == 'redis'" ], "requires_python": "", "summary": "OAuth 2.0 provider for python with Stateless tokens support", "version": "1.1.0" }, "last_serial": 3605012, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "ea5a7c190782258b1b5bdf9ded587d7e", "sha256": "4d8fec47d09affc6db74a95d257909daf49b6ab7a5eb700faaa8be87d36c1a46" }, "downloads": -1, "filename": "oauth2-stateless-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ea5a7c190782258b1b5bdf9ded587d7e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44455, "upload_time": "2018-01-19T11:15:09", "url": "https://files.pythonhosted.org/packages/42/d8/c0f81330afe137611e7861159544395a22be02207cf0aae387d288c197b2/oauth2-stateless-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "78c7e577698197904652862ec678c822", "sha256": "7f1034153d896827f34a3c2d6707a9d27e63bb90cee1a52b99e3c4183cd3c2f7" }, "downloads": -1, "filename": "oauth2_stateless-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "78c7e577698197904652862ec678c822", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 64488, "upload_time": "2018-02-14T17:41:53", "url": "https://files.pythonhosted.org/packages/62/ad/0414a32acb1b065dc2cd693e718e81e8e6238770df8dd05324af53d38ee2/oauth2_stateless-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ea053f0620f59de17ab2c8191a2a721b", "sha256": "216efef3b9ecb88974582900e827f0e8aac20c2fe1a18c1e30fcc1ac084552ed" }, "downloads": -1, "filename": "oauth2-stateless-1.0.1.tar.gz", "has_sig": false, "md5_digest": "ea053f0620f59de17ab2c8191a2a721b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 44813, "upload_time": "2018-02-14T12:16:35", "url": "https://files.pythonhosted.org/packages/37/ba/fa286d0e0b1e606f4641c7de21a17910bc2ba3d65b6267bb1a8c7dc1bf55/oauth2-stateless-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "e6b151e4b08e820adab236ffe0ba998c", "sha256": "c59f3762006f34d51c0d396fbfc883313b1dcb10267a98aa222b811144e23842" }, "downloads": -1, "filename": "oauth2_stateless-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e6b151e4b08e820adab236ffe0ba998c", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 64730, "upload_time": "2018-02-20T10:56:48", "url": "https://files.pythonhosted.org/packages/65/b7/bb3eb854010c466d74194783f2727179f172ac838a33333a7b16ef7eeb3d/oauth2_stateless-1.0.2-py2.py3-none-any.whl" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "2bf79e2ecaccbd5182c3682aa6a6e811", "sha256": "b6396add9e181fa655050779098a56c5aebde9899e5ef1d39939bc6ac7083f5a" }, "downloads": -1, "filename": "oauth2_stateless-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "2bf79e2ecaccbd5182c3682aa6a6e811", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 64750, "upload_time": "2018-02-20T11:27:43", "url": "https://files.pythonhosted.org/packages/45/67/a88092614fe083f337199590722e5519a9cafc4350ff769a2228f18d14f7/oauth2_stateless-1.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "eee3f49d8cbbc4bf4cc88850b33a807f", "sha256": "2fb009f1da0497500af9867b1e675e5995d6a476187f880ba091e0bbff6ccd69" }, "downloads": -1, "filename": "oauth2_stateless-1.0.4-py3.5.egg", "has_sig": false, "md5_digest": "eee3f49d8cbbc4bf4cc88850b33a807f", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 158934, "upload_time": "2018-02-22T10:50:23", "url": "https://files.pythonhosted.org/packages/f3/7c/5b526d99029aeb967a9f3a5d383f9a5c3451713dafe574d467d457ad7c3c/oauth2_stateless-1.0.4-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "9abc21e7c8929c7ffaaf5010313deb63", "sha256": "e226f5028d6c19734f459de686ab0894abeacaddf4452346a3c91833c155ceef" }, "downloads": -1, "filename": "oauth2-stateless-1.0.4.tar.gz", "has_sig": false, "md5_digest": "9abc21e7c8929c7ffaaf5010313deb63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45072, "upload_time": "2018-02-20T11:27:45", "url": "https://files.pythonhosted.org/packages/4d/cb/9225167913122e8d2e8153461a7394202659e3d54bf50b77df09f5f4750c/oauth2-stateless-1.0.4.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "5200dfa8932bb4a2383f992760229d83", "sha256": "330bc22e3ed68d5b6ed593e81fcc78a6b965c11900e824d218a29c97e5a00d79" }, "downloads": -1, "filename": "oauth2_stateless-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5200dfa8932bb4a2383f992760229d83", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 66166, "upload_time": "2018-02-22T10:50:22", "url": "https://files.pythonhosted.org/packages/f5/66/cb040592a62980ff705b51fd3a712b8757fd9a73db4932be890c372f5393/oauth2_stateless-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "43c7a4b67bbf79560a43e6fc60e6700f", "sha256": "29e484aaa72ea6f1dc4171583e9d46e182c15cad0136732ab12007f500dd646d" }, "downloads": -1, "filename": "oauth2_stateless-1.1.0-py3.5.egg", "has_sig": false, "md5_digest": "43c7a4b67bbf79560a43e6fc60e6700f", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 161899, "upload_time": "2018-02-22T10:50:25", "url": "https://files.pythonhosted.org/packages/0b/af/7d192c2e3e732c2bf919ffca2c32545c09c081920c88d765953b454b05bd/oauth2_stateless-1.1.0-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "172e1072c27b1f32b274f8bbe585e63b", "sha256": "306e7bb0a0f9d4a216b9a69c3b32d3978816f873e248a5c0844ffc4f02d1874f" }, "downloads": -1, "filename": "oauth2-stateless-1.1.0.tar.gz", "has_sig": false, "md5_digest": "172e1072c27b1f32b274f8bbe585e63b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45811, "upload_time": "2018-02-22T10:50:28", "url": "https://files.pythonhosted.org/packages/e9/b3/a63318226e8c3d9c3b32199732bf44d4bb5077ba3c8ef53796cabd9bbc36/oauth2-stateless-1.1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "5200dfa8932bb4a2383f992760229d83", "sha256": "330bc22e3ed68d5b6ed593e81fcc78a6b965c11900e824d218a29c97e5a00d79" }, "downloads": -1, "filename": "oauth2_stateless-1.1.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5200dfa8932bb4a2383f992760229d83", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 66166, "upload_time": "2018-02-22T10:50:22", "url": "https://files.pythonhosted.org/packages/f5/66/cb040592a62980ff705b51fd3a712b8757fd9a73db4932be890c372f5393/oauth2_stateless-1.1.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "43c7a4b67bbf79560a43e6fc60e6700f", "sha256": "29e484aaa72ea6f1dc4171583e9d46e182c15cad0136732ab12007f500dd646d" }, "downloads": -1, "filename": "oauth2_stateless-1.1.0-py3.5.egg", "has_sig": false, "md5_digest": "43c7a4b67bbf79560a43e6fc60e6700f", "packagetype": "bdist_egg", "python_version": "3.5", "requires_python": null, "size": 161899, "upload_time": "2018-02-22T10:50:25", "url": "https://files.pythonhosted.org/packages/0b/af/7d192c2e3e732c2bf919ffca2c32545c09c081920c88d765953b454b05bd/oauth2_stateless-1.1.0-py3.5.egg" }, { "comment_text": "", "digests": { "md5": "172e1072c27b1f32b274f8bbe585e63b", "sha256": "306e7bb0a0f9d4a216b9a69c3b32d3978816f873e248a5c0844ffc4f02d1874f" }, "downloads": -1, "filename": "oauth2-stateless-1.1.0.tar.gz", "has_sig": false, "md5_digest": "172e1072c27b1f32b274f8bbe585e63b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 45811, "upload_time": "2018-02-22T10:50:28", "url": "https://files.pythonhosted.org/packages/e9/b3/a63318226e8c3d9c3b32199732bf44d4bb5077ba3c8ef53796cabd9bbc36/oauth2-stateless-1.1.0.tar.gz" } ] }