package cn.coreqi.social.config;

 import org.springframework.social.security.SocialAuthenticationFilter;
import org.springframework.social.security.SpringSocialConfigurer; public class CoreqiSpringSocialConfig extends SpringSocialConfigurer { @Override
protected <T> T postProcess(T object) {
SocialAuthenticationFilter filter = (SocialAuthenticationFilter)super.postProcess(object);
filter.setFilterProcessesUrl("/coreqi/auth");
return (T) filter;
}
}

 package cn.coreqi.social.config;

 import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.encrypt.Encryptors;
import org.springframework.social.config.annotation.EnableSocial;
import org.springframework.social.config.annotation.SocialConfigurerAdapter;
import org.springframework.social.connect.ConnectionFactoryLocator;
import org.springframework.social.connect.UsersConnectionRepository;
import org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository;
import org.springframework.social.security.SpringSocialConfigurer; import javax.sql.DataSource; @Configuration
@EnableSocial
public class SocialConfig extends SocialConfigurerAdapter { @Autowired
private DataSource dataSource; /**
*
* @param connectionFactoryLocator 作用是去根据条件去查找应该用那个connectionFactory,因为系统中可能有很多的connectionFactory。
* @return
*/
@Override
public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
//第三个参数的作用是把插入到数据库的数据进行加解密
JdbcUsersConnectionRepository jdbcUsersConnectionRepository = new JdbcUsersConnectionRepository(dataSource,connectionFactoryLocator, Encryptors.noOpText());
//jdbcUsersConnectionRepository.setTablePrefix(); //设置数据表的前缀
return jdbcUsersConnectionRepository;
} /**
* 声明后还需要加在SpringSecurity过滤器链上
* @return
*/
@Bean
public SpringSocialConfigurer coreqiSocialSecurityConfig(){
return new CoreqiSpringSocialConfig();
}
}

⒊在SpringSecurity Config方法上添加过滤器链

最新文章

  1. ubuntu/var/log/下各个日志文件
  2. 如何在自己的代码中实现分享视频文件或者是图片文件到微信 QQ微博 新浪微博等!!!
  3. python函数基础
  4. ABAP QUERY报表添加双击事件
  5. RHEL7管道与重定向
  6. MVC-READ5(asp.net web from PK asp.net MVC)
  7. AutoCompleteTextView不能使用的问题
  8. Open multiple Eclipse workspaces on the Mac
  9. sql server 查询字符串指定字符出现的次数
  10. HW4.43
  11. HDOJ/HDU 1015 Safecracker(深搜)
  12. JAVA Web项目的编码过滤器
  13. 遍历数组中的元素(含es6方法)
  14. 接口登录CSDN发布博客---封装方法,使用unittest框架
  15. Generator自动生成DAO和POJO代码
  16. python第三方库 - dateutil
  17. JN5139 zigbee 资料
  18. 一篇很好的java异常框架讲解
  19. vue嵌套路由总结
  20. UrlUtils工具类,Java URL工具类,Java URL链接工具类

热门文章

  1. C# 实现身份验证之WCF篇(2)
  2. 2017-12-15python全栈9期第二天第七节之布尔值转数字
  3. db mysql / mysql cluster 5.7.19 / performance
  4. Canvas判断内容为空
  5. ibatis项目启动报错The string &quot;--&quot; is not permitted within comments【原】
  6. DirectX11 With Windows SDK--04 使用DirectX Tool Kit帮助开发
  7. HDU 1027(数字排列 STL)
  8. c++中sizeof的理解
  9. windows配置Java环境变量
  10. 安装Blend+SketchFlow Preview for Visual Studio 2012出现错误