Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.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
Spring启动社交控制器_Spring_Spring Boot_Spring Social - Fatal编程技术网

Spring启动社交控制器

Spring启动社交控制器,spring,spring-boot,spring-social,Spring,Spring Boot,Spring Social,我通过SpringSocialConfigurer使用springboot-Social进行OAuth身份验证,所有与第三方OAuth提供商的OAuth身份验证都通过/auth/providerId路径进行 一切正常,但我注意到,ConnectController也在我的应用程序中显示和配置: 2015-05-02 12:02:47 [main] INFO o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{prov

我通过
SpringSocialConfigurer
使用springboot-Social进行OAuth身份验证,所有与第三方OAuth提供商的OAuth身份验证都通过
/auth/providerId
路径进行

一切正常,但我注意到,
ConnectController
也在我的应用程序中显示和配置:

2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{providerId}],methods=[POST],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.connect(java.lang.String,org.springframework.web.context.request.NativeWebRequest)
2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{providerId}],methods=[GET],params=[error],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.oauth2ErrorCallback(java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.springframework.web.context.request.NativeWebRequest)
2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{providerId}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.removeConnections(java.lang.String,org.springframework.web.context.request.NativeWebRequest)
2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String org.springframework.social.connect.web.ConnectController.connectionStatus(org.springframework.web.context.request.NativeWebRequest,org.springframework.ui.Model)
2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{providerId}],methods=[GET],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public java.lang.String org.springframework.social.connect.web.ConnectController.connectionStatus(java.lang.String,org.springframework.web.context.request.NativeWebRequest,org.springframework.ui.Model)
2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{providerId}],methods=[GET],params=[oauth_token],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.oauth1Callback(java.lang.String,org.springframework.web.context.request.NativeWebRequest)
2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{providerId}],methods=[GET],params=[code],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.oauth2Callback(java.lang.String,org.springframework.web.context.request.NativeWebRequest)
2015-05-02 12:02:47 [main] INFO  o.s.w.s.m.m.a.RequestMappingHandlerMapping - Mapped "{[/connect/{providerId}/{providerUserId}],methods=[DELETE],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public org.springframework.web.servlet.view.RedirectView org.springframework.social.connect.web.ConnectController.removeConnection(java.lang.String,java.lang.String,org.springframework.web.context.request.NativeWebRequest)
我想我不需要
ConnectController
。有没有办法禁用它

更新:

这是我当前的社交配置

@Configuration
@EnableSocial
public class SocialConfig extends SocialConfigurerAdapter {

    @Autowired
    private UserService userService;

    @Autowired
    private SocialUserService socialUserService;

    @Autowired
    private TextEncryptor textEncryptor;

    @Override
    public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
        Neo4jUsersConnectionRepository connectionRepository = new Neo4jUsersConnectionRepository(userService, socialUserService,
                (SocialAuthenticationServiceLocator) connectionFactoryLocator, textEncryptor);
        connectionRepository.setConnectionSignUp(new UserConnectionSignUp(userService));
        return connectionRepository;
    }

    @Bean
    public SocialUserDetailsService socialUserDetailsService() {
        return new DBSocialUserDetailService(userService);
    }

}
添加

我下定决心

更新

我需要创建以下类才能正常工作

import org.springframework.context.annotation.Configuration;
导入org.springframework.core.env.Environment;
导入org.springframework.security.core.Authentication;
导入org.springframework.security.core.context.SecurityContextHolder;
导入org.springframework.security.crypto.encrypt.Encryptors;
导入org.springframework.social.UserIdSource;
导入org.springframework.social.config.annotation.ConnectionFactoryConfigurer;
导入org.springframework.social.config.annotation.EnableSocial;
导入org.springframework.social.config.annotation.socialConfiger;
导入org.springframework.social.connect.ConnectionFactoryLocator;
导入org.springframework.social.connect.UsersConnectionRepository;
导入org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository;
导入javax.inject.inject;
导入javax.sql.DataSource;
@配置
@使能社会
公共类MySocialConfig实现SocialConfiger{
@注入
私有数据源;
//
//社会配置器实现方法
//
@凌驾
public void addConnectionFactories(ConnectionFactoryConfigurer cfConfig,Environment env){
}
@凌驾
公共UserIdSource getUserIdSource(){
返回新的UserIdSource(){
@凌驾
公共字符串getUserId(){
身份验证=SecurityContextHolder.getContext().getAuthentication();
if(身份验证==null){
抛出新的IllegalStateException(“无法获取ConnectionRepository:没有用户登录”);
}
返回authentication.getName();
}
};
}
@凌驾
公共用户连接存储库getUsersConnectionRepository(ConnectionFactoryLocator ConnectionFactoryLocator){
返回新的JdbcUsersConnectionRepository(数据源、connectionFactoryLocator、Encryptors.noOpText());
}
}

您应该能够简单地从您的社交环境配置中删除
ConnectionController
bean。以什么方式?我没有手动声明这个bean?您需要为您的配置创建一个单独的社交上下文。如果SpringBoot自动为您实现了这一点,那么您仍然必须在定义您确切需要的地方创建自己的。你不能排除任何东西。我可以在我自己的SocialConfig中简单地重写公共ConnectController ConnectController(ConnectionFactoryLocator ConnectionFactoryLocator,ConnectionRepository ConnectionRepository)并从此方法返回null吗?我已将我当前的SocialConfig添加到问题主体中It’s Not work for me@SpringBootApplication(排除={SocialWebAutoConfiguration.class,FacebookAutoConfiguration.class})
@SpringBootApplication(exclude = SocialWebAutoConfiguration.class)