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 Details

  • 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

      public String getToken()
    • setToken

      public void setToken(String token)
    • filter

      public void filter(jakarta.ws.rs.client.ClientRequestContext requestContext) throws IOException
      This filter method is called for each request. The method adds teh bearer token into the header.
      Specified by:
      filter in interface jakarta.ws.rs.client.ClientRequestFilter
      Throws:
      IOException