try the registered beans , then the handler

This commit is contained in:
sebastienblanc 2017-04-12 10:41:46 +02:00
parent a011f44d39
commit ea9c663ae1

View file

@ -209,7 +209,11 @@ public class KeycloakSpringBootConfiguration {
} }
} }
WebAppContext webAppContext = (WebAppContext) server.getHandler(); WebAppContext webAppContext = server.getBean(WebAppContext.class);
//if not found as registered bean let's try the handler
if(webAppContext==null){
webAppContext = (WebAppContext) server.getHandler();
}
ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler(); ConstraintSecurityHandler securityHandler = new ConstraintSecurityHandler();
securityHandler.setConstraintMappings(jettyConstraintMappings); securityHandler.setConstraintMappings(jettyConstraintMappings);