1
带有JdbcTokenStore的Spring OAuth2 - 已使用自定义登录页面,如以下代码片段中所示。无法使用JdbcTokenStore注销Spring OAuth2
来自不同的在线资源here Spring安全似乎有一个内置的终端/注销登录用户,但这似乎并不适用于我。当我点击该端点时,它会重定向回自定义登录页面,这很好,但不一致。使用多个选项卡,有时可以但不是每次都有效。还注意到Spring创建的cookie还没有被清除。
是否有问题WebSecurityConfigurerAdapter定义如下?
@Configuration
@Order(-20)
protected static class LoginConfig extends WebSecurityConfigurerAdapter {
@Autowired
private AuthenticationManager authenticationManager;
@Override
protected void configure(HttpSecurity http) throws Exception {
// @formatter:off
http
.formLogin()
.loginPage("/login")
.permitAll()
.defaultSuccessUrl("/homepage", false)
.failureUrl("/login?error=true")
.and()
.requestMatchers().antMatchers("/login", "/homepage", "/login?error=true", "/oauth/authorize", "/oauth/confirm_access")
.and()
.authorizeRequests().anyRequest().authenticated();
// @formatter:on
}
@Override
protected void configure(AuthenticationManagerBuilder auth) throws Exception {
auth.parentAuthenticationManager(authenticationManager);
}
}
一旦内置的注销功能开始工作,它将是删除在数据库中创建的令牌的理想选择。试了几个潜在的答案online,但他们不工作。任何指针将深受赞赏?
我可以发布更多的代码片段,如果它可以帮助提供更多的清晰度。