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.

Source Distribution

django-auth-oidc-0.6.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

django_auth_oidc-0.6.0-py2.py3-none-any.whl (6.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-auth-oidc-0.6.0.tar.gz.

File metadata

  • Download URL: django-auth-oidc-0.6.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for django-auth-oidc-0.6.0.tar.gz
Algorithm Hash digest
SHA256 d6457dd9f253da12feac5639bbb87f7b2a0bd2a3749fdd8c827560456a865b2b
MD5 ee045ae5ccdb86b2fef6c213defea7de
BLAKE2b-256 1c990860e90288873804d74d49fbea0d97ff8d00961f0271396ec35b7fac95b2

See more details on using hashes here.

File details

Details for the file django_auth_oidc-0.6.0-py2.py3-none-any.whl.

File metadata

  • Download URL: django_auth_oidc-0.6.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.1 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1

File hashes

Hashes for django_auth_oidc-0.6.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 3788b5c582c1d4aa5efa1d74a93e6effafca8630605661a40caaa085886fa023
MD5 7113cc4f0fa04b18f49e15ed620545d9
BLAKE2b-256 d14a681eda9f7ac2694b47648c440c097bf97cfa3ee64b559809ed4eb090ec5c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page