CKAN SSO with SAML2 and identity providers

Adding SAML2 single sign-on to a CKAN portal with ckanext-saml2auth, mapping identity provider attributes to organizations and roles, and controlling sysadmins and local registration.

On this page

How CKAN SSO with SAML2 works and why it is harder than it looks

The ckanext-saml2auth extension adds SAML2 single sign-on to CKAN 2.10 and later, so publishers and staff can sign in through the organization's identity provider instead of a separate CKAN password. The login redirect is the easy part. The hard parts are mapping identity provider attributes to CKAN organizations and roles, deciding who may hold sysadmin rights, and keeping local CKAN accounts under control once federated login is in place. Teams usually need this when a portal is an internal staff tool, when several agencies or departments publish into one portal and must each see only their own organizations, or when audit requirements expect every publishing action to trace back to a named corporate identity.

The difficulty starts with the identity provider. Attributes such as group memberships, department codes or email domains have to be designed and named before the portal is configured, because CKAN can only assign roles from what the identity provider actually sends. Each attribute needs an owner, a documented meaning and a process for removing access when someone leaves or changes role. Ask the identity team to confirm which attributes are released to CKAN, how often group membership changes propagate, and what happens to accounts that were created locally before SSO was switched on. Also confirm how the extension handles sysadmin assignment by email list, since that list is a privileged control that should be reviewed like any other administrator access.

Two further risks are easy to miss. First, the portal must be tested against the current CKAN minor version and the previous one, because the project supports both for fixes and the extension must keep pace with each minor release. Second, ckanext-saml2auth is third-party code maintained outside the CKAN project, so it belongs in the same review as any other extension: read the code, pin the version, track its releases and confirm its SAML handling meets your security team's expectations. The ckanext-saml2auth repository is the starting point for that review. Plan for these checks before go-live, not after the first access request fails.

Components involved in CKAN SAML2 single sign-on

CKAN SAML2 single sign-on is not one setting but a chain of components that must agree on identifiers, attributes, certificates and URLs. A mismatch in any one of them usually shows up as a failed login or a user landing with the wrong role, so the team should review them together before changing anything.

CKAN core and its user model

CKAN owns the user accounts, organizations and roles that a SAML2 login ultimately maps into. Before configuring anything, decide which organizations and roles exist, who may administer them, and whether users created through SSO should be linked to existing CKAN accounts by email or by a stable identifier. Confirm which attribute uniquely identifies a user so that renamed or reissued accounts do not create duplicates. Check the CKAN version in use against the supported releases before adding an authentication extension.

CKAN release policy

The ckanext-saml2auth extension

This extension is the component that speaks SAML2 to the identity provider and translates the assertion into a CKAN login. It also carries the mapping rules that place users into organizations and roles, and the list of emails that receive sysadmin rights. Install it in the same environment as the CKAN release it supports, and read the extension's own documentation for the exact configuration keys, since names and formats can change between versions. Treat the sysadmin list as a privileged setting that needs its own review.

ckanext-saml2auth repository

The SAML2 identity provider

The identity provider authenticates users and issues the assertions CKAN relies on, including the attributes used for organization and role mapping. Its metadata file, signing certificate and attribute release policy must match what CKAN expects. Confirm with the identity team which attributes are released to this application, their exact names and formats, and how group membership is represented. Plan for certificate expiry and rotation, because an expired signing certificate stops logins without any change on the CKAN side.

Service provider entity settings

The service provider entity settings describe CKAN to the identity provider: its entity identifier, assertion consumer endpoint, signing and encryption keys, and the bindings it supports. These values must be identical on both sides, including trailing slashes and protocol. Store the private key outside the repository and restrict who can read the configuration file. Record every value in the change log so that a later certificate rotation or hostname change can be traced and tested.

Web server and public hostname

The SAML2 endpoints, redirect URLs and entity identifier all depend on the public hostname, scheme and port that users see. Nginx or the proxy in front of CKAN must pass the original host and protocol headers correctly, or CKAN will build endpoints that the identity provider rejects. Confirm the hostname before issuing metadata, since changing it later means reissuing metadata and re-testing every login path. Also confirm that the proxy does not expose the local login form on paths that should be SSO only.

