Example usage for org.springframework.security.web.authentication SimpleUrlAuthenticationFailureHandler SimpleUrlAuthenticationFailureHandler

List of usage examples for org.springframework.security.web.authentication SimpleUrlAuthenticationFailureHandler SimpleUrlAuthenticationFailureHandler

Introduction

In this page you can find the example usage for org.springframework.security.web.authentication SimpleUrlAuthenticationFailureHandler SimpleUrlAuthenticationFailureHandler.

Prototype

public SimpleUrlAuthenticationFailureHandler() 

Source Link

Usage

From source file:com.allanditzel.dashboard.config.SecurityConfig.java

@Override
protected void configure(HttpSecurity http) throws Exception {
    CsrfTokenResponseHeaderBindingFilter csrfFilter = csrfTokenResponseHeaderBindingFilter();

    http.addFilterAfter(csrfFilter, CsrfFilter.class).headers().cacheControl().xssProtection().and()
            .authorizeRequests().antMatchers("/static/bower_components/**").permitAll()
            .antMatchers("/static/login*.js").permitAll().antMatchers("/static/login*.css").permitAll()
            .antMatchers("/static/dashboard*.js").authenticated().antMatchers("/static/dashboard*.css")
            .authenticated().antMatchers("/static/DashboardApp/**").authenticated().anyRequest().authenticated()
            .and().formLogin().loginPage("/index.html").defaultSuccessUrl("/home.html", true)
            .successHandler(localUserPersistingAuthenticationSuccessHandler())
            .failureHandler(new SimpleUrlAuthenticationFailureHandler()).permitAll().and().logout()
            .logoutUrl("/logout").logoutSuccessUrl("/index.html").invalidateHttpSession(true).and()
            .requiresChannel().anyRequest().requiresSecure();
}

From source file:io.syndesis.runtime.SecurityConfiguration.java

@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(/*from   ww w  .  j a va2  s . c o  m*/
            (AuthenticationDetailsSource<HttpServletRequest, PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails>) (
                    request) -> new PreAuthenticatedGrantedAuthoritiesWebAuthenticationDetails(request,
                            AuthorityUtils.createAuthorityList("ROLE_AUTHENTICATED")));
    f.setAuthenticationFailureHandler(new SimpleUrlAuthenticationFailureHandler());
    f.setExceptionIfHeaderMissing(false);
    return f;
}

From source file:com.naveen.demo.config.Saml2SSOConfig.java

@Bean
public SimpleUrlAuthenticationFailureHandler authenticationFailureHandler() {
    SimpleUrlAuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
    failureHandler.setUseForward(true);/*from  www  .  j  av  a  2s . co  m*/
    failureHandler.setDefaultFailureUrl("/error");
    return failureHandler;
}

From source file:com.netflix.genie.web.security.saml.SAMLConfig.java

/**
 * Handler deciding where to redirect user after failed login.
 *
 * @return Authentication failure handler
 * @see SimpleUrlAuthenticationFailureHandler
 *//*from   w ww .  java2  s .  c om*/
@Bean
public SimpleUrlAuthenticationFailureHandler authenticationFailureHandler() {
    final SimpleUrlAuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
    failureHandler.setUseForward(true);
    failureHandler.setDefaultFailureUrl("/error");
    return failureHandler;
}

From source file:org.opentestsystem.ap.iat.config.SecurityConfig.java

@Bean
public SimpleUrlAuthenticationFailureHandler authenticationFailureHandler() {
    SimpleUrlAuthenticationFailureHandler failureHandler = new SimpleUrlAuthenticationFailureHandler();
    failureHandler.setUseForward(true);//from  w w w  . j  a  v  a  2  s  . c  om
    failureHandler.setDefaultFailureUrl(LANDING);
    return failureHandler;
}

From source file:org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilterTests.java

@Before
public void setUp() throws Exception {
    successHandler = new SavedRequestAwareAuthenticationSuccessHandler();
    successHandler.setDefaultTargetUrl("/logged_in.jsp");
    failureHandler = new SimpleUrlAuthenticationFailureHandler();
    failureHandler.setDefaultFailureUrl("/failed.jsp");
    SecurityContextHolder.clearContext();
}