Class KeycloakServlet

java.lang.Object
jakarta.servlet.GenericServlet
jakarta.servlet.http.HttpServlet
io.hawt.web.auth.keycloak.KeycloakServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable

public class KeycloakServlet extends jakarta.servlet.http.HttpServlet
Servlet, which aims to return: - whether keycloak is enabled (true/false) if path '/enabled' is used - keycloak.json to be used by keycloak JS adapter on frontend if path '/client-config' is used - validate if current JAAS logged subject is same like SSO user logged through keycloak if path '/validate-subject-matches' is used
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     
    static final String
    Keycloak config file used for frontend.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    Will try to guess the config location based on the server where hawtio is running.
    protected void
    doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
     
    void
     
    protected boolean
    validateKeycloakUser(jakarta.servlet.http.HttpServletRequest request, String keycloakUser)
     

    Methods inherited from class jakarta.servlet.http.HttpServlet

    doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service

    Methods inherited from class jakarta.servlet.GenericServlet

    destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • KEYCLOAK_CLIENT_CONFIG

      public static final String KEYCLOAK_CLIENT_CONFIG
      Keycloak config file used for frontend. Will use default location if not provided.
      See Also:
    • HAWTIO_KEYCLOAK_CLIENT_CONFIG

      public static final String HAWTIO_KEYCLOAK_CLIENT_CONFIG
      See Also:
  • Constructor Details

    • KeycloakServlet

      public KeycloakServlet()
  • Method Details

    • init

      public void init()
      Overrides:
      init in class jakarta.servlet.GenericServlet
    • defaultKeycloakConfigLocation

      protected String defaultKeycloakConfigLocation()
      Will try to guess the config location based on the server where hawtio is running. Used just if keycloakClientConfig is not provided
      Returns:
      config to be used by default
    • doGet

      protected void doGet(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response) throws IOException
      Overrides:
      doGet in class jakarta.servlet.http.HttpServlet
      Throws:
      IOException
    • validateKeycloakUser

      protected boolean validateKeycloakUser(jakarta.servlet.http.HttpServletRequest request, String keycloakUser)