Class KeycloakServlet

  • All Implemented Interfaces:
    java.io.Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

    public class KeycloakServlet
    extends javax.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:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor Description
      KeycloakServlet()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.String defaultKeycloakConfigLocation()
      Will try to guess the config location based on the server where hawtio is running.
      protected void doGet​(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)  
      void init()  
      protected boolean validateKeycloakUser​(javax.servlet.http.HttpServletRequest request, java.lang.String keycloakUser)  
      • Methods inherited from class javax.servlet.http.HttpServlet

        doDelete, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service, service
      • Methods inherited from class javax.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 Detail

      • KEYCLOAK_CLIENT_CONFIG

        public static final java.lang.String KEYCLOAK_CLIENT_CONFIG
        See Also:
        Constant Field Values
      • HAWTIO_KEYCLOAK_CLIENT_CONFIG

        public static final java.lang.String HAWTIO_KEYCLOAK_CLIENT_CONFIG
        See Also:
        Constant Field Values
    • Constructor Detail

      • KeycloakServlet

        public KeycloakServlet()
    • Method Detail

      • init

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

        protected java.lang.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​(javax.servlet.http.HttpServletRequest request,
                             javax.servlet.http.HttpServletResponse response)
                      throws java.io.IOException
        Overrides:
        doGet in class javax.servlet.http.HttpServlet
        Throws:
        java.io.IOException
      • validateKeycloakUser

        protected boolean validateKeycloakUser​(javax.servlet.http.HttpServletRequest request,
                                               java.lang.String keycloakUser)