CKAN single sign-on with Keycloak

Signing CKAN users in through Keycloak means choosing a community extension, confirming its CKAN version support and testing identity mapping before go-live. This page covers each step, the checks that close it and the failure points teams hit most often.

On this page

How CKAN single sign-on with Keycloak works and when it fits

A portal team that wants staff and partners to sign in through an identity provider it already runs should start with the extension decision, because CKAN has no built-in Keycloak connector. The supported path is a community extension: either ckanext-keycloak, listed in the CKAN ecosystem catalog, or ckanext-sso, published on PyPI as an extension for OIDC and Keycloak authentication. Both run inside CKAN and handle the redirect to Keycloak and the return of the user's identity. Keycloak sits between CKAN and any upstream provider. Keycloak supports OpenID Connect, OAuth 2.0 and SAML 2.0, and its identity brokering can accept sign-ins from upstream providers such as Google or GitHub. CKAN then trusts one issuer, and Keycloak decides which upstream account a person may use.

The two extensions differ in ways that matter before anything is installed. The latest release listed for ckanext-keycloak is v2.1, dated October 13, 2023, so confirm that it runs on the CKAN version you plan to deploy. The ckanext-sso compatibility table lists CKAN 2.10 and 2.11, so a team targeting CKAN 2.12.0, released August 26, 2026, must test that combination rather than assume it. Check which protocol each extension uses against your Keycloak client configuration, whether it maps Keycloak roles to CKAN organization membership or sysadmin status, and how it treats users who already hold local CKAN accounts. Those answers decide whether you can use an extension as published or need to pin a version or maintain a fork.

This pattern fits when your identity provider is already the system of record for staff and partner accounts, when a team can keep Keycloak patched and monitored, and when the portal can carry a community extension on its critical sign-in path. It fits less well when you need a contractual support line for the login code itself, because both extensions are community work outside CKAN core. Keycloak is open source under the Apache 2.0 license, and Red Hat's build of Keycloak offers a supported distribution, so the identity layer has support options even though the CKAN connector may not. Before cutover, plan a test realm, a staging CKAN, and a documented way for administrators to sign in with a local account if Keycloak is unavailable.

Choosing between ckanext-keycloak and ckanext-sso

Both community extensions are small projects, so start with who publishes them and how recently they changed. The ckanext-keycloak extension is listed in the CKAN ecosystem catalog, where its latest listed release is v2.1, dated October 13, 2023. The ckanext-sso extension is published on PyPI as an extension for authentication with OIDC and Keycloak. Catalog pages and package indexes show a snapshot, so they tell you little about how actively an extension is kept current.

  • Last listed release: ckanext-keycloak shows v2.1 from October 13, 2023. Ask whether the source repository holds later changes that the catalog does not display.
  • Package source: ckanext-sso installs from PyPI, so pin the exact version in your requirements file and keep the package hash in your build records.
  • Open issues: Read recent issues on both projects for security reports and for evidence that maintainers still respond.
  • Licensing and dependencies: Confirm the license and the Python packages each extension pulls in, since your security team will review both.

Before either extension goes on the build list, confirm the maintainer, repository activity and license for each one.

What to confirm before the Keycloak and CKAN build starts

These items decide which extension version, Keycloak release and network design your team can support. Each one constrains the next: the CKAN version limits the extension, the extension shapes the Keycloak client setup, and the network design determines where certificates must be trusted.

CKAN version and extension support

CKAN 2.12.0 is not confirmed by the extension listings. CKAN 2.12.0 was released on August 26, 2026, but the extension listings we reviewed do not state support for it. The ckanext-sso compatibility table lists CKAN 2.10 and 2.11, and the ckanext-keycloak listing's latest release is v2.1 from October 13, 2023. Ask the extension maintainer in writing which CKAN versions each release supports before you choose a target version.

CKAN releases

Keycloak version and upgrade path

Pin Keycloak to one tested release. The current Keycloak release is 26.8.1, published October 13, 2026. Since Keycloak 26.0, the project plans four minor releases a year, and breaking changes in a minor release are opt-in. Confirm which version your team will deploy, who owns upgrades, and whether updates are approved manually. If you use the Keycloak Operator, its documentation strongly recommends manual approval for operator updates. Re-test the CKAN login after every Keycloak upgrade.

