I have two applications that are registered as client with Keycloak. First application is custom developed and uses spring security to handle the logout.
Code snippet for logout:
@Bean(name = "logoutFilter")
public LogoutFilter logoutFilter(AdapterDeploymentContext adapterDeploymentContext, KeycloakProperties keycloakProperties) {
KeycloakLogoutHandler firstHandler = new KeycloakLogoutHandler(adapterDeploymentContext);
SecurityContextLogoutHandler secondHandler = new SecurityContextLogoutHandler();
AntPathRequestMatcher matcher = new AntPathRequestMatcher("/sso/logout**", HttpMethod.POST.toString());
LogoutFilter filter = new LogoutFilter(keycloakProperties.getDefaultTargetLogoutUrl(), firstHandler, secondHandler);
filter.setLogoutRequestMatcher(matcher);
return filter;
}
Now user1
is logged in to app1, kibana
and keycloak
. If logout is clicked in app1
, user1
is logged out of app1
& keycloak
applications, but user1
session is still active for kibana
and can access it without any issues.
My expectation is that when I click logout in app1
, session should be terminated and user should be logged out of all sessions/applications.