{ "info": { "author": "Nicola Iarocci", "author_email": "nicola@nicolaiarocci.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Internet :: WWW/HTTP :: Dynamic Content" ], "description": "Flask-Sentinel\n==============\nOAuth2 Provider currently supporting the Resource Owner Password Credentials\nGrant as described in Section 1.3.3 of `RFC 6749`_.\n\nPowered by Flask-OAuthlib, Redis and MongoDB.\n\nDeployment\n----------\n\n.. code-block:: console\n\n $ pip install flask-sentinel\n\nUsage\n-----\nOnce the extension and its dependencies are installed, you can use it like any\nother Flask extension:\n\n.. code-block:: python\n\n from flask import Flask\n from flask.ext.sentinel import ResourceOwnerPasswordCredentials, oauth\n\n\n app = Flask(__name__)\n\n # optionally load settings from py module\n app.config.from_object('settings')\n\n @app.route('/endpoint')\n @oauth.require_oauth()\n def restricted_access():\n return \"You made it through and accessed the protected resource!\"\n\n if __name__ == '__main__':\n ResourceOwnerPasswordCredentials(app)\n app.run(ssl_context='adhoc')\n\nUser and Client Management\n--------------------------\nYou can create users and clients through the default management interface\navailable at ``https://localhost:5000/oauth/management``.\n\n.. image:: https://raw.githubusercontent.com/pyeve/flask-sentinel/master/static/console.png\n :scale: 25 %\n\nYou can override the default page above with your own. Just drop your custom\n``management.html`` file in a ``templates`` folder residing in your application\nroot.\n\nThis page can and should have restricted access. In order to achieve that, set\n``SENTINEL_MANAGEMENT_USERNAME`` and ``SENTINEL_MANAGEMENT_PASSWORD`` in your\napplication settings. This will fire up a Basic Auth dialog when the page is\naccessed with a browser.\n\nTesting\n-------\nAfter creating a user and client, you may use ``curl`` to test the application.\n\nGenerating a Bearer Token\n~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: console\n\n $ curl -k -X POST -d \"client_id=9qFbZD4udTzFVYo0u5UzkZX9iuzbdcJDRAquTfRk&grant_type=password&username=jonas&password=pass\" https://localhost:5000/oauth/token\n {\"access_token\": \"NYODXSR8KalTPnWUib47t5E8Pi8mo4\", \"token_type\": \"Bearer\", \"refresh_token\": \"s6L6OPL2bnKSRSbgQM3g0wbFkJB4ML\", \"scope\": \"\"}\n\nGenerating a Bearer Token Using a Retrieved Refresh Token\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: console\n\n $ curl -X POST -d \"client_id=9qFbZD4udTzFVYo0u5UzkZX9iuzbdcJDRAquTfRk&grant_type=refresh_token&refresh_token=s6L6OPL2bnKSRSbgQM3g0wbFkJB4ML\" https://localhost:5000/oauth/token\n {\"access_token\": \"RmPAfqfsDoMCbQ2DUUehwcw1hMCMJj\", \"token_type\": \"Bearer\", \"expires_in\": 3600, \"refresh_token\": \"s6L6OPL2bnKSRSbgQM3g0wbFkJB4ML\", \"scope\": \"\"}\n\nAccessing a Protected Resource Using Retrieved Bearer Token\n~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n.. code-block:: console\n\n $ curl -k -H \"Authorization: Bearer NYODXSR8KalTPnWUib47t5E8Pi8mo4\" https://localhost:5000/endpoint\n You made it through and accessed the protected resource!\n\n\nConfiguration\n-------------\nConfiguration works like any other `Flask configuration`_. Here are\nthe built-in defaults:\n\n======================================= ======================================\n``SENTINEL_ROUTE_PREFIX`` Default prefix for OAuth endpoints.\n Defaults to ``/oauth``. Prepends both\n token and management urls.\n\n``SENTINEL_TOKEN_URL`` Url for token creation endpoint. Set to\n ``False`` to disable this feature.\n Defaults to ``/token``, so the\n complete url is ``/oauth/token``.\n\n``SENTINEL_MANAGEMENT_URL`` Url for management endpoint. Set to\n ``False`` to disable this feature.\n Defaults to ``/management``, so the\n complete url is ``/oauth/management``.\n\n``SENTINEL_REDIS_URL`` Url for the redis server. Defaults to\n ``redis://localhost:6379/0``.\n\n``SENTINEL_MONGO_DBNAME`` Mongo database name. Defaults to\n ``oauth``.\n\n``SENTINEL_MANAGEMENT_USERNAME`` Username needed to access the\n management page.\n\n``SENTINEL_MANAGEMENT_PASSWORD`` Password needed to access the\n management page.\n\n``OAUTH2_PROVIDER_ERROR_URI`` The error page when there is an error,\n default value is ``/oauth/errors``.\n\n``OAUTH2_PROVIDER_TOKEN_EXPIRES_IN`` Default Bearer token expires time,\n default is ``3600``.\n\n``OAUTH2_PROVIDER_ERROR_ENDPOINT`` You can also configure the error page\n uri with an endpoint name.\n\n======================================= ======================================\n\nOther standard PyMongo settings such as ``MONGO_HOST``, ``MONGO_PORT``,\n``MONGO_URI`` are also supported; just prefix them with ``SENTINEL_`` as\nseen above.\n\nWhen a token is created it is added to both the database and the Redis cache.\nIn Redis, ``key`` is the access token itself while ``value`` is the id of the\nuser who requested the token. This allows for fast token\nauthentication/verification bypassing the database lookup. This tecnique can be\nused, for example, when integrating ``flask-sentinel`` with `Eve`_ powered REST\nAPI instances.\n\nUsing Flask-Sentinel with Eve\n-----------------------------\nSee the `Eve-OAuth2`_ example project.\n\nSecurity\n--------\nSSL/TLS\n~~~~~~~\nWhen working with OAuth 2.0, all communications must be encrypted with SSL/TLS.\nThis example uses auto-generated SSL certificates, however in a production\nenvironment you should use a more formal, widely trusted certificate associated\nwith your domain. In addition, requests should be handled by something like\nNGINX and proxied to the authentication service.\n\n*Note: Add `-k` to your `curl` arguments if you are working with an untrusted\ndevelopment server running under SSL/TLS.*\n\nPassword Hashing\n~~~~~~~~~~~~~~~~\nBcrypt and a randomly generated salt are used to hash each user password before\nit is added to the database. You should never store passwords in plain text!\n\nLicense\n-------\nFlask-Sentinel is a `Nicola Iarocci`_ and `Gestionali Amica`_ open source\nproject distributed under the `BSD license`_.\n\nAcknowledgement\n---------------\nThis work is based on the `yoloAPI`_ project by `Josh Brandoff`_ and `Jonas\nBrunsgaard`_.\n\n.. _`RFC 6749`: http://tools.ietf.org/html/rfc6749#section-1.3.3\n.. _`yoloAPI`: https://github.com/brunsgaard/yoloAPI\n.. _`Josh Brandoff`: https://github.com/EmergentBehavior\n.. _`Jonas Brunsgaard`: https://github.com/brunsgaard\n.. _`Nicola Iarocci`: http://nicolaiarocci.com\n.. _`Gestionali Amica`: http://gestionaleamica.com\n.. _`BSD license`: https://github.com/pyeve/flask-sentinel/blob/master/LICENSE\n.. _`Eve-OAuth2`: https://github.com/pyeve/eve-oauth2\n.. _`Eve`: http://python-eve.org\n.. _`Flask configuration`: http://flask.pocoo.org/docs/0.10/config/", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/pyeve/flask-sentinel", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "Flask-Sentinel", "package_url": "https://pypi.org/project/Flask-Sentinel/", "platform": "any", "project_url": "https://pypi.org/project/Flask-Sentinel/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/pyeve/flask-sentinel" }, "release_url": "https://pypi.org/project/Flask-Sentinel/0.0.7/", "requires_dist": null, "requires_python": null, "summary": "OAuth2 Provider for Flask applications.", "version": "0.0.7" }, "last_serial": 2934828, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "cf6607a7e2986c53c3c193f7024ec039", "sha256": "763a7c64699ad59b338387c7d1602ead5977a225bc1aee9660cd24e587bab475" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.1.tar.gz", "has_sig": false, "md5_digest": "cf6607a7e2986c53c3c193f7024ec039", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10958, "upload_time": "2015-02-03T17:14:06", "url": "https://files.pythonhosted.org/packages/d6/1d/2e416533086435e7eb6b88ba43a2ae9ef48d7f1679357e126d1223ddef35/Flask-Sentinel-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "e35241c8b5f2f9f7201f83e6be5d57ad", "sha256": "51aa029692d3dba50e2bb19197b35517361d7d8d330fd3fe43c8d51e5563fd24" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.2.tar.gz", "has_sig": false, "md5_digest": "e35241c8b5f2f9f7201f83e6be5d57ad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11131, "upload_time": "2015-02-06T15:36:38", "url": "https://files.pythonhosted.org/packages/8d/aa/3480de1aae3b37ee93233b030ac00717fe362131cc037f67b77918569ecd/Flask-Sentinel-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "6ad95c950af27ecc1ea60d5a5c669bcb", "sha256": "74bf5901faca6bf6fcfd972d254f27c6e106bb7924ec6ef8043a1ed36add9483" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.3.tar.gz", "has_sig": false, "md5_digest": "6ad95c950af27ecc1ea60d5a5c669bcb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11292, "upload_time": "2015-06-25T06:49:08", "url": "https://files.pythonhosted.org/packages/81/0e/5f2cc5d1f10f4ad61448409363eb76384b78bcdf8c93d6e56b3e4e8fef10/Flask-Sentinel-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "3353a5db7cf95e3d0130023a3d885645", "sha256": "1b6cf5431b8cf5b6ec81eedf012747a936b894da32494727333a01056fd0ede1" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.4.tar.gz", "has_sig": false, "md5_digest": "3353a5db7cf95e3d0130023a3d885645", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13533, "upload_time": "2015-09-29T07:12:41", "url": "https://files.pythonhosted.org/packages/89/25/4a3ed39867c99a1722a52662b75b38d6713d7746d987e619439d5d41d195/Flask-Sentinel-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "79ec11791ef4d6d5c576978aca6a8eff", "sha256": "87a70eeb5e85eaa15d11b9b9382fff5189899f14234d3e2b910bb8f0f815624a" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.5.tar.gz", "has_sig": false, "md5_digest": "79ec11791ef4d6d5c576978aca6a8eff", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13664, "upload_time": "2016-06-02T07:14:07", "url": "https://files.pythonhosted.org/packages/3f/20/262797ce2eefcfffde58a366491b72b30be820d11e203c2bc4b4e9a19057/Flask-Sentinel-0.0.5.tar.gz" } ], "0.0.6": [ { "comment_text": "", "digests": { "md5": "0d6573cbc9a462594c666fa560094025", "sha256": "9cf2c5c85d6ac495184f16021db06c3ad64ac085925f62124db8877f2d501f01" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.6.tar.gz", "has_sig": false, "md5_digest": "0d6573cbc9a462594c666fa560094025", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13781, "upload_time": "2017-02-02T07:54:55", "url": "https://files.pythonhosted.org/packages/ed/08/f7b3077347d0e3e99753f813f5ef69d7166382fa986d0b0984c8f21d6882/Flask-Sentinel-0.0.6.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "3a0a01c1a2c3595ba2ed811d8c3b8d6a", "sha256": "bd0cd55ef0227a5a2341c85909a3db51140688807ee5589493e12ff95ed9bff8" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.7.tar.gz", "has_sig": false, "md5_digest": "3a0a01c1a2c3595ba2ed811d8c3b8d6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13948, "upload_time": "2017-06-08T08:53:42", "url": "https://files.pythonhosted.org/packages/c0/66/f49ee3ade6b19fae7dd7414a10e41e7912d2d0f95abc583a6ea9bd958549/Flask-Sentinel-0.0.7.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3a0a01c1a2c3595ba2ed811d8c3b8d6a", "sha256": "bd0cd55ef0227a5a2341c85909a3db51140688807ee5589493e12ff95ed9bff8" }, "downloads": -1, "filename": "Flask-Sentinel-0.0.7.tar.gz", "has_sig": false, "md5_digest": "3a0a01c1a2c3595ba2ed811d8c3b8d6a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13948, "upload_time": "2017-06-08T08:53:42", "url": "https://files.pythonhosted.org/packages/c0/66/f49ee3ade6b19fae7dd7414a10e41e7912d2d0f95abc583a6ea9bd958549/Flask-Sentinel-0.0.7.tar.gz" } ] }