Hey folks, long time no see,
I’m looking to add some instrumentation (specifically to new relic) for our keycloak without customizing the core server (ideal using a provider or module). Ideally I’d inject a filter into the filter chain of keycloak application after KeycloakSessionServletFilter, but don’t want or think I can mess with the embedded web.xml.
I found this, which works great… kinda, except it doesn’t run in the context of the application which causes me some issues down stream since it’s not actually running in the KeycloakApplication.
I tried going the “RESTEasy” route by adding ContainerRequestFilter but I’m guessing this isn’t getting injected/registered for various reasons, most likely that I’m adding it in a provider and not the core application.
Anyone ever pull something like this off??
— Phil
<servlet>
<servlet-name>Keycloak REST Interface</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServlet30Dispatcher</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>org.keycloak.services.resources.KeycloakApplication</param-value>
</init-param>
<init-param>
<param-name>resteasy.servlet.mapping.prefix</param-name>
<param-value>/</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
<async-supported>true</async-supported>
</servlet>
<listener>
<listener-class>org.keycloak.services.listeners.KeycloakSessionDestroyListener</listener-class>
</listener>
<filter>
<filter-name>Keycloak Session Management</filter-name>
<filter-class>org.keycloak.services.filters.KeycloakSessionServletFilter</filter-class>
<async-supported>true</async-supported>
</filter>