Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Spring社交登录、重定向和返回值_Java_Spring_Spring Social_Spring Social Facebook - Fatal编程技术网

Java Spring社交登录、重定向和返回值

Java Spring社交登录、重定向和返回值,java,spring,spring-social,spring-social-facebook,Java,Spring,Spring Social,Spring Social Facebook,我正在测试SpringSocialShowcase,并编写了一个类似的应用程序。虽然SpringSocialShowcase是一个使用SpringMVC编写的简单HTML应用程序,但我的应用程序使用的是angularjs和AJAX。Twitter或Facebook接受访问令牌后,重定向出现问题 在我的流程中,首先更改ProviderSignInControl的设置: providerSignInController.setSignUpUrl("/register/social"); <--

我正在测试SpringSocialShowcase,并编写了一个类似的应用程序。虽然SpringSocialShowcase是一个使用SpringMVC编写的简单HTML应用程序,但我的应用程序使用的是angularjs和AJAX。Twitter或Facebook接受访问令牌后,重定向出现问题

在我的流程中,首先更改
ProviderSignInControl
的设置:

providerSignInController.setSignUpUrl("/register/social"); <-- redirect into my controller

providerSignInController.setSignUpUrl(“/register/social”) 我建议使用SocialAuthenticationFilter而不是ProviderSignInController。SocialAuthenticationFilter通过spring security社交登录提供完整的控制器。一旦社交用户成功登录,则您希望重定向到主页或错误页面

我有一个简单的spring社交登录示例,它使用SocialAuthenticationFilter进行身份验证并维护与社交提供商的连接。希望对您有所帮助


是如何使用spring框架实现社交登录功能的示例。你是如何解决这个问题的?
@RequestMapping(value="/social" ,method=RequestMethod.GET)
    public ModelAndView social(WebRequest request, ){
        LOG.info("Register new user using social info");
        Connection<?> connection = ProviderSignInUtils.getConnection(request);

        if(connection != null){
            LOG.info("User has been authorize from  " + connection.getKey().getProviderId());
            LOG.info("Connection class: " + connection.getClass());
            model.addAttribute("socialUser",RegisterUserDto.fromSocialProfile(connection.fetchUserProfile()) );
        }else{

        }

        return new ModelAndView("redirect:http://localhost:8080/turnigo-core-web/#/register");
    }