1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 17:42:49 -05:00
This commit is contained in:
Oscar Hinton
2021-03-22 23:21:43 +01:00
committed by GitHub
parent 905b4b06da
commit 07f37d1f74
19 changed files with 567 additions and 194 deletions

View File

@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Security.Claims;
using System.Text.Json;
using System.Threading.Tasks;
using Bit.Core.Services;
using System.Linq;
@ -367,6 +368,7 @@ namespace Bit.Core.IdentityServer
case TwoFactorProviderType.Duo:
case TwoFactorProviderType.YubiKey:
case TwoFactorProviderType.U2f:
case TwoFactorProviderType.WebAuthn:
case TwoFactorProviderType.Remember:
if (type != TwoFactorProviderType.Remember &&
!(await _userService.TwoFactorProviderIsEnabledAsync(type, user)))
@ -394,6 +396,7 @@ namespace Bit.Core.IdentityServer
{
case TwoFactorProviderType.Duo:
case TwoFactorProviderType.U2f:
case TwoFactorProviderType.WebAuthn:
case TwoFactorProviderType.Email:
case TwoFactorProviderType.YubiKey:
if (!(await _userService.TwoFactorProviderIsEnabledAsync(type, user)))
@ -421,6 +424,10 @@ namespace Bit.Core.IdentityServer
["Challenges"] = tokens != null && tokens.Length > 1 ? tokens[1] : null
};
}
else if (type == TwoFactorProviderType.WebAuthn)
{
return JsonSerializer.Deserialize<Dictionary<string, object>>(token);
}
else if (type == TwoFactorProviderType.Email)
{
return new Dictionary<string, object>