mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
fix for multiple U2F devices
This commit is contained in:
parent
2743641122
commit
539c7d6e17
1 changed files with 9 additions and 1 deletions
|
@ -157,14 +157,22 @@ namespace BTCPayServer.U2F
|
|||
var authenticationRequest =
|
||||
UserAuthenticationRequests[userId].First(f =>
|
||||
f.KeyHandle.Equals(authenticateResponse.KeyHandle, StringComparison.InvariantCulture));
|
||||
|
||||
var registration = new DeviceRegistration(device.KeyHandle, device.PublicKey,
|
||||
device.AttestationCert, Convert.ToUInt32(device.Counter));
|
||||
|
||||
var authentication = new StartedAuthentication(authenticationRequest.Challenge,
|
||||
authenticationRequest.AppId, authenticationRequest.KeyHandle);
|
||||
|
||||
global::U2F.Core.Crypto.U2F.FinishAuthentication(authentication, authenticateResponse, registration);
|
||||
|
||||
var challengeAuthenticationRequestMatch = UserAuthenticationRequests[userId].First(f =>
|
||||
f.Challenge.Equals( authenticateResponse.GetClientData().Challenge, StringComparison.InvariantCulture));
|
||||
|
||||
if (authentication.Challenge != challengeAuthenticationRequestMatch.Challenge)
|
||||
{
|
||||
authentication = new StartedAuthentication(challengeAuthenticationRequestMatch.Challenge, authenticationRequest.AppId, authenticationRequest.KeyHandle);
|
||||
}
|
||||
global::U2F.Core.Crypto.U2F.FinishAuthentication(authentication, authenticateResponse, registration);
|
||||
|
||||
UserAuthenticationRequests.AddOrReplace(userId, new List<U2FDeviceAuthenticationRequest>());
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue