Skip to main content

WireCloud Keycloak plugin

Tests Coverage Status

This WireCloud plugin allows the usage of Keycloak as IDM for the authentication of WireCloud users as well as the usage of JWT tokens issued for those users to access to backend services.

This plugin can be installed with pip as follows:

pip install wirecloud-keycloak

Or using the sources:

python setup.py install

Once installed, it can be enabled by editing your settings.py file and including wirecloud.keycloak and social_django on the INSTALLED_APPS setting, addiding KeycloakOpenIdConnect as the authentication backend to use and configuring it.

INSTALLED_APPS += (
    # 'django.contrib.sites',
    # 'wirecloud.oauth2provider',
    'wirecloud.keycloak',
    'haystack',
    'social_django'
)

AUTHENTICATION_BACKENDS = ('wirecloud.keycloak.social_auth_backend.KeycloakOpenIdConnect',)

SOCIAL_AUTH_NO_DEFAULT_PROTECTED_USER_FIELDS = True
SOCIAL_AUTH_PROTECTED_USER_FIELDS = ('username', 'id', 'pk', 'email', 'password', 'is_active')

SOCIAL_AUTH_KEYCLOAK_OIDC_URL = 'https://keycloak.example.com'
SOCIAL_AUTH_KEYCLOAK_OIDC_REALM = 'demo'
SOCIAL_AUTH_KEYCLOAK_OIDC_KEY = 'wirecloud'
SOCIAL_AUTH_KEYCLOAK_OIDC_SECRET = '7667d30b-4e1a-4dfe-a040-0b6fdc4758f5'
SOCIAL_AUTH_KEYCLOAK_OIDC_GLOBAL_ROLE = True

These settings include:

  • SOCIAL_AUTH_KEYCLOAK_OIDC_URL: URL of the Keycloak server
  • SOCIAL_AUTH_KEYCLOAK_OIDC_REALM: Keycloak realm where WireCloud is registered
  • SOCIAL_AUTH_KEYCLOAK_OIDC_KEY: Client ID of the WireCloud application
  • SOCIAL_AUTH_KEYCLOAK_OIDC_SECRET: Client secret of the WireCloud application
  • SOCIAL_AUTH_KEYCLOAK_OIDC_GLOBAL_ROLE: Whether the admin role is taken from the realm instead of from the client (default: False)

This plugin is able to map Keycloak roles into WireCloud groups. To enable it, you should enable the realm roles and the client roles mappings either for the wirecloud application or for the roles scope. This mapping should include role information on the ID token.

Finally, to add backchannel logout support (Single Sign Off), the following code: url('', include('wirecloud.keycloak.urls')), has to be added inside the urlpatterns list defined on your urls.py file. Once done this, you can access the Keycloak console to configure the Admin URL of the WireCloud application to point into the following url: http(s)://wirecloud.example.com/keycloak.

Metadata

Release files for wirecloud-keycloak 0.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for wirecloud-keycloak 0.4.5
File Interpreter ABI Platform Actions
wirecloud_keycloak-0.4.5-py3-none-any.whl Python 3 none any Details for wirecloud_keycloak-0.4.5-py3-none-any.whl

Release files / wirecloud_keycloak-0.4.5-py3-none-any.whl

Download URL wirecloud_keycloak-0.4.5-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3ddd457ebe6278ce6a0eef256c263fd9c2ef317ff557ddcd01eabbbe735019ea
BLAKE2b-256 checksum
How to use checksums
bf99394061a280ca3ea5b86388469b675b7b806a00527f955ed6625b5a8dbe5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

Security for wirecloud-keycloak 0.4.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page