{ "info": { "author": "Andrew O'Hara", "author_email": "andrew@andrewohara.io", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6" ], "description": "aws-lambda-pyauthlib\n====================\n\n.. image:: https://img.shields.io/pypi/status/aws-lambda-pyauthlib.svg\n :target: https://pypi.org/project/aws-lambda-pyauthlib\n\n.. image:: https://travis-ci.org/oharaandrew314/aws-lambda-pyauthlib.svg?branch=master\n :target: https://travis-ci.org/oharaandrew314/aws-lambda-pyauthlib\n \n.. image:: https://img.shields.io/pypi/v/aws-lambda-pyauthlib.svg\n :target: https://pypi.org/project/aws-lambda-pyauthlib\n\n.. image:: https://img.shields.io/pypi/l/aws-lambda-pyauthlib.svg\n :target: https://pypi.org/project/aws-lambda-pyauthlib\n\n.. image:: https://img.shields.io/pypi/pyversions/aws-lambda-pyauthlib.svg\n :target: https://pypi.org/project/aws-lambda-pyauthlib\n \n.. image:: https://codecov.io/github/oharaandrew314/aws-lambda-pyauthlib/coverage.svg?branch=master\n :target: https://codecov.io/github/oharaandrew314/aws-lambda-pyauthlib\n :alt: codecov.io\n\nA python helper library for AWS API Gateway Custom Authorizers.\n\nInstallation\n------------\n\n.. code-block:: bash\n\n pip install aws-lambda-pyauthlib\n\nor\n\n.. code-block:: bash\n\n pipenv install aws-lambda-pyauthlib\n\n\nQuickstart\n----------\n\n.. code-block:: python\n\n '''authorizer_handler.py'''\n from pyauthlib import UserInfo, AuthPolicy, HttpMethod, parse_event, raise_401\n from my_auth_client import get_client\n\n def lambda_handler(event, _context):\n '''Exchanges access token for user_info and returns the policy.\n Unauthorized users are denied all access.\n Users are allowed read access to all resources.\n Admins are allowed full access to all resources.\n '''\n event = parse_event(event)\n \n identity = get_client().get_identity(event.access_token)\n user_info = UserInfo(identity['user_id'], identity['grants'])\n policy = AuthPolicy(user_info)\n\n if not user_info:\n raise_401()\n elif 'ROLE_ADMIN' in user_info.authorities:\n policy.allow(event.arn(method=HttpMethod.ALL, resource='*'))\n else:\n policy.allow(event.arn(method=HttpMethod.GET, resource='*'))\n\n return policy.build()\n \nMore Information\n----------------\n\nYou can also return an arbitrary authorizer context, by passing kwargs into the *UserInfo*.\nA list of authorities is always required, but nothing is stopping you from using an empty list.\n\nGo check out the `examples `_!", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/oharaandrew314/aws-lambda-pyauthlib/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "aws-lambda-pyauthlib", "package_url": "https://pypi.org/project/aws-lambda-pyauthlib/", "platform": "", "project_url": "https://pypi.org/project/aws-lambda-pyauthlib/", "project_urls": { "Homepage": "https://github.com/oharaandrew314/aws-lambda-pyauthlib/" }, "release_url": "https://pypi.org/project/aws-lambda-pyauthlib/0.2.2/", "requires_dist": null, "requires_python": "", "summary": "A python helper library for AWS API Gateway Custom Authorizers", "version": "0.2.2" }, "last_serial": 3350875, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "40de4511825379b0bc3f3956bf760aca", "sha256": "31213360a72015c3c51b755d08fdd994c0f01aaf2c8fb77becfed22b33af473c" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "40de4511825379b0bc3f3956bf760aca", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4019, "upload_time": "2017-11-04T23:48:52", "url": "https://files.pythonhosted.org/packages/1c/89/0868f671c3e379b55baa7e97fa92315dd2a96976dcfcc538eb2d0fa7225c/aws-lambda-pyauthlib-0.1.0.tar.gz" } ], "0.1.0.dev1": [ { "comment_text": "", "digests": { "md5": "cf91e78ec2c0f96301801b9c2550ed5a", "sha256": "e0a43adacd408cb0e2ff920750663a4cb37c2500b9d08d601dc00eac76a0242f" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.1.0.dev1.tar.gz", "has_sig": false, "md5_digest": "cf91e78ec2c0f96301801b9c2550ed5a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3780, "upload_time": "2017-11-04T21:52:14", "url": "https://files.pythonhosted.org/packages/16/ad/53b7534e08ded3ecb15284cf63204d71920b7f9d86f153946050eb75c70e/aws-lambda-pyauthlib-0.1.0.dev1.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "e4629b732351702230418ee0a9b25e3c", "sha256": "234835afd98d690dc672cd4d457c4883b67dd6d02a7b87b3273a9bc54477d291" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.1.1.tar.gz", "has_sig": false, "md5_digest": "e4629b732351702230418ee0a9b25e3c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4518, "upload_time": "2017-11-13T02:17:04", "url": "https://files.pythonhosted.org/packages/8b/63/c6291e1755dc581132359751492c6a26d585f091dcd0c9e6a725a8bee463/aws-lambda-pyauthlib-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "0f1cc0f287c22f51b072baa0d610c80a", "sha256": "03aa378dfc25a6f789ab280a83fae111765702892b943469d0607c5c2e8cd3da" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.1.2.tar.gz", "has_sig": false, "md5_digest": "0f1cc0f287c22f51b072baa0d610c80a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4463, "upload_time": "2017-11-16T20:53:53", "url": "https://files.pythonhosted.org/packages/c1/f8/1dcf3309cc2ed68255f67519a88c247944b7ce6bcfaa0b85233467092581/aws-lambda-pyauthlib-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "de199a3890dc218b588343a3e0641542", "sha256": "56fa7b6ebe478418be5db754b0bf087ae343c860565d36e48a2ff705dce13043" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.2.0.tar.gz", "has_sig": false, "md5_digest": "de199a3890dc218b588343a3e0641542", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4606, "upload_time": "2017-11-20T19:15:22", "url": "https://files.pythonhosted.org/packages/6b/4e/d21bbd5eec96a6ec92ff36d883238bde119f48011b5a22a50d24de636805/aws-lambda-pyauthlib-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "44bcadd5eb62adb114c88c11709c7ddb", "sha256": "345a88a7c7de6694da4bd1c769ed7306ac5e4e22d96d70c909a7493b9c019971" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.2.1.tar.gz", "has_sig": false, "md5_digest": "44bcadd5eb62adb114c88c11709c7ddb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4615, "upload_time": "2017-11-21T02:38:36", "url": "https://files.pythonhosted.org/packages/78/c6/1ca0dcee2f154afff2ae08da9485a72254092de3284b4bb531052d290c42/aws-lambda-pyauthlib-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "7f7cd73cee3ec443dce3c949887f77e3", "sha256": "5787b323e519480408fd88a357b85b919ff63542ad93d37d94320a96f5caa554" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.2.2.tar.gz", "has_sig": false, "md5_digest": "7f7cd73cee3ec443dce3c949887f77e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4614, "upload_time": "2017-11-21T02:55:36", "url": "https://files.pythonhosted.org/packages/3e/f7/dc4d3a71d79e356da715df0e0b87bbb4e1127d6d8f5de44d2116fb23c749/aws-lambda-pyauthlib-0.2.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7f7cd73cee3ec443dce3c949887f77e3", "sha256": "5787b323e519480408fd88a357b85b919ff63542ad93d37d94320a96f5caa554" }, "downloads": -1, "filename": "aws-lambda-pyauthlib-0.2.2.tar.gz", "has_sig": false, "md5_digest": "7f7cd73cee3ec443dce3c949887f77e3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4614, "upload_time": "2017-11-21T02:55:36", "url": "https://files.pythonhosted.org/packages/3e/f7/dc4d3a71d79e356da715df0e0b87bbb4e1127d6d8f5de44d2116fb23c749/aws-lambda-pyauthlib-0.2.2.tar.gz" } ] }