Skip to content

Commit 130fa9b

Browse files
committed
Update SignInManager.cs
1 parent 4964087 commit 130fa9b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/Identity/Core/src/SignInManager.cs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -759,13 +759,12 @@ async Task<PublicKeyCredentialDescriptor[]> GetAllowCredentialsAsync()
759759
var result = await Context.AuthenticateAsync(IdentityConstants.TwoFactorUserIdScheme);
760760
await Context.SignOutAsync(IdentityConstants.TwoFactorUserIdScheme);
761761

762-
if (result?.Principal == null)
762+
if (result?.Principal == null || result.Properties is not { } properties)
763763
{
764764
return null;
765765
}
766766

767-
var optionsJson = result.Properties?.Items[PasskeyCreationOptionsKey];
768-
if (optionsJson == null)
767+
if (!properties.Items.TryGetValue(PasskeyCreationOptionsKey, out var optionsJson) || optionsJson is null)
769768
{
770769
return null;
771770
}
@@ -798,13 +797,12 @@ async Task<PublicKeyCredentialDescriptor[]> GetAllowCredentialsAsync()
798797
var result = await Context.AuthenticateAsync(IdentityConstants.TwoFactorUserIdScheme);
799798
await Context.SignOutAsync(IdentityConstants.TwoFactorUserIdScheme);
800799

801-
if (result?.Principal == null)
800+
if (result?.Principal == null || result.Properties is not { } properties)
802801
{
803802
return null;
804803
}
805804

806-
var optionsJson = result.Properties?.Items[PasskeyRequestOptionsKey];
807-
if (optionsJson == null)
805+
if (!properties.Items.TryGetValue(PasskeyRequestOptionsKey, out var optionsJson) || optionsJson is null)
808806
{
809807
return null;
810808
}

0 commit comments

Comments
 (0)