Java Code Examples for org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter#setExceptionIfHeaderMissing()

The following examples show how to use org.springframework.security.web.authentication.preauth.RequestHeaderAuthenticationFilter#setExceptionIfHeaderMissing() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SecurityConfiguration.java    From syndesis with Apache License 2.0 6 votes vote down vote up
@SuppressWarnings("PMD.SignatureDeclareThrowsException")
private RequestHeaderAuthenticationFilter requestHeaderAuthenticationFilter() throws Exception {
    RequestHeaderAuthenticationFilter f = new RequestHeaderAuthenticationFilter();
    f.setPrincipalRequestHeader("X-Forwarded-User");
    f.setCredentialsRequestHeader("X-Forwarded-Access-Token");
    f.setAuthenticationManager(authenticationManager());
    f.setAuthenticationDetailsSource(
        (AuthenticationDetailsSource<HttpServletRequest, PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails>)
            (request) ->new PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails(
                request,
                AuthorityUtils.createAuthorityList("ROLE_AUTHENTICATED")
            )
    );
    f.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler());
    f.setExceptionIfHeaderMissing(false);
    return f;
}
 
Example 2
Source File: SecurityConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public RequestHeaderAuthenticationFilter headerAuthenticationFilter() throws Exception {
    RequestHeaderAuthenticationFilter requestHeaderAuthenticationFilter = new RequestHeaderAuthenticationFilter();
    requestHeaderAuthenticationFilter.setPrincipalRequestHeader("x-cdp-actor-crn");
    requestHeaderAuthenticationFilter.setAuthenticationManager(authenticationManager());
    requestHeaderAuthenticationFilter.setExceptionIfHeaderMissing(false);
    requestHeaderAuthenticationFilter.setContinueFilterChainOnUnsuccessfulAuthentication(true);
    return requestHeaderAuthenticationFilter;
}
 
Example 3
Source File: SecurityConfig.java    From cloudbreak with Apache License 2.0 5 votes vote down vote up
@Bean
public RequestHeaderAuthenticationFilter headerAuthenticationFilter() throws Exception {
    RequestHeaderAuthenticationFilter requestHeaderAuthenticationFilter = new RequestHeaderAuthenticationFilter();
    requestHeaderAuthenticationFilter.setPrincipalRequestHeader("x-cdp-actor-crn");
    requestHeaderAuthenticationFilter.setAuthenticationManager(authenticationManager());
    requestHeaderAuthenticationFilter.setExceptionIfHeaderMissing(false);
    requestHeaderAuthenticationFilter.setContinueFilterChainOnUnsuccessfulAuthentication(true);
    return requestHeaderAuthenticationFilter;
}