Skip to main content

Reusable Django app for integrating Single Sign-On (SSO) functionality

Project description

django-sso-client-oauth

django-sso-client-oauth is a reusable Django app that simplifies the integration of Single Sign-On (SSO) functionality into your Django projects. It is designed to work seamlessly with Django-based applications and supports flexible configurations for connecting to an SSO provider.

Note: This package is currently in beta. Features and APIs may change in future releases.

Features

  • SSO Integration: Easily integrate Single Sign-On functionality into your Django project.
  • Customizable Settings: Configure the SSO client to work with your specific SSO provider.
  • Token Management: Handle authentication tokens securely.
  • Django Compatibility: Works with Django 3.2+.

Installation

Install the package using pip:

pip install django-sso-client-oauth

Alternatively, for development purposes, you can install it in editable mode:

pip install -e .

To uninstall the package:

pip uninstall django-sso-client-oauth

Quickstart

  1. Add django_sso_client_oauth to your INSTALLED_APPS in settings.py:

    INSTALLED_APPS = [
        ...,
        "django_sso_client_oauth",
    ]
    
  2. Configure the SSO client settings in your Django project:

    SSO_CLIENT = {
         "BASE_URL": "https://sso.example.com",
         "CLIENT_ID": "your-client-id",
         "CLIENT_SECRET": "your-client-secret",
         "REDIRECT_URI": "https://your-app.com/sso/callback",
         "SCOPE": ["openid", "read", "write"],
         "LOGIN_REDIRECT": "/",
         "LOGIN_ERROR_REDIRECT": "/login/",
         "USERINFO_ENDPOINT": "/api/auth/me/",
         "AUTO_CREATE_USER": True,
         "SYNC_PERMISSIONS": True,
    }
    
  3. Include the SSO client URLs in your urls.py:

    from django.urls import path, include
    
    urlpatterns = [
        ...,
        path("sso/", include("django_sso_client_oauth.urls")),
    ]
    
  4. Run your Django server:

    python manage.py runserver
    

Usage

Redirecting Users to the SSO Provider

To initiate the SSO flow, redirect users to the SSO provider's login page. This can be done using the utility functions provided in the django_sso_client_oauth.utils module.

Handling SSO Callbacks

The app includes built-in views to handle SSO callbacks and exchange authorization codes for tokens. These views are automatically included when you add the app's URLs to your project.

Customizing Behavior

You can customize the behavior of the SSO client by overriding the default settings or extending the provided views and utilities.

Development

To contribute to this project:

  1. Clone the repository.

  2. Install dependencies:

    pip install -r requirements.txt
    

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Disclaimer

This package is in beta. Use it in production environments with caution, and report any issues you encounter.

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_sso_client_oauth-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_sso_client_oauth-1.0.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file django_sso_client_oauth-1.0.0.tar.gz.

File metadata

  • Download URL: django_sso_client_oauth-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_sso_client_oauth-1.0.0.tar.gz
Algorithm Hash digest
SHA256 584d52532f4bd52ff468e66b8cdf8eabd307101f168e2a053c46a355a4929152
MD5 1a54381e03039827b89cd27282906507
BLAKE2b-256 7be0676a54103a58ccf11085742f81aee2bfeb8dc9fb642916386a70a0a6a145

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sso_client_oauth-1.0.0.tar.gz:

Publisher: python-publish.yml on entespotify/django-sso-client-oauth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_sso_client_oauth-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_sso_client_oauth-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d96c8d833ee9e96b266739a8def02af44553e7f433061eb58bc29fc7768cca95
MD5 904d156982f8af829aeffe5d7a956758
BLAKE2b-256 335ae6ffe553ac06809bbedb1adce3da03bf68bcc3f22d402249383d7785f7f6

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_sso_client_oauth-1.0.0-py3-none-any.whl:

Publisher: python-publish.yml on entespotify/django-sso-client-oauth

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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