Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating client-related sub-entities should return ids and not bool. #33

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/Keycloak.Net.Core/AuthorizationResource/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ namespace Keycloak.Net
{
public partial class KeycloakClient
{
public async Task<bool> CreateResourceAsync(string realm, string resourceServerId, AuthorizationResource resource, CancellationToken cancellationToken = default)
public async Task<string> CreateResourceAsync(string realm, string resourceServerId, AuthorizationResource resource, CancellationToken cancellationToken = default)
{
var response = await GetBaseUrl(realm)
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/resource")
.PostJsonAsync(resource, cancellationToken)
.ReceiveJson<AuthorizationResource>()
.ConfigureAwait(false);
return response.ResponseMessage.IsSuccessStatusCode;
return response.Id;
}

public async Task<IEnumerable<AuthorizationResource>> GetResourcesAsync(string realm, string resourceServerId = null,
Expand Down
5 changes: 3 additions & 2 deletions src/Keycloak.Net.Core/AuthorizationScope/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ namespace Keycloak.Net
{
public partial class KeycloakClient
{
public async Task<bool> CreateAuthorizationScopeAsync(string realm, string resourceServerId, AuthorizationScope scope, CancellationToken cancellationToken = default)
public async Task<string> CreateAuthorizationScopeAsync(string realm, string resourceServerId, AuthorizationScope scope, CancellationToken cancellationToken = default)
{
var response = await GetBaseUrl(realm)
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/scope")
.PostJsonAsync(scope, cancellationToken)
.ReceiveJson<AuthorizationScope>()
.ConfigureAwait(false);
return response.ResponseMessage.IsSuccessStatusCode;
return response.Id;
}

public async Task<IEnumerable<AuthorizationScope>> GetAuthorizationScopesAsync(string realm, string resourceServerId = null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public async Task<GroupPolicy> CreateGroupPolicyAsync(string realm, string clien
{
var response = await GetBaseUrl(realm)
.AppendPathSegment($"/admin/realms/{realm}/clients/{clientId}/authz/resource-server/policy")
.AppendPathSegment(policy.Type == PolicyType.User ? "/group" : string.Empty)
.AppendPathSegment(policy.Type == PolicyType.Group ? "/group" : string.Empty)
.PostJsonAsync(policy, cancellationToken)
.ReceiveJson<GroupPolicy>()
.ConfigureAwait(false);
Expand Down
3 changes: 3 additions & 0 deletions src/Keycloak.Net.Core/Models/Clients/RolePolicy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@ public class GroupConfig

[JsonProperty("path")]
public string Path { get; set; }

[JsonProperty("extendChildren")]
public bool ExtendChildren { get; set; }
}

public enum PolicyType
Expand Down