1
0
mirror of https://github.com/bitwarden/server synced 2026-01-18 16:33:29 +00:00

yubico global settings

This commit is contained in:
Kyle Spearrin
2017-06-14 22:40:33 -04:00
parent c30efcaef0
commit 1fc441b6e8
4 changed files with 21 additions and 1 deletions

View File

@@ -9,6 +9,13 @@ namespace Bit.Core.Identity
{
public class YubicoOtpTokenProvider : IUserTwoFactorTokenProvider<User>
{
private readonly GlobalSettings _globalSettings;
public YubicoOtpTokenProvider(GlobalSettings globalSettings)
{
_globalSettings = globalSettings;
}
public Task<bool> CanGenerateTwoFactorTokenAsync(UserManager<User> manager, User user)
{
var provider = user.GetTwoFactorProvider(TwoFactorProviderType.YubiKey);
@@ -41,7 +48,7 @@ namespace Bit.Core.Identity
return Task.FromResult(false);
}
var client = new YubicoClient("TODO", "TODO");
var client = new YubicoClient(_globalSettings.Yubico.ClientId, _globalSettings.Yubico.ClientId);
var response = client.Verify(token);
return Task.FromResult(response.Status == YubicoResponseStatus.Ok);
}