首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Spring Boot,安全OAuth2谷歌注销,无自动登录

Spring Boot,安全OAuth2谷歌注销,无自动登录
EN

Stack Overflow用户
提问于 2020-06-12 03:47:43
回答 1查看 251关注 0票数 1

我的配置是:

代码语言:javascript
运行
复制
@Configuration
@EnableWebSecurity(debug = false)
@EnableGlobalMethodSecurity(securedEnabled = true)
public class SecurityConfig extends WebSecurityConfigurerAdapter {

  @Autowired
  private SaveNewOidcUserService saveNewOidcUserService;

  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http
      .authorizeRequests()
      .anyRequest().authenticated()
      .and()
      .logout()
      .clearAuthentication(true)
      .invalidateHttpSession(true)
      .deleteCookies("JSESSIONID")
      .logoutUrl("/logout")
      .logoutSuccessUrl("/")
      .permitAll()
      .and()
      .oauth2Login()
      .userInfoEndpoint()
      .oidcUserService(saveNewOidcUserService);
  }
}

版本:

代码语言:javascript
运行
复制
spring-security-oauth2-client 5.3.2.RELEASE
spring-boot-starter-security  2.3.0.RELEASE

我通过谷歌登录我的应用程序,注销我的应用程序后,我在火狐控制台日志中看到有GET到/login页面,所以如果我仍然登录谷歌,我的安全应用程序的内容会显示(因为自动登录),但应该要求通过谷歌登录屏幕选择帐户等。

如何强制注销后不自动登录?

EN

回答 1

Stack Overflow用户

发布于 2020-06-12 16:24:12

我加完后就解决了

代码语言:javascript
运行
复制
.exceptionHandling()
.defaultAuthenticationEntryPointFor(
  customAuthEP(),
  new AntPathRequestMatcher("/**")
)

就像这里https://stackoverflow.com/a/15875641/13729723

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/62332377

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档