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
-
Add
django_sso_client_oauthto yourINSTALLED_APPSinsettings.py:INSTALLED_APPS = [ ..., "django_sso_client_oauth", ]
-
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, }
-
Include the SSO client URLs in your
urls.py:from django.urls import path, include urlpatterns = [ ..., path("sso/", include("django_sso_client_oauth.urls")), ]
-
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:
-
Clone the repository.
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
584d52532f4bd52ff468e66b8cdf8eabd307101f168e2a053c46a355a4929152
|
|
| MD5 |
1a54381e03039827b89cd27282906507
|
|
| BLAKE2b-256 |
7be0676a54103a58ccf11085742f81aee2bfeb8dc9fb642916386a70a0a6a145
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_sso_client_oauth-1.0.0.tar.gz -
Subject digest:
584d52532f4bd52ff468e66b8cdf8eabd307101f168e2a053c46a355a4929152 - Sigstore transparency entry: 622515281
- Sigstore integration time:
-
Permalink:
entespotify/django-sso-client-oauth@10579eb6b2eb061eedf56c820f9a593fefaee660 -
Branch / Tag:
refs/tags/v1.0.0_renamed - Owner: https://github.com/entespotify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@10579eb6b2eb061eedf56c820f9a593fefaee660 -
Trigger Event:
release
-
Statement type:
File details
Details for the file django_sso_client_oauth-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_sso_client_oauth-1.0.0-py3-none-any.whl
- Upload date:
- Size: 6.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d96c8d833ee9e96b266739a8def02af44553e7f433061eb58bc29fc7768cca95
|
|
| MD5 |
904d156982f8af829aeffe5d7a956758
|
|
| BLAKE2b-256 |
335ae6ffe553ac06809bbedb1adce3da03bf68bcc3f22d402249383d7785f7f6
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
django_sso_client_oauth-1.0.0-py3-none-any.whl -
Subject digest:
d96c8d833ee9e96b266739a8def02af44553e7f433061eb58bc29fc7768cca95 - Sigstore transparency entry: 622515284
- Sigstore integration time:
-
Permalink:
entespotify/django-sso-client-oauth@10579eb6b2eb061eedf56c820f9a593fefaee660 -
Branch / Tag:
refs/tags/v1.0.0_renamed - Owner: https://github.com/entespotify
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@10579eb6b2eb061eedf56c820f9a593fefaee660 -
Trigger Event:
release
-
Statement type: