XWiki and Keycloak OpenID Connect SSO

For organizations that already run Keycloak, this page explains how to sign XWiki users in through Keycloak using the open source xwiki-contrib OpenID Connect extension, including client setup, claims and logout.

On this page

How XWiki Keycloak SSO works with OpenID Connect

An organization that already runs Keycloak can let XWiki users sign in with their Keycloak accounts through the open source xwiki-contrib OpenID Connect extension, which authenticates XWiki users against an external OpenID Connect provider. The SSO applications listed for XWiki Pro cover Active Directory and Azure Active Directory only, so Keycloak is not among the commercial options and this path depends on the community extension. Keycloak is an Apache 2.0 licensed identity server that supports OpenID Connect, which is the protocol the extension uses. This section covers the Keycloak client setup, how user and group claims reach XWiki, and how logout behaves. Before building, confirm the extension's current release, the XWiki versions it supports and its configuration options in the xwiki-contrib/oidc repository.

Start by deciding how Keycloak is organized for XWiki. Plan for a dedicated confidential client for the wiki, placed in a realm that your team already administers, and limit its valid redirect URIs to the exact callback address of the XWiki instance. A mismatch stops the login flow before any user reaches a page, so test the redirect with a single account before inviting others. Next, use protocol mappers to place the attributes XWiki needs, such as username, email and display name, into the tokens or the userinfo response, and add group membership as a claim. Confirm in the extension documentation which claim name it reads for groups and whether it matches groups by name or by identifier, because that choice decides how XWiki group membership is granted and removed. Keep the client secret in your secrets manager and out of wiki page history.

Logout needs its own design because signing out of XWiki and signing out of Keycloak are separate events unless the extension ends both. Confirm whether the extension calls the Keycloak end-session endpoint and whether it supports front-channel or back-channel logout. Then test each path with two browsers: sign out of XWiki and check whether the Keycloak session still exists, and sign out of Keycloak and check whether XWiki still serves pages. Set the session lifetimes in Keycloak and the matching settings in XWiki so that a shared workstation does not keep a wiki session open after the person has left. Record each result as an acceptance test, and repeat the tests after every extension or Keycloak upgrade, since logout is the part of the flow most likely to break silently.

What XWiki Keycloak SSO needs before you start

These six items decide whether the XWiki login works on the first attempt. Settle them in this order: versions first, then databases, certificates, network paths and administrator access, because each later choice depends on the earlier one.

Keycloak release line

Choose the Keycloak release your operations team will patch and support for the life of the integration. The current release is 26.8.1, and the project plans four minor releases a year, with breaking changes in minor releases made opt-in since 26.0. Before you choose, confirm the tested Keycloak versions listed for the xwiki-contrib OIDC extension, because that list may set the constraint. Plan the upgrade cadence now so your XWiki client settings survive each minor update.

Compatibility policy

XWiki line to run

Choose one XWiki line for production and match it in every environment: the stable line, the LTS line or the intermediate LTS line. Pull the image tag from the official XWiki Docker repository, and check that the OIDC extension build you plan to install supports that exact version. Each line has its own support window, and Java and Tomcat requirements may differ between lines, so confirm those with XWiki before you commit. Record the tag in your change log, since it sets your upgrade path.

XWiki image docs

Production databases for both products

Each product needs its own database on an engine from its supported list. Keycloak supports PostgreSQL 14 to 18, MariaDB, MySQL, Microsoft SQL Server, Oracle Database and several managed variants, and its dev-file database is for development only. XWiki's official images come in MySQL, PostgreSQL and MariaDB variants. Choose engines your team already backs up and monitors, and confirm exact engine versions against each vendor's current matrix before installation. Give each product separate credentials and a backup plan you can explain.

Keycloak database guide

HTTPS on both hostnames

Serve Keycloak and XWiki over HTTPS on their own hostnames, with a certificate chain that the XWiki server and users' browsers trust. Keycloak's production mode expects a configured hostname and TLS. The Java runtime inside the XWiki container must also trust the Keycloak certificate chain when it calls the token endpoint, so an internal certificate authority must be in the truststore that container uses. Register the exact XWiki callback URL in the Keycloak client, then check certificate expiry dates in your own environment before go-live.

