{ "info": { "author": "Fabian Franke", "author_email": "ffranke@d120.de", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3" ], "description": "# pyTUID\npyTUID is a simple CAS client django app which, contrary to other apps like this, don't use the `django.contrib.auth` models nor middleware. So all data is saved to a own database table (or not att all).\npyTUID is fitted for our use case with the CAS of the TU Darmstadt (hence the name) but can probably be used with many other CAS servers with a similar configuration (CAS 2 with SAML 1).\n\nFeel free to adapt this app to your needs. If you make changes compatible to the current behavior (or if it is configurable) I would be glad if you made a pull request.\n\n## Setup\n* To set up install this python library (for example with pip).\n* In your `settings.py`:\n * Add `pyTUID` to your `INSTALLED_APPS`.\n * Add `pyTUID.middleware.TUIDMiddleware` to your `MIDDLEWARE_CLASSES`.\n * Set at least `TUID_SERVER_URL` to your CAS server URL.\n* Include `pyTUID.urls` in your `urls.py` at any path you like.\n* Apply the migrations.\n* That's it!\n\n## Configuration\nCurrently the following settings are available:\n* `TUID_SERVER_URL` the CAS server URL (default: `None`)\n* `TUID_CREATE_USER` sets whether the logged in users should be saved to the database (default: `True`)\n* `TUID_LOGIN_DEFAULT_NEXT` sets the default page after login when no `next` is present in `POST` or `GET` parameters (default: `\"/\"`)\n* `TUID_LOGOUT_DEFAULT_NEXT` sets the default page after logout when no `next` is present in `POST` or `GET` parameters (default: `\"/\"`)\n* `TUID_MAPPING` sets the mapping from SAML attributes to model fields (key is model field, value is SAML attribute)\n The default is:\n\n ```python\n {'surname' : 'surname',\n 'given_name' : 'givenName',\n 'email' : 'mail',\n 'groups' : 'groupMembership'}\n ```\n Every key not provided in your config will be set to default.\n* `TUID_FORCE_SERVICE_URL` sets the service url provided to CAS. If not set the\n request url is used as service url.\n\n## Usage\nThere are three different ways to use this app:\n\n### Decorators\nFor function based views the easiest interaction with this app is using the view function decorators:\n\n#### tuid_login_required\nThe [`@tuid_login_required`](https://github.com/d120/pyTUID/blob/240d5c6/pyTUID/decorators.py#L35) decorator checks whether the user is logged in (with TUID) and redirects it to the login page otherwise.\n\n#### tuid_user_in_group\nThe [`@tuid_user_in_group(group[, permission_denied_message])`](https://github.com/d120/pyTUID/blob/240d5c6/pyTUID/decorators.py#L49) decorator first checks whether the user is logged in (with TUID) and displays the login page otherwise. If the user is already logged in it is checked whether it is in the given `group` and a `PermissionDenied` is risen with the optional `permission_denied_message`.\n\n#### tuid_user_passes_test\nThe [`@tuid_user_passes_test(test_func[, raise_exception[, permission_denied_message]])`](https://github.com/d120/pyTUID/blob/240d5c6/pyTUID/decorators.py#L10) decorator applies the `test_func` on the `TUIDUser` object. If `True` is returned the view will be displayed as usual. If `False` is returned and `raise_exception` is `True` a `PermissionDenied`exception with the optional `permission_denied_message` will be risen. If `raisle_exceptio` is `False` (the default) the login page will be displayed.\n\n### Mixins\nFor class based views the following two mixins exists:\n\n#### TUIDLoginRequiredMixin\nThe [`TUIDLoginRequiredMixin`](https://github.com/d120/pyTUID/blob/240d5c6/pyTUID/mixins.py#L6) works exactly like the `tuid_login_required` decorator.\n\n#### TUIDUserInGroupMixin\nThe [`TUIDUserInGroupMixin`](https://github.com/d120/pyTUID/blob/240d5c6/pyTUID/mixins.py#L20) works like the `tuid_user_in_group` decorator except that the parameters have to be specified as fields of the view class. The `group_required` field acts like the group parameter of the decorator and the `permission_denied_message` (optional) acts also like the `permission_denied_message`of the decorator.\n\n### TUIDUser\nFor more specific use-cases you may use the `TUIDUser` object of the `request`, which is an instance of [`models.TUIDUSER`](https://github.com/d120/pyTUID/blob/240d5c6/pyTUID/models.py#L4).\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/d120/pyTUID", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "pyTUID", "package_url": "https://pypi.org/project/pyTUID/", "platform": "", "project_url": "https://pypi.org/project/pyTUID/", "project_urls": { "Homepage": "https://github.com/d120/pyTUID" }, "release_url": "https://pypi.org/project/pyTUID/1.3.4/", "requires_dist": [ "python-cas" ], "requires_python": "", "summary": "Django app for authentication via TUID (CAS)", "version": "1.3.4" }, "last_serial": 4964461, "releases": { "1.3.3": [ { "comment_text": "", "digests": { "md5": "27ee46897bfcce832685d07e63cde4c9", "sha256": "0c4e290ab3d006afc59ae2f8a2bdbae326f8d3031ad793452373da4c61552714" }, "downloads": -1, "filename": "pyTUID-1.3.3-py3-none-any.whl", "has_sig": true, "md5_digest": "27ee46897bfcce832685d07e63cde4c9", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10273, "upload_time": "2019-03-07T12:33:01", "url": "https://files.pythonhosted.org/packages/d2/1e/c15cdbc1b057e76817469212101661249e975881a985012ec44deac1524f/pyTUID-1.3.3-py3-none-any.whl" } ], "1.3.4": [ { "comment_text": "", "digests": { "md5": "57ef321f56c9ea55052e3dc6a13365a0", "sha256": "4b6647ac52ef73a33bdceb452950b3520006dca5b1a92c9433ff89787c009303" }, "downloads": -1, "filename": "pyTUID-1.3.4-py3-none-any.whl", "has_sig": false, "md5_digest": "57ef321f56c9ea55052e3dc6a13365a0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12358, "upload_time": "2019-03-20T16:05:16", "url": "https://files.pythonhosted.org/packages/2a/72/a20ff567cee9e965abee4aa43677a3024a53fea6453a886228106ccb4160/pyTUID-1.3.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "92810aeb1a155b18cf2524e7427adf00", "sha256": "b5bbc5d7cbc02697d9007a35f108d181ceb785668ab0e2ff80683bee2db43137" }, "downloads": -1, "filename": "pyTUID-1.3.4.tar.gz", "has_sig": false, "md5_digest": "92810aeb1a155b18cf2524e7427adf00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8029, "upload_time": "2019-03-20T16:05:17", "url": "https://files.pythonhosted.org/packages/0d/c3/f10ff52675112e19b63349cfe6cabe49afdf5ff794f8f6ffca3d56194610/pyTUID-1.3.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "57ef321f56c9ea55052e3dc6a13365a0", "sha256": "4b6647ac52ef73a33bdceb452950b3520006dca5b1a92c9433ff89787c009303" }, "downloads": -1, "filename": "pyTUID-1.3.4-py3-none-any.whl", "has_sig": false, "md5_digest": "57ef321f56c9ea55052e3dc6a13365a0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 12358, "upload_time": "2019-03-20T16:05:16", "url": "https://files.pythonhosted.org/packages/2a/72/a20ff567cee9e965abee4aa43677a3024a53fea6453a886228106ccb4160/pyTUID-1.3.4-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "92810aeb1a155b18cf2524e7427adf00", "sha256": "b5bbc5d7cbc02697d9007a35f108d181ceb785668ab0e2ff80683bee2db43137" }, "downloads": -1, "filename": "pyTUID-1.3.4.tar.gz", "has_sig": false, "md5_digest": "92810aeb1a155b18cf2524e7427adf00", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8029, "upload_time": "2019-03-20T16:05:17", "url": "https://files.pythonhosted.org/packages/0d/c3/f10ff52675112e19b63349cfe6cabe49afdf5ff794f8f6ffca3d56194610/pyTUID-1.3.4.tar.gz" } ] }