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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a6a5d5d26227da9224f19ec15c117953b20f97db3f27c58bbf6fdd1fc72209c |
|
MD5 | cda1c8af8740f8aa461ea7fb83393892 |
|
BLAKE2b-256 | fd4e7a06a14f5f895a9ef5cd9e500f42712bb58f4c4afedadef5e9f78b2c5bfd |
Close
Hashes for django_admin_keycloak-0.3.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 733863f97b099b0a5909542eec27b7187a88a87b0a80e10d0c0f882e07bf0fac |
|
MD5 | d2fc16ffee4e38320d59c44c675f6414 |
|
BLAKE2b-256 | 0f17d5633ac35d75662a83522d2036b559ccd472d0f88137318cef7305d59527 |