{ "info": { "author": "Livio Ribeiro", "author_email": "livioribeiro@outlook.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: CherryPy", "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 :: Implementation :: PyPy", "Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP :: Dynamic Content", "Topic :: Internet :: WWW/HTTP :: Session" ], "description": "===================\ncherrypy.authorizer\n===================\n\nExtensible session based authentication and claims based authorization tool for CherryPy.\n\nIncludes authentication controllers for default dispatcher and method dispatcher.\n\nDefault authentication controllers are provided in `lribeiro.cherrypy.authorizer.authentication` for default\ndispatcher and method dispatcher.\n\nNote that if you have a callable class, the class itself must be decorated with ``@authorize``.\n\nDeveloped under Python3.4 and tested against Python2.7, Python3.4 and pypy.\n\nExample:\n--------\n\n.. sourcecode:: python\n\n import cherrypy\n\n from lribeiro.cherrypy import authorizer\n from lribeiro.cherrypy.authorizer import authorize\n from lribeiro.cherrypy.authorizer.authentication import Identity, AuthControllerDefaultDispatcher\n\n # authenticator function signature can be whatever you'd like,\n # as soon as you pass the correct parameters via Http POST\n def _authenticator(username, password):\n if username == 'user' and password == 'pass':\n return Identity('id', 'user')\n\n\n def _authorizer(claims):\n if 'read' in claims and claims['read'] == 'page':\n return True\n if 'write' in claims and claims['write'] == 'page':\n return True\n return False\n\n class Area1:\n @cherrypy.expose\n @authorize({'read': 'page'})\n def index(self):\n return 'authorized'\n\n\n @authorize\n class Area2:\n @cherrypy.expose\n def index(self):\n return 'authorized'\n\n @cherrypy.expose\n @authorize({'write': 'site'})\n def restricted(self):\n return 'restricted'\n\n @authorize # callable class itself must be decorated, not the __call__ method\n class Area3:\n exposed = True\n\n def __call__(self):\n return 'callable class'\n\n class Root:\n @cherrypy.expose\n def index(self):\n pass\n\n @cherrypy.expose\n def process_login(self, username, password):\n try:\n authenticate(username=username, password=password)\n raise cherrypy.HTTPRedirect('/area1')\n except AuthenticationError:\n raise cherrypy.HTTPError(403)\n\n\n if __name__ == '__main__':\n conf = {\n '/': {\n 'tools.sessions.on': True,\n 'tools.authorizer.on': True,\n 'auth.authenticator': _authenticator,\n 'auth.authorizer': _authorizer,\n 'auth.login_page': '/login',\n 'auth.login_redirect': '/logged_in',\n 'auth.logout_redirect': '/logged_out',\n 'auth.unauthorized_redirect': '/unauthorized'\n }\n }\n\n root = Root()\n root.area1 = Area1()\n root.area2 = Area2()\n root.auth = AuthControllerDefaultDispatcher()\n\n cherrypy.quickstart(root, '/', conf)", "description_content_type": null, "docs_url": null, "download_url": null, "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://bitbucket.org/livioribeiro/cherrypy-authorizer", "keywords": "authentication,authorization,access control,cherrypy", "license": "BSD License", "maintainer": null, "maintainer_email": null, "name": "lribeiro.cherrypy.authorizer", "package_url": "https://pypi.org/project/lribeiro.cherrypy.authorizer/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/lribeiro.cherrypy.authorizer/", "project_urls": { "Homepage": "http://bitbucket.org/livioribeiro/cherrypy-authorizer" }, "release_url": "https://pypi.org/project/lribeiro.cherrypy.authorizer/1.0.2/", "requires_dist": [ "CherryPy" ], "requires_python": null, "summary": "Extensible session based authentication and claims based authorization tool for CherryPy", "version": "1.0.2" }, "last_serial": 1226536, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "20666fbb1c38159847a06b5a7a8e5c97", "sha256": "7946eed298a30f75ea13ca8a95318315b7af94628ee008f04297740845d6b5db" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "20666fbb1c38159847a06b5a7a8e5c97", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 8439, "upload_time": "2014-09-04T13:12:29", "url": "https://files.pythonhosted.org/packages/21/b9/9d483aa6177ffb1dadb2fbd2ffd80dd5a919b61e044c4e461adbb18a713c/lribeiro.cherrypy.authorizer-1.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "4f3e27940aea42541f230e16f584d4f3", "sha256": "76de37f43e66cbc680d936598ec0bf25a5034505e14fa9289960d042eeb4046e" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0.tar.gz", "has_sig": false, "md5_digest": "4f3e27940aea42541f230e16f584d4f3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4932, "upload_time": "2014-09-04T13:12:32", "url": "https://files.pythonhosted.org/packages/a8/ea/e415482822de13c754ca7da4cfde71540e6adf44faa0e364b5f7bca85215/lribeiro.cherrypy.authorizer-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "b5d799ea5cb40004e71a660962784304", "sha256": "3340a1315833e18aaeb2a6f47c0e3969ad1a65b0310aea2379e997912fc11945" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "b5d799ea5cb40004e71a660962784304", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 9604, "upload_time": "2014-09-05T16:43:21", "url": "https://files.pythonhosted.org/packages/06/0e/9875300788cd2362f7af5f2268ff6fc18c373be64df9f645fa66dcbba3a8/lribeiro.cherrypy.authorizer-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "7a2cfb24aac9865a3422263e7a5c87fb", "sha256": "d35b4266deb26a77274672899c4badc0fe8c308ac336edee0d16d1293196aa79" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0.1.tar.gz", "has_sig": false, "md5_digest": "7a2cfb24aac9865a3422263e7a5c87fb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5938, "upload_time": "2014-09-05T16:43:24", "url": "https://files.pythonhosted.org/packages/b9/e1/abfa0d462c66df3687ff05d1afbda5f07666c5b984da3661bbb2ef50dfa7/lribeiro.cherrypy.authorizer-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "bdcd9324ce508c9b779c83482ec6f816", "sha256": "7fc8dc71764d27c5e0f790208b3ecf3dbbd317ac30ee96f3cee4f9140a8d9d77" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bdcd9324ce508c9b779c83482ec6f816", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10207, "upload_time": "2014-09-16T12:56:50", "url": "https://files.pythonhosted.org/packages/85/3a/d9bd3f4bf5cc28ea7dea157f2be8a5358e01bc798787c0be295e057160e5/lribeiro.cherrypy.authorizer-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8fe7cbb62e867feba80168edc3d089bf", "sha256": "ecde61a90349945c0d757762738f901d6e87a0248e4d3dec2141696a39d69e9a" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0.2.tar.gz", "has_sig": false, "md5_digest": "8fe7cbb62e867feba80168edc3d089bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6182, "upload_time": "2014-09-16T12:56:53", "url": "https://files.pythonhosted.org/packages/5d/d7/dced2fe0cc5ccefd608a6f34afff6059df5f2111f64ba4e8463f9fe9612d/lribeiro.cherrypy.authorizer-1.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "bdcd9324ce508c9b779c83482ec6f816", "sha256": "7fc8dc71764d27c5e0f790208b3ecf3dbbd317ac30ee96f3cee4f9140a8d9d77" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "bdcd9324ce508c9b779c83482ec6f816", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 10207, "upload_time": "2014-09-16T12:56:50", "url": "https://files.pythonhosted.org/packages/85/3a/d9bd3f4bf5cc28ea7dea157f2be8a5358e01bc798787c0be295e057160e5/lribeiro.cherrypy.authorizer-1.0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8fe7cbb62e867feba80168edc3d089bf", "sha256": "ecde61a90349945c0d757762738f901d6e87a0248e4d3dec2141696a39d69e9a" }, "downloads": -1, "filename": "lribeiro.cherrypy.authorizer-1.0.2.tar.gz", "has_sig": false, "md5_digest": "8fe7cbb62e867feba80168edc3d089bf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6182, "upload_time": "2014-09-16T12:56:53", "url": "https://files.pythonhosted.org/packages/5d/d7/dced2fe0cc5ccefd608a6f34afff6059df5f2111f64ba4e8463f9fe9612d/lribeiro.cherrypy.authorizer-1.0.2.tar.gz" } ] }