Skip to main content

A database-backed django-auth-adfs settings class

Project description

2   Features

  • Thin layer on top of django-auth-adfs
  • SAAS ready: store ADFS configuration in a database singleton
  • Quick toggle to enable/disable ADFS based auth
  • Hooks into Django’s auth machinery

Django-auth-adfs-db provides a setting class reading out the dynamic ADFS configuration. This moves the ADFS configuration from deploy-time to run-time, and SAAS clients can configure their ADFS integration themselves. No more server reloads of deployment environment variable changes needed!

3   Installation

3.1   Requirements

  • Python 3.6 or higher
  • setuptools 30.3.0 or higher
  • Django 2.1 or higher
  • PostgreSQL (with jsonb field)

3.2   Install

pip install django-auth-adfs-db

This will also install the django-auth-adfs and django-solo packages.

3.3   Django settings

Make sure the following libraries are added to your INSTALLED_APPS:


Add django_auth_adfs_db.backends.AdfsAuthCodeBackend to AUTHENTICATION_BACKENDS.

Ensure that LOGIN_URL and LOGIN_REDIRECT_URL are configured. You can set:

LOGIN_URL = reverse_lazy("django_auth_adfs:login")

if you wish to make ADFS your primary auth login.

Set the AUTH_ADFS config class:

AUTH_ADFS = {"SETTINGS_CLASS": "django_auth_adfs_db.settings.Settings"}

or a subclass thereof.

Finally, register the URLs in your root config with:

urlpatterns += [path("oauth2/", include("django_auth_adfs.urls")),]

3.4   ADFS login URL on admin login

Template: admin/login.html

{% extends "admin/login.html" %}
{% load solo_tags i18n %}

{% block content %}
{{ block.super }}

{% get_solo 'django_auth_adfs_db.ADFSConfig' as adfs_config %}
{% if adfs_config.enabled %}
<div class="submit-row">
    <a href="{% url 'django_auth_adfs:login' %}">{% trans "Login with ADFS" %}</a>
{% endif %}
{% endblock %}

4   Usage

You can now configure the ADFS settings in the Django admin.

Please follow the django-auth-adfs documentation for advanced usage.

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-adfs-db, version 0.3.0
Filename, size File type Python version Upload date Hashes
Filename, size django_auth_adfs_db-0.3.0-py3-none-any.whl (10.8 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size django-auth-adfs-db-0.3.0.tar.gz (10.6 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