Skip to content

Commit aa79cd5

Browse files
Merge pull request #5894 from piraveena/fc-logout
Add OIDC Frontchannel logout docs to IS
2 parents c82b7c8 + 122c230 commit aa79cd5

File tree

8 files changed

+117
-65
lines changed

8 files changed

+117
-65
lines changed
46.5 KB
Loading
96.1 KB
Loading
98.9 KB
Loading
97.1 KB
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{% set product_name = "WSO2 Identity Server" %}
2+
{% set product_url_format = "https://localhost:9443" %}
3+
{% set product_url_sample = "https://localhost:9443" %}
4+
{% include "../../../../../../includes/guides/authentication/oidc/add-front-channel-logout.md" %}

en/identity-server/next/mkdocs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -712,8 +712,9 @@ nav:
712712
- Revoke tokens: guides/authentication/oidc/revoke-tokens.md
713713
- Configure token exchange: guides/authentication/configure-token-exchange.md
714714
- Logout:
715-
- Front-channel logout: guides/authentication/oidc/add-logout.md
715+
- RP-initiated logout: guides/authentication/oidc/add-logout.md
716716
- Back-channel logout: guides/authentication/oidc/add-back-channel-logout.md
717+
- Front-channel logout: guides/authentication/oidc/add-front-channel-logout.md
717718
- Federated IdP-initiated logout: guides/authentication/oidc/oidc-federated-idp-initiated-logout.md
718719
- Configure SAML flows:
719720
- Configure SAML flows: guides/authentication/saml/index.md
Lines changed: 44 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,74 @@
1-
2-
{% if product_name == "WSO2 Identity Server" %}
31
# Implement back-channel logout
42

5-
Back-channel logout allows users to be logged out from a client application through direct communication of logout requests between the client application and the authorization server.
6-
7-
## How it works
8-
9-
The underlying message flow of OpenID Connect (OIDC) back-channel logout is as follows:
10-
11-
1. A user logout is initiated by either the client application or the authorization server.
12-
2. The authorization server identifies all client applications associated with the user's session.
13-
3. The authorization server generates a logout token, a special JWT containing specific claims, and sends it with a logout request to the logout endpoints of the identified client applications.
14-
4. Upon receiving the logout token, each client application validates it and then invalidates the corresponding user session.
3+
{% if product_name == "WSO2 Identity Server" %}
154

16-
## Prerequisites
17-
To get started, you need to:
18-
19-
- [Register two OIDC application with {{ product_name }}]({{base_path}}/guides/applications/register-oidc-web-app/). Application names used in this guide are `Playground_app1` and `Playground_app2`
5+
Back-channel logout, defined in the OpenID Connect (OIDC) specification, allows logging out of client applications without user interaction. Unlike front-channel logout that relies on the user's browser to notify each client application, back-channel logout happens entirely through server-to-server communication between the authorization server and the client applications.
206