Keycloak upgrading guide

Production database for Keycloak

Use PostgreSQL 14 to 18 in production. Keycloak supports PostgreSQL 14 through 18 as a production database, while its default dev-file database is for development only. Confirm the PostgreSQL version, and who runs backups and restores for Keycloak's realm data. Decide whether schema migrations run automatically at startup or are applied manually by your team, which the upgrading guide suggests for large deployments. Keep this database separate from CKAN's own PostgreSQL databases.

Keycloak database guide

Network paths and HTTPS certificates

Map every path that carries sign-in traffic: browsers to CKAN, browsers to Keycloak, and the CKAN server directly to Keycloak for token and discovery requests. Confirm that each hostname resolves inside your network and that the certificate chain is trusted by user browsers and the CKAN server. Check that firewalls and proxies allow the callback URL, and that the CKAN server can reach Keycloak's endpoints from its own network segment. Name the owner of certificate renewal before the build starts.

Keycloak production guide

Keycloak and upstream admin roles

Name who can create the realm, clients and identity provider links in Keycloak, and who holds matching rights at each upstream provider such as Google or GitHub. The ckanext-keycloak listing says Keycloak can broker these providers, so someone must register the client in each one and hold its secret. Agree who approves client secret rotation, who can change redirect URIs, and who receives the audit trail for administrative changes. Map these roles to the administrative roles described in the Keycloak server administration guide.

Keycloak admin guide

Staging CKAN and Keycloak realm

Ask for a staging CKAN and a staging Keycloak realm before production. Staging lets you test the extension on your chosen CKAN release, the callback URLs and the upstream provider registration without affecting live users. Use a separate realm with its own clients and test identity providers, and keep staging secrets apart from production secrets. Agree in the written scope who provisions each environment, how data is refreshed, and what must pass in staging before a production change window is booked.

How a CKAN login travels through Keycloak to an upstream provider

The login starts in the user browser, which CKAN redirects to the Keycloak realm. Keycloak then sends the browser to the upstream identity provider, such as Google or GitHub, and brokers the returned identity into its own user record. The browser carries an authorization code back to CKAN, and CKAN exchanges it server to server using the client secret kept in its configuration. Keycloak returns identity claims, and CKAN creates a local session. Check that CKAN, Keycloak and the Keycloak database all sit inside your trust boundary, and that the secret stays on the CKAN server.

Login path through Keycloak, with the trust boundary around the client network.

Configuring Keycloak and CKAN in the order that avoids lockouts

