use of com.evolveum.midpoint.authentication.impl.filter.MidpointRequestHeaderAuthenticationFilter in project midpoint by Evolveum.
the class HttpHeaderModuleWebSecurityConfigurer method requestHeaderAuthenticationFilter.
private RequestHeaderAuthenticationFilter requestHeaderAuthenticationFilter() {
MidpointRequestHeaderAuthenticationFilter filter = new MidpointRequestHeaderAuthenticationFilter();
filter.setPrincipalRequestHeader(getConfiguration().getPrincipalRequestHeader());
filter.setExceptionIfHeaderMissing(false);
filter.setAuthenticationManager(authenticationManager);
filter.setAuthenticationFailureHandler(new MidpointAuthenticationFailureHandler() {
@Override
protected String getPathAfterUnsuccessfulAuthentication(AuthenticationChannel authenticationChannel) {
return "/error/401";
}
});
MidPointAuthenticationSuccessHandler successHandler = new MidPointAuthenticationSuccessHandler() {
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws ServletException, IOException {
if (getRequestCache().getRequest(request, response) == null) {
getRequestCache().saveRequest(request, response);
}
super.onAuthenticationSuccess(request, response, authentication);
}
};
filter.setAuthenticationSuccessHandler(getObjectPostProcessor().postProcess(successHandler));
filter.setSessionRegistry(getSessionRegistry());
return filter;
}
Aggregations