Update documentation of spring security adapter registering Filters twice. Two new Keycloak filters were introduced since last update of the documentation. I'm adding them to documentation to be consistent with the code. (#340)

This commit is contained in:
Lubos Palisek 2018-04-06 08:09:02 +02:00 committed by Stian Thorgersen
parent 9bc60d9de1
commit df7a50d1ec

View file

@ -261,7 +261,7 @@ public KeycloakConfigResolver KeycloakConfigResolver() {
====== Avoid double Filter bean registration ====== Avoid double Filter bean registration
Spring Boot attempts to eagerly register filter beans with the web application context. Spring Boot attempts to eagerly register filter beans with the web application context.
Therefore, when running the Keycloak Spring Security adapter in a Spring Boot environment, it may be necessary to add two ``FilterRegistrationBean``s to your security configuration to prevent the Keycloak filters from being registered twice. Therefore, when running the Keycloak Spring Security adapter in a Spring Boot environment, it may be necessary to add ``FilterRegistrationBean``s to your security configuration to prevent the Keycloak filters from being registered twice.
[source,java] [source,java]
@ -290,6 +290,22 @@ public class SecurityConfig extends KeycloakWebSecurityConfigurerAdapter
return registrationBean; return registrationBean;
} }
@Bean
public FilterRegistrationBean keycloakAuthenticatedActionsFilterBean(
KeycloakAuthenticatedActionsFilter filter) {
FilterRegistrationBean registrationBean = new FilterRegistrationBean(filter);
registrationBean.setEnabled(false);
return registrationBean;
}
@Bean
public FilterRegistrationBean keycloakSecurityContextRequestFilterBean(
KeycloakSecurityContextRequestFilter filter) {
FilterRegistrationBean registrationBean = new FilterRegistrationBean(filter);
registrationBean.setEnabled(false);
return registrationBean;
}
... ...
} }
---- ----