This sequence connects CKAN to Keycloak in an order that keeps a working local sysadmin login available at every stage, so a misconfigured redirect or claim mapping cannot lock out the people who need to repair it. It ends with verified sign-ins for a new user, an existing local user and a sysadmin on a staging portal before any production change.

  1. Confirm version support on staging

    Before changing anything, confirm that the extension you plan to use supports your CKAN minor version. The ckanext-sso package on PyPI lists CKAN 2.10 and 2.11, and the ckanext-keycloak listing on the CKAN ecosystem site shows its latest release as v2.1 from October 13, 2023, so check compatibility before you commit. Run this check against a staging copy built from the production CKAN version. Done when you have recorded the extension, its supported CKAN versions and the Keycloak release you will test against, and the staging login still works unchanged.

  2. Install and enable the extension

    On staging, install the chosen extension into the CKAN Python environment, following its installation instructions. Add its plugin name to the ckan.plugins setting in the CKAN configuration file, and leave the standard CKAN login in place. Keep a local sysadmin account that you have tested and know works. Restart the CKAN web processes, then check the site loads, the local sysadmin can still sign in, and the logs show no plugin load errors. Done when CKAN starts with the extension loaded and the local sysadmin login is confirmed.

  3. Create the Keycloak realm and client

    In the Keycloak admin console, create a dedicated realm for the CKAN portal so its clients and users stay separate from other applications. Inside that realm, create an OpenID Connect client with client authentication turned on, which makes it a confidential client. Register the redirect URIs that the extension's documentation specifies, using your staging hostname only. Store the client secret in your secrets manager. Done when the client appears in the realm with client authentication enabled and the redirect URIs match the staging site exactly.

  4. Add the upstream provider as a broker

    In the same realm, add the upstream identity provider, such as Google or GitHub, under the identity providers section. Enter the client credentials that the provider issues for your Keycloak redirect URI. Keycloak then brokers the upstream logins, so CKAN only needs to talk to Keycloak. Test the provider sign-in through Keycloak before CKAN is involved. Done when a test user can sign in through the upstream provider and Keycloak lists that user in the realm's user list.

  5. Set issuer, client ID and secret

    In CKAN, enter the Keycloak realm's issuer URL, the client ID and the client secret, using the exact configuration key names given in the extension's own documentation. Restart CKAN and open the login page in a private browser window, so an existing session cannot hide a problem. Done when the login page offers the Keycloak sign-in option and the sign-in redirect reaches the Keycloak login screen for the realm you created, without an error page.

  6. Map claims to CKAN users

    Decide which claims identify the CKAN account, commonly the username and email claims from the OpenID Connect standard, and which claims, if any, set organization membership. Follow the extension's documentation for the exact claim names it reads. Use the client scope evaluation view in Keycloak to inspect the token issued for a test user. Keep sysadmin rights assigned manually or through a restricted group, not from a user-editable attribute. Done when the token for a test user contains the expected claims and CKAN maps them to one account with the correct organization roles.

  7. Test new, existing and sysadmin accounts

    Test three sign-ins on staging, in this order: a new user with no CKAN account, an existing local CKAN user whose email matches a Keycloak user, and a sysadmin account. Confirm whether the extension links the existing user by email or creates a duplicate account, and what happens to that user's local password login. For each test, check that the CKAN session shows the expected account and organizations, and that the local admin login still works. Done when all three accounts land on the correct CKAN account, and the sysadmin can open the admin pages.

What to check before relying on a community extension in production

Treat a community extension on the login path as code you will own, because a fault there can lock every user out of the portal. Start with the release record. The ckanext-keycloak listing shows its latest release as v2.1 from October 13, 2023, so ask when the maintainer last merged a fix and whether anyone reviews open issues. Then check compatibility against the exact CKAN minor version you run. The ckanext-sso compatibility table lists CKAN 2.10 and 2.11, and it does not list CKAN 2.12.0, released August 26, 2026, so confirm support for your version in writing or by test. Finally, ask how the maintainer wants security reports submitted, and note how quickly and clearly they respond to a question about a past advisory, since that predicts how a later vulnerability will be handled.

Then test the behaviors that fail quietly. Logout should end the CKAN session and, where your design requires it, the Keycloak session too, so confirm what happens on a shared workstation after a user signs out. Session expiry needs the same scrutiny: when the Keycloak session or token expires, the portal should either re-authenticate cleanly or block further requests, and it should not keep serving a user who has been disabled in Keycloak. Check account linking closely when Keycloak brokers an upstream provider such as Google or GitHub, because one person can then arrive with two identities. Confirm which claim the extension uses to match an existing local account, since email alone may be unverified or reassigned, and confirm that sysadmin rights come only from a list or group that an administrator controls. Pin the extension version in your requirements.txt, and read the diff between that release and the CKAN version you run, focusing on the login and logout hooks.

Keep a break-glass sysadmin login until SSO is proven. Create a local sysadmin account before cutover, store its credential in your secrets vault with a named owner, and test that it still signs in after each configuration change. Keep local login enabled in staging and production, including the ckan.plugins setting that controls which login path loads, until you have run the logout, expiry and linking checks and recorded the results. DeployOpen can test and document these checks as part of scoping, so the findings arrive before you commit to a build. The results decide whether the extension is fit for your portal. If it fails the logout or linking checks, the next step is either a different maintained option or a patch your team owns and maintains, and that work belongs in the written scope and quote.

Mapping Keycloak identity claims to CKAN users, organizations and sysadmins

This table lists the Keycloak claims that feed CKAN user records, organization memberships and sysadmin status, along with the decision each one drives and the check to run before go-live. Read each row as a question to answer for your portal: which claim identifies the user, which one places them in an organization, and what happens when a claim is absent. Exact claim names and mapping keys depend on the chosen extension, so confirm them against that extension's documentation and your Keycloak realm configuration.

