Skip to main content

Provides SSO functions for Django

Project description

Pursuit Library - SSO

This package provides SSO functions for Django.

Configuration

Create a SSO_CONFIG object in your settings.py:

SSO_CONFIG = {
    "saml2": {
        "entityid": "saml_entity_id",
        "organization": {
            "name": "organization_name",
            "verbose_name": "Organization Name"
        },
        "contacts": [
            {
                "name": "Contact 1",
                "email": "contact1@mydomain.com"
            }
        ],
        "idp": [
            {
                "id": "idp_id",
                "entity": "idp_entity_id",
                "metadata": "https://url/to/idp/metadata.xml",
                "debug_identity": {
                    "email": "user@example.com",
                    "first_name": "John",
                    "last_name": "Doe"
                }
            }
        ]
    },
    "default_redirect": "home:index",
    "get_or_create_user": get_or_create_user
}

The get_or_create_user finds an existing user or create a new one based on the IDP's response:

def get_or_create_user(idp: str, user_data) -> User:
    get_user_from_db(user_data)

Debugging

When debugging on a local machine, you can define SSO_DEBUG = True in your settings.py to bypass the remote IDP, and instead use the debug_identity object.

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

pursuitlib-sso-0.2.0.tar.gz (6.1 kB view hashes)

Uploaded Source

Built Distribution

pursuitlib_sso-0.2.0-py3-none-any.whl (7.0 kB view hashes)

Uploaded Python 3

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