{ "info": { "author": "gocept ", "author_email": "mail@gocept.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved", "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.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Browsers", "Topic :: Security", "Topic :: Security :: Cryptography", "Topic :: Software Development", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "================================\nThe gocept.webtoken distribution\n================================\n\nThis library helps you using JWT tokens with the Zope Component Architecture\n(ZCA).\n\nThis package is compatible with Python version 2.7, 3.4, 3.5 and 3.6.\n\nCopyright (c) 2015-2018 gocept gmbh & co kg\n\nAll Rights Reserved.\n\nThis software is subject to the provisions of the Zope Public License,\nVersion 2.1 (ZPL). A copy of the ZPL should accompany this distribution.\nTHIS SOFTWARE IS PROVIDED \"AS IS\" AND ANY AND ALL EXPRESS OR IMPLIED\nWARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS\nFOR A PARTICULAR PURPOSE.\n\nInstallation\n============\n\nThis package requires ``cryptography``, which needs some install attention.\nPlease refer to its `install documentation`_ for further information.\n\n\n.. _`install documentation`: https://cryptography.io/en/latest/installation/\n\n.. contents::\n\nUsage\n=====\n\nThe ``CryptographicKey`` utility\n--------------------------------\n\n``gocept.webtoken`` uses a global utility of the class\n``gocept.webtoken.CryptographicKeys``, which provides cryptographic keys for\ndifferent purposes. It loads a set of public and private keys from disk. It\ntakes the filesystem path to your key files and a list of key names::\n\n >>> import gocept.webtoken\n >>> import pkg_resources\n >>> path_to_keys = pkg_resources.resource_filename(\n ... 'gocept.webtoken', 'testing/keys')\n >>> keys = gocept.webtoken.CryptographicKeys(\n ... path_to_keys, ['key1'])\n\nFor each of the names, a private key file of the same name and a public key\nfile (with a .pub suffix) must reside inside the keys_dir.\n\nThe utility needs to be registered at the ZCA, either via a zcml file or via::\n\n >>> import zope.component\n >>> zope.component.provideUtility(keys)\n\n\nCreating a token\n----------------\n\nCreate a signed web token with the function ``create_web_token``. You will need\nthe private key name, which was registered at the CryptographycKey utility. It\nis referenced by its name and the suffix ``-private``::\n\n >>> expires_in = 300 # The token is valid for 300 seconds\n >>> payload = {'your': 'data'}\n >>> result = gocept.webtoken.create_web_token(\n ... 'key1-private', 'issuer', 'subject', expires_in, payload)\n >>> sorted(result.keys())\n ['data', 'token']\n\nThe token is available under the key ``token``, while the data encoded in the\ntoken is placed under the key ``data``.\n\n\nCreating a Bearer Authorization header\n--------------------------------------\n\nYou can create an `Bearer Authorization header`_ either from a token_dict as\nreturned by create_web_token or from a token directly::\n\n >>> gocept.webtoken.create_authorization_header(b'')\n ('Authorization', 'Bearer ')\n\n.. _`Bearer Authorization header`: https://tools.ietf.org/html/rfc6750#section-2.1\n\nExtracting a token from a Bearer Authorization header\n-----------------------------------------------------\n\nExtract the token from a dict containing the headers of you request or from the\nvalue of the HTTP Authorization header itself::\n\n >>> request_headers = dict(Authorization='Bearer ')\n >>> b'' == gocept.webtoken.extract_token(request_headers)\n True\n\n\nDecoding a token\n----------------\n\nDecode a signed web token with the function ``decode_web_token``. You will need\nthe public key name, which was registered at the CryptographycKey utility. It\nis referenced by its name and the suffix ``-public``::\n\n >>> result = gocept.webtoken.decode_web_token(\n ... result['token'], 'key1-public', 'subject')\n\nNote that the subject must match the subject given when the token was created.\n\nThe result contains all data encoded in the token. You can find the payload\nunder the key ``data``::\n\n >>> {'your': 'data'} == result['data']\n True\n\n\n\ngocept.webtoken\n===============\n\n3.0 (2018-11-14)\n----------------\n\n- Change license from ZPL to MIT.\n\n- Add support for Python 3.7.\n\n- Drop support for Python 3.4.\n\n- Make subject check optional as some systems like Keycloak use a random\n uuid as the subject which is unknown for the decoder.\n\n- Add `audience` parameter which is required to decode tokens generated\n by Keycloak.\n\n\n2.0 (2018-01-08)\n----------------\n\n- Drop support for Python 3.3 but add it for 3.6.\n\n- Make `setup.py` compatible with newer `setuptools` versions by no longer\n using absolute paths.\n\n\n1.2.1 (2015-10-08)\n------------------\n\n- Fix `extract_token` to accept any ``collections.Mapping`` derived object.\n\n\n1.2 (2015-10-08)\n----------------\n\n- Added helper functions to create a Bearer Authorization header and extract\n a token from it.\n\n- Officially support Python 3.5.\n\n\n1.1 (2015-10-01)\n----------------\n\n- Shortened imports for `CryptographicKeys`, `create_web_token` and\n `decode_web_token`, which are now importable directly from `gocept.webtoken`.\n\n- Added documentation.\n\n\n1.0 (2015-10-01)\n----------------\n\n* Add support for Python 3.3 and 3.4.\n\n* Initial release, extracted from internally used package.", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.org/gocept/gocept.webtoken", "keywords": "jwt token webtoken ZCA", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "gocept.webtoken", "package_url": "https://pypi.org/project/gocept.webtoken/", "platform": "", "project_url": "https://pypi.org/project/gocept.webtoken/", "project_urls": { "Homepage": "https://bitbucket.org/gocept/gocept.webtoken" }, "release_url": "https://pypi.org/project/gocept.webtoken/3.0/", "requires_dist": null, "requires_python": "", "summary": "Wrapper around JWT tokens and the Zope Component Architecture (ZCA).", "version": "3.0" }, "last_serial": 4485775, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "9b27c770f439bbd55724aa01543ef80d", "sha256": "f5a9024b7da45e6be35d231585c6ca2c32b1bf5aa6219f4cb3109285ba03ef69" }, "downloads": -1, "filename": "gocept.webtoken-1.0.zip", "has_sig": false, "md5_digest": "9b27c770f439bbd55724aa01543ef80d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16616, "upload_time": "2015-10-01T13:10:43", "url": "https://files.pythonhosted.org/packages/cf/9a/7bcc2704d729b898ffe363f46d3c30f7f17fe69be69335e165d9e2b6fbea/gocept.webtoken-1.0.zip" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "d0c4d62b17b2cc674a6c1775e7e501c9", "sha256": "ce43503116f3cdd8c6776d27830289a84b13cd7d06177ab7ccfff3ae692b07ea" }, "downloads": -1, "filename": "gocept.webtoken-1.1.zip", "has_sig": false, "md5_digest": "d0c4d62b17b2cc674a6c1775e7e501c9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19291, "upload_time": "2015-10-01T14:10:51", "url": "https://files.pythonhosted.org/packages/da/72/59ce44f5d23b71331701ebcd5a889c53ac6649368cc216178cd0479e8c15/gocept.webtoken-1.1.zip" } ], "1.2": [ { "comment_text": "", "digests": { "md5": "000ec70d2b67d781c97da0c72142d961", "sha256": "3af18e9027809c924244b490816fa5703488008e04b0b02c8882224c794e3420" }, "downloads": -1, "filename": "gocept.webtoken-1.2.tar.gz", "has_sig": false, "md5_digest": "000ec70d2b67d781c97da0c72142d961", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 16840, "upload_time": "2015-10-08T08:27:53", "url": "https://files.pythonhosted.org/packages/0c/86/dbb7915685179f939d3b4516edb7cb3d4fa3d3076b0b80b9860dae13a7f2/gocept.webtoken-1.2.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "6e1f045451ec0c3a7e9890103aa016b9", "sha256": "e07b3ccd5e70956debf24ead38f0f12a5ab257f217474c80aa9c91209ed700e6" }, "downloads": -1, "filename": "gocept.webtoken-1.2.1.tar.gz", "has_sig": false, "md5_digest": "6e1f045451ec0c3a7e9890103aa016b9", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 17152, "upload_time": "2015-10-08T09:18:58", "url": "https://files.pythonhosted.org/packages/a3/41/c7ea06f5abee5c41196dc00a235c146c483c791886002cabad52bdf2a784/gocept.webtoken-1.2.1.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "f37eef163022b751ff5005b31bb642a4", "sha256": "fe17f3e3e509436df8d34f87febf3e7e5c00c8303e3311ee22b920468f17b575" }, "downloads": -1, "filename": "gocept.webtoken-2.0.tar.gz", "has_sig": false, "md5_digest": "f37eef163022b751ff5005b31bb642a4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15874, "upload_time": "2018-01-08T12:28:44", "url": "https://files.pythonhosted.org/packages/2a/ea/235e29834106e960d4feb7b838c080372ac43db21ea9567703fa840b1bf1/gocept.webtoken-2.0.tar.gz" } ], "3.0": [ { "comment_text": "", "digests": { "md5": "89303dd3aed99930061030542f06fad6", "sha256": "a11d6a18454cb6e77fe094ff5c3f90fd3e00695e39b55f3e6890d5523e5cbb3e" }, "downloads": -1, "filename": "gocept.webtoken-3.0.tar.gz", "has_sig": false, "md5_digest": "89303dd3aed99930061030542f06fad6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15750, "upload_time": "2018-11-14T14:13:48", "url": "https://files.pythonhosted.org/packages/53/24/497455d002049c09e9ec3aef9984451d5dc978834b82a5d12953d21ef0d4/gocept.webtoken-3.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "89303dd3aed99930061030542f06fad6", "sha256": "a11d6a18454cb6e77fe094ff5c3f90fd3e00695e39b55f3e6890d5523e5cbb3e" }, "downloads": -1, "filename": "gocept.webtoken-3.0.tar.gz", "has_sig": false, "md5_digest": "89303dd3aed99930061030542f06fad6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15750, "upload_time": "2018-11-14T14:13:48", "url": "https://files.pythonhosted.org/packages/53/24/497455d002049c09e9ec3aef9984451d5dc978834b82a5d12953d21ef0d4/gocept.webtoken-3.0.tar.gz" } ] }