{ "info": { "author": "Michael Ottoson", "author_email": "michael@pointw.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# authparser\nUsed to parse http Authentication headers, and to call handlers per scheme.\n\nProvides\n\n### AuthParser\nThis class does the parsing and dispatches to handler methods per scheme.\n\n`add_handler(scheme, user_record_fn, challenge_fn=None, **kwargs)`\n- Registers an authentication scheme to be handled, and is details\n - **scheme**: (string) the name of the auth scheme, e.g. Basic, Bearer, Digest, etc.\n - **user_record_fn** (callable) the function `get_user_record()` calls after parsing the Authorization header.\n - The function will receive either the token for this scheme, or the params (see RFC 7235).\n - The function can return whatever your application needs, eg. True or False whether the Authoriation is valid, or a whole dict of claims. `get_user_record()` merely passes what is returned back to your application. \n - **challenge_fn** (callable) [optional] if specified, `get_challenge_header()` will call this function while building the `WWW-Authenticate` header. \n - The function receives all kwargs passed to `get_challenge_header()`. \n - The function should return a dict of name-value pairs which will be added to the scheme's challenge params. e.g. a Digest challenge (without qop) will issue a challenge similar to: `WWW-Authenticate: Digest nonce=\"dcd98b7102dd2f0e8b11d0f600bfb0c093\", realm=\"pointw.com\", opaque=\"5ccc069c403ebaf9f0171e9517f40e41\"`\n - **kwargs** - if any, they are passed through to the handler function. For example, you may wish to pass the URL being requested, the method being used, or even the entire request object.\n\n\n`clear_handlers()`\n- Clears all handlers.\n\n`get_user_record(auth_header)`\n- Parses the Authorization header and passes the results to the handler for the corresponding scheme.\n - **auth_header** (string) the Authorization header from the request (with or without the starting `Authorization: ` keyword).\n\n`get_challenge_header(**kwargs)`\n- Returns the challenge header based on the handlers previously added. Call this when forming the response to an unauthorized request.\n - **kwargs** [optional] \n - set `multi_line=True` to have this method return an array of headers, one item in the array per scheme/handler.\n - all other kwargs are passed to the `challenge_fn` for it to use as it sees fit. For example, if the request had an `Authorization:` header that had bad credentials, you could pass that fact to the `get_challenge_header()` so it can add details to the challenge header params. e.g. `WWW-Authenticate: Bearer error=\"invalid_token\"`\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pointw-dev/authparser", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "authparser", "package_url": "https://pypi.org/project/authparser/", "platform": "", "project_url": "https://pypi.org/project/authparser/", "project_urls": { "Homepage": "https://github.com/pointw-dev/authparser" }, "release_url": "https://pypi.org/project/authparser/1.0/", "requires_dist": [ "pyparsing" ], "requires_python": "", "summary": "Used to parse http Authentication headers, and to call handlers per scheme.", "version": "1.0" }, "last_serial": 4666624, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "4e6618d53a62443071a58dd9e0510359", "sha256": "2cb7fe1d64af905ab12b693583e82c2459fb0a7a76ccd38a55d180cb97d5cdc3" }, "downloads": -1, "filename": "authparser-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4e6618d53a62443071a58dd9e0510359", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5817, "upload_time": "2019-01-06T21:53:00", "url": "https://files.pythonhosted.org/packages/9a/59/f6a561e430209452ffc550b4a290c3ea11cdbd27a03eddba165c2f993cdb/authparser-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c8ca619f89e6462b45557408971f73a9", "sha256": "67f0f53eb63f4ccb0cc4fbdebeae8aaf645a97b36b05e97e69076cec15c61a63" }, "downloads": -1, "filename": "authparser-1.0.tar.gz", "has_sig": false, "md5_digest": "c8ca619f89e6462b45557408971f73a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4483, "upload_time": "2019-01-06T21:53:02", "url": "https://files.pythonhosted.org/packages/2c/e0/b5c17ef91b5f05a555d2ccfad6cd5e466ac0e2a7805e6abdc6b53d4eb30b/authparser-1.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "4e6618d53a62443071a58dd9e0510359", "sha256": "2cb7fe1d64af905ab12b693583e82c2459fb0a7a76ccd38a55d180cb97d5cdc3" }, "downloads": -1, "filename": "authparser-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4e6618d53a62443071a58dd9e0510359", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 5817, "upload_time": "2019-01-06T21:53:00", "url": "https://files.pythonhosted.org/packages/9a/59/f6a561e430209452ffc550b4a290c3ea11cdbd27a03eddba165c2f993cdb/authparser-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c8ca619f89e6462b45557408971f73a9", "sha256": "67f0f53eb63f4ccb0cc4fbdebeae8aaf645a97b36b05e97e69076cec15c61a63" }, "downloads": -1, "filename": "authparser-1.0.tar.gz", "has_sig": false, "md5_digest": "c8ca619f89e6462b45557408971f73a9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4483, "upload_time": "2019-01-06T21:53:02", "url": "https://files.pythonhosted.org/packages/2c/e0/b5c17ef91b5f05a555d2ccfad6cd5e466ac0e2a7805e6abdc6b53d4eb30b/authparser-1.0.tar.gz" } ] }