1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-16 01:51:21 +01:00

added two factor provider to response and device update on old auth bearer conversion

This commit is contained in:
Kyle Spearrin 2017-01-24 00:59:14 -05:00
parent 2b14dd320e
commit cb5419aca8

View File

@ -61,6 +61,7 @@ namespace Bit.Api.IdentityServer
var user = await _userManager.FindByIdAsync(idClaim.Value);
if(user != null && user.SecurityStamp == securityTokenClaim.Value)
{
var device = await SaveDeviceAsync(user, context);
BuildSuccessResult(user, context, null);
return;
}
@ -76,8 +77,10 @@ namespace Bit.Api.IdentityServer
{
if(!twoFactorRequest && await TwoFactorRequiredAsync(user))
{
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "Two factor code required.",
new Dictionary<string, object> { { "TwoFactorRequired", true } });
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "Two factor required.",
new Dictionary<string, object> {
{ "TwoFactorRequired", true },
{ "TwoFactorProvider", ((int?)user.TwoFactorProvider)?.ToString() } });
return;
}