Skip to main content

OpenID Connect authentication support for Django

Project description

https://badge.fury.io/py/django-auth-oidc.svg

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.

What is OpenID Connect?

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

It can be used for social logins (but we recommend Aiakos if you need more than one), 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-auth-oidc

settings.py

INSTALLED_APPS += ['django_auth_oidc']

urls.py

urlpatterns += [
        url(r'^auth/', include('django_auth_oidc.urls')),
]

Configuration

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-auth-oidc, version 0.6.0
Filename, size File type Python version Upload date Hashes
Filename, size django_auth_oidc-0.6.0-py2.py3-none-any.whl (6.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size django-auth-oidc-0.6.0.tar.gz (5.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page