Skip to content

Commit cdff32b

Browse files
author
Tiago Brenck
authored
Merge pull request #127 from Azure-Samples/tibre/signoutLoginHint
Removing login_hint from signout
2 parents 9931a8b + 8d39c39 commit cdff32b

File tree

3 files changed

+4
-21
lines changed

3 files changed

+4
-21
lines changed

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

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,19 @@ from <https://github.com/aspnet/AspNetCore/blob/master/src/Azure/AzureAD/Authent
5353

5454
### Intercepting the call to the logout endpoint
5555

56-
The ASP.NET Core OpenIdConnect middleware enables your app to intercept the call to the Microsoft identity platform logout endpoint by providing an OpenIdConnect event named `OnRedirectToIdentityProviderForSignOut`. The web app uses it to attempt to avoid the select account dialog to be presented to the user when signing out. This interception is done in the `AddAzureAdV2Authentication` of the `Microsoft.Identity.Web` reusable library. See [StartupHelpers.cs L58-L66](https://github.com/Azure-Samples/active-directory-aspnetcore-webapp-openidconnect-v2/blob/b87a1d859ff9f9a4a98eb7b701e6a1128d802ec5/Microsoft.Identity.Web/StartupHelpers.cs#L58-L66)
56+
The ASP.NET Core OpenIdConnect middleware enables your app to intercept the call to the Microsoft identity platform logout endpoint by providing an OpenIdConnect event named `OnRedirectToIdentityProviderForSignOut`.
5757

5858
```CSharp
5959
public static IServiceCollection AddAzureAdV2Authentication(this IServiceCollection services,
6060
IConfiguration configuration)
6161
{
62-
...
6362
services.Configure<OpenIdConnectOptions>(AzureADDefaults.OpenIdScheme, options =>
6463
{
65-
...
6664
options.Authority = options.Authority + "/v2.0/";
67-
...
68-
// Attempt to avoid displaying the select account dialog when signing out
65+
6966
options.Events.OnRedirectToIdentityProviderForSignOut = async context =>
7067
{
71-
var user = context.HttpContext.User;
72-
context.ProtocolMessage.LoginHint = user.GetLoginHint();
73-
context.ProtocolMessage.DomainHint = user.GetDomainHint();
74-
await Task.FromResult(0);
68+
//Your logic here
7569
};
7670
}
7771
}

Microsoft.Identity.Web/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This library contains a set of reusable classes useful in Web Applications and W
77
The library contains helper classes to:
88

99
- **Bootstrap the web resource from the Startup.cs file** in your web application by just calling a few methods
10-
- `AddAzureAdV2Authentication` to add authentication with the Microsoft Identity platform (AAD v2.0), including managing the authority validation, and the sign-out.
10+
- `AddAzureAdV2Authentication` to add authentication with the Microsoft Identity platform (AAD v2.0), including managing the authority validation.
1111

1212
```CSharp
1313
services.AddAzureAdV2Authentication();

Microsoft.Identity.Web/StartupHelpers.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,6 @@ public static IServiceCollection AddAzureAdV2Authentication(this IServiceCollect
7878
// Force the account selection (to avoid automatic sign-in with the account signed-in with Windows)
7979
//options.Prompt = "select_account";
8080

81-
// Handling the sign-out
82-
options.Events.OnRedirectToIdentityProviderForSignOut = async context =>
83-
{
84-
var user = context.HttpContext.User;
85-
86-
// Avoid displaying the select account dialog
87-
context.ProtocolMessage.LoginHint = user.GetLoginHint();
88-
context.ProtocolMessage.DomainHint = user.GetDomainHint();
89-
await Task.FromResult(0);
90-
};
91-
9281
// Avoids having users being presented the select account dialog when they are already signed-in
9382
// for instance when going through incremental consent
9483
options.Events.OnRedirectToIdentityProvider = context =>

0 commit comments

Comments
 (0)