{ "info": { "author": "Mozilla Services", "author_email": "services-dev@mozilla.org", "bugtrack_url": null, "classifiers": [ "Intended Audience :: Developers", "License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)", "Programming Language :: Python" ], "description": "========\ntokenlib\n========\n\nThis is generic support library for doing token-based authentication. You\nmight use it to build a login system using bearer tokens, two-legged oauth, or\nMAC Access authentication.\n\nGiven a server-side master secret, you can serialize a dict of data into\nan opaque, unforgeable authentication token::\n\n >>> token = tokenlib.make_token({\"userid\": 42}, secret=\"I_LIKE_UNICORNS\")\n >>> print token\n eyJzYWx0IjogImY0NTU5NCIsICJleHBpcmVzIjogMTMyOTg3NTI2Ny4xNDQ5MzUsICJ1c2VyaWQiOiA0Mn0miXCe4NQQtXTE8NXSGcsL6dzSuQ==\n\nLater, you can use the same secret to verify the token and extract the\nembedded data::\n\n >>> data = tokenlib.parse_token(token, secret=\"I_LIKE_UNICORNS\")\n >>> print data\n {u'userid': 42, u'expires': 1329875384.073159, u'salt': u'1c033f'}\n\nNotice that the data includes an expiry time. If you try to parse an expired\ntoken, it will fail::\n\n >>> # Use now=XXX to simulate a time in the future.\n >>> tokenlib.parse_token(token, secret=\"I_LIKE_UNICORNS\", now=9999999999)\n Traceback (most recent call last):\n ...\n ValueError: token has expired\n\nLikewise, it will fail if the token was constructed with a non-matching secret\nkey::\n\n >>> tokenlib.parse_token(token, secret=\"I_HATE_UNICORNS\")\n Traceback (most recent call last):\n ...\n ValueError: token has invalid signature\n\nEach token also has an associated \"token secret\". This is a secret key that\ncan be shared with the consumer of the token to enable authentication schemes\nsuch as MAC Access Authentication of Two-Legged OAuth::\n\n >>> key = tokenlib.get_token_secret(token, secret=\"I_LIKE_UNICORNS\")\n >>> print key\n EZslG8yEYTGyDvBjRnxGipL5Kd8=\n\nFor applications that are using the same settings over and over again, you\nwill probably want to create a TokenManager object rather than using the\nmodule-level convenience functions::\n\n >>> manager = tokenlib.TokenManager(secret=\"I_LIKE_UNICORNS\")\n >>> data = manager.parse_token(token)\n >>> print data\n {u'userid': 42, u'expires': 1329875384.073159, u'salt': u'1c033f'}\n\nThis will let you customize e.g. the token expiry timeout or hash module\nwithout repeating the settings in each call.\n\n\n2.0.0 - 2017-12-20\n==================\n\n * Py27, Py35 compliant\n\n\n0.3.1 - 2014-01-08\n==================\n\n* Make tokenlib.DEFAULT_HASHMOD a string.\n* Fix sporadically-failing test.\n\n\n0.3.0 - 2014-01-08\n==================\n\n* clarified licensing info\n* switched to sha256 as default hashing algorithm\n* renamed `get_token_secret` to `get_derived_secret` to clarify its\n purpose; the previous name remains but is deprecated.\n* added custom ValueError subclasses for more fine-grained error reporting.\n\n\n0.2.0 - 2012-11-27\n==================\n\n* support for python3 via source-level compatibility\n\n\n0.1.0 - 2012-03-14\n==================\n\n * Initial release.\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/mozilla-services/tokenlib", "keywords": "authentication token", "license": "MPLv2.0", "maintainer": "", "maintainer_email": "", "name": "tokenlib", "package_url": "https://pypi.org/project/tokenlib/", "platform": "", "project_url": "https://pypi.org/project/tokenlib/", "project_urls": { "Homepage": "https://github.com/mozilla-services/tokenlib" }, "release_url": "https://pypi.org/project/tokenlib/2.0.0/", "requires_dist": null, "requires_python": "", "summary": "Generic library for managing signed authentication tokens.", "version": "2.0.0" }, "last_serial": 3430112, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e7b82b6e2e3c9377829924df1096d2e5", "sha256": "a8b877b4e85d58ddb004193290173193ce5cb940f94d80f2d5be9dd3453c8ec5" }, "downloads": -1, "filename": "tokenlib-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e7b82b6e2e3c9377829924df1096d2e5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6398, "upload_time": "2012-03-14T19:32:27", "url": "https://files.pythonhosted.org/packages/f8/74/1ee109ac4e0b939ca5a0fc04af6357a794b0270bf256a173ab4f2d5a6937/tokenlib-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "abb5f0c8b6562bffa8724a2d0a5564e2", "sha256": "8fdeeee68d2b106d7109a1047d8653b776fa4cd86b629f6b8305a4033a494948" }, "downloads": -1, "filename": "tokenlib-0.2.0.tar.gz", "has_sig": false, "md5_digest": "abb5f0c8b6562bffa8724a2d0a5564e2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6820, "upload_time": "2012-11-27T05:30:36", "url": "https://files.pythonhosted.org/packages/17/71/61a21aa52b9ab24e414d09672c2f4719f3a3318804585f63061fc540c290/tokenlib-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "f6e503670c600525dbedd1c4465e5faf", "sha256": "953bd0f8109038d7843f99d1de23a4fbf306e512d2ff4661cf9faec94bd42d3a" }, "downloads": -1, "filename": "tokenlib-0.3.0.tar.gz", "has_sig": false, "md5_digest": "f6e503670c600525dbedd1c4465e5faf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8028, "upload_time": "2014-01-08T09:25:11", "url": "https://files.pythonhosted.org/packages/d4/df/9503385e29f9f37ab5d0c0c2e1a1d0ba5243db8022ac2b9894421bc4a876/tokenlib-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "734eb4be1e7f3bab1e93ab0b97ca29a5", "sha256": "4f46639ddb0f18e81f217ba1ddadaa4e00c0db939fd35906668d99d280415882" }, "downloads": -1, "filename": "tokenlib-0.3.1.tar.gz", "has_sig": false, "md5_digest": "734eb4be1e7f3bab1e93ab0b97ca29a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8118, "upload_time": "2014-01-08T09:39:39", "url": "https://files.pythonhosted.org/packages/9d/66/cf5836ca5671470a38ae2b18359d189d48a4e91feb20c0077f963cb0ab14/tokenlib-0.3.1.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "43c5257af597a500c9f442a5d1361b6a", "sha256": "1c6de2c06edf54954df535e5bd1cbb6d7821be032102f40e5a8a53acd5b03649" }, "downloads": -1, "filename": "tokenlib-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "43c5257af597a500c9f442a5d1361b6a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18785, "upload_time": "2017-12-20T03:03:49", "url": "https://files.pythonhosted.org/packages/f6/d0/dd970f811a64391355a387f0ba2a129f135c841b5ffb7d2d30a03ba6b4eb/tokenlib-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "936440e920922122f928d8a36b3863ff", "sha256": "569f27a117b0e0e6476946c96572741a33449c607835a3c6f3fdac85f93b3408" }, "downloads": -1, "filename": "tokenlib-2.0.0.tar.gz", "has_sig": false, "md5_digest": "936440e920922122f928d8a36b3863ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9374, "upload_time": "2017-12-20T03:03:50", "url": "https://files.pythonhosted.org/packages/66/17/147b29c8fe58e84df567b5120d72a15a760369b6d80349c1d6317e9ed30c/tokenlib-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "43c5257af597a500c9f442a5d1361b6a", "sha256": "1c6de2c06edf54954df535e5bd1cbb6d7821be032102f40e5a8a53acd5b03649" }, "downloads": -1, "filename": "tokenlib-2.0.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "43c5257af597a500c9f442a5d1361b6a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 18785, "upload_time": "2017-12-20T03:03:49", "url": "https://files.pythonhosted.org/packages/f6/d0/dd970f811a64391355a387f0ba2a129f135c841b5ffb7d2d30a03ba6b4eb/tokenlib-2.0.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "936440e920922122f928d8a36b3863ff", "sha256": "569f27a117b0e0e6476946c96572741a33449c607835a3c6f3fdac85f93b3408" }, "downloads": -1, "filename": "tokenlib-2.0.0.tar.gz", "has_sig": false, "md5_digest": "936440e920922122f928d8a36b3863ff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9374, "upload_time": "2017-12-20T03:03:50", "url": "https://files.pythonhosted.org/packages/66/17/147b29c8fe58e84df567b5120d72a15a760369b6d80349c1d6317e9ed30c/tokenlib-2.0.0.tar.gz" } ] }