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

Upgrade Keycloak 17+ (parameterized the endpoint /auth ) #79

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "3.1.202",
"version": "6.0.300",
"rollForward": "latestFeature"
}
}
4 changes: 2 additions & 2 deletions src/Keycloak.Net/AttackDetection/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public async Task<bool> ClearUserLoginFailuresAsync(string realm)
.AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> ClearUserLoginFailuresAsync(string realm, string userId)
Expand All @@ -21,7 +21,7 @@ public async Task<bool> ClearUserLoginFailuresAsync(string realm, string userId)
.AppendPathSegment($"/admin/realms/{realm}/attack-detection/brute-force/users/{userId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<UserNameStatus> GetUserNameStatusInBruteForceDetectionAsync(string realm, string userId) => await GetBaseUrl(realm)
Expand Down
38 changes: 19 additions & 19 deletions src/Keycloak.Net/AuthenticationManagement/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public async Task<bool> UpdateAuthenticatorConfigurationAsync(string realm, stri
.AppendPathSegment($"/admin/realms/{realm}/authentication/config/{configurationId}")
.PutJsonAsync(authenticatorConfig)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> DeleteAuthenticatorConfigurationAsync(string realm, string configurationId)
Expand All @@ -45,7 +45,7 @@ public async Task<bool> DeleteAuthenticatorConfigurationAsync(string realm, stri
.AppendPathSegment($"/admin/realms/{realm}/authentication/config/{configurationId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> AddAuthenticationExecutionAsync(string realm, AuthenticationExecution authenticationExecution)
Expand All @@ -54,7 +54,7 @@ public async Task<bool> AddAuthenticationExecutionAsync(string realm, Authentica
.AppendPathSegment($"/admin/realms/{realm}/authentication/executions")
.PostJsonAsync(authenticationExecution)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<AuthenticationExecutionById> GetAuthenticationExecutionAsync(string realm, string executionId) => await GetBaseUrl(realm)
Expand All @@ -68,7 +68,7 @@ public async Task<bool> DeleteAuthenticationExecutionAsync(string realm, string
.AppendPathSegment($"/admin/realms/{realm}/authentication/executions/{executionId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> UpdateAuthenticationExecutionConfigurationAsync(string realm, string executionId, AuthenticatorConfig authenticatorConfig)
Expand All @@ -77,7 +77,7 @@ public async Task<bool> UpdateAuthenticationExecutionConfigurationAsync(string r
.AppendPathSegment($"/admin/realms/{realm}/authentication/executions/{executionId}/config")
.PostJsonAsync(authenticatorConfig)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> LowerAuthenticationExecutionPriorityAsync(string realm, string executionId)
Expand All @@ -86,7 +86,7 @@ public async Task<bool> LowerAuthenticationExecutionPriorityAsync(string realm,
.AppendPathSegment($"/admin/realms/{realm}/authentication/executions/{executionId}/lower-priority")
.PostAsync(new StringContent(""))
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> RaiseAuthenticationExecutionPriorityAsync(string realm, string executionId)
Expand All @@ -95,7 +95,7 @@ public async Task<bool> RaiseAuthenticationExecutionPriorityAsync(string realm,
.AppendPathSegment($"/admin/realms/{realm}/authentication/executions/{executionId}/raise-priority")
.PostAsync(new StringContent(""))
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> CreateAuthenticationFlowAsync(string realm, AuthenticationFlow authenticationFlow)
Expand All @@ -104,7 +104,7 @@ public async Task<bool> CreateAuthenticationFlowAsync(string realm, Authenticati
.AppendPathSegment($"/admin/realms/{realm}/authentication/flows")
.PostJsonAsync(authenticationFlow)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<AuthenticationFlow>> GetAuthenticationFlowsAsync(string realm) => await GetBaseUrl(realm)
Expand All @@ -118,7 +118,7 @@ public async Task<bool> DuplicateAuthenticationFlowAsync(string realm, string fl
.AppendPathSegment($"/admin/realms/{realm}/authentication/flows/{flowAlias}/copy")
.PostJsonAsync(new Dictionary<string, object> { [nameof(newName)] = newName })
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<AuthenticationFlowExecution>> GetAuthenticationFlowExecutionsAsync(string realm, string flowAlias) => await GetBaseUrl(realm)
Expand All @@ -132,7 +132,7 @@ public async Task<bool> UpdateAuthenticationFlowExecutionsAsync(string realm, st
.AppendPathSegment($"/admin/realms/{realm}/authentication/flows/{flowAlias}/executions")
.PutJsonAsync(authenticationExecutionInfo)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> AddAuthenticationFlowExecutionAsync(string realm, string flowAlias, IDictionary<string, object> dataWithProvider)
Expand All @@ -141,7 +141,7 @@ public async Task<bool> AddAuthenticationFlowExecutionAsync(string realm, string
.AppendPathSegment($"/admin/realms/{realm}/authentication/flows/{flowAlias}/executions/execution")
.PostJsonAsync(dataWithProvider)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> AddAuthenticationFlowAndExecutionToAuthenticationFlowAsync(string realm, string flowAlias, IDictionary<string, object> dataWithAliasTypeProviderDescription)
Expand All @@ -150,7 +150,7 @@ public async Task<bool> AddAuthenticationFlowAndExecutionToAuthenticationFlowAsy
.AppendPathSegment($"/admin/realms/{realm}/authentication/flows/{flowAlias}/executions/flow")
.PostJsonAsync(dataWithAliasTypeProviderDescription)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<AuthenticationFlow> GetAuthenticationFlowByIdAsync(string realm, string flowId) => await GetBaseUrl(realm)
Expand All @@ -164,7 +164,7 @@ public async Task<bool> UpdateAuthenticationFlowAsync(string realm, string flowI
.AppendPathSegment($"/admin/realms/{realm}/authentication/flows/{flowId}")
.PutJsonAsync(authenticationFlow)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> DeleteAuthenticationFlowAsync(string realm, string flowId)
Expand All @@ -173,7 +173,7 @@ public async Task<bool> DeleteAuthenticationFlowAsync(string realm, string flowI
.AppendPathSegment($"/admin/realms/{realm}/authentication/flows/{flowId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<IDictionary<string, object>>> GetFormActionProvidersAsync(string realm) => await GetBaseUrl(realm)
Expand All @@ -197,7 +197,7 @@ public async Task<bool> RegisterRequiredActionAsync(string realm, IDictionary<st
.AppendPathSegment($"/admin/realms/{realm}/authentication/register-required-action")
.PostJsonAsync(dataWithProviderIdName)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<RequiredActionProvider>> GetRequiredActionsAsync(string realm) => await GetBaseUrl(realm)
Expand All @@ -216,7 +216,7 @@ public async Task<bool> UpdateRequiredActionAsync(string realm, string requiredA
.AppendPathSegment($"/admin/realms/{realm}/authentication/required-actions/{requiredActionAlias}")
.PutJsonAsync(requiredActionProvider)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> DeleteRequiredActionAsync(string realm, string requiredActionAlias)
Expand All @@ -225,7 +225,7 @@ public async Task<bool> DeleteRequiredActionAsync(string realm, string requiredA
.AppendPathSegment($"/admin/realms/{realm}/authentication/required-actions/{requiredActionAlias}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> LowerRequiredActionPriorityAsync(string realm, string requiredActionAlias)
Expand All @@ -234,7 +234,7 @@ public async Task<bool> LowerRequiredActionPriorityAsync(string realm, string re
.AppendPathSegment($"/admin/realms/{realm}/authentication/required-actions/{requiredActionAlias}/lower-priority")
.PostAsync(new StringContent(""))
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> RaiseRequiredActionPriorityAsync(string realm, string requiredActionAlias)
Expand All @@ -243,7 +243,7 @@ public async Task<bool> RaiseRequiredActionPriorityAsync(string realm, string re
.AppendPathSegment($"/admin/realms/{realm}/authentication/required-actions/{requiredActionAlias}/raise-priority")
.PostAsync(new StringContent(""))
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<IDictionary<string, object>>> GetUnregisteredRequiredActionsAsync(string realm) => await GetBaseUrl(realm)
Expand Down
6 changes: 3 additions & 3 deletions src/Keycloak.Net/AuthorizationResource/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public async Task<bool> CreateResourceAsync(string realm, string resourceServerI
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/resource")
.PostJsonAsync(resource)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<AuthorizationResource>> GetResourcesAsync(string realm, string resourceServerId = null,
Expand Down Expand Up @@ -49,7 +49,7 @@ public async Task<bool> UpdateResourceAsync(string realm, string resourceServerI
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/resource/{resourceId}")
.PutJsonAsync(resource)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> DeleteResourceAsync(string realm, string resourceServerId, string resourceId)
Expand All @@ -58,7 +58,7 @@ public async Task<bool> DeleteResourceAsync(string realm, string resourceServerI
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/resource/{resourceId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}
}
}
6 changes: 3 additions & 3 deletions src/Keycloak.Net/AuthorizationScope/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public async Task<bool> CreateAuthorizationScopeAsync(string realm, string resou
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/scope")
.PostJsonAsync(scope)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<AuthorizationScope>> GetAuthorizationScopesAsync(string realm, string resourceServerId = null,
Expand Down Expand Up @@ -45,7 +45,7 @@ public async Task<bool> UpdateAuthorizationScopeAsync(string realm, string resou
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/scope/{scopeId}")
.PutJsonAsync(scope)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> DeleteAuthorizationScopeAsync(string realm, string resourceServerId, string scopeId)
Expand All @@ -54,7 +54,7 @@ public async Task<bool> DeleteAuthorizationScopeAsync(string realm, string resou
.AppendPathSegment($"/admin/realms/{realm}/clients/{resourceServerId}/authz/resource-server/scope/{scopeId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}
}
}
8 changes: 4 additions & 4 deletions src/Keycloak.Net/ClientAuthorization/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public async Task<bool> UpdateAuthorizationPermissionAsync(string realm, string
.AppendPathSegment($"/{permission.Id}")
.PutJsonAsync(permission)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> DeleteAuthorizationPermissionAsync(string realm, string clientId, AuthorizationPermissionType permissionType,
Expand All @@ -72,7 +72,7 @@ public async Task<bool> DeleteAuthorizationPermissionAsync(string realm, string
.AppendPathSegment($"/{permissionId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<Policy>> GetAuthorizationPermissionAssociatedPoliciesAsync(string realm, string clientId, string permissionId)
Expand Down Expand Up @@ -171,7 +171,7 @@ public async Task<bool> UpdateRolePolicyAsync(string realm, string clientId, Rol
.AppendPathSegment($"/{policy.Id}")
.PutJsonAsync(policy)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<bool> DeleteRolePolicyAsync(string realm, string clientId, PolicyType policyType, string rolePolicyId)
Expand All @@ -182,7 +182,7 @@ public async Task<bool> DeleteRolePolicyAsync(string realm, string clientId, Pol
.AppendPathSegment($"/{rolePolicyId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}
#endregion
}
Expand Down
2 changes: 1 addition & 1 deletion src/Keycloak.Net/ClientInitialAccess/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public async Task<bool> DeleteInitialAccessTokenAsync(string realm, string clien
.AppendPathSegment($"/admin/realms/{realm}/clients-initial-access/{clientInitialAccessTokenId}")
.DeleteAsync()
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}
}
}
8 changes: 4 additions & 4 deletions src/Keycloak.Net/ClientRoleMappings/KeycloakClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public async Task<bool> AddClientRoleMappingsToGroupAsync(string realm, string g
.AppendPathSegment($"/admin/realms/{realm}/groups/{groupId}/role-mappings/clients/{clientId}")
.PostJsonAsync(roles)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<Role>> GetClientRoleMappingsForGroupAsync(string realm, string groupId, string clientId) => await GetBaseUrl(realm)
Expand All @@ -28,7 +28,7 @@ public async Task<bool> DeleteClientRoleMappingsFromGroupAsync(string realm, str
.AppendPathSegment($"/admin/realms/{realm}/groups/{groupId}/role-mappings/clients/{clientId}")
.SendJsonAsync(HttpMethod.Delete, roles)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<Role>> GetAvailableClientRoleMappingsForGroupAsync(string realm, string groupId, string clientId) => await GetBaseUrl(realm)
Expand All @@ -47,7 +47,7 @@ public async Task<bool> AddClientRoleMappingsToUserAsync(string realm, string us
.AppendPathSegment($"/admin/realms/{realm}/users/{userId}/role-mappings/clients/{clientId}")
.PostJsonAsync(roles)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<Role>> GetClientRoleMappingsForUserAsync(string realm, string userId, string clientId) => await GetBaseUrl(realm)
Expand All @@ -61,7 +61,7 @@ public async Task<bool> DeleteClientRoleMappingsFromUserAsync(string realm, stri
.AppendPathSegment($"/admin/realms/{realm}/users/{userId}/role-mappings/clients/{clientId}")
.SendJsonAsync(HttpMethod.Delete, roles)
.ConfigureAwait(false);
return response.IsSuccessStatusCode;
return response.ResponseMessage.IsSuccessStatusCode;
}

public async Task<IEnumerable<Role>> GetAvailableClientRoleMappingsForUserAsync(string realm, string userId, string clientId) => await GetBaseUrl(realm)
Expand Down
Loading