Which SSO decisions to settle before configuring CKAN

This table compares the five access decisions that shape a CKAN SAML2 setup, with the operational trade-off of each option. Read each row as a choice to make with your security, identity and portal owners before any configuration starts. The main takeaway is that role and sysadmin decisions cost more to change later than the login method itself.

DecisionWhen it fitsOperational cost
Local accounts alongside SAML2 versus SAML2 onlyKeep local accounts for break-glass access, external contributors or service accounts that the identity provider cannot serveLocal passwords and accounts still need review, offboarding and audit logging; SAML2 only removes that work but depends on the identity provider being available
Map roles from IdP attributes versus manage roles in CKANAttribute mapping fits when the identity provider already holds reliable department or group data for publishersAttribute mapping needs agreed attribute names and a change process with the identity team; in-CKAN roles require manual upkeep and drift over time
Email list for sysadmins versus manual administrator processAn email list suits a small, stable admin group that the security team can review on a fixed cadenceThe list lives in configuration, so changes need a deployment; a manual process is slower but leaves a clearer approval trail that you must document
Organization membership from the IdP versus sync or admin workflowIdP-sourced membership fits publishers whose organizations map cleanly to directory groups or attributesMismatched group names create silent access errors; an admin workflow adds recurring work for portal staff but gives direct control over publisher access
Run the extension directly versus fork itRunning the upstream extension suits teams that accept its release cadence and only need configuration changesA fork gives control over SAML2 behavior but adds patching, CKAN version compatibility checks and security review for every upgrade

How to set up CKAN SAML2 single sign-on, step by step

This sequence takes a CKAN portal from version check to production SAML2 login, with each step closed by a verifiable result. Following it in order keeps the identity provider, the extension and the role mapping consistent before real users sign in.

  1. Confirm CKAN version and extension compatibility

    Check which CKAN minor version the portal runs and whether it is still receiving security and bug fixes under the CKAN release policy, since only the latest patch of the current minor version and the previous minor version are supported. Then confirm that the ckanext-saml2auth release you plan to use supports that CKAN version, because the extension is documented for CKAN 2.10 and later. Record the current patch level and the target version in the change ticket. This step is closed when the team has a written compatibility note naming the CKAN version, the extension version and the upgrade path if they differ.

  2. Agree the attribute schema with the identity provider owner

    Before touching CKAN, meet the identity provider owner and agree the SAML2 attributes CKAN will receive: the unique user identifier, email, display name, group or role claims, and the attribute that identifies sysadmins. Write down the exact attribute names and value formats, and which values map to which CKAN organizations and roles. Ask the owner to confirm whether assertions are signed, which certificate signs them and how group membership is maintained. This step is closed when a signed attribute table exists that both teams can point to, and the identity provider owner has confirmed the test users and groups they will provide.

  3. Install the extension and register it in the plugin list

    In the CKAN virtual environment used by the portal, install ckanext-saml2auth from the version chosen in the first step, then add its plugin to the plugins setting in the CKAN configuration file. Restart the application services and check the logs for import errors. Keep the change in version control so the installation can be reproduced during upgrades. This step is closed when CKAN starts cleanly on a test instance and the login page shows the SAML2 sign-in option without errors in the logs.

  4. Configure the service provider, metadata and certificates

    Set the service provider entity identifier, the assertion consumer URL and the single logout endpoint in the CKAN configuration, following the extension's documentation for each key. Generate or obtain the signing and encryption certificates the portal will use, store the private keys with restricted file permissions, and exchange service provider metadata with the identity provider owner. Confirm the entity IDs and URLs match exactly on both sides, since a single mismatch usually breaks the assertion. This step is closed when the identity provider accepts the metadata and a test authentication request reaches the identity provider's sign-in page.

  5. Map attributes to organizations and roles in test

    Configure the extension to read the agreed attributes and assign CKAN organizations and roles from them, starting with a small set of groups such as one publisher organization and one editor role. Use test users whose group membership you control. Verify that the mapping creates the user account on first login and updates organization membership on later logins. Check whether removed group memberships are revoked in CKAN as expected, and document any gap. This step is closed when a successful assertion for each test user shows the expected attributes in the log and the correct organization and role are visible in that user's CKAN profile.

  6. Set the sysadmin list and control local registration

    Define the sysadmin email list in the extension configuration, keeping it as short as the operations team can justify and recording who approves each addition. Then disable or restrict local account registration in CKAN so that new users can only arrive through the identity provider. Also review existing local accounts, including any created during testing, and decide which to keep as break-glass administrators with strong credentials stored under the owner's control. This step is closed when a non-listed test user cannot reach sysadmin functions, a local registration attempt is refused, and the list of remaining local accounts has been reviewed and signed off.

  7. Run a test login for each role

    Sign in once for every role in the attribute table: a plain user, an organization editor or admin, a sysadmin and a user with no mapped group who should be denied or limited. For each login, confirm the session, the profile details, the organization memberships and the permissions available. Also test logout, including single logout if the identity provider supports it, and session expiry behavior. Record results against the attribute table so any deviation is traceable. This step is closed when every role produces the expected outcome and the test record is approved by the identity provider owner and the portal owner.

  8. Promote the configuration to production

    Move the reviewed configuration, extension version and plugin settings into production through the same change process used for other CKAN changes, with certificates and secrets supplied through the production secret store rather than copied from test. Schedule a limited pilot with a small group of publishers, monitor authentication logs and support requests, and keep a documented rollback path to the previous login method until the pilot is accepted. This step is closed when the pilot group signs in successfully, the rollback path has been rehearsed, and the operations team has accepted ongoing ownership of certificate renewal and group mapping changes.

