@Configuration
@ConditionalOnClass(value={org.springframework.social.connect.web.ConnectController.class,org.springframework.social.config.annotation.SocialConfigurerAdapter.class})
@ConditionalOnBean(value={org.springframework.social.connect.ConnectionFactoryLocator.class,org.springframework.social.connect.UsersConnectionRepository.class})
public class SpringSocialAutoConfiguration
extends org.springframework.social.config.annotation.SocialConfigurerAdapter
| Constructor and Description |
|---|
SpringSocialAutoConfiguration() |
| Modifier and Type | Method and Description |
|---|---|
void |
checkConfig() |
org.springframework.social.UserIdSource |
getUserIdSource() |
org.springframework.social.connect.UsersConnectionRepository |
getUsersConnectionRepository(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator) |
org.springframework.social.connect.web.ProviderSignInUtils |
providerSignInUtils(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator)
用于在回调时获取到信息
|
BaseSocialAutoConfigurerAdapter |
qqSocialAutoConfigurerAdapter(SocialProperties socialProperties)
QQ登陆连接工厂
|
SocialAuthenticationFilterPostProcessor |
socialAuthenticationFilterPostProcessor(org.springframework.security.web.authentication.AuthenticationSuccessHandler jsAuthenticationSuccessHandler)
spring social QQ处理器
|
org.springframework.social.security.SpringSocialConfigurer |
socialSecurityConfig(SocialAuthenticationFilterPostProcessor socialAuthenticationFilterPostProcessor,
SocialProperties socialProperties)
自定义qq登录路径和注册路径【此服务需要注册spring security过滤器链中】 【注意研读】
SocialAuthenticationProvider 源码
|
org.springframework.social.security.SocialUserDetailsService |
socialUserDetailsService(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
注入一个缺省的SocialUserDetailsService
|
BaseSocialAutoConfigurerAdapter |
wechatAutoConfigurerAdapter(SocialProperties socialProperties)
构建一个微信连接工厂
|
public org.springframework.social.connect.UsersConnectionRepository getUsersConnectionRepository(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator)
getUsersConnectionRepository in interface org.springframework.social.config.annotation.SocialConfigurergetUsersConnectionRepository in class org.springframework.social.config.annotation.SocialConfigurerAdapterpublic org.springframework.social.UserIdSource getUserIdSource()
getUserIdSource in interface org.springframework.social.config.annotation.SocialConfigurergetUserIdSource in class org.springframework.social.config.annotation.SocialConfigurerAdapter@Bean(value="qqSocialAutoConfigurerAdapter") public BaseSocialAutoConfigurerAdapter qqSocialAutoConfigurerAdapter(SocialProperties socialProperties)
socialProperties - spring social属性配置@Bean public org.springframework.social.connect.web.ProviderSignInUtils providerSignInUtils(org.springframework.social.connect.ConnectionFactoryLocator connectionFactoryLocator)
用于在回调时获取到信息
【作用】在注册过程中获取到spring social的用户信息 , 通过以下方法 实现 个人用户 和spring social用户 关系绑定 , providerSignInUtils.doPostSignUp(个人用户 id , new ServletWebRequest(request, response));connectionFactoryLocator - ConnectionFactoryLocator@Bean @ConditionalOnMissingBean public org.springframework.social.security.SocialUserDetailsService socialUserDetailsService(org.springframework.security.crypto.password.PasswordEncoder passwordEncoder)
passwordEncoder - 密码加密实例@Bean public SocialAuthenticationFilterPostProcessor socialAuthenticationFilterPostProcessor(org.springframework.security.web.authentication.AuthenticationSuccessHandler jsAuthenticationSuccessHandler)
jsAuthenticationSuccessHandler - 登陆成功处理器@Bean @Autowired public org.springframework.social.security.SpringSocialConfigurer socialSecurityConfig(SocialAuthenticationFilterPostProcessor socialAuthenticationFilterPostProcessor, SocialProperties socialProperties)
socialAuthenticationFilterPostProcessor - spring social 认证过滤器socialProperties - spring social属性配置@Bean
@ConditionalOnProperty(prefix="yishuifengxiao.social.weixin",
name={"appId","appSecret"})
public BaseSocialAutoConfigurerAdapter wechatAutoConfigurerAdapter(SocialProperties socialProperties)
socialProperties - spring social属性配置@PostConstruct public void checkConfig()
Copyright © 2021. All rights reserved.