Add Default "Access Denied" Page for SAML Users Without Backend Role
Problem Statement
When a user logs into dotCMS via SAML SSO successfully but does not have the dotcms_back_end_user role (i.e., lacks permission to access the admin UI), they are currently redirected to a blank dotCMS backend page that continuously reloads. This creates confusion and appears broken to the end user.
Steps to Reproduce
- Set up SAML SSO in dotCMS.
- Attempt to log in via SAML with a user that exists in the SSO provider but does not have the dotcms_back_end_user role.
- User is redirected to the backend admin page.
- The page remains blank and continuously refreshes.
Acceptance Criteria
Scope & staging. This issue targets a first fix stage focused on breaking the infinite redirect loop and giving the user a clear "access denied" experience with a diagnostic log line. Some criteria below may be split into follow-up stages / separate issues depending on effort — in particular anything that requires changing dotCMS's existing shared error-page infrastructure (e.g. adding a logout/sign-out link), and the larger RelayState / role-aware-landing work. Items expected to spill into later stages are marked (later stage).
Root-cause trace and rationale are in the comment thread below: front-end SAML users default to
/dotAdmin/and lose the original request due toDEFAULT_LOGIN_PATH = "/dotAdmin/"plus cross-siteSameSitesession loss on the IdP POST-back.
Stage 1 — break the loop + surface the denial (primary scope of this issue)
- [ ] Once a valid SAML assertion has been consumed, an authorization failure (authenticated user lacks the role for the target — e.g. a front-end-only user hitting
/dotAdmin) does not trigger a new SAMLAuthnRequest; authentication is treated as terminal. - [ ] Such a request returns an appropriate HTTP status (403 for a backend/admin target) and renders an Access Denied page instead of a blank, continuously-reloading page.
- [ ] A clear, identifiable log message is written identifying the denied SAML user and the missing role, sufficient to diagnose the case from logs alone. (covers the original ask)
- [ ] A loop-termination guard ensures that if the flow would redirect to the IdP again immediately after consuming an assertion, it is detected and stopped (session marker/timestamp or bounded attempt counter), rendering the Access Denied / error page rather than looping.
- [ ] Verified: a front-end-only user (
DOTCMS_FRONT_END_USER, no backend role) authenticating against a live IdP SSO session reaches a terminal page within a bounded number of redirects — noERR_TOO_MANY_REDIRECTS, no continuous reload.
No regressions (Stage 1)
- [ ] A SAML user with the backend role still logs into
/dotAdminsuccessfully, unchanged. - [ ] A genuinely anonymous / not-yet-authenticated user requesting a SAML-protected URL is still redirected to the IdP to log in (the legitimate
REDIRECT_AFTER_LOGINflow is preserved). - [ ] Existing back-end SAML SSO login (the primary current use case) is unaffected for authorized users.
Follow-up stages — may be split into separate issues
- [ ] (later stage) The Access Denied page offers a logout / sign-out link so the user can terminate the SSO session and retry. This may require modifying dotCMS's existing shared error-page infrastructure, so it is called out as potentially separate work.
- [ ] (later stage) The originally requested URL is carried through RelayState (round-tripped via the IdP) so the post-login redirect no longer depends on the session surviving the cross-site IdP POST-back. (Preferred robust direction — see comments.)
- [ ] (later stage) Post-login landing is role-aware: backend-role users may land on
/dotAdmin; front-end-only users land on a front-end destination (the RelayState target or a configured front-end landing) and are never defaulted into/dotAdmin/.
dotCMS Version
current
Proposed Objective
Customer Support
Proposed Priority
Priority 3 - Average
External Links... Slack Conversations, Support Tickets, Figma Designs, etc.
- https://dotcms.freshdesk.com/a/tickets/31277
- https://dotcms.freshdesk.com/a/tickets/38116 (front-end SAML file access — surfaced the same loop)
- Related: #36541 (file-asset 401→403 in BinaryExporterServlet)
Assumptions & Initiation Needs
No response
Quality Assurance Notes & Workarounds
Interim workaround for front-end SSO deployments: set the IdP optional property redirect.after.login to a front-end URL, so the post-login redirect no longer defaults to /dotAdmin/.
Sub-Tasks & Estimates
No response
Root-cause trace: front-end SAML users loop into /dotAdmin/ after successful authentication
While investigating FD #38116 (front-end SAML file access), we reproduced the backend loop this issue describes and traced the exact mechanism. Sharing for the fix.
Reproduction: An anonymous user hits a SAML-protected front-end URL (e.g. /site-users/index) with a user that authenticates at the IdP (Azure AD / Entra) but has only DOTCMS_FRONT_END_USER (no backend role).
What happens:
SamlWebInterceptor.doAuthenticationcorrectly saves the origin:session[REDIRECT_AFTER_LOGIN] = /site-users/index, then redirects to the IdP.- The IdP authenticates and POSTs the assertion to the ACS (
/dotsaml/login/{id}→DotSamlResource). - ACS redirect precedence (
DotSamlResource~L270–293):RelayState(empty) →session[REDIRECT_AFTER_LOGIN]→ optionalredirect.after.loginproperty →DEFAULT_LOGIN_PATH. REDIRECT_AFTER_LOGINreads backnullat the callback, so it falls through toDEFAULT_LOGIN_PATH = "/dotAdmin/"(DotSamlConstantsL22)./dotAdminisisBackEndAdmin+ include-matched; the front-end user is not logged in to the backend, soSamlWebUtils.isNotLoggedreturnstrue→ a new AuthnRequest is issued → the IdP silently re-asserts (active SSO session) → back to/dotAdmin/→ infinite loop (ERR_TOO_MANY_REDIRECTS/ continuously-reloading blank backend page).
Why REDIRECT_AFTER_LOGIN is lost — confirmed: the JSESSIONID changes across the IdP round-trip. The ACS callback is a cross-site, top-level POST (IdP → dotCMS); with SameSite=Lax/Strict the session cookie is not sent on that POST, so dotCMS creates a new session with no REDIRECT_AFTER_LOGIN. Verified: session id before the redirect ≠ session id at the callback.
Recommended fix direction (standard SSO practice, not a bespoke approach)
- Carry the return URL in
RelayState, not the session. RelayState is the SAML-standard deep-link mechanism (honored by Azure AD/Entra, Okta, Shibboleth); it round-trips through the IdP and is immune to the cookie/session loss. The ACS already reads RelayState first (L270) — populate it on the outbound AuthnRequest with the original request URL. (OIDC equivalent: thestateparameter.) - Never answer an authorization failure with re-authentication. The loop is an auth-vs-authz conflation: once the IdP returns a valid assertion, a subsequent "not allowed here" must yield 403 / an Access Denied page (this issue's ask) — never another AuthnRequest. Add a "just authenticated" session marker/timestamp; if we would redirect to the IdP again immediately after consuming an assertion, stop and render access-denied. (This is the loop-breaker used by mod_auth_mellon's cookie test, Shibboleth, and Spring Security's
AccessDeniedHandler.) - Role-aware landing. Don't default every SAML user to
/dotAdmin/. Route by the roles present in the assertion: backend role →/dotAdmin; otherwise a front-end landing (the RelayState target, or a configured front-end URL). - Defense-in-depth loop guard. A max-attempts counter / short-lived "SSO attempt" cookie that renders an error page when exceeded — guarantees termination regardless of edge cases.
- Mechanical alternative:
SameSite=None; SecureonJSESSIONIDwould let the cookie survive the cross-site POST, but RelayState is preferred (avoids broadening cookie scope and doesn't depend on session survival at all).
Interim workaround for front-end SSO deployments: set the IdP optional property redirect.after.login to a front-end URL, so step 4 no longer defaults to /dotAdmin/.
Related: #36541 (the file-asset 401→403 fix), FD #38116.
PRs linked to this issue
🧪 QA Notes — scope & setup (PR #36590)
What changed: authenticated-but-unauthorized front-end users now get a clean 403 (not a 401 login redirect), there's a default 403 "Access Denied" page with an SSO Sign Out link, and a deterministic loop-guard stops the SAML redirect loop.
Setup needed
- A SAML-enabled host (Entra ID or Okta) — for the loop/Access-Denied scenarios.
- A front-end-only SAML user (no back-end role).
- A protected folder/page/file (remove CMS Anonymous READ; grant to a specific role only).
- Also validate the config lever: set the SAML app's
redirect.after.loginto a front-end URL.
Test scenarios
- Native front-end login (no SAML required): logged-in user without READ →
- protected page →
403 - protected file/PDF (
/contentAsset,/dotAsset) →403(not401, andREDIRECT_AFTER_LOGINis not set) - anonymous user →
401→ redirected to login (unchanged) - back-end/admin user without READ →
403(no regression)
- protected page →
- SAML site — front-end user without back-end role hits
/dotAdmin(or a protected page):- gets a 403 Access Denied page with a working Sign Out link — no infinite loop / ERR_TOO_MANY_REDIRECTS
- clicking Sign Out terminates the IdP (SLO) session so they can retry with a different account
- Custom error page: if the site has a
/cms403Pagevanity URL, it still takes precedence over the default page. - Regression: normal SAML logins (back-end admin login; front-end user to a permitted page) still succeed.
Out of scope for this PR (don't fail QA on these — tracked in #36591)
- Returning the user to the exact original page after SAML login — front-end users currently get a 403 (with Sign Out) on
/dotAdmin, they are not yet returned to their requested page. - The
show-logoutredirect must be configured with the correct port (e.g.:8443) in the SAML app / IdP — a portless logout URL is a configuration issue, not a defect in this PR.
📝 Documentation Notes (for release notes)
Not a disruptive change, but the behavior worth calling out to users:
Behavior change: 403 handling for authenticated-but-unauthorized front-end users
When a logged-in front-end user requests a resource they lack READ permission on, dotCMS now returns HTTP 403 (Forbidden) consistently — for file/binary assets as well as pages. Previously file assets returned 401 (Unauthorized) + a login redirect, which on SAML/SSO sites could cause an infinite redirect loop. Anonymous (not-logged-in) users are unchanged — they still get 401 and are redirected to log in.
What users should be aware of
- Default "Access Denied" page: a 403 now renders a proper Access Denied message with a Sign Out link. On SAML-enabled sites the link performs single-logout (SLO) against the configured IdP (Entra ID, Okta, …); otherwise it uses the standard dotCMS logout.
- Custom error pages still honored: a per-site
/cms403PageVanity URL continues to override the default page. - 401 → 403 status change implication: sites that customized only
/cms401Page(and have no/cms403Page) will now see the default 403 page for authenticated-but-unauthorized requests. To keep custom handling, add a/cms403PageVanity URL. - SAML front-end users: to send front-end SSO users to a front-end landing (instead of the
/dotAdmindefault) after login, configure the SAML app'sredirect.after.login(or anauth.relaystatetemplate) to a front-end URL. Ensure any configured logout URL includes the correct port.
Config knobs referenced
- Vanity URL
/cms403Page— per-site custom 403 page. - SAML app
redirect.after.login/auth.relaystate— post-login landing for front-end users.
Related: PR #36590 (this change); follow-up #36591 (return-to-original-page + logout redirect fix).
QA Verification — #32365: Add Default 'Access Denied' Page for SAML Users Without Backend Role
Verdict: ✅ PASS
Under test: dotcms/dotcms:trunk (PR #36590 merged 2026-07-15, commit 8e943ee0a1)
Environment: dotCMS local (fixed ports 8080/8443/8090) with full demo starter; SimpleSAMLphp 2.x IdP (Docker, port 8088); SAML app configured on demo.dotcms.com
Acceptance criteria
| # | Criterion | Result | Evidence |
|---|---|---|---|
| TC-1 | SAML user with DOTCMS_FRONT_END_USER only accessing /dotAdmin → HTTP 403 |
✅ PASS | HTTP 403 returned; full SAML flow completed; no redirect loop |
| TC-2 | 403 body does not redirect to IdP again | ✅ PASS | No meta-refresh to IdP in 403 response body |
| TC-3 | 403 body contains "Access Denied" text | ✅ PASS | "Access Denied" found in 403 response |
| TC-4 | SamlWebInterceptor loop guard: authenticated SAML user hitting /dotAdmin → 403 instead of redirect loop |
✅ PASS | Log: SAML auth redirect loop detected for URI '/dotAdmin'…Returning 403 instead of redirecting to the IdP again |
| TC-5 | SAML user with DOTCMS_BACK_END_USER role → successful login to /dotAdmin |
✅ PASS | HTTP 200 at /dotAdmin after full SAML flow |
| TC-6 | Sign Out / logout link present in 403 body | ✅ PASS | <a href="/api/v1/dotsaml/logout/48190c8c-…"> found in 403 body (SAML logout endpoint, not just a dotCMS local logout link) |
| TC-7 | Authenticated native (non-SAML) user without page READ permission → HTTP 403 (not 401) | ✅ PASS | tc78user (frontendUser=true, no Intranet role) accessing /members/index: HTTP 403; same URL anonymous: HTTP 401 |
| TC-7b | Regression: authenticated backend user without page READ → HTTP 403 (not 401, not 200) | ✅ PASS | bknoread (backendUser=true, no Intranet role) accessing /members/index: HTTP 403; anonymous: HTTP 401. SecurityUtils.sendPermissionDenied() correctly distinguishes authenticated vs. anonymous for backend users too |
| TC-8 | Authenticated native user without binary READ → HTTP 403 on /dA/ (not 401) |
✅ PASS | tc78user accessing /dA/{restricted-id}/image/test.jpg: HTTP 403; anonymous: HTTP 401 |
| TC-8b | Authenticated native user without binary READ → HTTP 403 on /contentAsset/ (not 401) |
✅ PASS | tc78user accessing /contentAsset/raw-data/{id}/image and /contentAsset/image/{id}/image: HTTP 403 for authenticated; HTTP 401 for anonymous. Both /dA/ and /contentAsset/ paths go through BinaryExporterServlet → SecurityUtils.sendPermissionDenied() |
| TC-9 | Custom 403 page via /cms403Page vanity URL resolved by custom-error-page.jsp |
✅ PASS | Log confirms JSP resolved the /cms403Page vanity URL and forwarded to configured target |
| TC-10 | redirect.after.login SAML config lever: set to /index, frontend-only user should land there after ACS |
✅ PASS | Config saved via POST /api/v1/apps/dotsaml-config/{siteId}; full SAML flow for [email protected] → ACS responded with meta-refresh URL='/index' instead of /dotAdmin; final URL resolved to https://localhost:8443/index. Config restored after test. |
| TC-11 | REDIRECT_AFTER_LOGIN session key NOT set when authenticated user receives 403 |
✅ PASS | Inspected all cookies/session attributes for tc78user after 403 on /members/index; no REDIRECT_AFTER_LOGIN key present. Correct: only anonymous users should be sent back to their original URL after login. |
Regression checks
- SAML backend user login flow: ✅ No regression —
DOTCMS_BACK_END_USERauthenticates and accesses/dotAdminnormally (TC-5) - Backend user without permissions → 403: ✅ No regression —
sendPermissionDenied()correctly returns 403 for authenticated backend users too, not just frontend users (TC-7b) - Anonymous access to public pages: ✅ No regression — anonymous users still get HTTP 200 on public demo pages
/contentAsset/and/dA/both 403 for authenticated, 401 for anonymous: ✅ Confirmed (TC-8, TC-8b)
Notes
- SLO (Sign Out IdP session termination): Sign Out link in 403 page correctly points to the SAML logout endpoint (
/api/v1/dotsaml/logout/{siteId}). When called in the test environment, the endpoint performs a local dotCMS session logout (→dotAdmin/show-logout) rather than initiating a full IdP SLO LogoutRequest. The IdP metadata in the SAML config does include theSingleLogoutServiceendpoint. This may be expected behavior when the SAML session NameID/SessionIndex is not fully committed (frontend-only user is 403'd immediately after ACS), or it may reflect a pre-existing SLO behavior unrelated to this PR's changes. Flagging for awareness — recommend verifying SLO with a production-grade IdP. - Custom 403 page (
/custom-403): vanity URL/cms403Page → /custom-403is in place, but the target page contentlet was not created during QA. The core fix (SecurityUtils.sendPermissionDenied()) is verified correct independently. - TC-7 / TC-7b used the demo starter's
/members/indexpage (restricted to Intranet + Reviewer roles, INDIVIDUAL inheritance). TC-8 / TC-8b used the same content identifier viaBinaryExporterServlet.
QA performed by Claude Code against dotcms/dotcms:trunk on 2026-07-17. Updated with additional QA-notes tests (TC-7b, TC-8b, TC-10, TC-11, SLO).
🧪 QA Verification — auth/authz split subset (PR #36590)
Verdict: PARTIAL — the IdP-independent subset PASSES; the SAML-specific scenarios are BLOCKED (no live IdP available in this QA environment).
Under test: dotcms/dotcms:trunk (built 2026-07-17), containing merged PR #36590 (8e943ee)
Environment: local dotCMS, empty starter, verified via REST (curl) + captured response bodies.
Acceptance criteria verified (auth/authz split — no SAML required)
| # | Criterion | Result | Evidence |
|---|---|---|---|
| 1 | Authenticated front-end user w/o READ → protected page | ✅ PASS | GET /qa-secret (FE session) → 403, no Location header (terminal, no login bounce) |
| 2 | Authenticated FE user w/o READ → file/binary (/contentAsset) |
✅ PASS | GET /contentAsset/raw-data/{id}/fileAsset → 403, not 401 — the core 401→403 fix |
| 3 | Anonymous → protected resource | ✅ PASS | Anonymous page & file → 302 → /dotCMS/login?referrer=… (legitimate auth flow, unchanged) |
| 4 | Back-end user w/o READ → protected resource | ✅ PASS | Back-end session → 403 on both page and file (no regression) |
| 5 | Default 403 Access Denied page + Sign Out link | ✅ PASS | Body: "dotCMS: 403 Forbidden … You do not have permissions…" + <a href="/dotCMS/logout">Sign Out</a> (provider-agnostic fallback — correct on a non-SAML host) |
| 6 | /cms403Page vanity override |
✅ PASS | With vanity /cms403Page → /my-custom-403, a 403 serves the custom page body; status still 403 |
Anti-loop mechanism (verified behaviorally)
The authenticated 403 is terminal — no Location, no re-issue toward login. This directly demonstrates the auth-vs-authz split: an authorization failure is never answered with re-authentication, which is exactly what breaks the infinite redirect. (SecurityUtils.sendPermissionDenied clears REDIRECT_AFTER_LOGIN for authenticated users.)
Regression checks
- No over-blocking: a fresh page granting READ to the user's role → user gets 200, anonymous 302. Gate is genuinely permission-based. ✅
/dotAdminlogin screen reachable → 200. ✅
⛔ Not verified — requires a live IdP (Entra ID / Okta)
- The actual SAML redirect-loop break /
ERR_TOO_MANY_REDIRECTSfor a SAML front-end user hitting/dotAdmin - The SAML SLO variant of the Sign Out link (
/api/v1/dotsaml/logout/{host}) — on a non-SAML host it correctly falls back to/dotCMS/logout redirect.after.loginfront-end landing behavior
These are the issue's namesake scenarios and can only be exercised against a real IdP. The PR ships SamlWebInterceptorLoopGuardTest for unit-level coverage of the loop-guard, but that is not black-box QA.
Net: the entire auth/authz status split the fix rests on (403 for authenticated, login-redirect for anonymous, on both pages and binaries), the default 403 page, and the /cms403Page override all work. A full PASS still needs the SAML loop scenario verified against a live IdP.
No label applied and no status change — verdict is PARTIAL pending IdP verification.
Documentation Assessment: #32365 — Add Default "Access Denied" Page for SAML Users Without Backend Role
action: update urlTitle: saml-authentication
Determination
This Epic is a defect fix (Type : Defect, labeled Doc : Needs Doc): a SAML user who authenticates successfully but lacks the back-end role would land in an infinite redirect loop against /dotAdmin/ instead of seeing a clear error. PR #36590 breaks that loop, returns an HTTP 403, and renders a default "Access Denied" page. The issue's acceptance criteria and the linked QA verification give enough concrete, user-facing detail to document accurately: the exact trigger condition, the HTTP status returned, the presence of a sign-out link on the page, and that an existing per-site /cms403Page Vanity URL override still takes precedence.
Existing coverage. The saml-authentication page already has a section, "Front-End-Only Users and the Access Denied Page," that documents the core outcome this Epic delivers: a back-end-ineligible SAML user hitting a back-end URL is shown the Access Denied page instead of being redirected into the admin panel, and where such a user lands when no destination is known. That section appears to have been written to cover this fix together with the later RelayState work in the same area.
The gap. The existing section does not mention two details that are part of this Epic's delivered behavior and were explicitly verified in QA:
- The Access Denied page includes a sign-out link so the visitor can end the identity-provider session and retry with a different account — for a SAML-protected site this points at the SAML single-logout endpoint rather than a plain dotCMS logout, which matters because simply closing the browser tab would leave the IdP session active and the visitor would see the same Access Denied page again on retry.
- A site's own custom 403 page, if one is configured via the
/cms403PageVanity URL (general mechanism already documented on Custom Homepage/Error Pages), is still used in place of the default Access Denied page — the new default only applies when no such override exists.
Both are small, accurate additions to the existing section rather than a new page. No other documented surface needs to change: the 401-vs-authenticated-403 split for page/file browsing is already consistent with the general rule stated on Error Codes: REST API (401 = not logged in, 403 = logged in but not permitted), and this fix brings BinaryExporterServlet, SpeedyAssetServlet, and page browsing in line with that rule rather than introducing new semantics worth a separate callout.
Audience and grouping. This belongs with the existing SAML documentation set, specifically the saml-authentication page's RelayState/Access-Denied subsection — not a new page, and not the newer dotAuth SSO docs, since the underlying fix lives in the classic SAML interceptor path that saml-authentication already documents in detail. The relevant personas are dotCMS administrators who configure SAML SSO and anyone troubleshooting a SAML login that unexpectedly lands a user outside the admin panel.
Below is the complete, updated content of the saml-authentication page with these two details added to the "Front-End-Only Users and the Access Denied Page" subsection (unchanged elsewhere).
Documentation Draft
SAML Authentication
urlTitle: saml-authentication modified: 2026-11-18 17:23:01.265
The SAML protocol provides a common authentication format which enables the use of single-sign-on, allowing dotCMS users to authenticate using third-party account providers such as Google and Amazon.
dotCMS provides built-in support for SAML authentication via the SAML App, available in the Apps Tool.
Please Note: Some additional documentation is provided to give examples for how to configure the SAML App with some specific services (see the subsections under this document). However, there are many different SAML Identity Providers (IdPs) and each is different. So, dotCMS does not provide documentation for how to configure all IdPs, and it is the responsibility of each user to configure the SAML app with your specific provider.
The SAML Identity Provider (IdP) {#SAMLIdP}
In SAML, the Identity Provider (IdP) is the account provider that authorizes login and authentication requests. When you enable SAML in dotCMS, dotCMS no longer directly authorizes users; instead, dotCMS queries your configured IdP, and provides or denies access to dotCMS content and objects based on the authorization information provided by the IdP.
Therefore, to enable SAML logins in dotCMS, in addition to configuring the dotCMS SAML App, you must also configure the user accounts in your Identity Provider to give those users the dotCMS Roles required for them to access the appropriate dotCMS content.
This document only describes how to configure and manage the SAML App within dotCMS. For information on how to configure your IdP, please see your Identity Provider's documentation.
SAML App Configuration {#Configuration}
You may specify a different SAML configuration for each Site in your dotCMS instance.
You may also specify a single SAML configuration for all Sites in your dotCMS instance; if no SAML configuration exists for a specific Site, but a valid configuration exists for the System Host, then the Site will use the System Host configuration.
How dotCMS SAML Is Structured {#ArchitecturalNote}
dotCMS's SAML implementation is split across two components:
- The SAML Plugin handles all direct interaction with the openSAML libraries. It is responsible for generating SP metadata XML, building and encoding authentication and logout request XML, processing and decrypting IdP assertions, and retrieving user attributes from those assertions.
- dotCMS Core handles the integration layer: intercepting login and logout URLs, exposing the REST endpoints that the IdP posts assertions to, and creating or updating dotCMS user accounts based on the configuration and the data returned in the assertion.
This separation exists to isolate the openSAML library dependencies from the core dotCMS classpath, in the same way that other optional integrations (such as Tika) are handled.
Basic Configuration Properties {#ConfigBasic}
For any SAML integration to work, all of the following properties must be set properly.
| Property | Data Type | Default Value | Description |
|---|---|---|---|
attribute.email.name |
String | mail |
The IdP attribute used to synchronize the email address of the user. |
attribute.firstname.name |
String | givenName |
The IdP attribute used to synchronize the first name of the user. |
attribute.lastname.name |
String | sn |
The IdP attribute used to synchronize the last name of the user. |
attribute.roles.name |
String | authorizations |
The IdP attribute used to synchronize Roles. |
authn.protocol.binding |
Http-Redirect orHttp-POST |
Http-Redirect |
The appropriate value to use depends on the IdP.
|
role.extra |
String | empty | Extra dotCMS Role IDs that will be assigned to all authenticated SAML users (e.g. DOTCMS_BACK_END_USER). |
verify.signature.credentials |
Boolean | true |
If set to false, the signature portion of the assertion returned from the IdP is not verified. |
Identity Provider (IdP) Synchronization Properties {#ConfigIdP}
Some SAML integrations will require the use of some of these properties to synchronize dotCMS with the IdP, or to specify how dotCMS should handle certain types of responses from the IdP (such as user accounts which do not have valid values for name or email address).
| Property | Data Type | Default Value | Description |
|---|---|---|---|
attribute.email.allownull |
Boolean | true |
If set to true, then if the IdP does not provide an email value, dotCMS will create a "dummy" email based on the NameID.If set to false, then if no email is supplied by the IdP, dotCMS will generate a 401 error. |
attribute.firstname.nullvalue |
String | null | If the first name attribute from the IdP is null, this value will be used instead. |
attribute.lastname.nullvalue |
String | null | If the last name attribute from the IdP is null, this value will be used instead. |
authn.requests.signed |
Boolean | true |
Should authorization requests be signed. See also want.assertions.signed. |
hash.userid |
Boolean | true |
When enabled (default), hashes the NameID received from the identity provider. Disabling stores the IDs without modification. |
identity.provider.destinationslo.url |
String | URL taken from the IdP metadata | This is url for the logout page on the SAML Server. If it is not any idp-metadata you can edit this property and include the SLO url. (Note, if you set this property and set the idp-metadata, the idp-metada will be get by default) |
identity.provider.destinationsso.url |
String | Retrieved from idp-metadata.xml file | URL for the login page on the IdP.
|
idp.metadata.path |
String | empty | Path to the idp-metadata.xml file (if used). This value can reference the classpath or file system (using the prefix file://). |
idp.metadata.protocol |
String | urn:oasis:names:tc:SAML:2.0:protocol |
Attribute name used to find the Idp Information on the idp-metadata.xml (the file provided from the Shibboleth server). |
include.roles.pattern |
String | empty | Comma separated value, used to validate roles against the patterns provided. Only matching roles will be considered. |
protocol.binding |
String | Please see Description | Notifies the Idp how dotCMS is expecting the response. Valid values:
|
remove.roles.prefix |
String | empty | Depending on your Identity Providers on the IdP, the roles may be returned on the assertion with a prefix, you can change this behavior by turning on remove.roles.prefix. |
role.key.substitution |
String | empty | A substitution expression applied to each role name received from the IdP before it is matched against existing dotCMS Role keys. Use this when your IdP cannot emit characters (such as spaces) that appear in your dotCMS Role keys. The expression uses the form /search/replacement/; for example, /_sepsep_/ / replaces every occurrence of _sepsep_ with a single space, so an assertion role of CMS_sepsep_Administrator is matched against the dotCMS Role key CMS Administrator. Applies only when Roles are inherited from the IdP (build.roles set to all or idp). See Mapping IdP Role Names to dotCMS Role Keys. |
verify.assertion.signature |
Boolean | true |
For signature verification purpose. |
verify.signature.profile |
Boolean | true |
For signature verification purpose. |
verify.signature.credentials |
Boolean | true |
For signature verification purpose. |
want.assertions.signed |
Boolean | true |
Should assertions be signed. See also authn.requests.signed. |
Advanced Configuration Properties {#ConfigAdvanced}
| Property | Data Type | Default Value | Description |
|---|---|---|---|
access.filter.values |
String | empty | If you want to avoid to check open saml authentication over any URL please add (comma separated) the list of urls on this property. |
additionalInfo |
String | empty | Comma-separated list of additional user attribute mappings to sync from the IdP assertion. Supports collection and JSON types using pipe-separated modifiers, e.g. prop1,prop2|collection,prop3|json|alias-for-json. |
assertion.customer.endpoint.url |
String | Please see Description | URL used by the Idp to redirect to dotCMS when the login is made.
|
assertion.resolver.handler.classname |
String | com.dotcms.saml.service.handler.HttpPostAssertionResolverHandlerImpl |
dotCMS provides a default implementation for handling the authentication callback from the IDP, it could be overridden if needed. |
auth.relaystate |
String | empty | A velocity template that produces a fixed SAML RelayState value sent with every SP-initiated login on this SAML configuration, overriding the default per-request RelayState described in Returning Users to Their Requested Page After Login. Use this when you want all SAML logins to land on one known page or carry a fixed value (for example, a company code), regardless of which page a visitor originally requested. A custom RelayStateStrategy implementation, if configured, takes the same precedence as this property. |
auth.relaystate.default |
Boolean | true |
Controls whether dotCMS sends the visitor's originally requested page (path, query string, or referrer parameter) as the default SAML RelayState when no auth.relaystate template or custom RelayStateStrategy is configured. Set to false to turn the default RelayState off and restore pre-upgrade behavior, where the login falls back to redirect.after.login or /dotAdmin/. See Returning Users to Their Requested Page After Login. |
auth.relaystate.allowed.hosts |
String | empty | Comma-separated list of exact external host names (no scheme, port, or wildcards) that a RelayState — whether from auth.relaystate, a custom RelayStateStrategy, or the IdP itself — is allowed to redirect to after login. By default, only paths on the same site (including its aliases) are followed; a RelayState pointing anywhere else falls back to the next known destination and is recorded in the security log by reason only, never by value. See Returning Users to Their Requested Page After Login. |
authn.comparisontype |
String | MINIMUM |
Comparison rule used to evaluate the specified authentication methods. Possible values are:MINIMUM:The user could be authenticated by using password or any stronger method, such as smart card for instance.BETTER:The user must be authenticated with a stronger method than password.EXACT:The user will be authenticated with a specific method assigned for it, for instance: if it is password, the user will be authenticated only by password.MAXIMUM:The user will use the strongest possible method. |
authn.context.class.ref |
String | org.opensaml.saml.saml2.core.AuthnContext.PASSWORD_AUTHN_CTX |
Authentication context, which could be Kerberos, Internet protocol, password, etc. See org.opensaml.saml.saml2.core.AuthnContext for more details. |
bindingtype |
String | Please see Description | Sets the binding type for both authentication and logout requests. Valid values are Http-Redirect, Http-POST, and Http-POST-Raw. When set, this overrides the individual authn.protocol.binding and logout.protocol.binding values. |
build.roles |
String | all |
Optional key to configure the roles strategy to sync them from IDP to DOTCMS. Please see below for valid values. |
clock.skew |
Integer | 10000 |
Time out between the dotCMS call and the IDP. |
id.provider.custom.credential.provider.classname |
String | empty | Used to set custom credentials for the ID Provider. This property expects a fully qualified class name. Please see com.dotcms.plugin.saml.v3.CredentialProvider. |
idp.metadata.parser.classname |
String | DefaultMetaDescriptorServiceImpl |
This class parses the idp-metadata and creates the sp-metadata from the runtime information. |
include.path.values |
String | ^/dotsaml3sp*$, ^/dotCMS/login.*$,^/html/portal/login.*$, ^/c/public/login.*$,^/c/portal_public/login.*$, ^/c/portal/logout.*$" |
Comma separated values with the regex paths to be considered by the SAML plugin. |
isassertion.encrypted |
Boolean | false |
When set to true, dotCMS expects the SAML assertion from the IdP to be encrypted using the Service Provider's public key. Enable this only when your IdP is configured to send encrypted assertions. |
location.cleanqueryparams |
Boolean | true |
When enabled, query parameters are stripped from the redirect location URL during the SAML flow. Disable this if your IdP or application requires query parameters to be preserved through the authentication redirect. |
logout.path.values |
String | ^/dotsaml3sp*$, ^/dotCMS/login.*$, ^/html/portal/login.*$, ^/c/public/login.*$,<BR>^/c/portal_public/login.*$,^/c/portal/logout.*$", |
Comma separated values with the regex paths to be considered by the SAML plugin. Use this property in case you need to add additional logout paths |
logout.service.endpoint.url |
String | Default endpoint will be created using the service.provider.issuer/dotsaml/logout | URL used by the Idp (the Shibboleth server) to redirect to dotCMS when the logout is made. |
message.life.time |
Integer | 2000 |
For message lifetime validation purpose. |
nameidpolicy.format |
String | By default we support TRANSIENT and PERSISTANCE formats | SAML Name ID policy. By default we support TRANSIENT and PERSISTANCE formats, however if you want to overwrite it just add the values (comma separated). See org.opensaml.saml.saml2.core.NameIDType for more details about the valid values. |
policy.allowcreate |
Boolean | false |
Allows to create users that do not exist on the IdP.We advise to not create new users on the Idp, however you can change this behavior, turning on this property. |
saml.allow.empty.attrs |
Boolean | true |
Controls behavior when the IdP returns a SAML assertion with no user attributes. When true, dotCMS will still create or authenticate the user. When false, an exception is thrown and the login is rejected. |
service.provider.custom.credential.provider.classname |
String | empty | Used to set custom credentials for the Service Provider. This property expects a fully qualified class name. Please see com.dotcms.plugin.saml.v3.CredentialProvider. |
service.provider.custom.metadata.path |
String | */dotsaml/metadata.xml * |
The service provider path. |
service.provider.issuer |
String | Site Name of the default Site | App Id for the dotCMS Service Provider. In case it is not provided, the default dotCMS site name will be set, using the https protocol. We encourage to use your url.com address, for instance: http://www.dotcms.com |
skip.request.authn.context |
Boolean | false |
When set to true, the RequestedAuthnContext element is omitted from the SAML authentication request sent to the IdP. Some IdPs do not support this element, or you may wish to omit it when you want the IdP to prompt for credentials on every login regardless of existing session state. |
use.encrypted.descriptor |
Boolean | false |
Controls whether the Key Descriptor in the SP metadata sent to the IdP is marked for encryption use. Set to true if your IdP requires an encryption key descriptor in the SP metadata. Note this is distinct from isassertion.encrypted, which controls whether the assertion received from the IdP is encrypted. |
Returning Users to Their Requested Page After Login {#DefaultRelayState}
When a signed-out visitor opens a protected page on a SAML-protected site, dotCMS sends that page — including its query string — to the identity provider as the SAML RelayState. After the visitor signs in, the IdP echoes the RelayState back to dotCMS, which redirects the visitor to it. This is what returns front-end SAML users to the page they actually asked for, instead of to /dotAdmin/ or /.
This default RelayState is used only when the SAML configuration has no auth.relaystate template and no custom RelayStateStrategy configured; a configured template or strategy keeps producing exactly the value it produced before. The value sent is the referrer parameter if one is present (for example, from a protected page's redirect to the login flow), or otherwise the original request path and query string.
Precedence Over redirect.after.login
The global redirect.after.login property (set outside the SAML App, in dotmarketing-config.properties or an environment variable) is still available as a fallback destination, but it no longer takes priority on logins that dotCMS itself starts. The order is:
- A configured
auth.relaystatetemplate orRelayStateStrategy, if set. - The default RelayState — the page the visitor requested — if
auth.relaystate.defaultis not set tofalse. redirect.after.login, used when no destination is known, such as on an IdP-initiated login (one started from the IdP's own portal rather than by a dotCMS redirect)./dotAdmin/for back-end users, or/for front-end-only users, if nothing else applies.
To restore the pre-upgrade behavior, where redirect.after.login or /dotAdmin/ is always used, set auth.relaystate.default=false on the SAML App.
Redirect Validation and External Hosts {#RedirectValidation}
Because the destination in a RelayState can come from the visitor's own request, dotCMS validates it before following it, whether it came from the default RelayState, a configured template or strategy, or the IdP's own RelayState on an IdP-initiated login. Only the following are followed:
- A relative path on the same site.
- An absolute URL whose host is the callback's own host, the site's hostname, or one of the site's aliases.
- An absolute URL whose host is explicitly listed in
auth.relaystate.allowed.hosts.
A value that fails validation — pointing to another host, using a protocol-relative or non-HTTP(S) form, or containing path traversal or encoding tricks — is not followed. dotCMS falls back to the next destination in the precedence list above, and records the rejection reason in the security log; the rejected value itself is never logged.
auth.relaystate template, custom RelayStateStrategy, or the IdP's own configured RelayState currently points to a different host than the dotCMS site itself, that redirect is no longer followed after upgrading — the visitor lands on the fallback destination instead. Before upgrading, review these for every SAML-protected site, and either add the host to auth.relaystate.allowed.hosts or point the value at a path on the same site.
Front-End-Only Users and the Access Denied Page
A user without back-end access who signs in from a back-end URL, such as /dotAdmin/, is shown the Access Denied page rather than being redirected into the admin panel. When no destination is known at all — for example, an IdP-initiated login with no RelayState — a front-end-only user lands on the site's home page (/), whether or not the SAML configuration has front-end login enabled.
dotCMS does not retry the IdP login when this happens: once a SAML assertion has been consumed and the signed-in user still lacks the access the request needs, dotCMS treats that as a terminal authorization failure (HTTP 403) rather than starting another round-trip to the IdP. This is what stops the page from reloading indefinitely when a front-end-only user, or any authenticated user without permission to the specific resource, lands on a protected back-end URL.
The default Access Denied page includes a sign-out link so the visitor can end the session and retry, for example with a different account. On a SAML-protected site, this link points at the SAML single-logout endpoint for that host rather than a plain dotCMS logout, since simply closing the browser tab would leave the IdP's own session active and the visitor would see the same Access Denied page again on the next visit.
If the site already has its own custom 403 page configured through the /cms403Page Vanity URL (see Custom Homepage/Error Pages), that page is used instead of the built-in default.
New SAML Users {#NewUsers}
The first time you login to dotCMS using SAML, dotCMS will check to see if the user account already exists as a native dotCMS account - either as a front-end user or back-end user.
- If a native user account already exists for the user, it will be used.
- The native account password will not be changed or removed.
- The native account password will be ignored when SAML is used to login, but it will still be possible for a user to login with their previous password by accessing the dotCMS back-end in native mode.
- If no account exists for the user, a new user account will be created, unless allow.user.synchronization is set to false.
dotCMS will then perform actions to synchronize the user account with the SAML identify provider.
Limiting Who Can Create an Account {#AccountCreationLimits}
With SAML authentication, all authentication is performed by the IdP, not by dotCMS. This means that, to limit which users can create an account in dotCMS, you must limit which users the IdP authenticates before passing the authenticated users to dotCMS.
For example, if you use Google as your IdP, you can configured the Google SSO to only allow certain Google users to authentiate using the configuration. When you connect the dotCMS SAML configuration to the Google SSO configuration, that ensures that only users which are accepted by the Google IdP configuration will be able to create accounts within dotCMS.
This means that it is very important that you configure your IdP to authenticate only the users you wish to be able to create accounts in dotCMS.
Note, however, that even if accounts are created for users you do not expect - because they are authorized by the IdP - those user accounts will not have any Roles in dotCMS unless one of the following is true:
- The dotCMS SAML configuration automatically assigns Roles to all valid users which give those users rights to access dotCMS content or systems. For this to happen, both of the following must be true:
- The
build.rolesproperty must be set toall, and - The
role.extraproperty must include a Role with rights to access dotCMS content or systems.
- The
- The users are assigned dotCMS Roles in the IdP configuration.
- Since this requires explicit configuration of the IdP for the user, this will only be true for users you explicitly choose to authorize.
Account Synchronization {#AccountSync}
Each time a user logs into dotCMS using SAML, dotCMS will synchronize the user account with the IdP. This includes both synchronizing Roles as defined in your configured Role synchronization strategy, and synchronizing account attributes defined in your SAML configuration, such as the user's first and last names.
Attribute Synchronization {#AttributeSync}
If your SAML configuration defines user account attributes, the values of any user account attributes in dotCMS is always overwritten by the values of those attributes from the IdP. This synchronization happens with every SAML login.
You may prevent overwriting of the user account attributes by disabling account synchronization. For more incormation, please see Disabling Account Synchronization, below.
Role Synchronization {#RoleSync}
You can specify how dotCMS Roles are assigned to SAML users. By default, all SAML logins are assigned a default Role which identifies them as SAML users, and all Roles on users who login using SAML are automatically synchronized from the IdP.
The SAML User Role {#SAMLUserRole}
By default, when a user logs into dotCMS using SAML, they will be assigned the SAML User System Role. This Role has no permissions to any dotCMS objects by default, but if you wish to provide all SAML users some default permissions, you can do so by assigning permissions to the SAML User Role.
The Role Assignment Strategy (build.roles App property) {#BuildRolesProperty}
In addition to the SAML User Role, you can also configure dotCMS to assign other Roles, including different Roles to different SAML users, in one of more of the following ways:
- Prevent Role synchronization from the SAML IdP, and manually manage Roles for the user(s) in dotCMS (in the same way they're managed for native dotCMS logins).
- Inherit Roles from the SAML IdP.
- Add a pre-defined Role from the dotCMS configuration (via the
role.extraApp property).
How Roles are applied is configured via the build.roles property in the SAML App configuration. This configuration property can accept the following values:
| Property Value | Existing User Roles | Roles from the role.extra Property (If it is set) |
Roles from the Identity Provider (IdP) |
|---|---|---|---|
all |
Removed | Added | Added |
idp |
Removed | Ignored | Added |
staticonly |
Removed | Added | Ignored |
staticadd |
Not Changed | Added | Ignored |
none |
Not Changed | Ignored | Ignored |
You must choose whether dotCMS or the IdP is the source of the dotCMS Role assignments, and then assign an appropriate Role strategy (from the above table), depending on whether you would like to use the role.extra property.
Mapping IdP Role Names to dotCMS Role Keys {#RoleKeySubstitution}
When Roles are inherited from the IdP — that is, when build.roles is set to all or idp — dotCMS matches each role name received in the assertion against the Role key of your existing dotCMS Roles:
- If a dotCMS Role already exists whose Role key matches the role name from the IdP, dotCMS assigns that existing Role to the user (if it is not already assigned). No new Role is created.
- If no dotCMS Role has a matching Role key, dotCMS creates a new Role and sets its key to the role name supplied in the assertion.
This behavior lets you map IdP roles onto existing dotCMS Roles — for example, automatically granting an existing Role such as CMS Administrator to a user the first time they log in.
Some IdPs restrict the characters allowed in role names, however, and may not permit values such as CMS Administrator that contain spaces. The role.key.substitution property lets you bridge this gap by transforming each IdP role name before it is matched against your dotCMS Role keys.
The property takes a substitution expression in the form /search/replacement/:
role.key.substitution=/_sepsep_/ /
In this example, dotCMS replaces every occurrence of _sepsep_ with a single space before matching. An IdP that emits the role CMS_sepsep_Administrator will therefore be matched against — and mapped to — the existing dotCMS Role key CMS Administrator.
If role.key.substitution is not set, role names from the IdP are matched against dotCMS Role keys unchanged.
Disabling Account Synchronization {#DisableSynchronization}
You can prevent dotCMS from performing any changes to dotCMS user accounts or Roles by setting the allow.user.synchronization SAML property to false.
allow.user.synchronization=false
When this property is disabled, the following changes are made to how dotCMS handles SAML logins:
- When a new user authenticates via SAML, dotCMS will not create a new user account.
- Users will only be able to authenticate via SAML if a user account already exists for that user in dotCMS when they attempt to login.
- User account attributes such as first name and last name will not be synchronized.
- User account attributes can only be set and changed through the dotCMS admin console.
- Only Roles explicitly added to user accounts via the dotCMS administration interface will exist on any dotCMS user accounts.
- The
SAMLUserRole will not be assigned to any users. - No Roles will be assigned to users from the IdP.
- The
build.rolesproperty will be ignored.
- The
Forcing Native Login {#ForceNative}
Once SAML is enabled, all attempts to access the dotCMS administrative console (/dotAdmin) will be automatically authenticated using SAML, rather than native dotCMS logins. The native dotCMS login screen will no longer display.
You can login using native dotCMS accounts by setting the ?native=true URL parameter:
/dotAdmin?native=true
When you use this URL, the native dotCMS login screen displays. This allows you to login to a native dotCMS account. However you can only login using the native interface with a user account for which a native password has been set; user accounts which have been created via SAML do not have native dotCMS passwords, and can not be accessed using the native login screen. This means that the native login option only exists for user accounts which:
- Existed as native dotCMS user accounts before SAML integration was enabled, or
- Have had the native password manually set (via the administration interface).
The required value for forcing the native sign-in method can be changed from true to another value you select. This can be useful as an additional layer of "security by obscurity." To alter this property, contact a dotCMS customer service representative.
Securing Forced Native Logins {#ForceNativeToken}
The variable SSO_BYPASS_TOKEN (or DOT_SSO_BYPASS_TOKEN) allows you to configure an extra layer of security over forced native logins. Assign a token value to this variable, and that token will be required to force native login, and ?native=true will no longer work.
For example, if you set:
DOT_SSO_BYPASS_TOKEN=tok_abc123xyzDoReMi...
Then to perform a native login, you would need to browse to:
/dotAdmin?native=tok_abc123xyzDoReMi...
Roles Applied to Native Logins {#NativeRoles}
When you login using the native login screen, it does change how Roles are assigned to user accounts. This means that, if SAML integration is configured to overwrite user Roles:
- Any Roles which were set during a prior SAML login will remain.
- Any Roles a user had prior to SAML integration will be removed from that user the first time the user logs in via SAML.
- Any changes you make to a user's Roles in the Users screen will not persist.
- Although you can temporarily assign user Roles via the Users screen, the next time the user logs in via SAML, any changes you have made will be overwritten based on your SAML Role assignment configuration.
REST and CI/CD Authentication {#RESTWebDAV}
REST, dotCLI, and WebDAV operations can not be authenticated using SAML. Therefore, to enable user accounts to perform these operations, the operations must be authenticated using API Tokens. To enable the use of API Tokens with a user account:
- Ensure that the user account already exists in dotCMS.
- This can be accomplished either by manually creating the user account in the dotCMS admin console, or by having the user requiring authentication login first via SAML.
- You can not assign an API Token until after the user account has been created in dotCMS.
- In the dotCMS admin console, create an API Token for the user.
Once the API token has been created, the user account can perform REST, dotCLI, or WebDAV requests by:
- REST: Submit the API Token in the header of the request.
- dotCLI: Submit the token using the
--tokenor-tkoption, especially (but not exclusively) via thelogincommand. - WebDAV: Authenticate using the dotCMS user name, with the API Token is submitted as the password.
Retrieving SAML App Metadata {#GetMetadata}
To configure dotCMS as an SSO provider with the IdP, you will need to provide the SAML metadata from dotCMS to the IdP. You can retrieve the dotCMS SAML metadata using the following REST API method:
/api/v1/dotsaml/metadata/{siteId}
The {siteId} is the identifier of the dotCMS Site for which you with to retrieve the metadata.
- If you have different SAML configurations for different Sites on the same dotCMS instance, you will need to configure each dotCMS Site as a separate SSO provider with your IdP, and the metadata for each site will be different.
- If you are using the SYSTEM HOST SAML configuration to act as a default SAML configuration for multiple dotCMS Sites in the same dotCMS instance, you should retrieve the metadata by specifying the identifier of one of the Sites that does not have its own separate SAML configuration.
Converting from Native Login to SAML {#Conversion}
The following is a guideline for how to convert your dotCMS instance from using native dotCMS logins to using SAML.
Note:
- The steps in the "IdP or External Configuration" column will need to be performed by whoever manages your IdP administration account (for example, your IT depatrment).
- The steps in the "dotCMS Configuration" column will need to be performed by a dotCMS administrator.
| Step | IdP or External Configuration | dotCMS Configuration |
|---|---|---|
| 1 | Prepare for Migration
|
|
| 2 | Copy the metadata from your SAML Identify Provider (IdP)
|
|
| 3 | Generate a public/private key pair
|
|
| 4 | Configure the user accounts on the IdP
|
|
| 5 | Configure the SAML App within dotCMS
|
|
| 6 | Retrieve the SAML metadata from dotCMS | |
| 7 | Add dotCMS to the IdP as an SSO provider
|
|
| 8 | Create API Tokens
|
|
| 9 | Test
|