Django Admin Keycloak
Project description
django-admin-keycloak
Keycloak
Create Client OpenID with callback url https://keycloak.example.ru/sso/*
add client scopes "roles" and
set client Backchannel logout URL https://keycloak.example.ru/sso/logout
Settings
# define static config or add provider later in admin management
KEYCLOAK_PROVIDERS = [
{
'slug': 'local', # internal django slug
'name': 'Local', # name on login form
'client_id': 'local_django',
'client_secret': 'SECRET',
'redirect_uri': '/admin', # redirect uri after login
'server_url': 'https://keycloak.example.ru',
'realm_name': 'django',
'role_staff_user': 'dev_staff', # role for staff users
'role_super_user': 'dev_super_user', # role for superusers
}
]
Add to INSTALLED_APPS
INSTALLED_APPS = [
'django_admin_keycloak',
'django.contrib.admin',
# ...
]
Add to urls.py
urlpatterns = [
# ...,
path('sso/', include('django_admin_keycloak.url')),
# ...
]
If you define static config, you must execute command for update providers.
python manage.py update_static_providers
Available signals
user_sso_login
On login SSO user
- session: KeycloakSession
- request: HttpRequest
- userinfo: dict
- access_token: str
user_sso_logout
On logout SSO user
- session: KeycloakSession
- request: HttpRequest
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
Close
Hashes for django_admin_keycloak-0.3.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 586045003b0aaf9eaf850ecc80ed34d65a74513ec65cef36f925488bd6b2bfca |
|
MD5 | 4377a28e7ab49c871fc9808ed81b0b2d |
|
BLAKE2b-256 | 76da550255dfd347b347e5481f25d26a655100c8065630f693f375ab82d15cb5 |
Close
Hashes for django_admin_keycloak-0.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34f4a1a8e7b537cbef73642d606b9470e611dfb744a454e0bcf4563caf1326ec |
|
MD5 | 1b501abed41490150ef11b4441533c6e |
|
BLAKE2b-256 | 285bf730a9bcd403913b0c56e464c7a64927c268476585b791cc375dc7741906 |