{ "info": { "author": "Department for International Trade", "author_email": "", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.11", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: Implementation :: PyPy", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "# Django-staff-sso-client\n\n[![CircleCI](https://circleci.com/gh/uktrade/django-staff-sso-client/tree/master.svg?style=svg)](https://circleci.com/gh/uktrade/django-staff-sso-client/tree/master)\n[![codecov](https://codecov.io/gh/uktrade/django-staff-sso-client/branch/master/graph/badge.svg)](https://codecov.io/gh/uktrade/django-staff-sso-client)\n![PyPI](https://img.shields.io/pypi/v/django-staff-sso-client.svg)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-staff-sso-client.svg)\n![PyPI - Django Version](https://img.shields.io/pypi/djversions/django-staff-sso-client.svg)\n\n\nA Django client for `staff-sso`\n\n## Requirements\n\n[Python 3.6](https://www.python.org/downloads/release/python-368/)\n[Django>=1.11](https://www.djangoproject.com/)\n\n## Installation\n\n`pip install django-staff-sso-client`\n\n## Configuration\n\nAdd the following to your settings file:\n\n```\nINSTALLED_APPS=[\n [...]\n 'authbroker_client',\n]\n```\n\n```\n# authbroker config\nAUTHBROKER_URL = 'speak-to-webops-team-for-access'\nAUTHBROKER_CLIENT_ID = 'speak-to-webops-team-for-access'\nAUTHBROKER_CLIENT_SECRET = 'speak-to-webops-team-for-access'\n```\n\nAdd the `'authbroker_client.backends.AuthbrokerBackend'` authentication backend, e.g:\n\n```\nAUTHENTICATION_BACKENDS = [\n 'django.contrib.auth.backends.ModelBackend',\n 'authbroker_client.backends.AuthbrokerBackend',\n]\n```\n\nAdd the LOGIN_URL ( it must be '/auth/login' )\n\n```\nLOGIN_URL = reverse_lazy('authbroker:login')\n```\n\nAdd the LOGIN_REDIRECT_URL for e.g.\n```\nLOGIN_REDIRECT_URL = reverse_lazy('home_page')\n```\n\nThen finally add this to your main `urls.py` file:\n\n`path('auth/', include('authbroker_client.urls'))`\n\nor, if you're using Django<2:\n\n`url('^auth/', include('authbroker_client.urls', namespace='authbroker', app_name='authbroker_client'))`\n\n\nYou should now have an `/auth/login/` URL which directs users through the `staff-sso` login flow. Once a user is\nauthenticated via `staff-sso` (and chosen identify provider), they will be redirected back to your application.\nA local django user with a matching email address will then be logged in. The user entry will be created if it does\nnot already exist in the database.\n\nOnce authenticated, the user will be redirected to `settings.LOGIN_REDIRECT_URL`\n\nUse the django `@login_required` decorator to protect individual views, or if you want to protect all views use this middleware:\n\n```\nMIDDLEWARE = [\n [...]\n 'authbroker_client.middleware.ProtectAllViewsMiddleware',\n]\n```\n\nif you do like to use admin interface in your app, when using this module, you will also need to install and configure the [custom_usermodel](https://github.com/uktrade/django-staff-sso-usermodel).\n\n## TODO:\n\n* ensure has_valid_token() checks with `staff-sso` after grace period (e.g. 1 minute)\n* improve exception handling logic in `authbroker_client/views.py`\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/uktrade/django-staff-sso-client/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-staff-sso-client", "package_url": "https://pypi.org/project/django-staff-sso-client/", "platform": "", "project_url": "https://pypi.org/project/django-staff-sso-client/", "project_urls": { "Homepage": "https://github.com/uktrade/django-staff-sso-client/" }, "release_url": "https://pypi.org/project/django-staff-sso-client/0.3.1/", "requires_dist": [ "django (<3,>=1.11)", "requests-oauthlib", "raven", "pytest ; extra == 'test'", "pytest-cov ; extra == 'test'", "pytest-sugar ; extra == 'test'", "flake8 (==3.0.4) ; extra == 'test'", "requests-mock ; extra == 'test'", "codecov ; extra == 'test'", "twine ; extra == 'test'", "wheel ; extra == 'test'", "setuptools ; extra == 'test'", "pytest-django ; extra == 'test'" ], "requires_python": "", "summary": "Reusable Django app to facilitate gov.uk Staff Single Sign On", "version": "0.3.1" }, "last_serial": 5426082, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "a03b209ee2303c48b3cbaeabb0e8075f", "sha256": "acec2dd72a7d602baea1ce4c0ad3383906520327d3403898f9bb49070df10c81" }, "downloads": -1, "filename": "django_staff_sso_client-0.1.0-py3-none-any.whl", "has_sig": false, "md5_digest": "a03b209ee2303c48b3cbaeabb0e8075f", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10328, "upload_time": "2019-04-01T14:42:22", "url": "https://files.pythonhosted.org/packages/99/8b/58bd607502e0e06bf70b138e9e99fb39363af762800ef01e6abb6d0f430b/django_staff_sso_client-0.1.0-py3-none-any.whl" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "4eebfe85e48eceb4a3c8d964ffaeab67", "sha256": "e29fca636ac3d71a47ed74481fb3b337b56ad7765141970dbac7ce0fc9f7716d" }, "downloads": -1, "filename": "django_staff_sso_client-0.2.0-py3-none-any.whl", "has_sig": false, "md5_digest": "4eebfe85e48eceb4a3c8d964ffaeab67", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10387, "upload_time": "2019-04-01T15:06:28", "url": "https://files.pythonhosted.org/packages/95/81/1760176cfe999c1fdf2180cbb627573580968acd6338e2b5c5ceba02296e/django_staff_sso_client-0.2.0-py3-none-any.whl" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "d9ae85f7974f2e854fcb74ba7977e470", "sha256": "95b5ea10a2b8998497c0a549918fe8a52fc26cc1ede7c3be818a6ecbb8c1353d" }, "downloads": -1, "filename": "django_staff_sso_client-0.3.0-py3-none-any.whl", "has_sig": false, "md5_digest": "d9ae85f7974f2e854fcb74ba7977e470", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10444, "upload_time": "2019-05-24T11:45:15", "url": "https://files.pythonhosted.org/packages/88/9b/e88502ecda778c69a96a19fca548bc6e342680dc4e1e5fa7387ac96ffda5/django_staff_sso_client-0.3.0-py3-none-any.whl" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "af460d51dcfce035e8c5e84de3e1fd46", "sha256": "e602d5873258d3a34287890a392416bef8515736c8069c2b5b1136261e81bb1f" }, "downloads": -1, "filename": "django_staff_sso_client-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "af460d51dcfce035e8c5e84de3e1fd46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10456, "upload_time": "2019-06-20T14:03:08", "url": "https://files.pythonhosted.org/packages/b7/be/3ded34bc30af868e1a421532ca65ea9012ea7407ade34a0cf1ddf7e64009/django_staff_sso_client-0.3.1-py3-none-any.whl" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "af460d51dcfce035e8c5e84de3e1fd46", "sha256": "e602d5873258d3a34287890a392416bef8515736c8069c2b5b1136261e81bb1f" }, "downloads": -1, "filename": "django_staff_sso_client-0.3.1-py3-none-any.whl", "has_sig": false, "md5_digest": "af460d51dcfce035e8c5e84de3e1fd46", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 10456, "upload_time": "2019-06-20T14:03:08", "url": "https://files.pythonhosted.org/packages/b7/be/3ded34bc30af868e1a421532ca65ea9012ea7407ade34a0cf1ddf7e64009/django_staff_sso_client-0.3.1-py3-none-any.whl" } ] }