Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/aspnetcore.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/Identity/Core/src/SignInManager.cs')
-rw-r--r--src/Identity/Core/src/SignInManager.cs11
1 files changed, 3 insertions, 8 deletions
diff --git a/src/Identity/Core/src/SignInManager.cs b/src/Identity/Core/src/SignInManager.cs
index e6af0da9de..9b93a56d23 100644
--- a/src/Identity/Core/src/SignInManager.cs
+++ b/src/Identity/Core/src/SignInManager.cs
@@ -652,26 +652,21 @@ public class SignInManager<TUser> where TUser : class
{
var auth = await Context.AuthenticateAsync(IdentityConstants.ExternalScheme);
var items = auth?.Properties?.Items;
- if (auth?.Principal == null || items == null || !items.ContainsKey(LoginProviderKey))
+ if (auth?.Principal == null || items == null || !items.TryGetValue(LoginProviderKey, out var provider))
{
return null;
}
if (expectedXsrf != null)
{
- if (!items.ContainsKey(XsrfKey))
- {
- return null;
- }
- var userId = items[XsrfKey] as string;
- if (userId != expectedXsrf)
+ if (!items.TryGetValue(XsrfKey, out var userId) ||
+ userId != expectedXsrf)
{
return null;
}
}
var providerKey = auth.Principal.FindFirstValue(ClaimTypes.NameIdentifier);
- var provider = items[LoginProviderKey] as string;
if (providerKey == null || provider == null)
{
return null;