{ "info": { "author": "J\u00falio Vaz", "author_email": "jvaz@stone.com.br", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6" ], "description": "# Simple python authorization\n\nThis module was created to provide a simple authorization method to be used in service to service authorization.\n\n## How to use\n\n**Important note about the credentials backend:** At this moment we do not provide a backend to store credentials. We receive a dict containing all the valid credentials following this format: `{\"app_key\":[\"app_name\",\"secret\"]}`\n\nCreate a middleware in your API that receives the Authorization header and passes it to the package to ensue that the token is valid. In the above example we have a simple endpoint that validates the authentication based on a local dictionary as a credentials backend. Ideally you will implement a credential repository and pass the valid credentials to the module.\n\n```python\nfrom http import HTTPStatus\nfrom flask import request, jsonify, Flask\nfrom python_authorization import Authorization\n\napp = Flask(__name__)\n\n@app.route('/')\ndef dummy_endpoint():\n authorization_header = request.headers.get('Authorization')\n\n py_auth = Authorization(authorization_header, valid_credentials_dict={'valid_app_key1': ['valid_app_name', 'valid_secret']})\n\n # This method will only validate the format of the token\n is_valid = py_auth.validate_token_format()\n\n if not is_valid:\n return (jsonify({'Message': 'Invalid authorization token format'}), HTTPStatus.UNAUTHORIZED)\n\n # This method will asume that the token is in a valid format and will try to validate it \n is_authorized = py_auth.validate_token()\n\n if not is_authorized:\n return (jsonify({'Message': 'Invalid authorization token'}), HTTPStatus.UNAUTHORIZED)\n\n return (jsonify({'Message': 'You are in!'}), HTTPStatus.OK)\n\napp.run('0.0.0.0', port=5000)\n```\n\nYou can also use this module to authenticate at a service using the Credentials class.\n\n```python\nfrom python_authorization import Credentials\n\ncredentials_factory = Credentials('valid_app_name', 'valid_app_key1', 'valid_secret')\n\ntoken = credentials_factory.build_token()\n\nprint(f'This is my token: {token}')\n```\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/julio-vaz/python-authorization", "keywords": "python_authorization", "license": "MIT license", "maintainer": "", "maintainer_email": "", "name": "python-authorization", "package_url": "https://pypi.org/project/python-authorization/", "platform": "", "project_url": "https://pypi.org/project/python-authorization/", "project_urls": { "Homepage": "https://github.com/julio-vaz/python-authorization" }, "release_url": "https://pypi.org/project/python-authorization/1.0.3/", "requires_dist": [ "requests" ], "requires_python": "", "summary": "Simple python authorization library.", "version": "1.0.3" }, "last_serial": 5250200, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "c651b31d7ad8078e5161d62bcf1cdaa9", "sha256": "90d924f8819294ab3f6eca6e8a5ef2980b3a465efee1d067fd168cff8b826c0d" }, "downloads": -1, "filename": "python_authorization-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "c651b31d7ad8078e5161d62bcf1cdaa9", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 5823, "upload_time": "2019-04-30T00:23:13", "url": "https://files.pythonhosted.org/packages/d7/3f/65f2a0abd3a60a6bcfe11d8c89a8ddf630aa39150e7a8ed439625201610a/python_authorization-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c94d03b80584aaaa5ffa0e0cabc500b2", "sha256": "6d4433b49076d4ce943614aad9104b619c667ae7e6d429e47b7741af3d56a28f" }, "downloads": -1, "filename": "python_authorization-1.0.1.tar.gz", "has_sig": false, "md5_digest": "c94d03b80584aaaa5ffa0e0cabc500b2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3124, "upload_time": "2019-04-30T00:23:17", "url": "https://files.pythonhosted.org/packages/f8/0a/9d89469ab1694082440b53f851c3edb960196a1b3bc3e905d47c028c6171/python_authorization-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "5caf4c21a45802374600756697f0b418", "sha256": "f16c5da5e31530a079366c4cb814f5f99b2098e9e101597c74c27b559c25782a" }, "downloads": -1, "filename": "python_authorization-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "5caf4c21a45802374600756697f0b418", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6694, "upload_time": "2019-05-03T21:17:18", "url": "https://files.pythonhosted.org/packages/ea/86/c3656c17fc4bbf583c01a684343d7cc301755e160591ce27ef4d7492067e/python_authorization-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "434c639cc651e8bdd4fef45be3891bf5", "sha256": "49177f351d492ba7bc93db0fd4d14bfe274f46513bfabbbe397e63936d738a61" }, "downloads": -1, "filename": "python_authorization-1.0.2.tar.gz", "has_sig": false, "md5_digest": "434c639cc651e8bdd4fef45be3891bf5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3952, "upload_time": "2019-05-03T21:17:20", "url": "https://files.pythonhosted.org/packages/f7/1e/f2df3643493829962669fb02714bbb1d8140cf1c7fe035eb548c91c669ec/python_authorization-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "6c257dd88abde5ced5218249918e53a0", "sha256": "c220f3d8524dbef6c74dc9ac15ebc36f53b29ef09fe9ba98891599939956ee36" }, "downloads": -1, "filename": "python_authorization-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6c257dd88abde5ced5218249918e53a0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6659, "upload_time": "2019-05-10T01:49:33", "url": "https://files.pythonhosted.org/packages/f5/e4/a2f1c5d69c1c87a2e6ad5311823e7a923e3c6a5016f4f442117f8c826323/python_authorization-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88da3f57edd2985d4c4f4272a59e004d", "sha256": "6d2cc0de45795c2e4bbab504879664543f16ec84d910c9ec78207e969aa14090" }, "downloads": -1, "filename": "python_authorization-1.0.3.tar.gz", "has_sig": false, "md5_digest": "88da3f57edd2985d4c4f4272a59e004d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3932, "upload_time": "2019-05-10T01:49:35", "url": "https://files.pythonhosted.org/packages/3b/2f/a8a8ea1ecf04702c32816a6be04d70ec54c58940c77af1883c05c3369c32/python_authorization-1.0.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "6c257dd88abde5ced5218249918e53a0", "sha256": "c220f3d8524dbef6c74dc9ac15ebc36f53b29ef09fe9ba98891599939956ee36" }, "downloads": -1, "filename": "python_authorization-1.0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "6c257dd88abde5ced5218249918e53a0", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 6659, "upload_time": "2019-05-10T01:49:33", "url": "https://files.pythonhosted.org/packages/f5/e4/a2f1c5d69c1c87a2e6ad5311823e7a923e3c6a5016f4f442117f8c826323/python_authorization-1.0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "88da3f57edd2985d4c4f4272a59e004d", "sha256": "6d2cc0de45795c2e4bbab504879664543f16ec84d910c9ec78207e969aa14090" }, "downloads": -1, "filename": "python_authorization-1.0.3.tar.gz", "has_sig": false, "md5_digest": "88da3f57edd2985d4c4f4272a59e004d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3932, "upload_time": "2019-05-10T01:49:35", "url": "https://files.pythonhosted.org/packages/3b/2f/a8a8ea1ecf04702c32816a6be04d70ec54c58940c77af1883c05c3369c32/python_authorization-1.0.3.tar.gz" } ] }