Interface KeycloakAccess
- All Known Implementing Classes:
KeycloakContainer
public interface KeycloakAccess
A facade interface for accessing Keycloak server functionalities.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidassignRoleToUser(String role, String user) Assigns a role to a user in Keycloak.voidcreateRole(String name) Creates a new role in Keycloak with the specified name.voidcreateServiceAccount(String clientId, String clientSecret) Creates a new service account in Keycloak with the specified client ID and client secret.voidcreateUser(String name) Creates a new user in Keycloak.voiddeleteRole(String name) Deletes a role in Keycloak with the specified name.voiddeleteServiceAccount(String clientId) Deletes a service account in Keycloak with the specified client ID.voiddeleteUser(String name) Deletes a user in Keycloak with the specified name.Returns the URL of the Keycloak issuer.Returns the URL of the Keycloak token endpoint.default StringReturns the path of the Keycloak token endpoint.
-
Field Details
-
PRINCIPAL_NAME_CLAIM
The claim name used to identify the principal in Keycloak tokens.- See Also:
-
USER_PASSWORD
The password used for all users in Keycloak.- See Also:
-
-
Method Details
-
getIssuerUrl
URI getIssuerUrl()Returns the URL of the Keycloak issuer. This is typicallyhttps://<keycloak-server>/realms/<realm-name>. -
getTokenEndpoint
URI getTokenEndpoint()Returns the URL of the Keycloak token endpoint. This is typicallyhttps://<keycloak-server>/realms/<realm-name>/protocol/openid-connect/token. -
getTokenPath
Returns the path of the Keycloak token endpoint. This is typically/realms/<realm-name>/protocol/openid-connect/token. -
createRole
Creates a new role in Keycloak with the specified name. The role should not have thePRINCIPAL_ROLE:prefix. -
createUser
Creates a new user in Keycloak. The password is always "s3cr3t" -
assignRoleToUser
Assigns a role to a user in Keycloak. The role should not have thePRINCIPAL_ROLE:prefix. Both the role and the user must exist. -
createServiceAccount
Creates a new service account in Keycloak with the specified client ID and client secret. -
deleteRole
Deletes a role in Keycloak with the specified name. The role should not have thePRINCIPAL_ROLE:prefix. -
deleteUser
Deletes a user in Keycloak with the specified name. -
deleteServiceAccount
Deletes a service account in Keycloak with the specified client ID.
-