How a CKAN SAML2 login flows through the identity provider

The login starts in the user's browser, which reaches CKAN through Nginx and uWSGI. CKAN hands the request to ckanext-saml2auth, which redirects the user to the SAML2 identity provider. The trust boundary sits at the identity provider: CKAN only trusts the signed assertion that comes back. After validation, the extension reads the attributes, then writes user, organization and role records to the CKAN database. Check that sysadmin status comes from an explicit allow list and not from a broad attribute value.

Sequence of a CKAN SAML2 login, showing the identity provider trust boundary and where roles are written.

How SAML2 attributes map to CKAN organizations and roles

Most of the rework in a CKAN single sign-on project comes from attribute design, not from the CKAN configuration itself. The ckanext-saml2auth extension can assign users to organizations and roles based on SAML2 attributes, but it can only act on what the identity provider sends. Before any settings are written, agree with the identity provider team the exact attribute names, the value format of each one (for example, whether a department is sent as a display name, a code or a distinguished name), whether a user can carry several values, and how a user who has no value should be treated. Record these decisions in one shared mapping table, because a change to an attribute name later means changes on both sides and a fresh round of login testing. Confirm the current settings keys and mapping options against the extension's own documentation in its ckanext-saml2auth repository for the version you plan to run, since option names differ between releases.

The highest-risk mapping is one that grants sysadmin or a broad role from an attribute that was never meant for access control. A group or title attribute that is maintained for email lists, badges or directory searches can include people who should never edit every dataset on the portal. Keep sysadmin membership on a short, explicit list of named accounts that the platform owner approves, and map only narrow organization-level attributes to organization roles such as editor or member. Mapping an attribute to a role is also a question of who can remove it. If a publisher's directory group is cleared when someone leaves, the CKAN membership is removed at that user's next login, not immediately, so a departing editor may keep access until they next sign in. Ask the identity provider team how sessions are ended on offboarding and whether that gap is acceptable for your data.

Illustrative example: a department attribute with the value Environment Agency maps to the CKAN organization environment-agency, with the role of editor. A user who moves to another department gets the new mapping on their next login, and the old organization membership should be removed by the same logic, so confirm that this behavior holds in your configured version. Test each mapping with a real test account from every publishing organization, plus one user with no attribute, one user with an unexpected value and one sysadmin candidate. Check what each account can see and edit in the CKAN web interface and the API, and record the results against the mapping table. Repeat the tests after any identity provider change, because a renamed group can silently remove every publisher's access.

How SSO setup differs by deployment model