Keycloak or upstream attributeCKAN field or role it feedsDecision it drivesCheck to run
Username (preferred username or subject claim)CKAN user name, the login handle and profile URL slugWhether sign-in matches an existing CKAN account or creates a new oneConfirm which claim the extension uses, and that it stays unique and stable across logins
Email (email claim and its verified flag)CKAN user email addressAccount matching, and where notifications and password resets are sentConfirm unverified emails are not used for matching, and that a changed email updates on next sign-in
Display name (name, given name, family name)CKAN user full nameHow the user appears on datasets, organizations and activity streamsConfirm which claim fills the full name field and whether users can edit it in CKAN
Group or role claimOrganization membership and capacity (member, editor or admin)Which organizations a user joins at sign-in and with what capacityMap each Keycloak group to one organization and role, then test one user per role
Admin role or designated group claimCKAN sysadmin flag on the user recordWho holds full control of the portal, including all organizations and settingsKeep the sysadmin list short and documented, and confirm whether removing the role in Keycloak clears the flag
Missing username or email claimSign-in outcome and account linkingWhether to block sign-in or fall back to a local account, if local accounts remainSign in with a test user lacking the attribute and confirm the result matches your access policy
Missing group or role claimOrganization membership on the next sign-inWhether existing memberships are kept, changed or removed when a group is droppedRemove a test user from a Keycloak group, sign in again and confirm the CKAN membership change

Hardening the Keycloak to CKAN trust boundary

These six controls cover the path from the browser to Keycloak to CKAN, and the people who can change either side of it. Apply Keycloak's production guidance and set the Keycloak Operator's update approval to manual before go-live, if you deploy with the Operator.

HTTPS and proxy headers

CKAN usually runs behind a reverse proxy, so the callback URL it builds can carry the wrong scheme if the proxy does not forward the original protocol and host. Keycloak then refuses the login because the callback does not match the registered URI. Serve HTTPS on the browser leg, the Keycloak leg and the CKAN leg, and confirm that forwarded headers reach CKAN. Test with a fresh browser session and check that the callback URL CKAN generates uses https and the public hostname.

Confidential client secret

Register CKAN as a confidential client in Keycloak so the token exchange uses a client secret. Keep that secret outside the CKAN configuration file, where it would sit in plain text: load it from an environment variable or a secrets manager at process start. Confirm which setting the extension reads and whether it accepts that source. Rotate the secret on a schedule and after any staff change, and limit who can read the container or service environment that holds it.

Tight redirect URI lists

Keycloak redirects only to URIs on the client's allowed list, so wildcards and loose patterns widen what an attacker can capture. Register the exact CKAN callback URL for each environment, with the https scheme and the production hostname. Set the web origins list to the CKAN origin only, and remove development hosts before go-live. Review the list whenever a hostname changes, because a stale entry can outlive the system it once pointed to.

Short token and session lifetimes

Access token, refresh token and SSO session lifetimes are set in the Keycloak realm, and they decide how long a stolen token or an unattended browser stays usable. Shorten the access token lifetime and bound the idle and maximum SSO session times. Confirm how the CKAN extension handles token refresh, because a lifetime the extension cannot renew will sign users out mid-session. Record the chosen values in your change log so reviewers can check them against the policy.

Keycloak admin guide

Restricted sysadmin assignment

CKAN sysadmin is the highest privilege in the portal, so decide how it is granted before any user signs in. Map Keycloak groups or roles to CKAN roles only for named groups, and keep sysadmin out of automatic mapping so a broad group membership cannot escalate privileges. Log every grant and revocation with the approver's name, and review the sysadmin list on a fixed schedule. Confirm what the extension records by default and where those logs are kept.

Keycloak administration with MFA

Keycloak's admin console controls every client, redirect list and token setting in this design, so its administrator accounts are among the most sensitive identities in the chain. Limit the admin role to named administrators and keep the number of accounts small. Require multi-factor authentication for every admin account, including those in the master realm. Keep the admin console off the public internet where your network allows, and review admin events on a regular cycle.

Keycloak production guide

Common failures when CKAN and Keycloak disagree

This table lists seven failures that appear when CKAN and Keycloak disagree about redirects, identity claims, accounts, roles, proxies or sessions. Read each row as symptom, likely cause and fix, and check the Keycloak and CKAN logs first, since the log entry usually names the failing URI, claim or account. Most of these failures trace to settings that were never tested against the exact CKAN and extension versions in use.

