1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-06 21:48:12 -05:00

[PM-5435] Handle Fido2VerificationException on WebAuthn 2FA (#3615)

* Handle Fido2VerificationException on WebAuthn 2FA

* Linting!
This commit is contained in:
Todd Martin 2024-03-04 11:43:03 -05:00 committed by GitHub
parent 37a22540a9
commit 94d665e6e9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,6 +103,8 @@ public class WebAuthnTokenProvider : IUserTwoFactorTokenProvider<User>
// established ownership in this context.
IsUserHandleOwnerOfCredentialIdAsync callback = (args, cancellationToken) => Task.FromResult(true);
try
{
var res = await _fido2.MakeAssertionAsync(clientResponse, options, webAuthCred.Item2.PublicKey, webAuthCred.Item2.SignatureCounter, callback);
provider.MetaData.Remove("login");
@ -117,6 +119,12 @@ public class WebAuthnTokenProvider : IUserTwoFactorTokenProvider<User>
return res.Status == "ok";
}
catch (Fido2VerificationException)
{
return false;
}
}
private bool HasProperMetaData(TwoFactorProvider provider)
{