On a single CKAN web server, the service provider is usually reached at one public hostname, so the entity ID and the assertion consumer URL can be fixed to that name from the start. Certificates are installed on one machine, and the signing and encryption key pair is managed in one place. Sessions are held by the one web process and its cookie configuration, which keeps logout behavior easy to reason about.

  • Hostname: Confirm the exact public name, including any trailing path, before registering the service provider with the identity provider, since changing it later means re-registering.
  • Certificates: Keep the service provider key and certificate in a location readable only by the CKAN service account, and record their expiry dates.
  • Session behavior: Test that the session cookie settings in ckan.ini match the hostname and HTTPS scheme so logins do not loop.
  • Metadata refresh: Decide who reloads identity provider metadata and how often, and document the procedure for a key rollover.

Before go-live, confirm with the platform team which hostname the identity provider will call back to and who owns the certificate renewal calendar.

Controlling sysadmins and local registration in CKAN

Single sign-on decides who can authenticate, but it does not decide who can administer the portal or who can create accounts without the identity provider. The cards below cover the controls that sit around the SAML2 login, from the sysadmin list and local registration to API tokens, signing keys, stored attributes and the third-party extension itself.

Named sysadmin email list

Sysadmin rights should come from a short, named list of email addresses rather than from whoever happens to have a broad role in the identity provider. Confirm how the ckanext-saml2auth extension reads that list and where it is stored in your configuration. Review the list on a fixed schedule, and remove people who change roles or leave. The platform owner signs off on every change, and the security team keeps a record of who approved it.

Extension repository

Local self-registration

Decide whether CKAN's built-in registration form stays available once SAML2 login works. If it stays on, accounts can be created outside the identity provider, which bypasses your joiner and leaver process. Most SSO deployments turn local registration off and confirm that the SAML2 path is the only way a user account is created. The portal owner and the identity team should agree this in writing.

API tokens and service accounts

API tokens and service accounts authenticate without the browser login, so SSO policies such as multi-factor checks and session timeouts do not apply to them. List every token holder, the purpose of each token and its owner. Ask whether tokens can expire and whether a departing employee's tokens are revoked automatically. Harvesters and publishing scripts are the usual sources of long-lived tokens.

Signing certificate and private keys

The SAML2 signing certificate and the service provider's private key establish trust between CKAN and the identity provider. Record where the keys are stored, who can read them, and the expiry date of each certificate. Plan a rotation step that updates both the identity provider metadata and the CKAN configuration together, so a renewal does not lock out every user. Keep copies out of source control and out of shared configuration files.

Attributes CKAN stores

The SAML2 assertion can carry many attributes, but CKAN only needs the few used for organization membership, roles and the display name. Limit the mapping to those attributes and confirm which values CKAN writes to its user table. Avoid storing personal identifiers that the portal does not need. The privacy lead and the portal owner should agree the list, and the list should be reviewed when the identity provider changes.

Third-party extension review

ckanext-saml2auth is a third-party extension, so its code, dependencies and update history belong in your review before it reaches production. Check the commit history, open issues and the compatibility notes for your CKAN minor version. Pin the version you tested and record who approved the upgrade. The platform team owns this decision, and the security team should review any change that touches authentication code.

Review the repository

How to test CKAN SAML2 login and confirm it fails safely

Testing a CKAN SAML2 login is only complete when each role is shown to land in the right place and each failure is shown to stop access. Start with positive tests: for every role you plan to grant (for example, a publisher for one organization, an editor with a different organization, and a reader with no organization membership), sign in through the identity provider and confirm the resulting CKAN account has the expected organization memberships and capabilities. Check the mapping rules you configured for the ckanext-saml2auth extension against real test accounts in your identity provider, not only against the attribute names in the design document. Repeat the check after any change to attribute mappings, since a single renamed claim can silently move users into the wrong organization. Use a staging portal with the same configuration as production wherever possible, and confirm the extension's configuration keys against the version you deploy using its repository documentation.

