How XWiki trusted header authentication works behind a proxy
A team using XWiki trusted header authentication lets a reverse proxy or access gateway sign users in and pass their identity to XWiki in HTTP headers. XWiki does not check the password or the login itself. It reads the headers that arrive with each request and, through the xwiki-contrib trusted authenticator and its headers adapter, creates the user on first sight, syncs the configured user properties and syncs group membership. The gateway families that can set these headers include OAuth2 Proxy, Authelia and Pomerium, and each has its own login flow, session model and header names. The design depends on one condition: XWiki must accept identity headers only when they come from the proxy. The trust boundary is therefore the main design decision, and it matters more than which gateway you choose.
The trust boundary has two parts. The first is network placement: XWiki should be reachable only through the gateway, so that no client can send a request straight to the Tomcat port with a forged X-Forwarded-User header. The second is proxy hygiene: the gateway must strip any identity headers a client sends in the original request before it sets its own, so a user cannot supply a header that the gateway then passes through. Confirm both in your environment by sending a request directly to XWiki and to the gateway with spoofed headers, then checking which user XWiki records. Also confirm which header names your gateway emits, because OAuth2 Proxy, for example, uses headers such as X-Forwarded-User and X-Forwarded-Groups, and the authenticator must be configured to match them exactly.
Plan the sync rules before the first login, not after. Decide which user properties come from the header and which stay under wiki control, how group names from the gateway map to XWiki groups, and what happens when a user loses a group in the identity provider. Also decide how sessions end. Session handling sits in the gateway, so a user can remain signed in to XWiki after access is revoked upstream unless the gateway session and XWiki session are both expired. Test a removed group, a disabled account and a logout from each side. Ask the authenticator's maintainers and your gateway vendor which versions you have tested together, since the adapter and gateway release on their own schedules.
What the team needs before configuring the authenticator
Trusted header authentication only works when several pieces are settled first: the XWiki build, the gateway in front of it, the transport and network path, and the people who own group data. Each card below is a prerequisite to confirm before any configuration starts, because a gap in one of them can let a user set their own identity.
Supported XWiki version and deployment
Confirm which XWiki versions the xwiki-contrib trusted authenticator supports, and which extension version matches them, with the xwiki-contrib repository and your own environment. Choose the stable, LTS or intermediate LTS line on purpose, since the extension must load on the exact release you run. Record the deployment type (Docker image, Helm chart or package) and the database variant, because the extension is installed and upgraded differently in each.
Authenticator repositoryGateway and its identity provider
Decide which component sets the trusted headers, such as OAuth2 Proxy, Authelia or Pomerium, and which identity provider it authenticates users against. The gateway is the only component that should decide who a user is, so its login method, MFA and session lifetime become XWiki's effective login policy. Confirm that it can emit the user, group and email values you plan to map.
OAuth2 Proxy READMEHTTPS on the public name
Serve XWiki and the gateway only over HTTPS on the public host name that users type, and make sure the gateway redirects plain HTTP to it. Session cookies, redirects and header trust all depend on the scheme and host being consistent end to end. Confirm the certificate chain, the cookie domain and the external URL that XWiki is configured to advertise.
Network rules that force traffic through the proxy
Make XWiki's Tomcat port reachable only from the reverse proxy, using host firewall rules, security groups or a private network segment. If any client can reach XWiki directly, it can send its own identity headers and bypass the gateway entirely. Test this from outside the proxy network and from inside the cluster, where pod-to-pod access is often wider than expected.
Proxy rules that strip client headers
Configure the proxy to remove any incoming copies of the identity headers before it sets its own, so that a client-supplied value is never forwarded. Check every path, including health checks, API routes and any upstream load balancer that may add or pass through headers. Keep this configuration under version control so a later change does not quietly reopen the gap.
A named owner for group mapping
Assign one person or team to own the mapping from identity provider groups to XWiki groups, including who approves additions and removals. Group membership drives read and edit rights, so stale groups become access that nobody reviews. Agree how a leaver's account is disabled in the identity provider and how that change reaches XWiki's user records.
Which gateway should set the headers
The gateway you choose decides how identity reaches XWiki, so start from three questions: which identity provider holds your users, which reverse proxy already fronts your services, and who will operate the session store. OAuth2 Proxy is a reverse proxy that signs users in with Google, Microsoft Entra ID, GitHub or a generic OIDC provider, and it can forward usernames, groups and emails as headers. It can keep sessions in encrypted cookies, which need a cookie secret and no shared state, or in Redis, including Redis Sentinel or Redis Cluster. Cookie sessions cannot be locked, so concurrent token refreshes can force a re-login, a trade-off your team should test under real browser behavior.
Authelia is a two-factor authentication and single sign-on server that works as a companion to a proxy rather than replacing it. The proxy asks Authelia whether each request is allowed, and it supports NGINX, Traefik, Caddy, Envoy, HAProxy and others, with Apache and IIS listed separately. It only works over HTTPS, it authenticates against LDAP directories or a YAML user file, and it offers one-time passwords, security keys, passkeys and Duo push as second factors. It does not support SAML, so a SAML-only identity provider points you elsewhere. Pomerium is an identity-aware proxy with an Apache-2.0 Core edition that you run yourself, and a managed control plane option under Pomerium Zero, where application traffic stays in your environment. Its directory sync and RBAC for administrators sit in the Enterprise edition.
Confirm the exact header names each gateway emits before you write any authenticator configuration, because the trusted authenticator expects specific names and a mismatch silently breaks user creation or group sync. Check the names your chosen gateway sends (for example, the X-Forwarded-User and X-Forwarded-Groups headers that OAuth2 Proxy can pass, or the X-Auth-Request headers produced by its set-xauthrequest option in NGINX auth_request mode) against the headers the XWiki authenticator is configured to read. Also confirm which token the gateway forwards and whether group values arrive as a list or a delimited string. Verify these details in a lab with a test user before you rely on them.
How a header-authenticated request reaches XWiki
The flow starts with the user's browser, which is sent to the identity provider on first login and returns to the proxy or gateway with a session. The proxy is the only component that sets identity headers, and it removes any headers a client sent on its own before adding them. The proxy then forwards the request to XWiki, where the trusted authenticator reads the headers to create or update the user and sync properties and groups. Check that XWiki accepts connections only from the proxy, so a request that bypasses the proxy cannot carry trusted headers.
Identity headers are added only at the proxy, inside a boundary XWiki trusts.
Configuring the trusted authenticator in sequence
This sequence takes XWiki from a private network to a working header-based sign-in, where the gateway owns authentication and XWiki creates, updates and groups accounts from the identity headers it receives. Each step ends with a check so the team can confirm the previous layer works before adding the next.
Deploy XWiki on a private network
The platform team installs XWiki in its own infrastructure, using the official image or the deployment method your team already supports, and places the instance on a network segment that only the gateway can reach. The XWiki port must not be exposed directly to users or to any other network. Confirm the database connection, the first administrator account and the standard login page before any proxy layer is added. The check is that an administrator can log in directly on the internal address and that no direct route from user networks to the XWiki port exists. Record the exact internal address, because the gateway's upstream configuration and the header trust rules depend on it.
Put the gateway in front with HTTPS
The security or platform team places a reverse proxy or access gateway in front of XWiki and terminates TLS there, with a certificate issued for the public hostname. Users should reach only the gateway, and the gateway should forward requests to the internal XWiki address. Forwarding headers, such as the original host and protocol, need to be set so XWiki generates correct links. Check that a request to the public hostname returns XWiki content over HTTPS and that a request sent directly to the internal address from outside the private network fails. This two-part test shows the gateway is the only path in.
Configure the gateway to authenticate and emit identity headers
The identity team configures the gateway, for example OAuth2 Proxy, Authelia or Pomerium, to authenticate users against the identity provider and to add identity headers to requests it forwards. The headers the trusted authenticator reads, such as user identifier, email and groups, must be set by the gateway only after its own authentication succeeds. Strip any identity headers that arrive from the client before the gateway adds its own. Confirm the exact header names with the extension documentation and the gateway documentation. The check is a request through the gateway, authenticated as a test user, that returns the expected header values from a debug or echo endpoint placed on the internal side.
Install and enable the trusted authenticator extension
The XWiki administrator installs the xwiki-contrib trusted authenticator extension from the source the team has approved, then enables it as the authenticator for the instance. Check the extension version against the XWiki version in use, and confirm that the extension is documented for that release line before installation. Make the change in a staging instance first so that a broken authenticator does not lock out the administrators. The check is that the extension appears in the installed extensions list and that the instance starts without errors in the logs. Keep at least one local administrator account that does not depend on the gateway, so recovery stays possible.
Set the header adapter and sync settings
The administrator selects the headers adapter in the trusted authenticator configuration, then maps the header names that carry the user identifier, the profile properties and the group memberships. The extension supports user creation, configurable user property synchronization and group membership synchronization, so decide which properties and groups XWiki should overwrite on each login and which it should leave alone. Exact configuration keys must be taken from the extension's own documentation, not from examples in this page. Record every mapping in the change record. The check is a configuration review against the gateway's header list, where each mapped header has a matching source and no mapping points to a header the gateway does not send.
Test with a new account
The tester signs in through the gateway with an identity that has never logged in to XWiki before. The expected result is that the trusted authenticator creates the XWiki user, populates the profile properties from the headers and places the account in the groups the headers declare. Open the user's profile and group memberships in the XWiki administration pages and compare them with the identity provider record. Repeat the test with a user who is outside the expected groups to confirm that access is denied or limited as designed. The check is a profile and group record that matches the source identity exactly.
Test with an existing account and a forged header
The tester signs in with an account that already exists in XWiki, after changing one of its group memberships or profile values in the identity provider. The expected result is that the extension applies the synced values at login, and that any property or group the configuration does not sync is left unchanged. Then send a request directly to the XWiki address with a forged identity header from a host outside the gateway. The request must fail or be ignored, because the only trusted path should be through the gateway. If the forged request succeeds, stop the rollout and correct the network path and header stripping before any user is moved to this setup.
Mapping proxy headers to XWiki users and groups
This table maps each identity header a gateway sends to the XWiki user name, email property, other profile properties and group membership it should populate. Rows marked as needing confirmation depend on the exact header name and format of the chosen gateway and trusted authenticator version, so check them against the release you deploy before writing the mapping.
| Gateway header | XWiki target | Rule |
|---|---|---|
| X-Forwarded-User (OAuth2 Proxy), confirm exact name | User name (login identifier) | Use the stable subject or login value only, never a display name. Reject requests where it is empty. Confirm the header name for your gateway. |
| X-Auth-Request-User (nginx auth_request mode), confirm exact name | User name (login identifier) | Same rule as the forwarded user header. Confirm which of the two families your gateway sends when set-xauthrequest is enabled. |
| X-Forwarded-Email or X-Auth-Request-Email, confirm exact name | Email property of the XWiki user profile | Sync on each login so changes at the identity provider reach the profile. Leave the value unchanged if the header is absent rather than blanking it. |
| Other claim headers such as name or department, confirm which claims are forwarded | Other profile properties (first name, last name, custom fields) | Map only the properties your policy requires. Confirm the header format and whether multi-valued claims need splitting before they reach the property sync setting. |
| X-Forwarded-Groups or X-Auth-Request-Groups, confirm exact name and separator | Group membership in XWiki groups | Sync group membership on each request, adding and removing memberships. Confirm the delimiter, the group name format and whether groups are sent as full identifiers or short names. |
| Access token or ID token passthrough, confirm whether forwarded | Not mapped to profile data | Do not pass tokens to XWiki unless a documented need exists. Treat them as credentials and confirm how the authenticator handles them, if at all. |
Keeping identity headers from being forged
Trusted header authentication is only as strong as the path that delivers the headers. The controls below work as a set: each closes a different way an attacker could present a user identity that the gateway never verified, and none of them replaces the others.
Strip identity headers at the edge
Any client can send a header named like the identity header, such as X-Forwarded-User or the header name your gateway uses. The edge proxy must delete every identity and group header from inbound requests before its own authentication step sets the verified values. Test this directly by sending forged headers from outside the gateway and confirming XWiki still shows an anonymous or correctly authenticated session.
Restrict XWiki to the proxy network
If XWiki's Tomcat port is reachable from anywhere except the gateway, a client can connect straight to it and send any header it likes. Bind or firewall the XWiki container so only the gateway's network segment or address can reach it, and confirm that a direct request with identity headers is rejected. This is the control most often missed in container and Kubernetes deployments, where internal service addresses are reachable from other workloads.
Limit which proxy addresses are trusted
Ask the trusted authenticator's configuration whether it can restrict the proxy addresses it accepts headers from. If it can, list only the gateway's addresses. If the version you deploy cannot, the network restriction above becomes the only trust boundary, so record that as an accepted limitation. Confirm the exact setting against the extension documentation for your release.
Trusted authenticator repositoryKeep the gateway and XWiki patched
The gateway and XWiki both sit on the authentication path, so a vulnerability in either can undermine the header trust model. Track releases for the gateway and for the XWiki line you run, apply security updates on a defined schedule, and retest the forged-header checks after each upgrade. Confirm the currently supported XWiki release line with the XWiki security and upgrade pages before you set the schedule.
Log authentication at both layers
Record login decisions at the gateway, including the identity it asserted and any rejected requests, and record user creation and group changes in XWiki. Correlate the two by user name and time so an unexpected account or group change can be traced back to the gateway decision that caused it. Confirm that logs leave the containers and are retained for the period your policy requires.
Review gateway and wiki settings together
Gateway session lifetime, cookie flags and group claims shape what XWiki trusts, and XWiki's own group mapping decides what those claims grant. Review both configurations in one session with the same owner. Limit group claims to groups the wiki actually uses, so unrelated directory groups do not become wiki permissions and unused groups do not expand the attack surface.
What user creation and sync do on each login
On the first login, the trusted authenticator reads the identity headers from the proxy, creates the XWiki user if none exists, writes the configured user properties, and applies group membership. On every later login it repeats the property and group sync, so a change made at the identity provider reaches XWiki the next time the user signs in. Group removals only take effect if sync is allowed to remove memberships, and that is the first decision to confirm. Check the authenticator's configuration for how it treats groups that are absent from the incoming headers, and do not assume it adds and removes symmetrically until you have tested it. Confirm the exact property and group options against the authenticator's documentation in the xwiki-contrib trusted authenticator repository for the version you deploy.
Three decisions need an explicit answer before rollout. The first is the user name format: decide whether the wiki name is the proxy username, an email prefix or a stable identifier, because changing it later creates a second account for the same person and orphans their edits. The second is existing local accounts that share a name with an incoming header user. Decide whether sync may take them over or must stop and report the conflict, and audit for these accounts before enabling the authenticator. The third is admin protection: sync should never strip the XWiki admin group or the rights of a break-glass administrator, even if the identity provider no longer lists them. Keep at least one local administrator outside header sync and verify that it still signs in.
Test each case with a non-production account before any production user logs in. Create a test user, add it to a group, remove it from that group at the identity provider, and confirm the membership change in XWiki on the next login. Repeat with a renamed user, a user whose name matches an existing local account, and an account that holds admin rights. Record what each login produced, including the user object and group objects, and keep those results with your change record. If any result differs from what your design says, fix the configuration before rollout rather than relying on the proxy to correct it later.
Common failures in header authentication and how to fix them
This table pairs each common failure in XWiki trusted header authentication with its likely cause and a fix the team can verify. Read it while testing the gateway and XWiki together, starting from the symptom users report. Most failures trace back to the header contract between the proxy and the authenticator, so check that contract first.
| Symptom | Likely cause | Fix and check to run |
|---|---|---|
| User is signed in at the gateway but sees a guest session in XWiki | The authenticator does not receive the identity header on that request path, or the configured header name does not match what the gateway sends | Compare the configured user header name with the one the gateway sets. Request a protected page through the gateway and confirm the header reaches XWiki, for example by logging received headers on a test route. |
| Group membership is missing or empty after login | The groups header is not forwarded, the group separator does not match, or group sync is not enabled in the authenticator configuration | Confirm the gateway sends the groups header with the expected delimiter. Log in as a test user with known groups, then check the XWiki user profile and group membership pages. |
| Duplicate accounts appear with names differing only in case | The gateway passes the identity in a different case than existing XWiki accounts, and the authenticator creates a new user instead of matching the old one | Decide one canonical case for user names at the gateway, normalize the header before it reaches XWiki, and search the user directory for near-duplicate names before go-live. |
| Login loops between the gateway and XWiki | The gateway session is not established before XWiki is reached, cookie domain or path settings differ between the two, or XWiki redirects to a login URL the gateway intercepts again | Check cookie domain, path and secure flags at both ends. Trace one login in the browser network log and confirm each redirect target is reachable and returns an authenticated response. |
| Headers are visible in the browser but missing in XWiki | The proxy strips or renames headers, the internal hop drops them, or a second proxy in the chain overwrites them | Inspect headers at each hop in order. Confirm the final proxy passes identity headers to XWiki and that no intermediate layer removes them. |
| A sync removes or changes an administrator account | The synced group or property values do not include the admin group, a claim is empty for a privileged user, or the sync overwrites rights on every login | Keep an admin account that is excluded from sync, review the property and group mapping rules, and test with a non-production admin identity before enabling sync for all users. |
| Any user can set identity headers directly and sign in as someone else | XWiki is reachable without going through the gateway, so client-supplied headers are trusted | Restrict network access so only the gateway can reach XWiki, and have the gateway strip any identity headers from incoming client requests. Test by sending forged headers directly to XWiki and confirming they are rejected. |
Questions teams ask before configuring header authentication
How much effort does trusted header authentication take to set up?
The effort depends on how many identity sources feed the proxy, how groups are modeled, whether a gateway already exists, and how much HTTPS and network work is needed before headers can be trusted. A single identity source with an existing gateway and clean group data is a much smaller job than several directories with inconsistent group names. No duration is given here because a figure should come from a scoped plan that lists each of these drivers against your environment. Ask for the plan to break the work into proxy configuration, XWiki authenticator setup, property and group sync, and verification.
Can our team configure trusted header authentication in-house?
A team with experience running a reverse proxy, XWiki administration and the identity source can usually do the work without a partner. The hard parts are less about XWiki itself and more about proving that the proxy strips any incoming copies of identity headers, that only the proxy can reach XWiki, and that group sync maps correctly for every user. If none of those skills sit in one team, a fixed-scope engagement can cover the gap. Either way, decide the group model and the owner before anyone edits configuration.
What do we need to provide before the work starts?
Plan to provide four things before the work starts:
- Read access or a service account for the identity provider or directory, so user attributes and groups can be inspected.
- A test environment that matches production HTTPS, hostnames and network paths.
- A written group model that states which groups grant wiki rights and which properties are synced.
- A named owner who can approve header names, group mappings and changes to proxy rules.
Without the group model and owner, the work tends to stall at the point where access decisions are made.
Do we need an XWiki SAS support plan to use the trusted authenticator?
No. The trusted authenticator is an xwiki-contrib extension, and the setup can be planned and built without a support subscription from XWiki SAS. A support plan matters when you want a vendor to answer questions about the extension in production, help with upgrades, or resolve issues on a schedule you rely on. Check the terms of any support plan against the XWiki version and extension versions you run. Ask your implementation partner whether they will support the extension after go-live and under what terms.
How do we choose a gateway that sends trusted headers to XWiki?
Choose a gateway by the systems it must front, the identity provider it must talk to, and how your team wants to run it. OAuth2 Proxy supports generic OpenID Connect and dedicated providers and can forward user, group and email headers. Authelia works as a companion to reverse proxies such as NGINX and Traefik and authenticates against LDAP or a YAML user file, but it requires HTTPS. Pomerium is an identity-aware proxy with Apache-2.0 Core licensing and a commercial edition with a managed control plane. Confirm each candidate's header names, session storage and group handling in its documentation against your identity source before deciding.
What security controls stop users from forging identity headers?
The gateway must remove any identity headers sent by the client before it sets its own, and XWiki must accept those headers only from the gateway. In practice that means the XWiki container or pod is not reachable except through the proxy, the proxy overwrites or strips the header names used by the authenticator, and internal network policies block direct access. Test this with a request that carries a forged header from outside the proxy and from inside the network. Record the result as part of your verification evidence.
What changes if the proxy or identity provider fails?
If the gateway or identity provider is unavailable, users cannot sign in through headers, and existing sessions depend on the gateway's session storage. OAuth2 Proxy with cookie sessions holds no state on the server, but its sessions cannot be locked, so concurrent token refreshes can force a new login. Redis-backed sessions change that trade-off. Plan an outage runbook, decide whether a local administrator account remains available, and test a failover path before go-live.
How DeployOpen scopes and delivers header authentication
DeployOpen plans and implements XWiki trusted header authentication behind a reverse proxy inside your own infrastructure, starting from a written scope. The work covers the proxy controls that stop header forgery, the trusted authenticator configuration, and the user, property and group sync your teams need, with testing and documentation delivered for your security and operations staff to review.
How we scope
- Confirm which reverse proxy or access gateway will set the identity headers and where it runs
- Map each header to an XWiki user property and group, and agree which users may be created on first login
- Record the proxy controls that prevent clients from sending spoofed headers, and who owns each one
- Agree the scope, deliverables and timeline in writing before build work starts
How we build
- Deploy XWiki and the trusted authenticator in your environment with the database and Tomcat setup you approve
- Configure the headers authenticator, user creation and property and group sync against your identity source
- Lock down the proxy so only the gateway can reach XWiki and identity headers are stripped from inbound requests
- Test forged header requests, logout behavior and group changes before sign-off
How we hand over
- Deliver configuration files, proxy rules and a record of each control tested, with the reasons for each choice
- Document how to add users, change group mappings and rotate proxy or session secrets
- Walk your administrators through the runbook so they can change mappings without rebuilding the setup
- Provide a retest summary so your team can compare results after later changes
How we support
- Ongoing support, upgrades and continuous testing are available as retainers after handover
- Retainers can cover XWiki and authenticator upgrades, proxy changes and repeat header forgery testing
- Confirm the supported extension and XWiki versions with the project before planning an upgrade
- Ask for the support scope, response expectations and change process in writing as part of the quote

