{ "info": { "author": "Anthony Lukach", "author_email": "alukach@cadasta.org", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha" ], "description": "DRF Temporary Scoped Token\n==========================\n\n|Build Status| |Requirements Status|\n\n``rest_framework_tmp_scoped_token`` provides a Django REST\nFramework-compatible system to generate and validate signed\nauthorization tokens. Generated tokens contain the ID of a user on whose\nbehalf the token bearer authenticates, a white-list of HTTP verbs and\nAPI endpoints that the bearer is permitted to access, an max-lifespan of\nthe token, and a note about the intended recipient.\n\nUsage\n-----\n\nAuthorization\n~~~~~~~~~~~~~\n\nAdd ``rest_framework_tmp_scoped_token.TokenAuth`` to the\n``DEFAULT_AUTHENTICATION_CLASSES`` section of your ``REST_FRAMEWORK``\nsettings in ``settings.py``:\n\n.. code:: python\n\n REST_FRAMEWORK = {\n 'DEFAULT_AUTHENTICATION_CLASSES': (\n # ... Your other forms of auth\n 'rest_framework_tmp_scoped_token.TokenAuth',\n )\n }\n\nTo authenticate with an temporary permissions token, make a request with\nthe token included in either:\n\n- the ``Authorization`` HTTP header with a ``TmpToken`` keyword:\n\n .. code:: http\n\n Authorization: TmpToken eyJzb21ldGhpbmctc2VjcmV0IjoiaG9wZSBub2JvZHkgc2VlcyB0aGlzIn0:1d47N6:woJG0EgLNDb0OjYQmCbsjniP-2Y\n\n- a ``TOKEN`` ``GET`` query parameter:\n\n .. code:: http\n\n /api/?TOKEN=eyJzb21ldGhpbmctc2VjcmV0IjoiaG9wZSBub2JvZHkgc2VlcyB0aGlzIn0:1d47N6:woJG0EgLNDb0OjYQmCbsjniP-2Y\n\nIf you would like to customize either the ``Authorization`` header\nkeyword or the ``GET`` query parameter used, you can subclass the\n``rest_framework_tmp_scoped_token.TokenAuth`` class and override the\n``keyword`` or ``get_param`` values.\n\nToken\n~~~~~\n\nTo generate a token, use the\n``rest_framework_tmp_scoped_token.TokenManager`` class. The token\nencompasses the following information:\n\n- **user**: User that will be authenticated by token.\n- **endpoints**: key:value pairs of HTTP methods and endpoint roots\n that token is authorized to access. The following values would\n authorize the token to make GET requests to any endpoints that begin\n with '``api/v1/foo``:\n\n .. code:: python\n\n {'GET': ['/api/v1/foo']}\n\n **NOTE**: This this token will not override any existing permissions\n for its associatted User within the system. It only adds further\n restrictions to the endpoints that can be accessed.\n- **max\\_age**: How long, in seconds, the token will be valid. By\n default, tokens will be valid for 1 hour. Non-expiring tokens are not\n supported.\n- **recipient**: *(Optional)* A textual description of the recipient\n for which this token was intended. No validation is done with this\n data, however it is appended to the request as a\n ``X-API-Token-Recipient`` header by the accompanying DRF\n authentication scheme. This is for tracking purposes\n\n**NOTE**: The tokens are signed via Django's\n```signing`` `__\nfacility. It is important to know that the **tokens are not encrypted**,\nthey are simply signed. For this reason, you should not include any\nsensitive/secret information in the tokens. For an example, notice how\neasy it is to view the contents of a signed string:\n\n.. code:: python\n\n In [1]: from django.core import signing\n\n In [2]: t = signing.dumps({'something-secret': 'hope nobody sees this'})\n\n In [3]: print(t)\n eyJzb21ldGhpbmctc2VjcmV0IjoiaG9wZSBub2JvZHkgc2VlcyB0aGlzIn0:1d47N6:woJG0EgLNDb0OjYQmCbsjniP-2Y\n\n In [4]: import base64\n\n In [5]: print(base64.urlsafe_b64decode(t.encode('utf8')))\n b'{\"something-secret\":\"hope nobody sees this\"}5w\\x8e\\xcd\\xeb\\n\\t\\x1bA ,\\xd0\\xdb\\xd0\\xe8\\xd8B`\\x9b\\xb29\\xe2?\\xed\\x98'\n\nContributing\n------------\n\nTesting\n~~~~~~~\n\n.. code:: bash\n\n pip install -r requirements-test.txt\n ./runtests\n\nDeploying\n~~~~~~~~~\n\n.. code:: bash\n\n pip install -r requirements-deploy.txt\n python setup.py test clean build tag publish\n\n.. |Build Status| image:: https://travis-ci.org/Cadasta/drf-tmp-scoped-token.svg?branch=master\n :target: https://travis-ci.org/Cadasta/drf-tmp-scoped-token\n.. |Requirements Status| image:: https://requires.io/github/Cadasta/drf-tmp-scoped-token/requirements.svg?branch=master\n :target: https://requires.io/github/Cadasta/drf-tmp-scoped-token/requirements/?branch=master\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/Cadasta/drf-tmp-scoped-token", "keywords": "", "license": "GNU Affero General Public License v3.0", "maintainer": "", "maintainer_email": "", "name": "drf-tmp-scoped-token", "package_url": "https://pypi.org/project/drf-tmp-scoped-token/", "platform": "", "project_url": "https://pypi.org/project/drf-tmp-scoped-token/", "project_urls": { "Homepage": "https://github.com/Cadasta/drf-tmp-scoped-token" }, "release_url": "https://pypi.org/project/drf-tmp-scoped-token/0.2.1/", "requires_dist": [ "djangorestframework (>=3.4.0)", "six" ], "requires_python": "", "summary": "Temporary Django REST Framework permission-scoped token", "version": "0.2.1" }, "last_serial": 3711006, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "48148c637ae81f40c200752a8127b0c4", "sha256": "fcb0ff9efaed0db883ccec81bba2eca967b0e40f1df96aae0398e1599bcd979a" }, "downloads": -1, "filename": "drf_tmp_scoped_token-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "48148c637ae81f40c200752a8127b0c4", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10820, "upload_time": "2017-07-18T22:31:48", "url": "https://files.pythonhosted.org/packages/c8/7d/3266a4030dca2404d147440ea824d074686a0acaf2efb32bebe3fc14a100/drf_tmp_scoped_token-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d332714b7ca8e88663c5061926318881", "sha256": "cf5ec640e71f1072b147cec50404ebff6d0e8495929a016d36188676cefb581d" }, "downloads": -1, "filename": "drf-tmp-scoped-token-0.0.1.tar.gz", "has_sig": false, "md5_digest": "d332714b7ca8e88663c5061926318881", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6641, "upload_time": "2017-07-18T22:31:49", "url": "https://files.pythonhosted.org/packages/ac/76/c18fbd7267b06fa6f53ac428570c39ce496b79cc0c4e86eb041474bcb149/drf-tmp-scoped-token-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "f33021b3d110dbcd5ed6e537f032121c", "sha256": "98af1a690cef228cbfe641371d218eddb0a1178af31d402f0e34db3f6c09c8b3" }, "downloads": -1, "filename": "drf_tmp_scoped_token-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "f33021b3d110dbcd5ed6e537f032121c", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10930, "upload_time": "2017-07-18T23:07:23", "url": "https://files.pythonhosted.org/packages/94/d7/b80f7b40940cbcfc4a2f2fcdc4b20fcf5c0df0779334ebb9da919faacc9b/drf_tmp_scoped_token-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "ecdd9988832596e46e532f1d9355ef9f", "sha256": "9023347b5741181e0e01fbe99c631c13b4bb56eef690c1d73abe62e973ccff88" }, "downloads": -1, "filename": "drf-tmp-scoped-token-0.0.2.tar.gz", "has_sig": false, "md5_digest": "ecdd9988832596e46e532f1d9355ef9f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6740, "upload_time": "2017-07-18T23:07:24", "url": "https://files.pythonhosted.org/packages/31/85/40fda8f09ee4af9c87ca31185403335c09615ef0960fb59100e43c0f0217/drf-tmp-scoped-token-0.0.2.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "666140dec5134f618295eb3108171015", "sha256": "c22dbe09c7d202fb1e88d095a247475a490ff527179ce5abf414f65a17eee469" }, "downloads": -1, "filename": "drf_tmp_scoped_token-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "666140dec5134f618295eb3108171015", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11054, "upload_time": "2017-07-19T18:54:49", "url": "https://files.pythonhosted.org/packages/d5/ac/10ed1598d17f548b756ed7228f4329a39a246a97fc474253ebae6ecf17f3/drf_tmp_scoped_token-0.1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d793d9448707f0113d6e8ada641f3f27", "sha256": "7760d957a6b38b690d2d5597f125d10a596e166391dee383b1810a711683a02c" }, "downloads": -1, "filename": "drf-tmp-scoped-token-0.1.0.tar.gz", "has_sig": false, "md5_digest": "d793d9448707f0113d6e8ada641f3f27", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6874, "upload_time": "2017-07-19T18:54:51", "url": "https://files.pythonhosted.org/packages/61/cc/578bc5801c57150f8e7ebdb201cf6fce83bb9c5ac6f5ceb4a153de0ec3fd/drf-tmp-scoped-token-0.1.0.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "02023dab103aa41c83e8fabb9aa43e86", "sha256": "004a7cab87ed86f230af935eb923eef7583976162f2e746081e836a2d7a89035" }, "downloads": -1, "filename": "drf_tmp_scoped_token-0.2.0-py2-none-any.whl", "has_sig": false, "md5_digest": "02023dab103aa41c83e8fabb9aa43e86", "packagetype": "bdist_wheel", "python_version": "py2", "requires_python": null, "size": 11510, "upload_time": "2017-07-28T21:01:44", "url": "https://files.pythonhosted.org/packages/16/ae/68e395e87d196ec4d316a6d93956f14a86413a91f4f98735246a5a40d14c/drf_tmp_scoped_token-0.2.0-py2-none-any.whl" }, { "comment_text": "", "digests": { "md5": "69a2763a41e0e102595f6d38d41a0c4b", "sha256": "06a4a1637b9b16d5b85e870341dd8bdf4d614d3bfd68bdf93ba632f94ff35778" }, "downloads": -1, "filename": "drf_tmp_scoped_token-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "69a2763a41e0e102595f6d38d41a0c4b", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11510, "upload_time": "2017-07-28T22:21:59", "url": "https://files.pythonhosted.org/packages/7f/2a/067ec6b1c8b68487493e7eb61a425ecd19e4e0581d7bbdca2bda607c41e3/drf_tmp_scoped_token-0.2.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "3b830f75c3510ac363af84bb230247ad", "sha256": "b20d9b76cb569e6f799a86bcad2cb4777712afe73c28ddcd48e269ad7383f3bc" }, "downloads": -1, "filename": "drf-tmp-scoped-token-0.2.0.tar.gz", "has_sig": false, "md5_digest": "3b830f75c3510ac363af84bb230247ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7271, "upload_time": "2017-07-28T21:01:49", "url": "https://files.pythonhosted.org/packages/a5/e6/1c9a6a19cf045ebca3ee60ca33b16cbe716cfef62f7888c640ca41309c79/drf-tmp-scoped-token-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "bfd6045f8d1b9fcf8f96f4f4d2d5741f", "sha256": "b8b38ad127fee4844f097575d68e20a121dce7cd87176ba14dcc097a595d8ddc" }, "downloads": -1, "filename": "drf_tmp_scoped_token-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bfd6045f8d1b9fcf8f96f4f4d2d5741f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11682, "upload_time": "2018-03-27T17:20:15", "url": "https://files.pythonhosted.org/packages/f0/8f/03de9b6fa34f2451bd46c66c5902ee069853f7eaee466cdffa96a7334615/drf_tmp_scoped_token-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "904348910f8c0ad6abbf7b25bb30c064", "sha256": "173f9bde36928d71d41d007345e29c9d3c10feafd36e58411a056faafeb97a76" }, "downloads": -1, "filename": "drf-tmp-scoped-token-0.2.1.tar.gz", "has_sig": false, "md5_digest": "904348910f8c0ad6abbf7b25bb30c064", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7527, "upload_time": "2018-03-27T17:20:16", "url": "https://files.pythonhosted.org/packages/b2/86/2a03971a7b0393e014f84d26e286624e0fa7fb06ab51f9e0f7b644e2607d/drf-tmp-scoped-token-0.2.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bfd6045f8d1b9fcf8f96f4f4d2d5741f", "sha256": "b8b38ad127fee4844f097575d68e20a121dce7cd87176ba14dcc097a595d8ddc" }, "downloads": -1, "filename": "drf_tmp_scoped_token-0.2.1-py3-none-any.whl", "has_sig": false, "md5_digest": "bfd6045f8d1b9fcf8f96f4f4d2d5741f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 11682, "upload_time": "2018-03-27T17:20:15", "url": "https://files.pythonhosted.org/packages/f0/8f/03de9b6fa34f2451bd46c66c5902ee069853f7eaee466cdffa96a7334615/drf_tmp_scoped_token-0.2.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "904348910f8c0ad6abbf7b25bb30c064", "sha256": "173f9bde36928d71d41d007345e29c9d3c10feafd36e58411a056faafeb97a76" }, "downloads": -1, "filename": "drf-tmp-scoped-token-0.2.1.tar.gz", "has_sig": false, "md5_digest": "904348910f8c0ad6abbf7b25bb30c064", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7527, "upload_time": "2018-03-27T17:20:16", "url": "https://files.pythonhosted.org/packages/b2/86/2a03971a7b0393e014f84d26e286624e0fa7fb06ab51f9e0f7b644e2607d/drf-tmp-scoped-token-0.2.1.tar.gz" } ] }