1
0
mirror of https://github.com/bitwarden/server synced 2025-12-28 14:13:48 +00:00

yubikey setup for 2FA

This commit is contained in:
Kyle Spearrin
2017-06-20 14:12:31 -04:00
parent 612697e815
commit 69de88cc32
4 changed files with 115 additions and 7 deletions

View File

@@ -32,7 +32,7 @@ namespace Bit.Core.Identity
public Task<bool> ValidateAsync(string purpose, string token, UserManager<User> manager, User user)
{
if(token.Length != 44)
if(string.IsNullOrWhiteSpace(token) || token.Length != 44)
{
return Task.FromResult(false);
}
@@ -45,7 +45,7 @@ namespace Bit.Core.Identity
return Task.FromResult(false);
}
var client = new YubicoClient(_globalSettings.Yubico.ClientId, _globalSettings.Yubico.ClientId);
var client = new YubicoClient(_globalSettings.Yubico.ClientId, _globalSettings.Yubico.Key);
var response = client.Verify(token);
return Task.FromResult(response.Status == YubicoResponseStatus.Ok);
}