微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Spring OAuth2 在会话中保存原始请求并重定向到原始 URL

如何解决Spring OAuth2 在会话中保存原始请求并重定向到原始 URL

这是安全配置

@Override
    protected void configure(HttpSecurity http) throws Exception {
        http
                .csrf()
                    .disable()
                .formLogin()
                    .disable()
                .httpBasic()
                    .disable()
                .authorizeRequests()                  
                    .antMatchers("/auth/**","/oauth2/**")
                        .permitAll()
                    .anyRequest()
                        .authenticated()
                    .and()
                .oauth2Login()
                    .authorizationEndpoint()
                        .baseUri("/oauth2/authorize")
                        .and()
                    .redirectionEndpoint()
                        .baseUri("/oauth2/callback/*")
                        .and()
                    .userInfoEndpoint()
                        .userService(customOAuth2UserService)
                        .and()
                    .successHandler(oAuth2AuthenticationSuccessHandler)
                    .failureHandler(oAuth2AuthenticationFailureHandler);

    }

前端的 URL 是 http://localhost:8080/oauth2/authorize/google?redirect_uri=http://localhost:8080/some-url

但是在用户被授权并成功登录后,用户不会被重定向http://localhost:8080/some-url

可能是什么原因以及如何解决

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。