List of usage examples for org.springframework.security.web.authentication.logout SimpleUrlLogoutSuccessHandler setUseReferer
public void setUseReferer(boolean useReferer)
From source file:cn.edu.zjnu.acm.judge.config.SecurityConfiguration.java
@Override protected void configure(HttpSecurity http) throws Exception { SimpleUrlAuthenticationSuccessHandler simpleUrlAuthenticationSuccessHandler = new JudgeAuthenticationSuccessHandler( "/"); simpleUrlAuthenticationSuccessHandler.setUseReferer(false); simpleUrlAuthenticationSuccessHandler.setTargetUrlParameter("url"); DefaultRedirectStrategy defaultRedirectStrategy = new DefaultRedirectStrategy(); simpleUrlAuthenticationSuccessHandler.setRedirectStrategy(defaultRedirectStrategy); SimpleUrlLogoutSuccessHandler simpleUrlLogoutSuccessHandler = new SimpleUrlLogoutSuccessHandler(); simpleUrlLogoutSuccessHandler.setUseReferer(true); // @formatter:off http.authorizeRequests().antMatchers(ckfinder.getServlet().getPath()).hasAnyRole("ADMIN").and().csrf() .disable().exceptionHandling().authenticationEntryPoint(authenticationEntryPoint()).and() .formLogin().loginPage("/login").usernameParameter("user_id1").passwordParameter("password1") .successHandler(simpleUrlAuthenticationSuccessHandler).failureHandler(failureHandler()).permitAll() .and().headers().cacheControl().disable().httpStrictTransportSecurity().disable().frameOptions() .sameOrigin().and().logout().logoutUrl("/logout") .logoutSuccessHandler(simpleUrlLogoutSuccessHandler).permitAll().and().rememberMe() .rememberMeParameter("rememberMe").tokenRepository(persistentTokenRepository).and().requestCache() .requestCache(new NullRequestCache()).and().servletApi(); // @formatter:on }