From cb5419aca893a62d3df7278eef67dbf48e7f0b97 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Tue, 24 Jan 2017 00:59:14 -0500 Subject: [PATCH] added two factor provider to response and device update on old auth bearer conversion --- src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs b/src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs index bf5b976b16..0a76acdae1 100644 --- a/src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs +++ b/src/Api/IdentityServer/ResourceOwnerPasswordValidator.cs @@ -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 { { "TwoFactorRequired", true } }); + context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "Two factor required.", + new Dictionary { + { "TwoFactorRequired", true }, + { "TwoFactorProvider", ((int?)user.TwoFactorProvider)?.ToString() } }); return; }