Skip to main content

Single LogOut (SLO) plugin for django_saml2_auth

Project description

django-saml2-auth-signout-slo

A plugin to support Single LogOff (SLO) in django-saml2-auth

Introduction

By default, django-saml2-auth only signs out users in the local Django application. For security reasons, the logout needs to be passed to the IdP (identity provider). Otherwise, a user who clicks the login button will be logged in again without providing a password (or otherwise).

Example

In settings.py:

INSTALLED_APPS += (
    ...
    'django_saml2_auth',
    # ensure the plugin is loaded
    'django_saml2_auth_signout_slo',
    ...
)

# this is the "usual" config object from django-saml2-auth
SAML2_AUTH = {
    'DEFAULT_NEXT_URL': '/',
    'PLUGINS': {
        # use this package in lieu of DEFAULT signout plugin 
        'SINGOUT': ['SLO'],
    }
}

ADFS Notes

There are several issues using this package with ADFS:

  • ADFS does not provide a NameID by default. NameID is required (at least by PySAML2) for SLO.
  • ADFS does not expose an SLO endpoint by default.

The following are one way to address these issues (but use at your own risk). The Name ID strategy was taken from this article. The SLO endpoint was taken from this article.

  • In your SAMLConfig, add the line:

    'NAME_ID_FORMAT': 'urn:oasis:names:tc:SAML:2.0:nameid-format:persistent',
    
  • In your ADFS Claim Rules, add a custom rule ("Send Claims Using a Custom Rule"):

    c:[Type == "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname"]
    => add(
        store = "_OpaqueIdStore",
        types = ("http://mycompany/internal/persistentId"),
        query = "{0};{1};{2}",
        param = "ppid",
        param = c.Value,
        param = c.OriginalIssuer
    );
    
  • In your ADFS Claim Rules, add a Transform Rule:

    • Incoming claim type: http://mycompany/internal/persistentId (literally this, don't change mycompany)
    • Outgoing claim type: NameID
    • Outgoing name ID format: Persistent Identifier
  • Under the Relaying Party Trust's Properties -> Endpoints tab, add a SAML Logout Endpoint:

    • Binding: POST
    • Trusted URL: Your ADFS endpoint, something like https://<my.adfs.com>/adfs/ls
    • Response URL: empty

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_saml2_auth_signout_slo-0.0.6.tar.gz (4.5 kB view details)

Uploaded Source

File details

Details for the file django_saml2_auth_signout_slo-0.0.6.tar.gz.

File metadata

  • Download URL: django_saml2_auth_signout_slo-0.0.6.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.1

File hashes

Hashes for django_saml2_auth_signout_slo-0.0.6.tar.gz
Algorithm Hash digest
SHA256 6a9fee96d2a5d4ae626c3ec2a6ae7c526ee5e924db407cd98cff188a7633a676
MD5 32aa8a7e7af2fc3e4ca9de9971bb1a15
BLAKE2b-256 0cd98bea18a74d3f3805a52c3799c19dffed839dbb8627a4ef1817bed523f490

See more details on using hashes here.

Supported by

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