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:
@ -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 })
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user