21-
- [Download two instances of the playground application](https://github.com/wso2/samples-is/releases/download/v4.5.2/playground2.war) as this guide uses the playground sample app. Rename the second file as `playground3.war`.
7+
For protocol details, see the OpenID specification: [OpenID Connect Back-Channel Logout 1.0](https://openid.net/specs/openid-connect-backchannel-1_0.html).
228

23-
- Configure the sample applications;
9+
## How it works
2410

25-
1. Copy the downloaded playground.war file into `<TOMCAT_HOME>/apache-tomcat-<version>/webapps` folder.
26-
2. Start the Tomcat server.
27-
3. If required, update the `<param-value>` parameters for the `serverUrl`, `username` and `password` in the `WEB-INF/web.xml` file.
28-
4. Restart the Tomcat server, if you have done any changes to the `WEB-INF/web.xml` file.
11+
![oidc-backchannel-logout-scenario]({{base_path}}/assets/img/guides/oidc-logout/oidc-backchannel-logout-scenario.png)
2912

30-
## Configure back-channel logout
13+
The underlying message flow of OIDC back-channel logout happens as follows:
3114

32-
- To configure back-channel logout for `Playground_app1`:
15+
1. The client application initiates a user logout.
16+
2. {{ product_name }} identifies all the client applications associated with the user's session.
17+
3. {{ product_name }} generates a logout token, a special JWT (JSON Web Token) containing specific claims and sends it with a logout request to the logout endpoints of all the client applications.
18+
4. Upon receiving the logout token, each client application validates the token and proceeds to invalidate the corresponding user session.
3319

34-
1. On the WSO2 Identity Server Console, go to **Applications** and select your OIDC application.
35-
2. Go to the **Protocol** tab and enter the following details:
20+
## Configure back-channel logout URL
3621

37-
| Field Name | Value |
38-
|---------------|-------|
39-
| Grant type | Implicit |
40-
| Back channel logout URL | http://localhost:8080/playground3/bclogout |
22+
Follow the steps below to register the back-channel endpoint of your application with {{product_name}}.
4123

42-
3. Click **Update** to save your configurations.
24+
!!! note "Before you begin"
4325

44-
- To configure back-channel logout for `Playground_app2`:
26+
[Register your OIDC application]({{base_path}}/guides/applications/) in {{product_name}}.
4527

46-
1. On the WSO2 Identity Server Console, go to **Applications** and select your OIDC application.
47-
2. Go to the **Protocol** tab and enter the following details:
28+
1. On the {{ product_name }} Console, go to **Applications** and select your OIDC application.
4829

49-
| Field Name | Value |
50-
|---------------|-------|
51-
| Grant type | Implicit |
52-
| Back channel logout URL | http://localhost:8080/playground2/bclogout |
30+
2. Go to the **Protocol** tab, and under **Logout URLs**, enter the **Back channel logout URL**.
5331

54-
3. Click **Update** to save your configurations.
32+
![Configure backchannel logout URL]({{base_path}}/assets/img/guides/oidc-logout/oidc-backchannel-logout-configuration.png){: width="600" style="display: block; margin: 0; border: 0.3px solid lightgrey;"}
5533

56-
## Try it out
34+
3. Click **Update** to save your configurations.
5735

58-
1. Access the **Playgrpund_app1** application using the following URL: http://localhost:8080/playground2/.
36+
## Set up your client application
5937

60-
2. Click **Import Photos**.
38+
To complete the back-channel logout flow, you must set up the client application so that it can perform the following required actions.
6139

62-
3. Enter the following details:
40+
1. **Receive back-channel logout requests** - The client application must expose an endpoint that accepts POST requests from the authorization server to handle logout requests. You need to [register this endpoint with {{product_name}}](#configure-back-channel-logout-url).
6341

64-
| Field name | Value |
65-
|-------------|-------|
66-
| **Authorization Grant Type** | `Implicit` |
67-
| **Client ID** | The OAuth Client ID received when registering the Playground_app1 in WSO2 Identity Server. |
68-
| **Callback URL** | `http://localhost:8080/playground2/oauth2client` |
69-
| **Authorize Endpoint** | `https://localhost:9443/oauth2/authorize` |
42+
2. **Validate the logout token** - The following is an example of the logout token sent by the {{ product_name }} to a client application:
7043

71-
4. Click **Authorize**. You will be redirected to the WSO2 Identity Server login page.
44+
``` json
45+
{
46+
"iss": "{{product_url_sample}}/oauth2/token",
47+
"sub": "aa21e449-****-****-****-****a6a3961f",
48+
"aud": "w_Hwp05dF****_****9SNwpflAa",
49+
"iat": 1609911868,
50+
"exp": 1609911988,
51+
"jti": "16159e3e-****-****-****-b0782ab33d58",
52+
"sid": "15043ffc-****-****-****-9b107f7da38c",
53+
"events": {
54+
"http://schemas.openid.net/event/backchannel-logout": {}
55+
}
56+
}
57+
```
7258

73-
5. Enter the credentials of your user account and click Sign In. You will now receive an ID Token.
59+
Your client application must perform JWT token validation as defined in the [OIDC back-channel logout specification](https://openid.net/specs/openid-connect-backchannel-1_0.html#Validation). A summary of the validations is below.
7460

75-
6. Access the **Playground_app2** application using the follwoing URL: http://localhost:8080/playground3/
61+
- `iss`: Must match your trusted issuer.
7662

77-
7. Repeat steps 2-5 for **Playground_app2** application with the following values:
63+
- `aud`: Must match your application's client ID.
7864

79-
| Field name | Value |
80-
|-------------|-------|
81-
| **Authorization Grant Type** | `Implicit` |
82-
| **Client ID** | The OAuth Client ID received when registering the Playground_app2 in WSO2 Identity Server. |
83-
| **Callback URL** | `http://localhost:8080/playground3/oauth2client` |
84-
| **Authorize Endpoint** | `https://localhost:9443/oauth2/authorize` |
65+
- `iat` and `exp`: Must be within a valid timeframe.
8566

86-
8. Click **Logout** on one of the applications. You will be prompted to consent to the logout.
67+
- `events`: Must contain the http://schemas.openid.net/event/backchannel-logout claim.
8768

88-
9. Provide consent. You will receive confirmation of sucessful logout.
69+
- `sid`: Must be present to identify the session.
8970

90-
10. Now, go to the other application and reload the page. Note that you are redirected to the login page of the playground application and you will see that the **Logged in user** has changed to `null`.
9171

92-
You have successfully configured and tried out OIDC back-channel logout. You can check out the Tomcat logs on the terminal window to see the back-channel logout flow.
72+
3. **Terminate the user session** - Once the client validates the token and determines it to be valid, the client should use the `sid` claim to locate and terminate the user's session.
9373

94-
{% endif %}
74+
{% endif %}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
2+
{% if product_name == "WSO2 Identity Server" %}
3+
4+
# Implement OIDC front-channel logout
5+
6+
Front-channel logout lets the authorization server notify client applications to end a user's session through the user's browser via iframes.
7+
8+
Use front-channel logout when client applications cannot accept server-to-server (back-channel) requests but can receive browser-delivered logout notifications.
9+
10+
For protocol details see the OpenID specification: [OpenID Connect Front-Channel Logout 1.0](https://openid.net/specs/openid-connect-frontchannel-1_0.html).
11+
12+
## How it works
13+
14+
![oidc-front-channel-logout-scenario]({{base_path}}/assets/img/guides/oidc-logout/oidc-frontchannel-logout-scenario.png)
15+
16+
The front-channel logout flow works as follows:
17+
18+
1. The client application initiates a user logout.
19+
2. {{ product_name }} terminates the user's session.
20+
3. {{ product_name }} identifies all the client applications associated with the user's session.
21+
4. {{ product_name }} responds with an HTML page that embeds an iframe for each application that has a front-channel logout URI configured.
22+
5. Upon receiving the logout request, each client application validates the requests and proceeds to invalidate the corresponding user session.
23+
24+
## Configure front-channel logout URL
25+
26+
If your application supports OIDC front-channel logout, you can configure the logout URL of the application in the Console. That endpoint can listen to OIDC front-channel logout requests from {{ product_name }}, and terminate the application's sessions.
27+
28+
To get started, you need to have an application registered in {{ product_name }}. If you don't already have one, [register a web app with OIDC]({{base_path}}/guides/applications/register-oidc-web-app/).
29+
30+
Follow the steps below to register the front-channel endpoint of your application with {{product_name}}.
31+
32+
!!! note "Before you begin"
33+
34+
[Register your OIDC application]({{base_path}}/guides/applications/) in {{product_name}}.
35+
36+
1. On the {{product_name}} Console, go to **Applications** and select your OIDC application.
37+
38+
2. Go to the **Protocol** tab, and under **Logout URLs**, enter the **Front channel logout URL**.
39+
40+
![oidc-logout]({{base_path}}/assets/img/guides/oidc-logout/oidc-frontchannel-logout-configuration.png)
41+
42+
3. Click **Update** to save your configurations.
43+
44+
=== "Logout request format"
45+
46+
```url
47+
http://myapp.com?iss={{product_url_format}}/oauth2/token&sid={sid_value}
48+
```
49+
50+
=== "Example request"
51+
52+
```url
53+
http://myapp.com?iss={{product_url_sample}}/oauth2/token&sid=15043ffc-****-****-****-9b107f7da38c
54+
```
55+
56+
!!! note
57+
58+
**Cross-site cookie considerations**
59+
60+
Front-channel logout uses GET requests delivered via iframes to notify client domains. While GET requests in iframes have good browser support, modern browsers restrict third-party cookies and cross-site tracking, which can cause logout to fail.
61+
62+
*Recommendations:*
63+
64+
- Prefer [back-channel logout]({{base_path}}/guides/authentication/oidc/add-back-channel-logout/) for reliable server-to-server session termination, as it does not depend on browser cookie policies.
65+
- Consider hosting applications on subdomains of a shared parent domain (for example, `app1.example.com` and `app2.example.com`) so cookies can use `Domain=.example.com` and become first-party.
66+
67+
{% endif %}

0 commit comments

Comments
 (0)