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.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | d275ef5d6a00743bde3e0cad09db6a809ccfa901d145be741d1f035f296eb770 |
|
MD5 | 6bf3e04078ac5a223280a9dcd77513a5 |
|
BLAKE2b-256 | 758d8f03940c8af52793b92b69c2bf472b007febc4afd111fb16f4ec4861fa01 |
Close
Hashes for django_admin_keycloak-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 607f1542fd881fa3f14a3db55afc96ec155cfc2376788d64c9d3076c3b7d5a7d |
|
MD5 | 3e0d01e04aa0f79be1f55c82b54dba37 |
|
BLAKE2b-256 | 7dec8d292a4201d6bb78e21a40f933cad7afc667187eefbb07f9cba9228ffbfd |