-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
website/docs: Update docs for single logout #17169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
PeshekDotDev
wants to merge
27
commits into
main
Choose a base branch
from
slo-docs
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
14a82cf
Update docs for slo
7d5b34c
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev 8917a45
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev d7b43e5
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev e91433a
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev 79a7e53
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev a5c8a44
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev be02527
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev a3337cb
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev bd968e0
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev 659fc9d
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev 415ba0d
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev 74a9fec
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev 178f810
Update website/docs/add-secure-apps/providers/saml/saml_single_logout.md
PeshekDotDev b8020a6
Update website/docs/add-secure-apps/flows-stages/stages/user_logout.md
PeshekDotDev fcec4aa
Apply suggestions from code review
PeshekDotDev 41805ce
Apply suggestions from code review
PeshekDotDev 853353e
Apply suggestions from code review
PeshekDotDev 9ef6ecd
update and add feedback
efc89e4
Update single_logout.md
PeshekDotDev ab16ca8
Update website/docs/add-secure-apps/flows-stages/stages/single_logout.md
PeshekDotDev 78bf1ab
Apply suggestions from code review
PeshekDotDev c9caab3
Update website/docs/add-secure-apps/providers/oauth2/fontchannel_and_…
PeshekDotDev 13ff3d2
Update feedback
38646bc
Update and fix merge conflicts
3b5aba2
update single_logout.md location
475c321
update location of single logout in sidebar
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 0 additions & 64 deletions
64
website/docs/add-secure-apps/providers/oauth2/backchannel-logout.mdx
This file was deleted.
Oops, something went wrong.
117 changes: 117 additions & 0 deletions
117
...te/docs/add-secure-apps/providers/oauth2/fontchannel_and_backchannel_logout.mdx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,117 @@ | ||||||
--- | ||||||
title: OAuth2/OpenID Connect front-channel and back-channel logout | ||||||
description: Configure front-channel and back-channel logout for OAuth2/OpenID Connect providers | ||||||
authentik_version: "2025.8.0" | ||||||
authentik_preview: true | ||||||
--- | ||||||
|
||||||
## Overview | ||||||
|
||||||
OAuth2/OpenID logout is a security feature defined in the OpenID Connect specification. It allows an OpenID Provider (OP), such as authentik, to notify Relying Parties (RPs) when a user session ends. This ensures that all associated applications can properly terminate the user's session. | ||||||
|
||||||
For more information about single logout across all providers, see the [Single Logout (SLO) Overview](../single-logout/index.md). | ||||||
|
||||||
:::warning | ||||||
Your OAuth application (Relying Party) must explicitly support OpenID Connect front-channel logout or back-channel logout to properly handle logout requests. Not all OAuth applications support these features, so compatibility should be verified. | ||||||
::: | ||||||
|
||||||
## Requirements | ||||||
|
||||||
Your OAuth application (Relying Party) must: | ||||||
|
||||||
- **HTTPS**: Use HTTPS in production. | ||||||
- **Accessible**: Be reachable from authentik. | ||||||
- **Logout endpoint**: Have a defined endpoint to handle OP logout requests (front-channel, back-channel, or both). | ||||||
|
||||||
## Configuration | ||||||
|
||||||
### Set up single logout | ||||||
|
||||||
1. In the Admin interface, navigate to **Applications** > **Providers** | ||||||
2. Edit or create an OAuth2 provider | ||||||
3. In the **Logout URI** field, enter the endpoint for logout (if supported by your RP) | ||||||
4. Select the **Logout method** to define whether the RP supports **Front-channel logout** or **Back-channel logout** at that URI | ||||||
5. Click **Finish** to save your changes | ||||||
|
||||||
:::info | ||||||
Back-channel logout is the only way to ensure that users are logged out of the provider when their session is administratively terminated (e.g., when a user is deactivated or their session is deleted). | ||||||
::: | ||||||
|
||||||
### Logout URI format | ||||||
|
||||||
The **Logout URI** should be a single URL provided by your Relying Party application, for example: | ||||||
|
||||||
#### Back-channel | ||||||
|
||||||
``` | ||||||
https://app.example.com/oauth/backchannel-logout | ||||||
https://api.service.com/logout/backchannel | ||||||
https://client.example.org/backchannel-logout | ||||||
``` | ||||||
|
||||||
#### Front-channel | ||||||
|
||||||
``` | ||||||
https://app.example.com/oauth/logout | ||||||
https://api.service.com/logout | ||||||
``` | ||||||
|
||||||
## How OpenID Connect single logout works | ||||||
|
||||||
### Back-channel logout | ||||||
|
||||||
With back-channel logout, authentik sends logout requests directly from the server to the Relying Party's back-channel logout endpoint using HTTP POST. The logout request includes a signed JWT logout token that contains: | ||||||
|
||||||
- `iss` (issuer): The authentik issuer URL | ||||||
- `sub` (subject): The user's unique identifier | ||||||
- `aud` (audience): The client ID | ||||||
- `iat` (issued at): Token creation timestamp | ||||||
- `jti` (JWT ID): Unique token identifier | ||||||
- `events`: Logout event claim | ||||||
- `sid` (session ID): The session identifier (if available) | ||||||
|
||||||
Example back-channel logout request: | ||||||
|
||||||
```http | ||||||
POST /backchannel-logout HTTP/1.1 | ||||||
Host: client.example.org | ||||||
Content-Type: application/x-www-form-urlencoded | ||||||
|
||||||
logout_token=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9... | ||||||
``` | ||||||
|
||||||
Back-channel logout is triggered when: | ||||||
|
||||||
- A user logs out through a logout flow | ||||||
- An administrator deletes a user's session | ||||||
- A user account is deactivated | ||||||
- A session expires or is revoked | ||||||
|
||||||
### Front-channel logout | ||||||
|
||||||
With front-channel logout, authentik injects an iframe logout stage into the logout flow. This stage loads the Relying Party's front-channel logout URL in a hidden iframe within the user's browser. The logout URL includes session information as query parameters: | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
||||||
- `iss`: The authentik issuer URL | ||||||
- `sid`: The session identifier | ||||||
|
||||||
Example front-channel logout iframe: | ||||||
|
||||||
```html | ||||||
<iframe | ||||||
src="https://app.example.com/oauth/logout?iss=https://authentik.company&sid=session_id" | ||||||
></iframe> | ||||||
``` | ||||||
|
||||||
The RP processes the logout request and terminates the user's session. After all iframes complete their requests, the user continues through the authentik logout flow. | ||||||
|
||||||
:::info | ||||||
Front-channel logout only works for user-initiated logouts through a logout flow. It cannot be used for administrative session termination since it requires an active browser session. | ||||||
::: | ||||||
|
||||||
## Resources | ||||||
|
||||||
- [Single Logout (SLO) Overview](../single-logout/index.md) | ||||||
- [User Logout Stage](../../flows-stages/stages/user_logout.md) | ||||||
- [OAuth2 Provider Configuration](./index.mdx) | ||||||
- [OpenID Connect Back-Channel Logout 1.0 Specification](https://openid.net/specs/openid-connect-backchannel-1_0.html) | ||||||
- [OpenID Connect Front-Channel Logout 1.0 Specification](https://openid.net/specs/openid-connect-frontchannel-1_0.html) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
website/docs/add-secure-apps/providers/saml/saml_single_logout.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
--- | ||
title: SAML Single Logout | ||
--- | ||
|
||
[Single logout (SLO)](../single-logout/index.md) allows you to configure authentik to log out a user from all supported providers simultaneously when signing out of authentik. For SAML providers, this requires your service provider to support Single Logout via a Single Logout Service URL. Check with your provider to see if they support Single Logout, as not all providers do. | ||
|
||
## Configure your SAML provider | ||
|
||
To enable single logout, add a **Single Logout Service URL** to your SAML provider. The URL is the service provider’s endpoint to which authentik sends logout requests. | ||
|
||
1. Log in to authentik as an administrator and open the authentik Admin interface | ||
2. Navigate to **Applications** > **Providers** | ||
3. Click the edit icon of the SAML provider that you want to configure for SLO | ||
4. Set the **SLS URL** field to your service provider's logout endpoint | ||
5. Select the appropriate **SLS Binding**: | ||
- **Redirect** - Uses HTTP redirects to send logout requests to the provider (front-channel only) | ||
- **POST** - Supports both front-channel and back-channel logout methods | ||
6. Select the appropriate **Logout Method**: | ||
- **Front-channel iframe** - Performs parallel logout requests using hidden iframes. Supports both Redirect and POST bindings | ||
- **Front-channel native** - Uses the active browser tab to chain redirects and POST requests for sequential logout. Supports both Redirect and POST bindings | ||
- **Back-channel** - Performs server-to-server POST requests to log out the user. Requires POST SLS binding. Users are logged out even when their session is administratively terminated | ||
7. (Optional) Enable **Sign Logout Request** to cryptographically sign SAML logout requests sent to the service provider | ||
8. Click **Finish** | ||
|
||
:::info | ||
Back-channel logout ensures users are logged out even when their session is terminated administratively (e.g., when a user is deactivated or their session is deleted). This requires POST SLS binding. | ||
::: | ||
|
||
## How SAML Single Logout Works | ||
|
||
When a user logs out of authentik through a logout flow, authentik initiates the single logout process for all SAML providers configured with an SLS URL and logout method. | ||
|
||
### Front-channel iframe logout | ||
|
||
With front-channel iframe logout, authentik injects an iframe logout stage into the logout flow. This stage loads all provider logout URLs simultaneously in hidden iframes within the browser, allowing parallel logout across multiple providers. After all iframes complete their requests, the user continues through the authentik logout flow. | ||
|
||
### Front-channel native logout | ||
|
||
With front-channel native logout, authentik chains logout requests sequentially using the active browser tab. For POST bindings, the browser automatically submits forms to each provider. For Redirect bindings, the browser follows redirect URLs. Each provider returns the user to authentik who redirects to the next provider. After all providers have been visited, the user completes the authentik logout flow. | ||
|
||
### Back-channel logout | ||
|
||
With back-channel logout, authentik sends SAML logout requests directly from the server to each provider's SLS URL using HTTP POST. This happens asynchronously and does not require browser interaction. Back-channel logout is also triggered automatically when: | ||
|
||
- A user's session is administratively deleted. | ||
- A user account is deactivated. | ||
|
||
:::info | ||
Back-channel logout requires POST SLS binding. | ||
PeshekDotDev marked this conversation as resolved.
Show resolved
Hide resolved
|
||
::: | ||
|
||
## Binding Comparison | ||
|
||
| Feature | Redirect Binding | POST Binding | | ||
| -------------------- | --------------------- | ------------------------ | | ||
| Front-channel iframe | ✅ Supported | ✅ Supported | | ||
| Front-channel native | ✅ Supported | ✅ Supported | | ||
| Back-channel | ❌ Not supported | ✅ Supported | | ||
| Request sent via | URL query parameters | HTTP POST body | | ||
| Maximum data size | Limited by URL length | Large requests supported | | ||
|
||
## SAML session tracking | ||
|
||
authentik tracks SAML sessions for each provider to support single logout. When a user successfully authenticates to a SAML provider, authentik creates a `SAMLSession` record containing: | ||
|
||
- The SAML `SessionIndex` | ||
- The `NameID` and `NameID format` used for the session | ||
- A link to the user's authenticated session | ||
|
||
These session records are used to generate proper SAML logout requests with the correct `SessionIndex` and `NameID` values that the service provider expects. | ||
|
||
## Resources | ||
|
||
- [Single Logout (SLO) Overview](../single-logout/index.md) | ||
- [User Logout Stage](../../flows-stages/stages/user_logout.md) | ||
- [SAML Profiles 2.0 Specification](https://docs.oasis-open.org/security/saml/v2.0/saml-profiles-2.0-os.pdf) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.