Django OpenID Connect (OIDC) authentication provider
This module makes it easy to integrate OpenID Connect as an authentication source in a Django project.
Behind the scenes, it uses Roland Hedberg’s great pyoidc library.
Modified by JHUAPL BOSS to support Python3
Modified by Thomas Frössman with fixes and additional modifications.
Quickstart
Install djangooidc:
# Latest (pre) release pip install django-oidc-tf # Latest code - unstable! pip install git+https://github.com/thomasf/django-oidc.git
Then to use it in a Django project, add this to your urls.py:
url(r'openid/', include('djangooidc.urls')),
Then add the following items to your settings.py:
add ‘djangooidc.backends.OpenIdConnectBackend’ to AUTHENTICATION_BACKENDS after the default ‘django.contrib.auth.backends.ModelBackend’
set LOGIN_URL = ‘openid’
add the specific OIDC parameters (change the absolute URLs to yours):
# Information used when registering the client, this may be the same for all OPs # Ignored if auto registration is not used. OIDC_DYNAMIC_CLIENT_REGISTRATION_DATA = { "application_type": "web", "contacts": ["ops@example.com"], "redirect_uris": ["http://localhost:8000/openid/callback/login/", ], "post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/", ] } # Default is using the 'code' workflow, which requires direct connectivity from your website to the OP. OIDC_DEFAULT_BEHAVIOUR = { "response_type": "code", "scope": ["openid", "profile", "email", "address", "phone"], }
The configuration above is enough to use OIDC providers (OP) that support discovery and self client registration. In addition, you may want to use a specific OpenID Connect provider that is not auto-discoverable. This is done by adding items to the OIDC_PROVIDERS dictionary. See full documentation for parameter names.
For example, an Azure AD OP would be:
OIDC_PROVIDERS = {
"Azure Active Directory": {
"srv_discovery_url": "https://sts.windows.net/aaaaaaaa-aaaa-1111-aaaa-xxxxxxxxxxxxx/",
"behaviour": OIDC_DEFAULT_BEHAVIOUR,
"client_registration": {
"client_id": "your_client_id",
"client_secret": "your_client_secret",
"redirect_uris": ["http://localhost:8000/openid/callback/login/"],
"post_logout_redirect_uris": ["http://localhost:8000/openid/callback/logout/"],
}
}
}
You may now test the authentication by going to (on the development server) http://localhost:8000/openid/login or to any of your views that requires authentication.
Features
Ready to use Django authentication backend
No models stored in database - just some configuration in settings.py to keep it simple
Fully integrated with Django’s internal accounts and permission system
Support for all OIDC workflows: Authorization Code flow, Implicit flow, Hybrid flow. Don’t worry if you don’t know what these are - the package comes with great defaults.
Includes logout at the provider level
History
0.1.0 (2015-05-08)
First release
Metadata
Release files for django-oidc-tf 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-oidc-tf-0.0.8.tar.gz | 17.6 kB | Without provenance | Details for django-oidc-tf-0.0.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_oidc_tf-0.0.8-py3-none-any.whl | Python 3 | none | any | Details for django_oidc_tf-0.0.8-py3-none-any.whl |
Total release size: 34.3 kB
Release files / django-oidc-tf-0.0.8.tar.gz
| Download URL | django-oidc-tf-0.0.8.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
492d100401b1e33ef22d9da3e55c3d6815717f8e806efbb0ca17f7c4c11256de
|
|
BLAKE2b-256 checksum How to use checksums |
fcc0620bdf2044d9e575ede473c743ea8feeb7fb1f354be99c20b089196b2116
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_oidc_tf-0.0.8-py3-none-any.whl
| Download URL | django_oidc_tf-0.0.8-py3-none-any.whl |
|---|---|
| Size | 16.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2eb8c143bdbfbdc8523d0db6e306578750d1beb5f2e323a94fcdc9d17703d4ff
|
|
BLAKE2b-256 checksum How to use checksums |
e9ded5ed0288d42aa03e05600a39eba9c76d2b0627c804fe40ccb9dac4fe73c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-oidc-tf 0.0.8
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.