FailureSymptomLikely causeFix
Redirect URI mismatchKeycloak shows an invalid redirect URI error after the user selects the identity providerThe redirect URI registered on the Keycloak client does not match the CKAN callback URL exactlyCopy the callback URL from the extension documentation and register it exactly, including scheme, host and path
CKAN version outside supportLogin fails at startup or stops working after a CKAN upgradeThe extension does not list the CKAN minor version in use; ckanext-sso lists CKAN 2.10 and 2.11Pick the extension version listed for your CKAN minor version, and confirm support with its maintainer before upgrading
Missing email or username claimKeycloak sign-in succeeds, but CKAN rejects the account or creates a user with no emailThe client scope does not send the claim the extension maps to the CKAN email or username fieldAdd email and username mappers to the Keycloak client scope, then confirm both claims in a test login
Duplicate accounts from local usernamesA user gets a second CKAN account, or a new login cannot reuse an existing usernameThe extension creates a new user when the Keycloak username matches a local CKAN account with different identifiersDecide how existing local accounts map before go-live, then link or migrate them with a tested script and backups
Sysadmin locked out after mapping changesA former sysadmin loses admin rights after a role, group or email list changeSysadmin status follows a Keycloak role or email list, and the mapping no longer includes that userReview sysadmin mappings in a test environment before production, and keep a recovery sysadmin account if the extension allows one
Callback uses wrong scheme behind proxyRedirects go to http instead of https, or the login loops back to the sign-in pageThe reverse proxy does not forward the original scheme and host, so CKAN builds the callback URL incorrectlySet forwarded protocol and host headers at the proxy, and confirm the CKAN site URL setting matches the public address
Logout ends CKAN but not KeycloakAfter logging out of CKAN, clicking sign in returns the user without a Keycloak login promptCKAN clears its own session but does not call the Keycloak end-session endpointTest the logout path, confirm whether the extension triggers Keycloak logout, and document any remaining session behavior for users

Questions buyers ask before hiring help with CKAN and Keycloak SSO

What drives the cost of CKAN and Keycloak single sign-on work?

Cost follows how much identity work surrounds the CKAN login, and five factors drive it most. Scope rises with the number of identity sources brokered through Keycloak, any custom claim mapping that turns upstream attributes into CKAN roles or organizations, the number of CKAN instances that need the same setup, whether Keycloak already runs in a supported state or has to be built, and the test scope, from a basic sign-in check to role, logout and failure testing. Ask for a written scope that lists each identity source, mapping rule, instance and test case, and marks which items are one-time setup and which recur. Confirm which infrastructure costs you carry directly, such as hosting for Keycloak and the staging CKAN, so the quote states them clearly.

How long does CKAN single sign-on with Keycloak take?

Duration depends on the same drivers as cost, plus how quickly your side makes decisions and grants access. The work usually runs through identity source review, Keycloak realm and client configuration, CKAN plugin setup, claim mapping, testing in a staging CKAN and a planned cutover to production. The sharpest timing levers are the number of identity sources, how many CKAN instances share the setup, whether Keycloak already exists, and how long your team takes to provide realm access, upstream provider changes and a confirmed sysadmin list. Changes at an upstream provider, such as registering a redirect address, depend on people outside the project, so list them as dependencies. Ask for phases, milestones and a named owner for each dependency in the written scope, and treat any duration that lacks those details as provisional.

What must we provide before CKAN Keycloak single sign-on work starts?

Before work starts, your team should provide access, a staging environment and a named list of people who will hold sysadmin rights. The core items are:

  • Realm and admin access to the Keycloak instance, or a named administrator who makes changes under agreed direction
  • Access to each upstream identity provider, so a client can be registered and its settings confirmed
  • A staging CKAN that matches the production CKAN version, extensions and configuration
  • A named list of sysadmins and the organization roles each person needs

Also agree who approves changes to production realm settings and where client secrets will be stored. Write these owners and dependencies into the scope so an access delay produces a visible decision instead of a silent slip in the cutover date.

Can our internal team set up CKAN single sign-on with Keycloak alone?

