Skip to main content

Django-Better-Auth-OIDC - OpenID Connect authentication support for Django

This is a Django login view that authenticates against an OpenID Connect Authentication Server.

Use it if you own a single Authentication Server that you want to share between multiple apps.

Huh?

This is a fork of the abandoned django-auth-oidc. Original code by the Aiakos team.

What is OpenID Connect?

It’s a OAuth2-based standard for authentication in applications.

It can be used for social logins, and for setting up Single Sign-On into multiple services hosted by the same company. In the last case, it somewhat supersedes LDAP, as with OIDC people are entering their credentials only into the views served by the Authentication Server, and not into all the company’s applications.

Requirements

Installation

pip install django-better-auth-oidc

settings.py

INSTALLED_APPS += ['django_better_auth_oidc']

urls.py

urlpatterns += [
        path('auth/', include('django_better_auth_oidc.urls')),
]

Configuration

Server Cache Lock

By default, DBAO will only fetch the server info based on a cache lock timer. To disable this feature, use the setting AUTH_SERVER_CACHE_LOCK and set to false.

Authorization Server

App’s redirect URI: http(s)://app-domain/auth/done App’s post-logout redirect URI: http(s)://app-domain/LOGOUT_REDIRECT_URL (or / if not set)

Authorization Server details

You may specify following settings in the Django settings file:

  • AUTH_SERVER - OpenID Connect Authorization Server URL.

  • AUTH_CLIENT_ID - Client ID received from the Authorization Server

  • AUTH_CLIENT_SECRET - Client secret received from the Authorization Server

  • AUTH_PROTOCOL (optional) - Legacy protocol supported by openid-connect library, for example github or gitlab. See openid-connect’s documentation for full list of supported protocols.

Or, alternatively, you may set the AUTH_URL environment variable:

AUTH_URL=(protocol+)http(s)://client_id:client_secret@server/

(Note: “:”, “@”, “/” and “%” inside client_id and client_secret must be urlquoted.)

Behavior

  • AUTH_SCOPE (default: [‘openid’]) - list of scopes to request from the auth server

  • AUTH_GET_USER_FUNCTION (default: ‘django_auth_oidc:get_user_by_username’) - name of a function that takes the user info dict, and returns an user object representing that user; note that it should set the user.backend attribute.

Metadata

Release files for django-better-auth-oidc 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-better-auth-oidc 0.2.0
File Size Uploaded
django-better-auth-oidc-0.2.0.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-better-auth-oidc 0.2.0
File Interpreter ABI Platform
django_better_auth_oidc-0.2.0-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 13.7 kB

Release files / django-better-auth-oidc-0.2.0.tar.gz

Download URL django-better-auth-oidc-0.2.0.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f591e0dc3f67ab7b09e7a715fa8d29b2150bc0fb1f0e544d5711c30f5ddf803c
BLAKE2b-256 checksum
How to use checksums
6ce9e7db74dd360cf53a5ab8f2a22827d433053340350a07845c9a889418757f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release files / django_better_auth_oidc-0.2.0-py2.py3-none-any.whl

Download URL django_better_auth_oidc-0.2.0-py2.py3-none-any.whl
Size 8.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
f020b47f8a59fa8a5157df3a0280e2a351ad7d793e91a549516ece57d0c44c44
BLAKE2b-256 checksum
How to use checksums
baa198ab7cf3ca958d95d4712a447b88aa5192f94bd298d8574373fb21827620
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page