Negative tests matter more for a security review. Confirm that a test user without the required attribute is refused and gets no account or role. Present an expired assertion and an assertion with a mismatched audience or issuer, and confirm CKAN rejects both. Remove a test user from the identity provider or from the mapped group, then confirm the user cannot log in again and that any existing session ends within the lifetime you have set. For the sysadmin test, sign in with an account that is not on the approved list and verify it has no administrative rights, then sign in with a listed account and confirm the rights are granted as designed. Also confirm that local registration is disabled if your policy requires SSO only, by attempting to create an account through the normal registration path.

Fail-safe behavior needs its own tests. Disable or block the identity provider in staging and record what users see and what the portal permits: the expected result is that no new SSO sessions start and no access is widened. Then decide whether a break-glass local administrator path exists. If it does, document who holds the credentials, where they are stored, how use is logged and alerted, and how the account is disabled afterward. Test that path in staging with the same steps an operator would follow in an incident. If no such path is planned, record that decision and the recovery process instead. Ask your identity team to confirm how long IdP outages and certificate rotations take to resolve, because that determines how long users may be locked out. Finally, store every test case, date, tester, expected result, actual result and screenshot or log excerpt as evidence for your security review, and keep the same test set for regression after each CKAN or extension upgrade.

What drives CKAN SSO effort and how to keep each down

This table lists the factors that most change the effort of a CKAN SSO build with SAML2, with the effect of each and the steps that keep it contained. Read it before requesting a quote, because each driver should appear as a line item or an explicit assumption in the written scope. Most of the schedule risk sits in identity provider coordination and attribute design, not in the extension itself.

DriverEffect on effortHow to reduce it
Number of identity providersEach IdP needs its own metadata exchange, certificate handling, test accounts and login flow checks, so effort grows with every additional provider.Confirm which IdPs are in scope for launch, and defer the rest to a later phase with a written change request.
Number of organizations and rolesEvery organization and role mapping must be defined, tested and reviewed, and the number of combinations drives test cases.Start with a short list of organizations and a small role set, then add mappings through a documented change process.
Complexity of the attribute modelMapping multi-valued claims, nested group names or inconsistent attribute formats takes analysis and custom logic beyond the default mapping.Ask the IdP team to publish a fixed attribute list with sample values before design starts.
Identity provider team availabilityMetadata exchange, certificate renewal and attribute changes stall when the IdP owner is slow to respond, which extends calendar time more than hands-on effort.Name the IdP contact, agree a response window and book metadata and test sessions before the project starts.
Number of CKAN environmentsDevelopment, test and production each need separate SAML settings, certificates and callback URLs, and each must be verified.Keep environment configuration in version-controlled files, and use the same extension settings across environments with only endpoints changed.
Multi-node deploymentSession handling, sticky routing and consistent configuration across web nodes add testing and troubleshooting work.Confirm the load balancer and session approach early, and test login and logout against every node.
Customization of the extension or templatesChanges to the login page, error pages or the extension code must be built, reviewed and kept through upgrades, which adds ongoing maintenance.Limit changes to configuration where possible, and document any custom code so it can be reviewed against each new release.
Compliance evidence requiredAssessors may ask for configuration records, access reviews, sysadmin lists and logging evidence, which adds documentation and testing steps.Ask the compliance team for the evidence list before design, and collect it as the build proceeds rather than at the end.
Retesting after CKAN minor upgradesMinor releases may include backwards-incompatible changes, so SSO login, role mapping and sysadmin behavior need regression testing after each upgrade.Keep an automated or scripted login and role test suite, and ask any support provider to include SSO checks in upgrade scope.

Questions teams ask before setting up CKAN SSO

How much effort does SAML2 single sign-on take in CKAN?

The effort depends mostly on how many identity provider attributes you need to map, how many organizations and roles sit behind them, and how many environments must be configured. The ckanext-saml2auth extension supports CKAN 2.10 and later and can assign users to organizations and roles from SAML2 attributes, so the core build is a configuration and integration task rather than new code. Expect additional work for testing against your identity provider's metadata, for agreeing the attribute contract, and for documenting the result. Ask any partner for a written breakdown that separates identity provider configuration, CKAN configuration, role mapping tests and handover.

What does the identity team need to provide for CKAN SSO?

