mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 15:42:48 -05:00
[AC-292] Public Api - allow configuration of custom permissions (#4022)
* Also refactor OrganizationService user invite methods
This commit is contained in:
@ -61,4 +61,23 @@ public class IdentityApplicationFactory : WebApplicationFactoryBase<Startup>
|
||||
|
||||
return root.GetProperty("access_token").GetString();
|
||||
}
|
||||
|
||||
public async Task<string> TokenFromOrganizationApiKeyAsync(string clientId, string clientSecret,
|
||||
DeviceType deviceType = DeviceType.FirefoxBrowser)
|
||||
{
|
||||
var context = await Server.PostAsync("/connect/token",
|
||||
new FormUrlEncodedContent(new Dictionary<string, string>
|
||||
{
|
||||
{ "scope", "api.organization" },
|
||||
{ "client_id", clientId },
|
||||
{ "client_secret", clientSecret },
|
||||
{ "grant_type", "client_credentials" },
|
||||
{ "deviceType", ((int)deviceType).ToString() }
|
||||
}));
|
||||
|
||||
using var body = await AssertHelper.AssertResponseTypeIs<JsonDocument>(context);
|
||||
var root = body.RootElement;
|
||||
|
||||
return root.GetProperty("access_token").GetString();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user