{ "info": { "author": "Kevin Broadwater, Nicholas Willhite", "author_email": "willnx84@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "License :: OSI Approved :: Apache Software License", "Natural Language :: English", "Operating System :: POSIX :: Linux", "Programming Language :: Python :: 3.6" ], "description": ".. image:: https://travis-ci.org/willnx/vlab_api_common.svg?branch=master\n :target: https://travis-ci.org/willnx/vlab_api_common\n\n###############\nvlab_api_common\n###############\n\nCommon logic used by every API within vLab - things like making response\nshapes consistent, providing functionality for the ``describe`` parameter, etc.\n\n\n****************************************\nThe ``requires`` and ``deny`` decorators\n****************************************\n\nThese decorators are used together to create an `Access Control List `_\nfor your Flask API. You can layer these directorates however you want, but beware -\n*\"With great power comes great responsibility.\"*\n\nExamples\n========\n\nHere are some examples of using the ``requires`` and ``deny`` decorators.\n\nBasic Syntax\n------------\n\nTo use the ``requires`` or ``deny`` decorators in your Flask API, simply add them\nto your function before ``@app.route``. You should also accpet ``**kwargs`` because\nadditional information like the token and validation information will be passed\nalong.\n\nThis example will allow any user with a valid token access:\n\n.. code-block:: python\n\n from vlab_api_common import requires, deny\n @requires()\n @app.route('/api/1/foo')\n def hello(**kwargs):\n return \"hello world\"\n\n\nWhile this example shows how to forbid ``jordan`` access:\n\n.. code-block:: python\n\n from vlab_api_common import requires, deny\n @deny(username='jordan')\n @app.route('/api/1/foo')\n def hello(**kwargs):\n return \"hello world\"\n\nVerifying\n---------\n\nIn this example, any user with a valid authentication token will be able to\nperform an HTTP GET on the API end point.\n\n.. code-block:: python\n\n @requires(verify=False)\n @app.route('/api/1/foo')\n def hello(**kwargs):\n return \"hello world!\"\n\nThe difference in this next example is that the ``requires`` decorator will check\nwith the configured vLab Authentication Service to ensure that the user has not\ndeleted their token:\n\n.. code-block:: python\n\n @requires()\n @app.route('/api/1/foo')\n def hello(**kwargs):\n return \"hello world!\"\n\nNotice how this is the default behavior. If you have a resource that's not very\nsensitive, and have extremely high requirements on availability, consider explicitly\nsetting ``verify=False`` on the ``requires`` and ``deny`` decorators.\n\nThe ``verify`` keyword argument applies to both the ``requires`` and ``deny`` decorators.\n\n\nOR-ing identities\n------------------\n\nYou can specify multiple values in the ``requires`` and ``deny`` decorators.\nWhen you specify more than one value in a single decorator, the identities\nare ``OR`` ed. In other words, the moment an identity in the token matches a defined\nvalue, the user is granted access.\n\nIn this example, if the user is named `bob` but he is not part of `Department A`,\nthen the user is still granted access:\n\n.. code-block:: python\n\n @requires(username=('bob', 'sarah'), memberOf='Department A')\n @app.route('/api/1/foo')\n def hello(**kwargs):\n return \"Hello World!\"\n\nAND-ing identities\n-------------------\n\nWhen you layer multiple ``requires`` and/or ``deny`` decorators together, you ``AND``\nthose decoratores. In other words, all decorators must return successfully for\nthe user to be granted access.\n\nIn this example, only ``forest`` and ``jenny`` from ``Department A`` will be granted\naccess. All other members within `Department A` will not be granted access\n\n.. code-block:: python\n\n @requires(username=('forest', 'jenny'))\n @requires(memberOf='Department A')\n @app.route('/api/1/foo')\n def hello(**kwargs):\n return \"hello forest or jenny from Department A!\"\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "vlab-api-common", "package_url": "https://pypi.org/project/vlab-api-common/", "platform": "", "project_url": "https://pypi.org/project/vlab-api-common/", "project_urls": null, "release_url": "https://pypi.org/project/vlab-api-common/2019.7.12/", "requires_dist": [ "flask-classy", "requests", "pyjwt", "ujson", "jsonschema", "cryptography", "pyVmomi" ], "requires_python": "", "summary": "Common logic used by all the RESTful API services of vLab", "version": "2019.7.12" }, "last_serial": 5524936, "releases": { "2018.10.25": [ { "comment_text": "", "digests": { "md5": "777e1ca82a7e876ec11935a4900287c1", "sha256": "cbfe3006512050fe50d237ccd62866fc7fe006ce5647fff531bc18abee19424d" }, "downloads": -1, "filename": "vlab_api_common-2018.10.25-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "777e1ca82a7e876ec11935a4900287c1", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10001, "upload_time": "2018-10-25T17:24:58", "url": "https://files.pythonhosted.org/packages/9d/b0/1079bef23d313155cc41a5129f7cf1842fb32758acfaa68d5ce62dc35311/vlab_api_common-2018.10.25-py2.py3-none-any.whl" } ], "2018.11.28": [ { "comment_text": "", "digests": { "md5": "4670582732bfa160be28f378c999903a", "sha256": "2cd05c6b8ba0a5ffe7fda018675134ac9178e74325e0afd1ca0fdc1c27370a35" }, "downloads": -1, "filename": "vlab_api_common-2018.11.28-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "4670582732bfa160be28f378c999903a", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14355, "upload_time": "2018-11-28T21:27:41", "url": "https://files.pythonhosted.org/packages/ca/89/97c2c4f2948c87486d452adf9fb72179c5c659b40370d6d93f73b488db2a/vlab_api_common-2018.11.28-py2.py3-none-any.whl" } ], "2018.5.11": [ { "comment_text": "", "digests": { "md5": "ea334f262a2e70a0b7e3d400d1e9d877", "sha256": "4d6e10d21fa22497a1a39a498c6894fbc5712922aa6e03e329b93e5308a0ec13" }, "downloads": -1, "filename": "vlab-api-common-2018.5.11.tar.gz", "has_sig": true, "md5_digest": "ea334f262a2e70a0b7e3d400d1e9d877", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9842, "upload_time": "2018-05-12T02:09:46", "url": "https://files.pythonhosted.org/packages/85/7c/9f7d36f3788fa05682e69a1210139c861cef4bb561089ac853eb5e97b19e/vlab-api-common-2018.5.11.tar.gz" } ], "2018.5.22": [ { "comment_text": "", "digests": { "md5": "23cfc78fcae57e5a641a26f2ca76dbec", "sha256": "24401f0a5ce2a9235fe77c5dd6fa89ba0b27a9aad8342dea7c81a225b05f0b12" }, "downloads": -1, "filename": "vlab-api-common-2018.5.22.tar.gz", "has_sig": true, "md5_digest": "23cfc78fcae57e5a641a26f2ca76dbec", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11085, "upload_time": "2018-05-23T01:19:49", "url": "https://files.pythonhosted.org/packages/94/a8/393b10ba5bc8e2e1a5ee98669f5412342ab234cdd1fb9b24455d19875b45/vlab-api-common-2018.5.22.tar.gz" } ], "2018.5.30": [ { "comment_text": "", "digests": { "md5": "be616003257f8a1eec4c5d9270b159cb", "sha256": "7bb5d4481be9cc2f1b0dd1e5030078ff9d2e09b7d50f700156326a3b79579ffa" }, "downloads": -1, "filename": "vlab-api-common-2018.5.30.tar.gz", "has_sig": true, "md5_digest": "be616003257f8a1eec4c5d9270b159cb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8089, "upload_time": "2018-05-31T13:18:43", "url": "https://files.pythonhosted.org/packages/39/fd/d09fc8cc5024e3afade4eff643e04de550c6b4e30053f1801fa14f5e7678/vlab-api-common-2018.5.30.tar.gz" } ], "2018.6.3": [ { "comment_text": "", "digests": { "md5": "16cf00d706757a7644af591807aae891", "sha256": "7d7d3f77830644f66d9c9da9c83476c346cd8bbe31ab61c0ad5ca62190a53289" }, "downloads": -1, "filename": "vlab_api_common-2018.6.3-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "16cf00d706757a7644af591807aae891", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 11798, "upload_time": "2018-06-03T16:18:03", "url": "https://files.pythonhosted.org/packages/a7/3d/cb829a308fdd058042f615e8ccbb709904d15eed546d90cb1c4c90c8d24c/vlab_api_common-2018.6.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "62ace012eb6e4606d4406a2677c3c24e", "sha256": "12c52c675616cb99c731ecbfe9adbd5d79bbcf84e056e77ceb4301c119d06bf7" }, "downloads": -1, "filename": "vlab_api_common-2018.6.3-py3-none-any.whl", "has_sig": true, "md5_digest": "62ace012eb6e4606d4406a2677c3c24e", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13275, "upload_time": "2018-06-03T16:15:43", "url": "https://files.pythonhosted.org/packages/df/4a/7b1b9243675fa9a7c6e88c98e1823e9858c82b7809877708770d6a79fdce/vlab_api_common-2018.6.3-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "e6a42fbb82d58d36a7d2fd4674c2259d", "sha256": "d54998cbfb3f8e03f19531b1f4277c95c1783105184210a7d40f08442a57bcba" }, "downloads": -1, "filename": "vlab-api-common-2018.6.3.tar.gz", "has_sig": true, "md5_digest": "e6a42fbb82d58d36a7d2fd4674c2259d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8416, "upload_time": "2018-06-03T16:14:40", "url": "https://files.pythonhosted.org/packages/ad/13/e60f2578515cb013195a4d86e5861e9f815d3eee65440c9b62b086c5fd71/vlab-api-common-2018.6.3.tar.gz" } ], "2018.6.4": [ { "comment_text": "", "digests": { "md5": "f01171caef66e95a4bb67f70cb64f176", "sha256": "d71b0988eb09288dd56fd96d5557e395baf3878812a193d0d09bdd4e8a13b4ab" }, "downloads": -1, "filename": "vlab_api_common-2018.6.4-py2.py3-none-any.whl", "has_sig": true, "md5_digest": "f01171caef66e95a4bb67f70cb64f176", "packagetype": "bdist_wheel", "python_version": "3.5", "requires_python": null, "size": 13289, "upload_time": "2018-06-05T00:03:56", "url": "https://files.pythonhosted.org/packages/2e/59/036956619713d116ba584f777a0b4eaf2dc87198f56270ba7a3d859f4244/vlab_api_common-2018.6.4-py2.py3-none-any.whl" } ], "2018.7.2": [ { "comment_text": "", "digests": { "md5": "3c807faf4ff1b417f0837f65a62b1289", "sha256": "cead40d46043ee9051895a84a1fca1d74c2c6a33fb5f68c13afd770e9cf3ec21" }, "downloads": -1, "filename": "vlab_api_common-2018.7.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "3c807faf4ff1b417f0837f65a62b1289", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9512, "upload_time": "2018-07-02T16:57:02", "url": "https://files.pythonhosted.org/packages/0e/e5/ac8bab6158b71decff0799f16a4cd3077a242e7124ac1f25a7785c6d3601/vlab_api_common-2018.7.2-py2.py3-none-any.whl" } ], "2018.8.2": [ { "comment_text": "", "digests": { "md5": "fab21d8e620a786781c24a2e965cea1f", "sha256": "1cf12113616b2903ef49d3b43574ed17afb286e9c8408b8e043c4dfdd6d2d6ec" }, "downloads": -1, "filename": "vlab_api_common-2018.8.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "fab21d8e620a786781c24a2e965cea1f", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9515, "upload_time": "2018-08-02T19:10:16", "url": "https://files.pythonhosted.org/packages/92/a5/0ec279e3704cb0ce66e04f3f881d200bd88c1df98c8a0e1c2aa8335ba43c/vlab_api_common-2018.8.2-py2.py3-none-any.whl" } ], "2018.9.19": [ { "comment_text": "", "digests": { "md5": "25ccf20cd1c8672d36f595e36a8889ba", "sha256": "5c9c40c8a171b50282526fd23244b6ffd40da7b5b67a9bc2734c4c7947d9c998" }, "downloads": -1, "filename": "vlab_api_common-2018.9.19-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "25ccf20cd1c8672d36f595e36a8889ba", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9764, "upload_time": "2018-09-19T18:16:40", "url": "https://files.pythonhosted.org/packages/93/8b/7a894f3d4e8fbf5fe460e0ea6182384f8a275e1fced879e9e11a4a4b4ba9/vlab_api_common-2018.9.19-py2.py3-none-any.whl" } ], "2018.9.21": [ { "comment_text": "", "digests": { "md5": "117075f84e05f92243f976b0509a5368", "sha256": "b4e14121f595835cc7370b872fb76c78c87bf9221bccabddfd253aff107c773c" }, "downloads": -1, "filename": "vlab_api_common-2018.9.21-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "117075f84e05f92243f976b0509a5368", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9864, "upload_time": "2018-09-21T15:42:33", "url": "https://files.pythonhosted.org/packages/94/ee/a391f99bce94dce3f138872529eba42229d1a7aa072fd31ab72fc471ce46/vlab_api_common-2018.9.21-py2.py3-none-any.whl" } ], "2019.7.12": [ { "comment_text": "", "digests": { "md5": "36502f9a2fc5414bc0cc087dab77bebb", "sha256": "a174c777a3d841564dc6565571d49a35f7e4d2ce4c33adadbc8215bcec99ff5b" }, "downloads": -1, "filename": "vlab_api_common-2019.7.12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "36502f9a2fc5414bc0cc087dab77bebb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14368, "upload_time": "2019-07-12T20:50:35", "url": "https://files.pythonhosted.org/packages/f5/86/327789abfa618398b27d371b14a5b7d302be512deaaf9298bd34406b5a81/vlab_api_common-2019.7.12-py2.py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "36502f9a2fc5414bc0cc087dab77bebb", "sha256": "a174c777a3d841564dc6565571d49a35f7e4d2ce4c33adadbc8215bcec99ff5b" }, "downloads": -1, "filename": "vlab_api_common-2019.7.12-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "36502f9a2fc5414bc0cc087dab77bebb", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 14368, "upload_time": "2019-07-12T20:50:35", "url": "https://files.pythonhosted.org/packages/f5/86/327789abfa618398b27d371b14a5b7d302be512deaaf9298bd34406b5a81/vlab_api_common-2019.7.12-py2.py3-none-any.whl" } ] }