Keycloak production settings

Network paths between the services

XWiki must reach Keycloak's OpenID Connect discovery document and token endpoint from the server side, and users' browsers must reach Keycloak's authorization endpoint and the XWiki callback. Test the server-side path from inside the XWiki container itself, especially if it resolves Keycloak through a public name. Map each path, its port and its direction before the change window. Confirm DNS records and firewall rules for every path in your own environment, since they depend on your network design.

Keycloak administrator access

Name one or two people who can create realms, clients and protocol mappers in Keycloak. The integration needs a realm your team governs, an OpenID Connect client for XWiki, and mappers that place user and group claims into the token. Use named administrator accounts and keep the bootstrap account for emergencies. Decide before setup who owns the client secret and its rotation, since the extension stores that secret in its own configuration.

Keycloak admin guide

Where the browser, XWiki and Keycloak hand off a login

The flow starts when a user opens a wiki page that requires login. The XWiki OpenID Connect extension redirects the browser to Keycloak, where the user signs in and approves consent if the client requires it. Keycloak returns an authorization code through the browser, and XWiki exchanges that code for tokens over the back-channel, a direct server-to-server call that does not pass through the browser. XWiki then reads identity and group claims from the tokens and creates its own session. The logout branch shows that the XWiki session and the Keycloak session are separate, so confirm whether your configuration ends both.

Browser, XWiki and Keycloak messages during login and logout.

Which Keycloak claims map to XWiki users and groups

This table compares each Keycloak claim with the XWiki identity, profile field or group it feeds, and names who owns each value. The last column lists what to confirm before the first test login, starting with the supported claim names and first-login profile behavior in the extension documentation. The main takeaway is to treat Keycloak group names as stable identifiers that survive a rename, because XWiki group membership depends on them.

Keycloak sourceXWiki targetWho owns the valueWhat to confirm
Subject (sub claim)Persistent key linking the XWiki account to the Keycloak user, if the extension uses it as the login keyKeycloak generates it per user; the realm admin does not edit itWhich claim the extension reads as the login key and whether that key can change after first login
Preferred usernameXWiki login name or display identifier, only if the extension maps this claimKeycloak user administrators maintain the value; the XWiki admin sets the mappingWhether the value is unique in the realm and whether XWiki accepts its characters as a user name
EmailXWiki user email property in the profileIdentity team in Keycloak, fed from the HR or directory sourceWhether the extension writes email on first login and whether later Keycloak changes sync to XWiki
Given nameXWiki first name profile fieldKeycloak user administrators, fed from the HR or directory sourceThe claim name the extension reads and whether it overwrites names edited in XWiki
Family nameXWiki last name profile fieldKeycloak user administrators, fed from the HR or directory sourceThe same checks as given name, plus how the field appears in XWiki user profiles
Groups claim (group membership mapper)XWiki group membership, matched by Keycloak group name, so names must stay stableKeycloak admin configures the mapper; XWiki admin maps groups to XWiki groupsThe claim name, whether group paths or short names are sent, and whether removing a user from a Keycloak group removes XWiki membership

XWiki Keycloak SSO setup sequence, one check per step

