Spring boot 弹簧启动OAuth2sso
我使用@EnableOath2Sso注释成功地将客户端与OIDC提供程序集成。然而,对于注销,我有点挣扎。提供程序需要idToken作为注销请求的参数。我的设置是:Spring boot 弹簧启动OAuth2sso,spring-boot,spring-security,Spring Boot,Spring Security,我使用@EnableOath2Sso注释成功地将客户端与OIDC提供程序集成。然而,对于注销,我有点挣扎。提供程序需要idToken作为注销请求的参数。我的设置是: @EnableOAuth2Sso @Configuration public class OpenIDConnectConfig extends WebSecurityConfigurerAdapter { public void configure(HttpSecurity http) throws Exception {
@EnableOAuth2Sso
@Configuration
public class OpenIDConnectConfig extends WebSecurityConfigurerAdapter {
public void configure(HttpSecurity http) throws Exception {
http.antMatcher("/**").
authorizeRequests().
anyRequest().authenticated().and().
logout().logoutSuccessHandler(this::onLogout).and().
csrf().csrfTokenRepository(CookieCsrfTokenRepository.withHttpOnlyFalse());
}
public void onLogout(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
}
如何从onLogout方法访问idToken,以便重定向到指向OIDC提供程序的正确URL?检查
身份验证
对象,它可能在那里,具体取决于您如何处理身份验证对象的设置。如果没有,您可以扩展主体来存储它。不幸的是,它不包含id令牌。我还没有找到如何重写设置autentication对象的代码。