1
0
mirror of https://github.com/bitwarden/server synced 2026-01-05 10:03:23 +00:00

public and private keys added to db and user domain. added account APIs got getting and putting keys.

This commit is contained in:
Kyle Spearrin
2017-02-11 23:00:55 -05:00
parent 7589f9c933
commit 024ee08907
6 changed files with 75 additions and 4 deletions

View File

@@ -118,8 +118,13 @@ namespace Bit.Api.IdentityServer
claims.Add(new Claim("device", device.Identifier));
}
context.Result = new GrantValidationResult(user.Id.ToString(), "Application", identityProvider: "bitwarden",
claims: claims.Count > 0 ? claims : null);
context.Result = new GrantValidationResult(user.Id.ToString(), "Application",
identityProvider: "bitwarden",
claims: claims.Count > 0 ? claims : null,
customResponse: new Dictionary<string, object>
{
{ "PrivateKey", user.PrivateKey }
});
}
private void BuildTwoFactorResult(User user, ResourceOwnerPasswordValidationContext context)
@@ -139,8 +144,8 @@ namespace Bit.Api.IdentityServer
private void BuildErrorResult(bool twoFactorRequest, ResourceOwnerPasswordValidationContext context)
{
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant, customResponse:
new Dictionary<string, object>
context.Result = new GrantValidationResult(TokenRequestErrors.InvalidGrant,
customResponse: new Dictionary<string, object>
{{
"ErrorModel", new ErrorResponseModel(twoFactorRequest ?
"Code is not correct. Try again." : "Username or password is incorrect. Try again.")