This sequence takes an XWiki instance from a Keycloak realm and client to working single sign-on, and each step ends with a check that confirms it before you move on. It finishes with group-based access tested for one allowed and one denied user, plus logout behavior and a local administrator fallback.

  1. Confirm HTTPS and final hostnames

    Confirm the public hostnames for the XWiki instance and the Keycloak server before you register anything, because the redirect URIs and the issuer URL are copied into both systems. Both services should be served over HTTPS with certificates that the XWiki server and users' browsers trust. Your platform team and your network or DNS owner should agree on these names in writing. Check: from a client network, open the Keycloak realm's well-known OpenID configuration URL and the XWiki base URL, confirm both certificates are valid, and record the exact URLs in your change record.

  2. Create a dedicated realm and client

    Create a realm for XWiki users, separate from the master realm used for Keycloak administration, so that wiki access is managed and audited on its own. In that realm, create an OpenID Connect client with client authentication turned on, which makes it a confidential client, and with the standard authorization code flow enabled. Enter the exact callback URL from the extension's documentation as a valid redirect URI, built from your final XWiki hostname, and avoid wildcards. Check: the client's credentials tab shows a secret, and the realm's discovery document lists the authorization and token endpoints under the issuer URL you recorded.

  3. Add a group claim to tokens

    Add a group membership mapper to the XWiki client so that the token or user information response carries the Keycloak groups each user belongs to. Decide now whether the claim will hold full group paths or short group names, because the group mapping in XWiki must match exactly what arrives. Use the claim name and the matching extension setting named in the extension repository, and keep both aligned. Check: sign in as a test user who belongs to one group, inspect the token or user information response, and confirm the group appears under the expected claim name with the value you plan to map.

  4. Install the extension on a test instance

    On a separate test XWiki instance, install the xwiki-contrib OpenID Connect authenticator from its extension repository, choosing a version that matches the XWiki version you run. Do not test first on the production wiki, because configuration errors and extension conflicts are easier to recover from on a copy. If the test instance uses a different hostname, add its callback URL to the Keycloak client as a separate redirect URI. Check: the extension appears in the installed extensions list, the instance restarts without errors in its logs, and the OpenID Connect authenticator can be selected in the authentication configuration.

  5. Enter issuer, client ID and secret

    In the XWiki authenticator settings, enter the realm issuer URL, the client ID and the client secret, using the exact setting names the extension documents. Store the secret in the administration configuration only, never in wiki page content, and limit who can view or edit that configuration. Confirm that XWiki and Keycloak agree on the issuer URL character for character, including any trailing path segments. Check: the login page offers an OpenID Connect sign-in option, and selecting it sends the browser to the Keycloak login page for your realm with the expected client ID.

  6. Sign in as a test user

    Sign in with a Keycloak test user who has no XWiki account yet, and confirm that the extension creates the wiki user profile on first login. Check that the name and email fields on the profile match the Keycloak user's values, and that the profile is created where you expect in the XWiki user space. Then sign out and sign in again with the same user, confirming that the existing profile is reused and that no duplicate account appears in the user list. Record the profile name so the access tests in the next step use the same accounts.

  7. Configure group mapping and test access

    Set up the allow and deny group settings the extension supports, and map any Keycloak groups that should carry XWiki group membership. Then test one allowed user and one denied user, using test accounts you create in Keycloak for this purpose. Confirm that the allowed user reaches the wiki and that the denied user is refused at sign-in, and confirm that the denied user cannot reach pages through a session left open from an earlier test. Check: record the result for each account along with its group membership, and confirm the results match the access policy you agreed in writing.

  8. Configure logout and a local fallback

    Decide what signing out should do: end only the XWiki session, or also end the Keycloak session. Set the Keycloak client's logout settings to match the behavior the extension supports and your decision. Keep at least one local XWiki administrator account that does not depend on Keycloak, store its credentials in your approved secrets store, and confirm it works. Check: sign out and confirm the XWiki session ends and the Keycloak behavior matches your decision. Then, on the test instance, disable the OpenID Connect sign-in and confirm the local administrator can still log in.

Securing XWiki Keycloak SSO for production

Keycloak and XWiki trust each other through one client secret, a fixed set of redirect URIs and the group claims that decide who can do what. The cards below cover each control on that trust path, from the secret and the transport to the recovery account and the Keycloak server itself. Check them before users depend on the login.

Store the client secret safely

The OpenID Connect client secret lets XWiki exchange authorization codes with Keycloak, so anyone holding it can impersonate the client. Keep it in the secrets manager your platform team already operates and inject it into the XWiki configuration at deploy time. Keep it out of wiki pages, Git repositories and container images. Write the rotation plan before go-live: who rotates the secret, how often, how Keycloak and XWiki change together, and how you confirm logins still work afterward.

