You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: astro/src/content/docs/identityserver/saml/concepts.md
+30-6Lines changed: 30 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "SAML 2.0 Concepts"
3
3
description: Core SAML 2.0 concepts you need to understand when integrating with IdentityServer's SAML 2.0 Identity Provider feature.
4
-
date: 2026-03-23
4
+
date: 2026-05-15
5
5
sidebar:
6
6
label: Concepts
7
7
order: 5
@@ -58,7 +58,9 @@ sequenceDiagram
58
58
SP->>User: Grant access (session created)
59
59
```
60
60
61
-
In IdentityServer, you register each SP using a `SamlServiceProvider` configuration object. This tells IdentityServer the SP's entity identifier, where to deliver assertions (the Assertion Consumer Service URL), and how to communicate. See the [Service Provider Store](/identityserver/saml/service-providers.md) and the [SamlServiceProvider model](/identityserver/saml/configuration.md#samlserviceprovider-model) for details.
61
+
In IdentityServer, you register each SP using a `SamlServiceProvider` configuration object. This tells IdentityServer the SP's entity identifier, where to deliver assertions (the Assertion Consumer Service URL) and how to communicate. See the [Service Provider Store](/identityserver/saml/service-providers.md) and the [SamlServiceProvider model](/identityserver/saml/configuration.md#samlserviceprovider-model) for details.
62
+
63
+
Duende IdentityServer can also act as a SAML Service Provider itself, consuming assertions from an external SAML IdP. See [Identity Provider and Service Provider](/identityserver/saml/idp-and-sp.md) for an overview of both roles.
62
64
63
65
## Metadata
64
66
@@ -127,9 +129,15 @@ The most common use of RelayState is deep linking: the SP encodes the URL the us
127
129
128
130
IdentityServerpreservesRelayStateautomaticallythroughtheauthenticationflow. Themaximumpermittedlengthiscontrolledby `SamlOptions.MaxRelayStateLength` (default: `80` bytes). See [SamlOptions](/identityserver/saml/configuration.md#samloptions).
WhenauserauthenticatesviaSAML, theyestablishasessionattheIdPandaseparatelocalsessionateachSPtheyvisit. Loggingoutofoneapplicationendsonlythatapplication's local session. Without SLO, the user still has active sessions at every other SP they visited, and anyone with access to the browser can continue using those applications. SLO solves this by letting a single logout action propagate to all SPs in the federation.
131
137
132
-
SAMLSingleLogout (SLO) isaprotocolforcoordinatingsessionterminationacrossanentirefederation. WhenauserlogsoutatoneSPorattheIdP, theIdPsends `LogoutRequest` messagestoeveryotherSPwherethatuserhasanactivesession, thenwaitsfor each SP to confirm.
138
+
### SP-Initiated SLO
139
+
140
+
ThemostcommonflowstartsatanSP. Whentheuserclicks"Log out"inanapplication, theSPsendsa `LogoutRequest` totheIdP. TheIdPendstheuser's session, then sends `LogoutRequest` messages to every other SP where the user has an active session. Each SP terminates its local session and responds with a `LogoutResponse`. Once all SPs have responded (or timed out), the IdP sends a final `LogoutResponse` back to the originating SP.
TheIdPcanalsoinitiatelogoutwithoutwaitingfor an SP to start the flow. This happens when an administrator ends a session, a session timeout occurs, or the IdP detects a security event. The IdP sends `LogoutRequest` messages directly to all SPs with active sessions for that user. There is no originating SP to return a final `LogoutResponse` to.
163
+
164
+
### Front-Channel Logout
165
+
166
+
IdentityServer uses front-channel logout, which means logout notifications travel through the user's browser via redirects. The IdP redirects the browser to each SP's SLO endpoint in sequence, and each SP terminates its local session before the browser is redirected onward. This approach is simpler to implement than back-channel (server-to-server) logout, butitrequirestheuser's browser to remain open and active throughout the logout sequence. Back-channel logout is not supported.
InIdentityServer, youconfigureSLOperSPbysetting `SamlServiceProvider.SingleLogoutServiceUrl`. IdentityServerthensendsfront-channellogoutnotificationstoallSPswithaconfiguredSLOendpointwhenauser's session ends. See the [logout endpoint](/identityserver/saml/endpoints.md#logout-endpoint) and [`ISamlLogoutNotificationService`](/identityserver/saml/extensibility.md#isamllogoutnotificationservice) for customization options.
Copy file name to clipboardExpand all lines: astro/src/content/docs/identityserver/saml/configuration.md
+46-56Lines changed: 46 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "SAML Configuration"
3
-
description: Configuration options and models for the SAML 2.0 Identity Provider feature, including SamlOptions, Saml2Options, and SamlServiceProvider settings.
4
-
date: 2026-03-02
3
+
description: Configuration options and models for the SAML 2.0 Identity Provider feature, including SamlOptions and SamlServiceProvider settings.
`AddSaml()` registers all SAML services and six SAML endpoints, enabling five of them by default. The IdP-initiated SSO endpoint requires explicit opt-in (see [Enabling IdP-Initiated SSO](#enabling-idp-initiated-sso) below). It can be called with no arguments when all Service Provider configuration is managed via the admin API, or with an options callback to configure protocol-level settings via `Saml2Options`:
24
+
`AddSaml()` registers all SAML services and endpoints, enabling most of them by default. The IdP-initiated SSO endpoint requires explicit opt-in (see [Enabling IdP-Initiated SSO](#enabling-idp-initiated-sso) below). It can be called with no arguments when all Service Provider configuration is managed via the admin API, or with an options callback to configure protocol-level settings:
`SamlOptions` controls the global behavior and policy of the SAML 2.0 Identity Provider: how claims are mapped to SAML attributes, how assertions are signed, how NameIDs are resolved, and what tolerances apply to timestamps and request lifetimes. It is distinct from `Saml2Options`, which handles protocol plumbing (entity ID, endpoint paths, metadata generation).
37
+
`SamlOptions` controls the global behavior and policy of the SAML 2.0 Identity Provider: how claims are mapped to SAML attributes, how assertions are signed, how NameIDs are resolved, and what tolerances apply to timestamps and request lifetimes.
38
38
39
39
Access `SamlOptions` via `IdentityServerOptions.Saml` when calling `AddIdentityServer()`:
40
40
@@ -53,7 +53,7 @@ Use `SamlOptions` when you need to set defaults that apply across all Service Pr
53
53
Available options:
54
54
55
55
***`MetadataValidityDuration`**
56
-
IdentityServer-layer setting that, if set, causes the metadata document to include a `validUntil` attribute. Defaults to 7 days. For most deployments, prefer configuring `Saml2Options.Metadata.ExpiryDuration` via the `AddSaml()` callback instead, which operates at the protocol layer and defaults to 5 days.
56
+
IdentityServer-layer setting that, if set, causes the metadata document to include a `validUntil` attribute. Defaults to 7 days.
57
57
58
58
***`WantAuthnRequestsSigned`**
59
59
When `true`, the IdP requires all AuthnRequests to be signed. Defaults to `false`.
@@ -95,6 +95,21 @@ Available options:
95
95
***`UserInteraction`**
96
96
Configures SAML endpoint paths. See [SamlUserInteractionOptions](#samluserinteractionoptions) below.
97
97
98
+
### Error Inspector Callbacks
99
+
100
+
These three optional callbacks let you observe and react to errors that occur while IdentityServer parses or validates incoming SAML messages. They are particularly useful when you are debugging interoperability issues with a specific SP, because they give you access to the raw XML and the error details before IdentityServer returns a failure response.
101
+
102
+
None of these callbacks are required. When they are not set, IdentityServer handles errors using its default behavior.
103
+
104
+
***`AuthnRequestErrorInspector`**
105
+
A callback invoked when an error occurs while parsing or validating an incoming `AuthnRequest`. It receives the raw XML and the error details, so you can log the message, inspect the failure reason, or take corrective action on a per-SP basis. This is useful for diagnosing SP configuration problems such as malformed request signatures or unexpected XML structure.
106
+
107
+
***`LogoutRequestErrorInspector`**
108
+
A callback invoked when an error occurs while parsing or validating an incoming `LogoutRequest`. It works the same way as `AuthnRequestErrorInspector` but applies to SLO flows. Use it to investigate cases where an SP's logout request is rejected unexpectedly.
109
+
110
+
***`LogoutResponseErrorInspector`**
111
+
A callback invoked when an error occurs while processing an incoming `LogoutResponse` from an SP during Single Logout (SLO). It lets you handle cases where an SP returns a malformed or unexpected response, for example to log the raw XML for later analysis or to suppress the error for a known non-compliant SP.
112
+
98
113
### Default Claim Mappings
99
114
100
115
The default `DefaultClaimMappings` dictionary maps common OIDC claim types to SAML 2.0 attribute
@@ -140,50 +155,6 @@ The full URL for each endpoint is formed by combining the base URL of the Identi
140
155
the `Route` prefix and the individual path suffix. For example, the metadata endpoint is available
141
156
at `https://your-idp.example.com/saml/metadata` by default.
142
157
143
-
## Saml2Options
144
-
145
-
`Saml2Options` is the protocol-level configuration class for the SAML 2.0 IdP. While `SamlOptions` controls behavior and policy (claim mappings, assertion lifetime, signing defaults), `Saml2Options` controls the SAML protocol plumbing: the IdP's entity identity, which endpoint paths and HTTP bindings are active, and how the metadata document is generated and cached.
146
-
147
-
It lives in the `Duende.IdentityServer.Saml.Configuration` namespace and is configured via the `AddSaml()` options callback:
Use `Saml2Options` when you need to control the IdP's published identity (entity ID), the URL paths it listens on, or the shape of the metadata document it serves to Service Providers. Most deployments do not need to set `EntityId` explicitly; the default (`{host}/saml`) is suitable for standard configurations.
160
-
161
-
Available options:
162
-
163
-
***`EntityId`** (`string?`)
164
-
The SAML entity ID of this IdP. If not set, IdentityServer derives it from the host URL combined with `EntityIdPath` (resulting in `{host}/saml` by default). Most deployments do not need to set this explicitly. Defaults to `null`.
165
-
166
-
***`EntityIdPath`** (`string`)
167
-
Path component appended to the OIDC issuer URL when `EntityId` is not explicitly set. Defaults to `/saml`.
HTTP bindings accepted by the SSO endpoint. Defaults to both HTTP-Redirect and HTTP-POST.
177
-
178
-
***`Metadata.Enabled`** (`bool`)
179
-
Whether the metadata endpoint is active. Defaults to `true`.
180
-
181
-
***`Metadata.CacheDuration`** (`TimeSpan`)
182
-
How long clients should cache the metadata document. Defaults to 1 hour.
183
-
184
-
***`Metadata.ExpiryDuration`** (`TimeSpan`)
185
-
Protocol-layer setting that controls how far in the future the metadata `validUntil` attribute is set. Defaults to **5 days**. This is the preferred way to configure metadata expiry. Set it via the `AddSaml()` callback on `Saml2Options`. It is distinct from `SamlOptions.MetadataValidityDuration` (the IdentityServer-layer property accessed via `IdentityServerOptions.Saml`), which defaults to 7 days. When both are configured, `Saml2Options.Metadata.ExpiryDuration` takes effect at the protocol level.
186
-
187
158
## SamlServiceProvider Model
188
159
189
160
`SamlServiceProvider` represents a registered SAML 2.0 Service Provider. Each SP has its own entity ID, ACS endpoints, signing certificates, and claim configuration. SPs can be registered statically in code or managed dynamically via a custom store.
SP's Single Logout Service endpoint, expressed as a `SamlEndpointType` with a `Location` (Uri) and `Binding` (SamlBinding). Required for SLO support. Defaults to `null`. See [SamlEndpointType](#samlendpointtype) below.
231
202
232
-
***`RequireSignedAuthnRequests`** (`bool`)
233
-
When `true`, unsignedAuthnRequestsfromthisSParerejected. Defaultsto `false`.
203
+
***`RequireSignedAuthnRequests`** (`bool?`)
204
+
When `true`, unsignedAuthnRequestsfromthisSParerejected. When `null`, fallsbacktotheglobal `SamlOptions.WantAuthnRequestsSigned` default. Defaultsto `null`.
Copy file name to clipboardExpand all lines: astro/src/content/docs/identityserver/saml/endpoints.md
+11-3Lines changed: 11 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,7 +1,7 @@
1
1
---
2
2
title: "SAML Endpoints"
3
3
description: Details of the SAML 2.0 protocol endpoints registered by IdentityServer, including metadata, sign-in, logout, and IdP-initiated SSO.
4
-
date: 2026-03-02
4
+
date: 2026-05-15
5
5
sidebar:
6
6
label: Endpoints
7
7
order: 30
@@ -89,8 +89,12 @@ Enable it only for Service Providers that explicitly require it.
89
89
90
90
Handles incoming SAML Single Logout (SLO) requests from Service Providers. The SP sends a SAML
91
91
`LogoutRequest` message to this endpoint. IdentityServer processes the request, terminates the
92
-
user's IdentityServer session, and sends front-channel logout notifications to other registered
93
-
SPs.
92
+
user's IdentityServer session, and coordinates logout across all other SPs.
93
+
94
+
IdentityServer tracks which SPs have active sessions for the user. After receiving a `LogoutRequest`,
95
+
it sends `LogoutRequest` messages to all other SPs with active sessions. It then collects their
96
+
responses and, if some SPs do not respond or return an error, returns a partial logout status to the
97
+
originating SP to indicate that not all sessions were successfully terminated.
94
98
95
99
## Logout Callback Endpoint
96
100
@@ -100,6 +104,10 @@ SPs.
100
104
Processes SAML `LogoutResponse` messages returned by Service Providers after they have processed a
101
105
logout notification from IdentityServer. This endpoint completes the SAML SLO round-trip.
102
106
107
+
As each SP returns a `LogoutResponse`, IdentityServer records the result. If not all SPs with active
108
+
sessions have responded by the time the logout flow completes, IdentityServer returns a partial
109
+
logout status to the originating SP to indicate that some sessions may still be active.
110
+
103
111
:::note
104
112
SAML Single Logout is inherently complex: the process requires coordinated session termination across every SP that participated in the user's session. Partial failures are common. An SP may be unreachable, slow to respond, or the user may close the browser before all notifications complete, leaving some SPs with an active session while others consider the session terminated. Many deployments supplement SLO with short session lifetimes as a simpler fallback. See [Single Logout](/identityserver/saml/concepts.md#single-logout) for more background.
0 commit comments