Skip to content

Commit 30b0800

Browse files
authored
reverting part of 23f558d in startup.cs (#105)
1 parent 4413088 commit 30b0800

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

Microsoft.Identity.Web/StartupHelpers.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,17 @@ public static IServiceCollection AddAzureAdV2Authentication(this IServiceCollect
7676
// and [Access Tokens](https://docs.microsoft.com/en-us/azure/active-directory/develop/access-tokens)
7777
options.TokenValidationParameters.NameClaimType = "preferred_username";
7878

79+
// Handling the sign-out
80+
options.Events.OnRedirectToIdentityProviderForSignOut = async context =>
81+
{
82+
var user = context.HttpContext.User;
83+
84+
// Avoid displaying the select account dialog
85+
context.ProtocolMessage.LoginHint = user.GetLoginHint();
86+
context.ProtocolMessage.DomainHint = user.GetDomainHint();
87+
await Task.FromResult(0);
88+
};
89+
7990
// Avoids having users being presented the select account dialog when they are already signed-in
8091
// for instance when going through incremental consent
8192
options.Events.OnRedirectToIdentityProvider = context =>
@@ -154,12 +165,6 @@ public static IServiceCollection AddMsal(this IServiceCollection services, IEnum
154165
// Remove the account from MSAL.NET token cache
155166
var _tokenAcquisition = context.HttpContext.RequestServices.GetRequiredService<ITokenAcquisition>();
156167
await _tokenAcquisition.RemoveAccount(context);
157-
158-
var user = context.HttpContext.User;
159-
160-
// Avoid displaying the select account dialog
161-
context.ProtocolMessage.LoginHint = user.GetLoginHint();
162-
context.ProtocolMessage.DomainHint = user.GetDomainHint();
163168
};
164169
});
165170
return services;

0 commit comments

Comments
 (0)