Package org.imixs.archive.service.util
Class KeycloakAuthenticator
java.lang.Object
org.imixs.archive.service.util.KeycloakAuthenticator
- All Implemented Interfaces:
jakarta.ws.rs.client.ClientRequestFilter
public class KeycloakAuthenticator
extends Object
implements jakarta.ws.rs.client.ClientRequestFilter
This RequestFilter performs a keycloak authentication.
The client configuration is defined in a keycloak.json file as follows:
{
"realm": "imixs-office-workflow",
"auth-server-url" : "https://my.keycloak.host/",
"resource" : "the clientid",
"credentials": {
"secret": "xxx"
}
}
- Author:
- rsoika
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionKeycloakAuthenticator(String _baseUri, String username, String password) Creates a new FormAuthenticator based on a baseUri and a username, password. -
Method Summary
-
Field Details
-
KEYCLOAK_ENDPOINT
- See Also:
-
KEYCLOAK_REALM
- See Also:
-
KEYCLOAK_CLIENTID
- See Also:
-
KEYCLOAK_SECRET
- See Also:
-
-
Constructor Details
-
KeycloakAuthenticator
public KeycloakAuthenticator(String _baseUri, String username, String password) throws org.imixs.melman.RestAPIException Creates a new FormAuthenticator based on a baseUri and a username, password. The constructor post the user credentials to the endpoint /j_security_check to receive a JSESSIONID.- Parameters:
_baseUri-username-password-- Throws:
org.imixs.melman.RestAPIException
-
-
Method Details
-
readConfig
public void readConfig() -
getToken
-
setToken
-
filter
This filter method is called for each request. The method adds teh bearer token into the header.- Specified by:
filterin interfacejakarta.ws.rs.client.ClientRequestFilter- Throws:
IOException
-