Skip to content

Commit 1cd59bf

Browse files
author
Tiago Brenck
authored
Merge pull request #135 from Azure-Samples/tibre/1_6_improvements
1-6 Sign-out README improvements
2 parents 3559db8 + 2bb935d commit 1cd59bf

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

1-WebApp-OIDC/1-6-SignOut/README.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,9 @@ public static IServiceCollection AddAzureAdV2Authentication(this IServiceCollect
7171
}
7272
```
7373

74-
### Intercepting the callback after logout - Single Sign Out
74+
### Clearing the token cache
7575

76-
Your application can also intercept the after logout event, for instance to clear the entry of the token cache associated with the account that signed out. We'll see in the second part of this tutorial (about the Web app calling a Web API), that the web app will store access tokens for the user in a cache. Intercepting the after logout callback enables your web application to remove the user from the token cache. This is illustrated in the `AddMsal()` method of [StartupHelper.cs L137-143](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/b87a1d859ff9f9a4a98eb7b701e6a1128d802ec5/Microsoft.Identity.Web/StartupHelpers.cs#L137-L143)
77-
78-
The Logout Url that you have registered for your application enables you to implement single sign out. Indeed, the Microsoft identity platform logout endpoint will call the Logout URL registered with your application. This call happens whether or not the sign-out was initiated from your web app, or from another web app or the browser. For more information, see [Single sign-out](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc#single-sign-out) in the conceptual documentation
76+
Your application can also intercept the logout event, for instance to clear the entry of the token cache associated with the account that signed out. We'll see in the second part of this tutorial (about the Web app calling a Web API), that the web app will store access tokens for the user in a cache. Intercepting the logout callback enables your web application to remove the user from the token cache. This is illustrated in the `AddMsal()` method of [StartupHelper.cs L137-143](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/b87a1d859ff9f9a4a98eb7b701e6a1128d802ec5/Microsoft.Identity.Web/StartupHelpers.cs#L137-L143)
7977

8078
```CSharp
8179
public static IServiceCollection AddMsal(this IServiceCollection services, IEnumerable<string> initialScopes)
@@ -96,3 +94,16 @@ public static IServiceCollection AddMsal(this IServiceCollection services, IEnum
9694
return services;
9795
}
9896
```
97+
98+
### Single Sign-Out
99+
100+
The **Logout Url** that you have registered for your application enables you to implement single sign-out. Indeed, the Microsoft identity platform logout endpoint will call the **Logout Url** registered with your application. This call happens whether or not the sign-out was initiated from your web app, or from another web app or the browser. For more information, see [Single sign-out](https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-protocols-oidc#single-sign-out) in the conceptual documentation.
101+
102+
In our tutorial, you registered `https://localhost:44321/signout-oidc` as the **Logout Url** but you haven't created the `signout-oidc` endpoint. This endpoint is actually implemented by ASP.NET Core so there is no need to create it, however, if you want to intercept it you should use `OnRemoteSignOut` event:
103+
104+
```CSharp
105+
options.Events.OnRemoteSignOut = async context =>
106+
{
107+
//Intercepting the signout-oidc endpoint
108+
};
109+
```

0 commit comments

Comments
 (0)