Spring security SpringSecurity5和OAuth2-未调用成功处理程序,登录后将进入无限循环

Spring security SpringSecurity5和OAuth2-未调用成功处理程序,登录后将进入无限循环,spring-security,spring-security-oauth2,Spring Security,Spring Security Oauth2,我正在尝试将SpringSecurity迁移到最新版本(SpringSecurity5.2.2和CloudOAuth2)。由于@enableAuth2Client现在处于维护模式,我尝试将http.oauth2Login()与customization for success处理程序一起使用。下面是我的安全课- @Configuration public class OAuth2SecurityConfig extends WebSecurityConfigurerAdapter {

我正在尝试将SpringSecurity迁移到最新版本(SpringSecurity5.2.2和CloudOAuth2)。由于@enableAuth2Client现在处于维护模式,我尝试将http.oauth2Login()与customization for success处理程序一起使用。下面是我的安全课-

@Configuration
public class OAuth2SecurityConfig extends WebSecurityConfigurerAdapter {

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.authorizeRequests()
         .anyRequest().authenticated()
         .and()
         .oauth2Login().successHandler(new SimpleUrlAuthenticationSuccessHandler("<url to redirect>"));
    }
}
@配置
公共类OAuth2SecurityConfig扩展了WebSecurity配置适配器{
@凌驾
受保护的无效配置(HttpSecurity http)引发异常{
http.authorizeRequests()
.anyRequest().authenticated()
.及()
.oauth2Login().successHandler(新的SimpleLauthenticationSuccessHandler(“”);
}
}
我已经注册了名为“custom”的客户。以下是浏览器中的流程-

http://localhost:9000/oauth2/authorization/custom
->IDP的登录页面和成功登录->在URL上获取授权码
http://localhost:9000/login/oauth2/code/custom
->它再次转到
http://localhost:9000/oauth2/authorization/custom
和无限循环。未调用Successhandler。此外,我在日志中没有看到访问令牌生成

在过去的两天里,我尝试了很多事情,比如调整安全配置等,但都没有效果


感谢您的帮助

问题在于用户信息端点。我的IDP没有公开用户信息端点,而在请求失败的spring oauth2中它是强制的。我需要重写默认的OAuth2UserService实现来解决这个问题