The identity team owns the trust relationship, so it must supply or approve the SAML2 metadata exchange, the signing and encryption certificates, the attribute names and values that will drive organization and role assignment, and the logout and session behavior. Your team should also confirm which user groups are allowed to reach the portal and who approves changes to those groups. Without a named owner on the identity side, attribute mapping tends to stall during testing. Ask the identity team to review a written attribute list before CKAN configuration starts.

Can our team set up CKAN SSO without a partner?

A team with CKAN operations experience and identity provider administration skills can likely do it in-house, because the extension is open source and the configuration is well contained. The risk lies in the cross-team coordination, in testing edge cases such as users with missing attributes or multiple organization memberships, and in producing evidence for security reviews. A partner is useful when you need the work fixed in writing, tested against a defined scope and handed over with documentation. Compare the internal estimate with a written quote that lists deliverables and test cases.

Does SAML2 SSO affect CKAN upgrades?

Yes, because SSO sits in the authentication path and depends on the extension matching your CKAN version. CKAN patch releases do not break backwards compatibility, but minor releases may include backwards-incompatible changes, so an extension version that works on one minor release must be re-tested on the next. Check the extension's compatibility before each minor upgrade and include a login test in your upgrade checklist. Plan a staging run with real identity provider flows, since a broken login path is one of the first issues users will report. Confirm with your support provider how this check is covered.

Must local CKAN accounts be removed after SSO goes live?

Not always, but you should decide deliberately. Keeping local registration open lets people create accounts outside your identity provider, which weakens your access review and offboarding process. Many teams disable self-registration and keep a small number of break-glass local sysadmin accounts with strong credentials, stored under a documented process. Review existing local accounts, map them to federated identities where possible, and remove or disable the rest. Confirm the exact registration and login settings against the extension documentation for your version.

How do we control who becomes a CKAN sysadmin?

Sysadmin rights should follow a short, reviewed list rather than whatever a single attribute value grants. The ckanext-saml2auth extension can manage sysadmins by email list, which gives you a defined source of truth you can review with your access governance process. Restrict who can edit that list, log changes, and review it on a schedule that matches your policy. Test that an ordinary user with a matching group name does not gain administrative rights. Document the approval path so auditors and security reviewers can trace each sysadmin back to a business owner.

Does DeployOpen issue an audit report or certification for CKAN SSO?

No. DeployOpen plans, implements, hardens and documents self-hosted platforms, and prepares the systems, controls and evidence that a compliance assessment will examine. Independent auditors and certification bodies are the parties that issue audit reports, attestations or certifications. For SSO, that evidence may include the configuration record, role mapping rules, access review procedures, logging settings and test results. Ask your assessor which artifacts they need before the work starts so the evidence matches their requirements.

How DeployOpen scopes, builds and hands over CKAN SSO work

DeployOpen treats CKAN SSO with SAML2 as a fixed-scope piece of platform work inside your own infrastructure. We agree on the identity provider, attribute mapping and sysadmin rules in writing first, then build, test and document the integration so your security and identity teams can review it.

How we scope

  • Confirm which identity provider, SAML2 metadata and attributes the portal will receive from your directory
  • Agree in writing how attributes map to organizations, roles and sysadmin access
  • Decide whether local registration stays on, is restricted, or is switched off entirely
  • Fix deliverables, test cases and timelines in a written scope before any work starts

How we build

  • Install and configure ckanext-saml2auth on the CKAN version your portal runs, inside your environment
  • Map identity provider attributes to CKAN organizations and roles against an agreed rules table
  • Manage sysadmin membership through the agreed email list and keep break-glass access documented
  • Test login, logout, role assignment and denied-access paths with your identity provider test users

How we hand over

  • Deliver configuration files, attribute mapping tables and a runbook for the identity team
  • Document certificate and metadata renewal steps, including who signs and where keys are stored
  • Walk your platform and security staff through the test evidence and known limitations
  • Record the extension version and CKAN version pinned so future upgrades can be checked

How we support

  • Ongoing support, upgrades and continuous testing are available as a retainer after handover
  • Retesting the SSO path after each CKAN patch or minor upgrade is part of what to confirm in scope
  • Ask whether a retainer covers extension compatibility checks when CKAN changes its supported versions
  • Agree in writing who responds to identity provider certificate changes and login incidents

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.