Use exact redirect URIs

Keycloak returns the browser only to the redirect URIs registered on the XWiki client, so a loose pattern can send a login response to an address you never meant to trust. Register the full callback address for each XWiki hostname and environment, with no wildcards. Keep staging and test hosts in their own Keycloak clients. Review the list whenever a hostname changes, because an old URI stays valid until someone removes it.

Serve XWiki over HTTPS only

Authorization codes, tokens and the XWiki session cookie all pass through the browser, so plain HTTP exposes the sign-in. Terminate TLS at the reverse proxy or ingress, redirect HTTP to HTTPS, and confirm that session cookies are marked Secure. Check that the public URLs configured in XWiki and Keycloak match the HTTPS addresses users actually see, because a mismatch breaks redirects. Test from a clean browser session, not from one that is already signed in.

Keycloak production guide

Keep a tested local administrator

If Keycloak is unreachable, its certificate has expired or the OpenID Connect settings are wrong, administrators can be locked out of XWiki entirely. Keep a tested local administrator account that does not depend on the OIDC authenticator. Store its credentials in your password vault and reserve it for recovery. Test that account before go-live and after every change to the authenticator, because an unused account often has an expired password or lacks the rights you need.

Treat group claims as authority

XWiki permissions should follow the group claims Keycloak places in the token, and nothing a user can edit on their own profile. Map each claim to an XWiki group on purpose, and confirm which Keycloak groups reach the token through the mapper you configure. Restrict who can change group membership in Keycloak to a small admin role, and log and review those changes. Anyone who can add themselves to a group can gain wiki access without a wiki administrator noticing.

Harden Keycloak and control updates

Set access and refresh token lifetimes to match how long a wiki session should last, and enable brute-force protection in the realm so repeated failed sign-ins are temporarily blocked. If you run Keycloak on Kubernetes, set the Operator to manual approval for updates, so each upgrade follows your release notes and test run. Keycloak's documentation requires a synchronously replicated database for its supported high availability designs.

Keycloak high availability

Failures that appear during XWiki Keycloak SSO testing

This table lists the failures teams most often meet when testing XWiki with Keycloak single sign-on, with the symptom, likely cause and first place to check. Read each row from the symptom, then match it to the cause and verify against the logs and client settings. Most failures come from URLs, certificates, clocks and claims that differ between the two servers, so check those before changing the authenticator.

FailureSymptomLikely causeWhat to check
Invalid redirect URI at KeycloakKeycloak shows an invalid redirect URI page right after the XWiki login buttonThe callback URL in the Keycloak client does not match the public XWiki address, often through scheme or host nameCompare the client's valid redirect URIs with the callback in the XWiki log and the address bar
Discovery, issuer or certificate failureXWiki cannot load the provider configuration, or the login fails at the token requestThe issuer value differs from the realm URL, or XWiki does not trust the certificate that Keycloak presentsFetch the realm configuration from the XWiki host, compare the issuer, and confirm the CA is in the Java trust store
Users sign in without expected groupsUsers log in but lack the XWiki groups or rights they should haveThe group claim is missing from the token, the client mapper is absent, or the group name format differsInspect the client's mapper settings and token preview in Keycloak, then check the claim name the authenticator reads
Duplicate XWiki accounts after a username changeA returning user gets a new XWiki account while the old one keeps the historyThe login matched on a claim that changed in Keycloak, so a second account was createdConfirm which claim the authenticator uses to match users, then list existing accounts in XWiki administration
Keycloak session survives XWiki sign-outAfter logging out of XWiki, opening it again signs the user straight back inXWiki clears its own session only, and the Keycloak single sign-on session stays active in the browserReview the logout settings in the authenticator, then test with the Keycloak session list open
Clock skew causes token rejectionTokens are rejected as not yet valid or expired even though the login was just issuedTime drift between the XWiki host and Keycloak makes valid tokens look early or expiredCompare time sync status on both hosts and match timestamps in the XWiki and Keycloak logs for one login
Login loop behind a reverse proxyThe browser bounces between XWiki and Keycloak, and the redirect uses httpThe proxy forwards the request as http or drops forwarded host headers, so XWiki builds the wrong callback addressConfirm the proxy forwards the public scheme and host, and that XWiki's configured URL uses https

