django-admin-keycloak


Namedjango-admin-keycloak JSON
Version 0.4.0 PyPI version JSON
download
home_pagehttps://github.com/migelbd/django-admin-keycloak
SummaryDjango Admin Keycloak
upload_time2024-09-28 09:09:46
maintainerNone
docs_urlNone
authorMikhail Badrazhan
requires_python<4.0,>=3.10
licenseNone
keywords keycloak django
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # django-admin-keycloak

![](https://github.com/migelbd/django-admin-keycloak/raw/main/example.png)

## 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 
```python

# 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
```python
INSTALLED_APPS = [
    'django_admin_keycloak',
    'django.contrib.admin',
    # ...
]
```
Add to urls.py
```python
urlpatterns = [
    # ...,
    path('sso/', include('django_admin_keycloak.url')),
    # ...
]
```

If you define static config, you must execute command for update providers.
```bash
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


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/migelbd/django-admin-keycloak",
    "name": "django-admin-keycloak",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.10",
    "maintainer_email": null,
    "keywords": "keycloak, django",
    "author": "Mikhail Badrazhan",
    "author_email": "mikhail@devilweb.ru",
    "download_url": "https://files.pythonhosted.org/packages/b0/42/b14620eb15df18208c6daec3517796ee7594ee221c591fc603114a1a8775/django_admin_keycloak-0.4.0.tar.gz",
    "platform": null,
    "description": "# django-admin-keycloak\n\n![](https://github.com/migelbd/django-admin-keycloak/raw/main/example.png)\n\n## Keycloak\nCreate Client OpenID with callback url `https://keycloak.example.ru/sso/*`\nadd client scopes \"roles\" and \nset client Backchannel logout URL `https://keycloak.example.ru/sso/logout`\n### Settings \n```python\n\n# define static config or add provider later in admin management\nKEYCLOAK_PROVIDERS = [\n    {\n        'slug': 'local', # internal django slug\n        'name': 'Local', # name on login form\n        'client_id': 'local_django',\n        'client_secret': 'SECRET',\n        'redirect_uri': '/admin', # redirect uri after login\n        'server_url': 'https://keycloak.example.ru',\n        'realm_name': 'django',\n        'role_staff_user': 'dev_staff', # role for staff users\n        'role_super_user': 'dev_super_user', # role for superusers\n    }\n]\n\n```\nAdd to INSTALLED_APPS\n```python\nINSTALLED_APPS = [\n    'django_admin_keycloak',\n    'django.contrib.admin',\n    # ...\n]\n```\nAdd to urls.py\n```python\nurlpatterns = [\n    # ...,\n    path('sso/', include('django_admin_keycloak.url')),\n    # ...\n]\n```\n\nIf you define static config, you must execute command for update providers.\n```bash\npython manage.py update_static_providers\n```\n## Available signals\n### user_sso_login\n###### On login SSO user\n- session: KeycloakSession\n- request: HttpRequest\n- userinfo: dict\n- access_token: str\n#### user_sso_logout\n###### On logout SSO user\n- session: KeycloakSession\n- request: HttpRequest\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Django Admin Keycloak",
    "version": "0.4.0",
    "project_urls": {
        "Homepage": "https://github.com/migelbd/django-admin-keycloak",
        "Repository": "https://github.com/migelbd/django-admin-keycloak"
    },
    "split_keywords": [
        "keycloak",
        " django"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed1a29581281ab936126304746287cc653f65f059a68afd364da76c6ec0e959e",
                "md5": "dee117cae98024f2fe2fa67c57e26b99",
                "sha256": "4cf6aa787c4a269da6d6518e8234a44bd8f7278036641768fd5e9cac287b47d1"
            },
            "downloads": -1,
            "filename": "django_admin_keycloak-0.4.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "dee117cae98024f2fe2fa67c57e26b99",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.10",
            "size": 22456,
            "upload_time": "2024-09-28T09:09:44",
            "upload_time_iso_8601": "2024-09-28T09:09:44.831437Z",
            "url": "https://files.pythonhosted.org/packages/ed/1a/29581281ab936126304746287cc653f65f059a68afd364da76c6ec0e959e/django_admin_keycloak-0.4.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b042b14620eb15df18208c6daec3517796ee7594ee221c591fc603114a1a8775",
                "md5": "4d6d166f2a72f8bd9d245dd7d1af51fb",
                "sha256": "b64984b21877d94179d36d941d7ad7d92dd9d808947c26cea7478a05b3f712c0"
            },
            "downloads": -1,
            "filename": "django_admin_keycloak-0.4.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4d6d166f2a72f8bd9d245dd7d1af51fb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.10",
            "size": 12951,
            "upload_time": "2024-09-28T09:09:46",
            "upload_time_iso_8601": "2024-09-28T09:09:46.398533Z",
            "url": "https://files.pythonhosted.org/packages/b0/42/b14620eb15df18208c6daec3517796ee7594ee221c591fc603114a1a8775/django_admin_keycloak-0.4.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-28 09:09:46",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "migelbd",
    "github_project": "django-admin-keycloak",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "django-admin-keycloak"
}
        
Elapsed time: 2.18745s