春季启动,谷歌 auth2 注销

时间:2021-05-10 13:52:23

标签: spring-boot authentication google-oauth spring-security-oauth2 google-login

我正在处理 google oauth2 注销。当 2 gmail 在浏览器中登录时,我正在获取 google 帐户屏幕以选择注销后要使用的帐户。但是当只有一个谷歌帐户登录时,我无法注销。它会自动登录并进入主屏幕。即使在浏览器中登录了一个 Gmail,如何停止自动登录并获得谷歌帐户选择屏幕?

     @Override
public void configure(HttpSecurity httpSecurity) throws Exception {
    httpSecurity.csrf().disable().antMatcher("/**").authorizeRequests()
            .antMatchers("/", "/login","/home","/logout").authenticated()
            .anyRequest().authenticated()
            .and()
            .logout()
            .invalidateHttpSession(true)
            .clearAuthentication(true)
            .logoutSuccessUrl("/oauth2/authorization/google")
            .deleteCookies("JSESSIONID")
            .permitAll()
            .and()
            .oauth2Login()
            .userInfoEndpoint()
            .oidcUserService(oidcUserService());
}

0 个答案:

没有答案