Skip to main content

Django SAML2 Authentication Made Easy. Easily integrate with SAML2 SSO identity providers like Okta

Project description

Django SAML

Django SAML Authentication Made Easy.

Full documentation for the project is available at https://djangosaml.readthedocs.io/en/latest/.

Python Version

Pypi

Downloads

Requirements

  • Python 3.6+
  • Django 5.0, 4.2, 4.1, 4.0, 3.2, 3.1, 3.0

Installation

xmlsec1 is required by pysaml2:

    apt install xmlsec1
    // or
    yum install xmlsec1
    // or
    brew install xmlsec1

Install using pip...

pip install djangosaml

Add 'djangosaml' to your INSTALLED_APPS setting.

INSTALLED_APPS = [
    ...
    'djangosaml',
]

Now update your root urls.py:

urlpatterns = [
    ...
    path('djangosaml/', include('djangosaml.urls')),
]

Copy your metadata.xml into root directory.

In settings.py, add the SAML2 related configuration.

SAML2_AUTH = {
    # Metadata is required, local file path
    'METADATA_LOCAL_FILE_PATH': BASE_DIR / 'metadata.xml',
    # Populates the Issuer element in authn request
    'ENTITY_ID': 'https://your-domain/djangosaml/acs/',
    # Change Email/UserName/FirstName/LastName to corresponding SAML2 userprofile attributes.
    'ATTRIBUTES_MAP': { 
        'email': '',
        'username': '',
        'first_name': '',
        'last_name': '',
    },
}

In your SAML2 SSO identity provider, set the Single-sign-on URL and Audience URI(SP Entity ID) to:

https://your-domain/djangosaml/acs/

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

djangosaml-1.0.7.tar.gz (7.2 kB view details)

Uploaded Source

Built Distribution

djangosaml-1.0.7-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file djangosaml-1.0.7.tar.gz.

File metadata

  • Download URL: djangosaml-1.0.7.tar.gz
  • Upload date:
  • Size: 7.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for djangosaml-1.0.7.tar.gz
Algorithm Hash digest
SHA256 aa1baa797add41a25304874aa232779926060000b0faeda0565c8a5734f0f0f5
MD5 c1af07d4058c97df4d610758cfa7602a
BLAKE2b-256 1be4595f7e27808b3ef86cce772540f6ae7c94eccb27c696654d201ae346c063

See more details on using hashes here.

File details

Details for the file djangosaml-1.0.7-py2.py3-none-any.whl.

File metadata

  • Download URL: djangosaml-1.0.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for djangosaml-1.0.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 9ffd65d26ae466b9df050ba6d190c6b6825fb73f38010ea0d993b6b7d3612f89
MD5 f8c010852f0a36cb63d33be67b46d0d4
BLAKE2b-256 744585a54af330e37c1dbd8acad28ba9a5b35d20207438a866d576bf87c1db2e

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