Commit 1d12658a authored by Jason Song's avatar Jason Song Committed by GitHub

fix the issue that an immediate login after logout will be redirected to signin page (#2633)

parent 40c5e478
...@@ -273,11 +273,10 @@ public class AuthConfiguration { ...@@ -273,11 +273,10 @@ public class AuthConfiguration {
http.authorizeRequests() http.authorizeRequests()
.antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll() .antMatchers("/prometheus/**","/metrics/**","/openapi/**", "/vendor/**", "/styles/**", "/scripts/**", "/views/**", "/img/**").permitAll()
.antMatchers("/**").hasAnyRole(USER_ROLE); .antMatchers("/**").hasAnyRole(USER_ROLE);
http.formLogin().loginPage("/signin").permitAll().failureUrl("/signin?#/error").and().httpBasic(); http.formLogin().loginPage("/signin").defaultSuccessUrl("/", true).permitAll().failureUrl("/signin?#/error").and()
SimpleUrlLogoutSuccessHandler urlLogoutHandler = new SimpleUrlLogoutSuccessHandler(); .httpBasic();
urlLogoutHandler.setDefaultTargetUrl("/signin?#/logout");
http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true) http.logout().logoutUrl("/user/logout").invalidateHttpSession(true).clearAuthentication(true)
.logoutSuccessHandler(urlLogoutHandler); .logoutSuccessUrl("/signin?#/logout");
http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin")); http.exceptionHandling().authenticationEntryPoint(new LoginUrlAuthenticationEntryPoint("/signin"));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment