{ "info": { "author": "Olivier Poitrey", "author_email": "rs@dailymotion.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: No Input/Output (Daemon)", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: Telecommunications Industry", "License :: OSI Approved :: MIT License", "Operating System :: Unix", "Programming Language :: Python", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: HTTP Servers", "Topic :: Security" ], "description": "Eve Auth JWT\n============\n\n.. image:: https://img.shields.io/pypi/v/eve-auth-jwt.svg\n :target: https://pypi.python.org/pypi/eve-auth-jwt\n\n.. image:: https://travis-ci.org/rs/eve-auth-jwt.svg?branch=master\n :target: https://travis-ci.org/rs/eve-auth-jwt\n\nAn OAuth 2 JWT token validation module for `Eve `_.\n\nInstallation\n------------\n\nTo install eve-auth-jwt, simply:\n\n $ pip install eve-auth-jwt\n\nAt Eve initialization::\n\n from eve import Eve\n from eve_auth_jwt import JWTAuth\n\n app = Eve(auth=JWTAuth, settings=SETTINGS)\n\nConfiguration\n-------------\n\nThis module reads its configuration form Eve settings. Here is the list of new directives:\n\n* ``JWT_SECRET`` (required): Defines the symetric secret token secret used to de/encode the token (async keys support is a TODO).\n* ``JWT_ISSUER`` (required): Defines the required token issuer (``iss`` claim).\n* ``JWT_AUDIENCES``: Defines a list of accepted audiences (``aud`` claim). If not provided, only tokens with no audience set will be accepted. The resource level ``audiences`` parameter is also available.\n* ``JWT_ROLES_CLAIM``: Defines the claim name for roles. If set, Eve roles check will be activated, and any resources with ``allowed_roles`` set will require to have those roles present in the defined token's claim.\n* ``JWT_SCOPE_CLAIM``: Defines the claim name for scope. If set and the token has a claim of the same name containing the string ``viewer``, only ``GET`` and ``HEAD`` methods will be granted. All other values are ignored and added to the list of exposed roles with the ``scope:`` prefix.\n\nReading Roles\n-------------\n\nIf access is granted, the authentication module exposes roles and token's claims thru ``get_authen_roles()`` and ``get_authen_claims()`` methods. You may access those values from your event hook as follow::\n\n def my_hook(...)\n resource_def = app.config['DOMAIN'][resource_name]\n auth = resource_def['authentication']\n if 'somerole' in auth.get_authen_roles():\n # grant some finer access\n\n\nSecuring custom routes\n----------------------\n\nJWT Authorization can be applied to any custom routes using the `@requires_token` wrapper. This annotation will only provide *audience and role access control*. User level access must be written manually.\n\nExample of audience access control::\n\n from eve_auth_jwt import requires_token, get_request_auth_value\n\n @app.route('/my_resource/download', methods=['GET'])\n @requires_token(audiences=['myAudience'])\n def csv_download():\n # Allows all users with myAudience to access download\n account_id = get_request_auth_value()\n if check_user(account_id):\n\n abort(401)\n\n return generateCSV(account_id)\n\nExample of `myAdmin` access control::\n\n from eve_auth_jwt import requires_token\n\n @app.route('/admin/my_resource/download', methods=['GET'])\n @requires_token(audiences=['myAudience'], allowed_roles=['myAdmin'])\n def csv_download():\n account_id = request.args.get('account_id', None)\n return generateCSV(account_id)\n\n\nAccess the parsed JWT token values\n----------------------------------\n\nThe parsed JWT token values are stored in the `flask.g` dict, but custom functions exist to aid in reading the values. The values are only available after the JWT token integrity check and user authorization occurs.\n\nExample of access the parse JWT token fields::\n\n from eve_auth_jwt import get_request_auth_value, get_authen_claims, get_authen_roles\n\n def my_fn():\n # Request authentication value as a str\n account_id = get_request_auth_value()\n\n # JWT claims as a dict[str]\n payload = get_authen_claims()\n\n # Roles as arr[str]\n roles = get_authen_roles()\n\n\nLicenses\n--------\n\nAll source code is licensed under the `MIT License `_.", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rs/eve-auth-jwt", "keywords": "eve,api,rest,oauth,auth,jwt", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "eve-auth-jwt", "package_url": "https://pypi.org/project/eve-auth-jwt/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/eve-auth-jwt/", "project_urls": { "Homepage": "https://github.com/rs/eve-auth-jwt" }, "release_url": "https://pypi.org/project/eve-auth-jwt/1.0.5/", "requires_dist": [ "eve (>=0.5.0)", "pyjwt (==1.3.0)" ], "requires_python": "", "summary": "Eve JWT authentication", "version": "1.0.5" }, "last_serial": 2126200, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "f2b2eece721930a6f5f884cffa2e8e4b", "sha256": "887f58dac50dbd5ad94aa54bef18e1909cd824c447ab2d87037a0f567dda17cb" }, "downloads": -1, "filename": "eve_auth_jwt-1.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f2b2eece721930a6f5f884cffa2e8e4b", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6197, "upload_time": "2015-05-22T23:58:04", "url": "https://files.pythonhosted.org/packages/9c/07/35be062f2cd9dc152bfc6aa5cbe455b5afeca84e80c7fd5012a5485b7117/eve_auth_jwt-1.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ed591d3f857b71b33191c05161229f63", "sha256": "e5d2c8751cd6d8885b1c0966f7eef482fe577451d0d6d5770ac73d476f9005cd" }, "downloads": -1, "filename": "eve-auth-jwt-1.0.0.tar.gz", "has_sig": false, "md5_digest": "ed591d3f857b71b33191c05161229f63", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3956, "upload_time": "2015-05-22T23:58:02", "url": "https://files.pythonhosted.org/packages/94/c0/35e9f8de0ffeeb00a1084aba24d7b8953cb118865e6805ea8c34169e4254/eve-auth-jwt-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "82fe334a8558831f8bf6d45ebc475e98", "sha256": "622ecb6a7708eb88b3281837ef9c7e5a0981128506f2f508ab9ff4eacc87e34e" }, "downloads": -1, "filename": "eve_auth_jwt-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "82fe334a8558831f8bf6d45ebc475e98", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6280, "upload_time": "2015-05-26T00:38:47", "url": "https://files.pythonhosted.org/packages/ae/c7/5298d4b8243f917e5b5d66617afcfd8fc4afbafcd73662ed14664272f23e/eve_auth_jwt-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "60a3884a6f4ba2215106bf95295673cf", "sha256": "b06ac0ece38022dc4637d3778094d6b1889f81c8a652a8f3e4c234d81624f46d" }, "downloads": -1, "filename": "eve-auth-jwt-1.0.1.tar.gz", "has_sig": false, "md5_digest": "60a3884a6f4ba2215106bf95295673cf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4010, "upload_time": "2015-05-26T00:38:43", "url": "https://files.pythonhosted.org/packages/b8/fb/a763e1934cf092307d102d5774645f2f0a9e29d05c9a90bee679cd8e1396/eve-auth-jwt-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "99d7ad3715ab3cea840a937c0ef0a35a", "sha256": "4d3392d776ac060c06c491f825061938f66d5f9cc8ab4507837c29390e76cbf6" }, "downloads": -1, "filename": "eve_auth_jwt-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "99d7ad3715ab3cea840a937c0ef0a35a", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 6283, "upload_time": "2015-05-26T05:11:21", "url": "https://files.pythonhosted.org/packages/50/ce/5f9a0b18c6516a96b48aca1065febbbd12321de5ceea4dd8fc4d809e9a9f/eve_auth_jwt-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3adbe94ddff0d610e77d530f04c06bd7", "sha256": "365134a0b797eae16bb837dad9fddd990f23dba73d53da00cb5c415c19d2483a" }, "downloads": -1, "filename": "eve-auth-jwt-1.0.2.tar.gz", "has_sig": false, "md5_digest": "3adbe94ddff0d610e77d530f04c06bd7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4001, "upload_time": "2015-05-26T05:11:00", "url": "https://files.pythonhosted.org/packages/8e/44/5f9f792c1ef941ff30ce16d9eb9a9f42d3c36ae66747131744bae82b1921/eve-auth-jwt-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "82f4eef54227afe1446ea7c8d335740a", "sha256": "aa23d0aa5bd3ddd7e9232ea1de68ea334b96fd4100b0c896ba20700b3a9e4e22" }, "downloads": -1, "filename": "eve_auth_jwt-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "82f4eef54227afe1446ea7c8d335740a", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 6278, "upload_time": "2015-11-21T00:20:26", "url": "https://files.pythonhosted.org/packages/4e/49/5f41c2cb44e79e45da4bad25165fd3e1bcb71a76ecb097214f631b445a67/eve_auth_jwt-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "435479e2e28f0f62d5f78557ec147bf8", "sha256": "cdcc08582ce335dc2dabf8f50c0099ed678dca9b9eb7ee0a6ea27bb079d682dc" }, "downloads": -1, "filename": "eve-auth-jwt-1.0.3.tar.gz", "has_sig": false, "md5_digest": "435479e2e28f0f62d5f78557ec147bf8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3988, "upload_time": "2015-11-21T00:20:04", "url": "https://files.pythonhosted.org/packages/48/0f/e0d558e3835b3fe4a024f1b50e5e65ce6d84ecfcfc3b525d4d4258120002/eve-auth-jwt-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "73f2cd49d915f21bf035e309e895594e", "sha256": "6dfefaad11d38987db9a6cb4e3629ae938180f02e2164780314d0b55aa36841d" }, "downloads": -1, "filename": "eve_auth_jwt-1.0.4-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "73f2cd49d915f21bf035e309e895594e", "packagetype": "bdist_wheel", "python_version": "3.4", "requires_python": null, "size": 6828, "upload_time": "2016-03-10T22:14:19", "url": "https://files.pythonhosted.org/packages/c6/ed/7bc18a8f18a8aaf5574b9fc774fc05355a5bd31e51a2ee41a304d89e7e8f/eve_auth_jwt-1.0.4-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3d9cf60279c6072656f20957af9e5c88", "sha256": "a684438cd787538dcec9b8313f0903d694073aa069b8d50724f31ac877ea7568" }, "downloads": -1, "filename": "eve-auth-jwt-1.0.4.tar.gz", "has_sig": false, "md5_digest": "3d9cf60279c6072656f20957af9e5c88", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4209, "upload_time": "2016-03-10T22:14:04", "url": "https://files.pythonhosted.org/packages/6e/bb/f44c8ad441f970021c39458d9d57e378cbeb889c33bc431d28da75f48b22/eve-auth-jwt-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "bdae379857a366d1125e7a02f7b4d1d6", "sha256": "a8b11fb7299b02022761d094f908b1a9c8d69c0d5dcecc7495c5045a5995a1e1" }, "downloads": -1, "filename": "eve_auth_jwt-1.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bdae379857a366d1125e7a02f7b4d1d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8184, "upload_time": "2016-05-20T22:52:00", "url": "https://files.pythonhosted.org/packages/ff/04/08f6740db62bd69c4b3d2fd37d7c1b723c3fa6f758e7d6b78ccbabb2442f/eve_auth_jwt-1.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b7c027f4db8ada1606ac01a880e8dc7f", "sha256": "e4a1823cccf9bd39f5dc60e347486e328291cc0804cd551aa50ae4a4715f04e3" }, "downloads": -1, "filename": "eve-auth-jwt-1.0.5.tar.gz", "has_sig": false, "md5_digest": "b7c027f4db8ada1606ac01a880e8dc7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5141, "upload_time": "2016-05-20T22:53:43", "url": "https://files.pythonhosted.org/packages/ed/6d/1d96fe6ae6a7a659d42c0576c664695ed5a1f17bae64c738a6bb612a20e2/eve-auth-jwt-1.0.5.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bdae379857a366d1125e7a02f7b4d1d6", "sha256": "a8b11fb7299b02022761d094f908b1a9c8d69c0d5dcecc7495c5045a5995a1e1" }, "downloads": -1, "filename": "eve_auth_jwt-1.0.5-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bdae379857a366d1125e7a02f7b4d1d6", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 8184, "upload_time": "2016-05-20T22:52:00", "url": "https://files.pythonhosted.org/packages/ff/04/08f6740db62bd69c4b3d2fd37d7c1b723c3fa6f758e7d6b78ccbabb2442f/eve_auth_jwt-1.0.5-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "b7c027f4db8ada1606ac01a880e8dc7f", "sha256": "e4a1823cccf9bd39f5dc60e347486e328291cc0804cd551aa50ae4a4715f04e3" }, "downloads": -1, "filename": "eve-auth-jwt-1.0.5.tar.gz", "has_sig": false, "md5_digest": "b7c027f4db8ada1606ac01a880e8dc7f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5141, "upload_time": "2016-05-20T22:53:43", "url": "https://files.pythonhosted.org/packages/ed/6d/1d96fe6ae6a7a659d42c0576c664695ed5a1f17bae64c738a6bb612a20e2/eve-auth-jwt-1.0.5.tar.gz" } ] }