What logout ends and what stays signed in

Signing out of XWiki ends the XWiki session and nothing more. The single sign-on session is held by Keycloak, in a browser cookie for the Keycloak sign-in pages and in a session record on the Keycloak server. While that session is active, anyone who opens XWiki again can be signed in without a password prompt, because the OpenID Connect redirect is answered from the existing Keycloak session. The same session covers every other application in the realm that signs users in through Keycloak, so a user who signs out of XWiki can still open a file share, a ticketing tool or a dashboard without signing in again. Before go-live, confirm whether the xwiki-contrib OpenID Connect extension sends the browser to the Keycloak end-session endpoint when a user logs out. If it does not, XWiki sign-out is local only, and your security team should record that as the accepted behavior.

Next, confirm which logout propagation options the extension version and your Keycloak version support. Front-channel logout, back-channel logout to client endpoints and post-logout redirect URIs are configured in different places, and each needs matching settings on the Keycloak client and in the extension. Do not assume support from a release name alone. Check the extension documentation and the Keycloak release notes, then test the exact pairing you plan to run. Session lifetimes decide how long one sign-on lasts. In the realm settings, the SSO session idle timeout ends a session after a period of inactivity, and the SSO session max lifetime ends it after a fixed period regardless of activity. These values apply to every client in the realm, so changing them for XWiki also changes them for the other applications. Agree the values with your security policy and check the settings against the Keycloak server administration guide.

Test the sign-out path with two browsers before you accept the design. In browser A and browser B, sign in to XWiki as the same test user through Keycloak, so each browser holds its own XWiki session. In browser A, sign out of XWiki, then check whether the XWiki page in browser B still shows the user as signed in. That result shows whether the extension propagates sign-out to other sessions. Next, open XWiki in browser A again. If it signs in without a password prompt, the Keycloak session survived the XWiki sign-out. Also open the second application in the realm from browser A and check its state. Repeat the sequence after the realm idle timeout has passed, and again after an administrator ends the test user's sessions in the Keycloak admin console. Inspect the cookies after each sign-out, record the results for each Keycloak and extension version, and repeat the sequence after any upgrade of either component.

XWiki Keycloak SSO cost, effort and who does the work

What drives the cost and duration of XWiki and Keycloak SSO work?

The main drivers are how many XWiki instances and environments need sign-in, how complex the group model is, and how mature the existing Keycloak realm is. One production wiki with a test copy and a clean realm is a small change. Several wikis across development, staging and production, each mapping Keycloak groups to XWiki rights with different rules, needs more design and more testing. Whether high availability or the Keycloak Operator is in scope adds infrastructure work on the Keycloak side. Browser testing of login, logout and permission checks adds time at the end. Ask for each environment, each group rule and each test case to be listed in the written scope, because those items set most of the effort.

What is one-time and what recurs after XWiki Keycloak SSO is set up?

The initial setup is one-time: the Keycloak client, the extension configuration, the group mapping, the test pass and the handover documentation. After go-live, cost recurs with change. Each XWiki upgrade, each change to the OpenID Connect extension and each Keycloak upgrade needs a repeat test of login, group claims and logout before production. Keycloak plans four minor releases a year, and since Keycloak 26.0 breaking changes in a minor release are opt-in, which reduces but does not remove the testing each upgrade needs. XWiki also publishes stable and LTS lines. At research time the official Docker tags were 18.8.0 for stable, 17.10.14 for LTS and 18.4.7 for the intermediate LTS, so confirm which line you will track before you agree who owns upgrades.

Can an internal team set up XWiki Keycloak SSO without an outside partner?