Yes, an internal team with CKAN, Python and Keycloak experience can do this alone, but the work is more than a configuration change. The team needs to install and configure the chosen extension, create and map the Keycloak client, derive roles and organizations from claims, test login, logout and session expiry, and keep the setup working through CKAN and Keycloak upgrades. Confirm early whether you have a staging CKAN and upstream provider access, since those two items often decide the schedule. Whichever way you proceed, keep a break-glass local sysadmin account for recovery, so a misconfigured login cannot lock every administrator out of the portal. A split model, where your team owns operations and a partner handles the initial build and testing, is also workable, and the written scope can assign each duty by name.

Should we use ckanext-keycloak or ckanext-sso for our CKAN version?

Choose by checking each extension's stated CKAN support against the version you run, then test the one that fits your identity design. ckanext-sso is published on PyPI as an extension for OIDC and Keycloak authentication, and its compatibility table lists CKAN 2.10 and 2.11, so a CKAN 2.12 portal needs confirmation from the maintainers before you choose it. ckanext-keycloak lets users sign in through a Keycloak server instead of local CKAN accounts and supports identity providers configured in Keycloak, such as Google or GitHub. Its CKAN ecosystem listing shows a latest release of v2.1 from October 13, 2023, so check its compatibility and maintenance activity before you rely on it. Whichever you pick, test with your actual identity sources and a realistic set of user roles.

What ongoing work follows a CKAN Keycloak single sign-on launch?

Ongoing work covers Keycloak upgrades, CKAN upgrades, extension updates and regression testing after each change. Keycloak plans four minor releases a year, and since version 26.0 it says breaking changes in minor releases are opt-in, which still calls for a review of your realm and client settings. CKAN targets about two minor releases a year and supports the latest patch of the current minor release and the previous minor release. Older patch releases lose support once a newer patch is out, and each CKAN minor release can break an extension, so the SSO extension must be checked against every target version before the portal moves. CKAN's release policy sets out these rules. Ask the provider how it tests each upgrade in staging and records the changes, and list that work as recurring in the scope.

What should we check before relying on a community CKAN SSO extension?

Check maintenance status, CKAN version support, login and logout behavior, and failure handling before you rely on a community extension. Community extensions are maintained outside CKAN core, so ask who maintains the code, when it last changed, and whether the maintainer has published a release for your CKAN version. Then test the behavior that matters to your portal:

  • Sign-in and sign-out, including session expiry and logout expectations
  • How upstream attributes map to CKAN roles, organizations and sysadmin status
  • Behavior when Keycloak or an upstream identity provider is unavailable
  • Whether a local recovery account remains usable

Review the Keycloak side as well, including a supported production database and the upgrade approach your team will follow.

How DeployOpen scopes and delivers CKAN and Keycloak SSO

DeployOpen plans CKAN single sign-on with Keycloak as a fixed-scope engagement inside your own infrastructure, with the CKAN version, the community extension and the Keycloak deployment agreed in writing before work starts. The build covers the Keycloak realm, client configuration, the CKAN extension, and the upstream identity providers you choose to connect. Ongoing support and upgrades are available as a retainer.

How we scope

  • The written scope names the CKAN version, the extension and the Keycloak release before any configuration starts.
  • Scope lists each identity provider to connect, such as Google or GitHub, and the user details it must send.
  • Scope states whether local CKAN login stays available for administrators, and who holds the sysadmin role.

How we build

  • Keycloak realm, clients and identity brokering are configured in your infrastructure and documented step by step.
  • The CKAN extension is chosen by checking its listed CKAN compatibility against the version in scope.
  • Login, logout, account creation and role mapping are tested end to end before anyone outside the project uses them.

How we hand over

  • A handover pack covers realm settings, client secret storage, extension versions and the CKAN configuration keys changed.
  • Runbooks describe Keycloak database backups, schema migration at startup, and how to recover from a failed change.
  • Your team reviews the setup walkthrough and support boundaries before the handover is signed off.

How we support

  • Ongoing support covers Keycloak and CKAN patch updates, applied after the release notes and compatibility checks are reviewed.
  • Upgrades of Keycloak and CKAN are scoped separately, because each has its own release cadence and breaking-change notes.
  • Retainers can include retesting the login flow after each change, if the written scope includes security testing.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.