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.2.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e04e8ebbe15d2b4c5960165397b874e7500f73d8e0cd714cf5a21cdad93b1e8e |
|
MD5 | 57360be846676923591efbe441390c8b |
|
BLAKE2b-256 | 11d2f251eba1a9fd90bb410643bcafb0c03858c7b9917947b578265b40195a31 |
Close
Hashes for django_admin_keycloak-0.2.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1f872c714c86d36cc285ef6be62de3865639acc61acc4fce153c9e59081ac1e |
|
MD5 | 0d4fa767013cd067198145da203c965e |
|
BLAKE2b-256 | f7029d0b456c916de1ae0c5a15cdb689d7a7ff52264fcb34d2206c6fe88fb78a |