public class KeycloakClientHelper extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Constructor and Description |
|---|
KeycloakClientHelper() |
| Modifier and Type | Method and Description |
|---|---|
static TokenResponse |
getTokenForUser(String context,
String username,
String password)
Gets a new
TokenResponse, containing the AccessToken and the
RefreshToken from the Keycloak server in the environment of the
context represented by the context parameter. |
static void |
setDefaultGWClientID(String gatewayClientId)
Sets the new default GW
clientId used for all the queries to the
Keycloak server. |
public static void setDefaultGWClientID(String gatewayClientId)
clientId used for all the queries to the
Keycloak server.
Note: The operation will logged as WARN to be visible.gatewayClientId - the new GW clientIdpublic static TokenResponse getTokenForUser(String context, String username, String password) throws KeycloakClientException
TokenResponse, containing the AccessToken and the
RefreshToken from the Keycloak server in the environment of the
context represented by the context parameter.
The context parameter is also used as audience for the token.context - the context ot be used for discovery and for audienceusername - the user's usernamepassword - the user's passwordKeycloakClientException - if an error occurs during the processCopyright © 2025. All rights reserved.