1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-04 01:22:50 -05:00

added licensing apis, refactored some services

This commit is contained in:
Kyle Spearrin
2017-08-30 11:23:55 -04:00
parent ccd6b784be
commit 8b947cafaf
11 changed files with 134 additions and 9 deletions

View File

@ -21,7 +21,8 @@ namespace Bit.Core.IdentityServer
"orgadmin",
"orguser"
}),
new ApiResource("api.push", new string[] { JwtClaimTypes.Subject })
new ApiResource("api.push", new string[] { JwtClaimTypes.Subject }),
new ApiResource("api.licensing", new string[] { JwtClaimTypes.Subject })
};
}
}

View File

@ -25,8 +25,7 @@ namespace Bit.Core.IdentityServer
if(clientId.StartsWith("installation."))
{
var idParts = clientId.Split('.');
Guid id;
if(idParts.Length > 1 && Guid.TryParse(idParts[1], out id))
if(idParts.Length > 1 && Guid.TryParse(idParts[1], out Guid id))
{
var installation = await _installationRepository.GetByIdAsync(id);
if(installation != null)
@ -36,7 +35,7 @@ namespace Bit.Core.IdentityServer
ClientId = $"installation.{installation.Id}",
RequireClientSecret = true,
ClientSecrets = { new Secret(installation.Key.Sha256()) },
AllowedScopes = new string[] { "api.push" },
AllowedScopes = new string[] { "api.push", "api.licensing" },
AllowedGrantTypes = GrantTypes.ClientCredentials,
AccessTokenLifetime = 3600 * 24,
Enabled = installation.Enabled,