From 63cc54c84a9805ec0762991d2561f67f81307327 Mon Sep 17 00:00:00 2001 From: Maduranga Siriwardena Date: Sat, 11 Jul 2026 21:41:27 +0530 Subject: [PATCH] Add Single Sign-On documentation for flows Add a guide (Single Sign-On for Flows) and a key-concept page (Sessions and Single Sign-On) covering flow-centric SSO, the Check SSO Session and Save / Load Session nodes, checkpoints, session lifetime, and the session cookie. Add an SsoSingleStepDiagram component for the flow diagram, wire both pages into the sidebar, and extend the Vale title-case exceptions and vocabulary. --- .vale/styles/ThunderID/TitleCaseTitles.yml | 1 + .../guides/guides/flows/single-sign-on.mdx | 102 ++++++++++++++++ .../key-concepts/authentication/sessions.mdx | 42 +++++++ docs/sidebars.ts | 10 ++ docs/src/components/SsoFlowDiagram.tsx | 109 ++++++++++++++++++ 5 files changed, 264 insertions(+) create mode 100644 docs/content/guides/guides/flows/single-sign-on.mdx create mode 100644 docs/content/guides/key-concepts/authentication/sessions.mdx create mode 100644 docs/src/components/SsoFlowDiagram.tsx diff --git a/.vale/styles/ThunderID/TitleCaseTitles.yml b/.vale/styles/ThunderID/TitleCaseTitles.yml index 5ee46180e1..a0bbb5a7b1 100644 --- a/.vale/styles/ThunderID/TitleCaseTitles.yml +++ b/.vale/styles/ThunderID/TitleCaseTitles.yml @@ -33,6 +33,7 @@ exceptions: - Per-Cache - act - Sign-In + - Sign-On - Sign-Out - Sign-Up - iOS diff --git a/docs/content/guides/guides/flows/single-sign-on.mdx b/docs/content/guides/guides/flows/single-sign-on.mdx new file mode 100644 index 0000000000..cd08ec35a9 --- /dev/null +++ b/docs/content/guides/guides/flows/single-sign-on.mdx @@ -0,0 +1,102 @@ +--- +title: Single Sign-On for Flows +sidebar_position: 6 +persona: iam +description: Add Single Sign-On (SSO) to authentication flows so users skip steps they have already completed, using the Check SSO Session and Save / Load Session nodes in the Console Flow Builder. +--- + +import {SsoSingleStepDiagram} from '../../../../src/components/SsoFlowDiagram'; + +# Single Sign-On for Flows + +Single Sign-On (SSO) lets a user authenticate once and then reuse that authentication across applications, without repeating steps they have already completed. provides SSO as a building block inside authentication flows: you add two nodes to a flow, and the flow skips authentication steps whenever a valid session already covers them. + +This guide explains how flow SSO works, describes the two SSO nodes, and shows how to add SSO to a flow. For the underlying session model, see [Sessions and Single Sign-On](../../key-concepts/authentication/sessions.mdx). + +## How Single Sign-On Works + +Flow SSO is **flow-centric**: a session belongs to exactly one flow. Every application that authenticates through the same flow shares that flow's session, so the second application reuses the first application's authentication instead of prompting the user again. Two different flows never share a session. + +A flow SSO session has three characteristics: + +- **Per-flow.** The flow is the grouping key. The session covers only applications that use the same flow. +- **Browser-scoped.** references the session with a per-flow cookie that the browser sends on each request. Flow SSO applies to browser-based authentication. +- **Checkpoint-based.** A **checkpoint** is the authentication that SSO can skip. You define it with a **Check SSO Session** node and a **Save / Load Session** node, and the checkpoint covers the steps between them. On a later sign-in, the flow reuses the checkpoint instead of prompting for those steps. + +## Single Sign-On Nodes + +You build flow SSO from two executor nodes in the Console Flow Builder. You place them around each authentication step you want to make skippable. + +### Check SSO Session + +The **Check SSO Session** node decides whether the following authentication step can be skipped. Place it immediately before the step. It answers the question: *Can the following authentication be skipped by reusing the existing session?* In a flow definition, it is a `TASK_EXECUTION` step that runs the `SSOCheckExecutor`. + +The node has two outcomes: + +| Outcome | Link label | Meaning | +|---|---|---| +| Success | **Skip to** | A valid session already covers this step. The flow skips the step and continues from the target node. | +| Failure | **Authenticate** | No reusable session covers this step. The flow runs the full authentication step. | + +### Save / Load Session + +The **Save / Load Session** node is the checkpoint. Place it at the point where the authentication you want to make skippable completes: the join point that both the **Skip to** and **Authenticate** paths lead to. In a flow definition, it is a `TASK_EXECUTION` step that runs the `SessionExecutor`. + +The node performs one of two actions automatically, based on the request: + +- On a fresh sign-in, it establishes the session (or attaches to the session an earlier checkpoint in the same sign-in created) and saves the checkpoint for the authentication just completed. +- On a reused session, it loads the saved checkpoint so downstream nodes read the authenticated user without re-running the steps it covers. + +## Add Single Sign-On to a Flow + +To make a group of authentication steps skippable, wrap them with a **Check SSO Session** node before the first step and a **Save / Load Session** node at the join point where they complete. The group can be a single step or multiple steps. + +The following diagram shows a password step made skippable. The **Skip to** path bypasses the prompt and credential check; the **Authenticate** path runs them. Both paths converge on **Save / Load Session**. + + + +To build this flow: + +1. Open the flow in the **Console Flow Builder**. +2. Add a **Check SSO Session** node after the entry point, before the first authentication step you want to make skippable. +3. Connect the **Authenticate** outcome to the first node of that authentication (for example, the credentials prompt). +4. Add a **Save / Load Session** node after the authentication steps complete. +5. Connect the **Skip to** outcome of **Check SSO Session** directly to the **Save / Load Session** node. +6. Connect the final node of the authentication to the same **Save / Load Session** node, so both paths converge. +7. Continue the flow from **Save / Load Session** to the remaining nodes (for example, authorization and the Auth Assertion Generator). + +The first time a user signs in, the flow takes the **Authenticate** path and **Save / Load Session** establishes the session. On the next sign-in through the same flow, **Check SSO Session** finds the session and takes the **Skip to** path. + +## Configure Session Lifetime + +Two timeouts bound every flow SSO session: + +- **Idle timeout**: the maximum inactivity period. The idle deadline moves forward on each use of the session, so an active session stays alive. The default is 30 minutes. +- **Absolute timeout**: the maximum total lifetime, fixed when the session is created and never extended. The default is 8 hours. + +A session expires when it passes either deadline. After expiry, **Check SSO Session** takes the **Authenticate** path and the user signs in again. + +Set the timeouts in the `session` server-config resource. In a source checkout, use `backend/cmd/server/config/resources/server_configs/session.yaml`; in a packaged distribution, use `/config/resources/server_configs/session.yaml`. Durations are in seconds. A value of `0` uses the default. + +```yaml +name: session +value: + idleTimeoutSeconds: 1800 # 30 minutes + absoluteTimeoutSeconds: 28800 # 8 hours +``` + +The idle timeout must not exceed the absolute timeout. + +## Session Cookie + + references each flow SSO session with a per-flow cookie named `tid_sso_`, where `` is derived from the flow identifier. A separate cookie per flow keeps one flow's session from affecting another. The cookie carries only an opaque handle, never user data, and its attributes follow browser security best practices: + +- `HttpOnly`, so client-side scripts cannot read it. +- `SameSite=Lax`. +- `Secure`, when the server runs over TLS. + +The cookie lifetime matches the absolute session timeout. + +## Current Scope and Limitations + +- Flow SSO applies to **browser-based** authentication, because it relies on the cookies. diff --git a/docs/content/guides/key-concepts/authentication/sessions.mdx b/docs/content/guides/key-concepts/authentication/sessions.mdx new file mode 100644 index 0000000000..b27867d38a --- /dev/null +++ b/docs/content/guides/key-concepts/authentication/sessions.mdx @@ -0,0 +1,42 @@ +--- +title: Sessions and Single Sign-On +sidebar_position: 2 +description: Understand how {{ProductName}} sessions work and how flow Single Sign-On (SSO) lets users reuse authentication across applications. +--- + +# Sessions and Single Sign-On + +A session records that a user authenticated, so can trust that authentication again later without prompting the user to repeat it. Single Sign-On (SSO) builds on sessions: when a user has a valid session, reuses it and skips the steps the session already covers. + +This page explains the session model and how SSO applies to authentication flows. To add SSO to a flow, see [Single Sign-On for Flows](../../guides/flows/single-sign-on.mdx). + +## Flow-Centric Sessions + + ties each SSO session to a single flow. The flow is the grouping key: every application that authenticates through the same flow shares that flow's session, and two different flows never share a session. + +Because the flow is the grouping key, you can group sessions by the security category of the applications. Assign applications that share a security category to the same flow so they reuse one authentication. Put applications in a more sensitive category on a separate flow, so a session established for a lower-category application never signs the user in to a higher-category one. + +## Checkpoints + +A **checkpoint** is the authentication that SSO can skip and reuse. You define it with a pair of nodes: a **Check SSO Session** node marks where the reusable authentication begins, and a **Save / Load Session** node marks where it ends. The checkpoint covers the authentication steps between them. + +On a fresh sign-in, the flow runs those steps and saves the checkpoint under the session. On a later sign-in, the flow reuses the checkpoint and skips the steps it covers. If the checkpoint has expired, the user completes the steps again. + +## Session Lifetime + +Two independent timeouts bound every session: + +| Timeout | Behavior | Default | +|---|---|---| +| Idle | Moves forward on each use of the session, so an active session stays alive. The session expires after this much inactivity. | 30 minutes | +| Absolute | Fixed when the session is created and never extended. The session expires this long after creation regardless of activity. | 8 hours | + +A session expires when it passes either deadline. After expiry, the next sign-in through the flow authenticates the user again. An administrator configures both timeouts in the server configuration. See [Configure Session Lifetime](../../guides/flows/single-sign-on.mdx#configure-session-lifetime). + +## Browser Scope + +Flow SSO applies to browser-based authentication. references each session with a per-flow cookie that carries only an opaque handle, never user data. Because the cookie is the reference, SSO reuse happens within a browser: a user who authenticates in one browser does not gain a session in another. + +## Related + +- [Single Sign-On for Flows](../../guides/flows/single-sign-on.mdx) shows how to add the SSO nodes to a flow in the Console Flow Builder. diff --git a/docs/sidebars.ts b/docs/sidebars.ts index 69a92a1f7f..5a25c8643d 100644 --- a/docs/sidebars.ts +++ b/docs/sidebars.ts @@ -557,6 +557,11 @@ const sidebars: SidebarsConfig = { id: 'guides/guides/flows/build-a-flow', label: 'Build a Flow', }, + { + type: 'doc', + id: 'guides/guides/flows/single-sign-on', + label: 'Single Sign-On', + }, { type: 'doc', id: 'guides/guides/flows/advanced-configurations', @@ -849,6 +854,11 @@ const sidebars: SidebarsConfig = { id: 'guides/key-concepts/authentication/integration-models', label: 'Integration Models', }, + { + type: 'doc', + id: 'guides/key-concepts/authentication/sessions', + label: 'Sessions and Single Sign-On', + }, ], }, { diff --git a/docs/src/components/SsoFlowDiagram.tsx b/docs/src/components/SsoFlowDiagram.tsx new file mode 100644 index 0000000000..d2a8343696 --- /dev/null +++ b/docs/src/components/SsoFlowDiagram.tsx @@ -0,0 +1,109 @@ +/** + * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com). + * + * WSO2 LLC. licenses this file to you under the Apache License, + * Version 2.0 (the "License"); you may not use this file except + * in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +import React from 'react'; + +export function SsoSingleStepDiagram(): React.ReactElement { + return ( +
+ +
+ ); +}