Extensions for django-allauth module to support groups of Keycloak.
Project description
django-allauth-keycloak-ext is a Python package that extends Django-allauth to support security groups configured in Keycloak.
Features
Supports adding/removing users from Django groups mapped to Keycloak groups during login procedure.
Supports mapping Keycloak groups to is_staff and is_superuser flags of Django users.
Installation
To install django-allauth-keycloak-ext, run the following command:
pip install django-allauth-keycloak-ext
Usage
Once you have installed django-allauth-keycloak-ext, you can use it in your Django project by following these steps:
Add ‘allauth_keycloak_groups’ to your INSTALLED_APPS setting:
INSTALLED_APPS = [ # ... 'allauth_keycloak_ext', # ... ]
Configure Django-allauth to use Keycloak Ext as a provider by adding the following settings to your settings.py file:
SOCIALACCOUNT_PROVIDERS = { "keycloak_ext": { "KEYCLOAK_URL": "http://localhost:8080", "KEYCLOAK_REALM": "master", "GROUPS": { "GROUP_TO_FLAG_MAPPING": { "is_staff": ["Django Staff", "django-admin-role"], "is_superuser": "django-admin-role", }, } } }
Configure the security groups you want to use in Keycloak and map them to Django groups in your settings.py file:
ALLAUTH_KEYCLOAK_GROUPS = { 'group-name-1': 'django-group-name-1', 'group-name-2': 'django-group-name-2', # ... }
Note that the keys of the ALLAUTH_KEYCLOAK_GROUPS dictionary should be the names of the security groups you have configured in Keycloak, and the values should be the names of the Django groups you want to map them to.
License
This package is released under the MIT License.
Contributing
Contributions to this project are welcome. Please submit bug reports
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
File details
Details for the file django-allauth-keycloak-ext-0.1.1.tar.gz
.
File metadata
- Download URL: django-allauth-keycloak-ext-0.1.1.tar.gz
- Upload date:
- Size: 6.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f6f3a9a0fa1a2ff837d251b7736fb7945b837f22ef0dc4c37f45608c063f45d |
|
MD5 | cfa52bb09601971933812c754c89b630 |
|
BLAKE2b-256 | 55af3ced235ad40ecd9fc80fff1c70206fc377cc4c42a433352dafcdeca9f4e6 |
File details
Details for the file django_allauth_keycloak_ext-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: django_allauth_keycloak_ext-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a208048bde1e6ffeea1ec83932e7e6f5d4f9dff2e651828efc2e70a3f3cb6daf |
|
MD5 | 6433f435b60d44e86bc8f8e6c6d4f05a |
|
BLAKE2b-256 | daf15dbc6e37fb8790424b9a016caa4b50dbb83952e96778fcef4fd22ecc5feb |