mirror of
https://github.com/bitwarden/server.git
synced 2025-04-06 21:48:12 -05:00
added two factor provider to response and device update on old auth bearer conversion
This commit is contained in:
parent
2b14dd320e
commit
cb5419aca8
@ -61,6 +61,7 @@ namespace Bit.Api.IdentityServer
|
|||||||
var user = await _userManager.FindByIdAsync(idClaim.Value);
|
var user = await _userManager.FindByIdAsync(idClaim.Value);
|
||||||
if(user != null && user.SecurityStamp == securityTokenClaim.Value)
|
if(user != null && user.SecurityStamp == securityTokenClaim.Value)
|
||||||
{
|
{
|
||||||
|
var device = await SaveDeviceAsync(user, context);
|
||||||
BuildSuccessResult(user, context, null);
|
BuildSuccessResult(user, context, null);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -76,8 +77,10 @@ namespace Bit.Api.IdentityServer
|
|||||||
{
|
{
|
||||||
if(!twoFactorRequest && await TwoFactorRequiredAsync(user))
|
if(!twoFactorRequest && await TwoFactorRequiredAsync(user))
|
||||||
{
|
{
|
||||||
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "Two factor code required.",
|
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, "Two factor required.",
|
||||||
new Dictionary<string, object> { { "TwoFactorRequired", true } });
|
new Dictionary<string, object> {
|
||||||
|
{ "TwoFactorRequired", true },
|
||||||
|
{ "TwoFactorProvider", ((int?)user.TwoFactorProvider)?.ToString() } });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user