【发布时间】:2019-08-12 22:34:46
【问题描述】:
我的spring security有问题,我尝试在spring security中注销,但似乎不起作用。我请求注销url,但会话和身份验证不明确。
这是一个 spring cloud 应用程序,运行 spring cloud Finchley.RELEASE。使用 zuul、spring security 和 oauth2。
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/login","/login.html").permitAll()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage("/login")
.successHandler(loginSuccessHandler)
.failureHandler(loginFailHandler)
.permitAll()
.and()
.logout()
.logoutRequestMatcher(new AntPathRequestMatcher("/logout"))
.logoutSuccessHandler(logoutHandler)
.clearAuthentication(true)
.deleteCookies("JSESSIONID")
.invalidateHttpSession(true);
http .cors().and().csrf().disable();
}
我希望在请求注销 url 后,身份验证和会话无效
【问题讨论】:
标签: java spring-security spring-security-oauth2