Yes, if the team already runs both XWiki and Keycloak and can read the extension documentation. Client registration, the redirect URI, token claims and the XWiki authenticator settings are defined steps for an engineer who knows both products. The gaps are usually group design and logout testing. Group design decides which Keycloak groups receive which XWiki rights, and a mistake gives users access they should not have, so a second reviewer who knows the wiki permission model is useful. Logout spans the identity provider, the wiki session and the browser, and teams often test only the normal sign-in path. An internal team can close both gaps by writing group and logout test cases before go-live and running them on every change.

What does XWiki SAS charge for consulting on this kind of work?

XWiki SAS lists consulting at 1200 EUR per day, and that rate applies to customers on a Business or Enterprise support plan. Use it as context for what the software vendor charges for its own consulting, not as a quote for this work. The rate does not tell you how many days a given SSO project needs, because that depends on the drivers covered above. If you already hold a Business or Enterprise support plan, ask whether consulting days are included or billed separately, and ask how any follow-up support is priced. Vendor pricing and independent implementation pricing are separate decisions, so compare written scopes, not day rates alone.

What should a written quote for XWiki Keycloak SSO include?

A useful quote states the written scope, the environments, the test cases and a retest after fixes. Ask the provider to list:

  • The XWiki instances and environments in scope, with versions and database types.
  • The Keycloak version, realm state, deployment model and whether high availability or the Keycloak Operator is included.
  • The group model, with each Keycloak group, the XWiki group or right it maps to, and any groups that must be denied.
  • The client setup, token claims, logout behavior and the browser test matrix.
  • The test cases, the defect list and a retest of fixes.
  • Handover documentation, and the upgrade support available after go-live.

Also ask who signs off on group mappings and how changes after go-live are priced. A quote is only as precise as the scope behind it, so a vague scope produces a vague number.

Does DeployOpen publish prices for XWiki Keycloak SSO work?

No. DeployOpen does not publish a price list, and a quote follows from the written scope. Most engagements are fixed-scope, with scope, deliverables and timelines agreed in writing before work starts. Ongoing support, upgrades and continuous testing are available as retainers, which suits the recurring part of this work after go-live. To request a quote, share the number of XWiki instances and environments, the Keycloak version and deployment model, the group design you need and the test expectations. DeployOpen plans, implements, integrates, hardens and documents self-hosted platforms inside your own cloud accounts, data centers or air-gapped networks, so both services remain in your infrastructure.

How DeployOpen scopes XWiki Keycloak SSO work

DeployOpen scopes XWiki and Keycloak OpenID Connect SSO as a fixed-scope piece of work, with deliverables and timelines agreed in writing before work starts. The work covers the xwiki-contrib OpenID Connect authenticator, the Keycloak client, user and group claims, and logout behavior, deployed and verified in the infrastructure you control. Ongoing support, upgrades and continuous testing are available as a retainer.

How we scope

  • The written scope names the XWiki version line, the Keycloak realm and the extension version to be used.
  • Scope lists the user and group claims XWiki reads from Keycloak and how each maps to XWiki.
  • Engagements are fixed-scope, with deliverables and timelines agreed in writing before work starts.

How we build

  • Create the Keycloak client for XWiki, set the redirect URI to the wiki's public address, and confirm scopes.
  • Install and configure the xwiki-contrib OpenID Connect extension on a test instance before any change reaches production.
  • Test login, logout and group-based access with named test accounts that match your Keycloak groups.

How we hand over

  • Handover documents the Keycloak client settings, claim mappings and XWiki authenticator configuration, so your team can audit them.
  • Logout behavior is written down, including whether XWiki sessions end when a user signs out of Keycloak.
  • The runbook covers client secret rotation and retesting login after an XWiki or extension upgrade.

How we support

  • Ongoing support, upgrades and continuous testing are available as retainers after handover.
  • Retainer scope should name which XWiki and Keycloak versions are covered and how upgrades are tested first.
  • Ask how Keycloak upgrades are tested, since Keycloak plans four minor releases a year.

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.