修改Spring Social默认提交地址
2024-08-24 03:36:44
⒈
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方法上添加过滤器链
最新文章
- ubuntu/var/log/下各个日志文件
- 如何在自己的代码中实现分享视频文件或者是图片文件到微信 QQ微博 新浪微博等!!!
- python函数基础
- ABAP QUERY报表添加双击事件
- RHEL7管道与重定向
- MVC-READ5(asp.net web from PK asp.net MVC)
- AutoCompleteTextView不能使用的问题
- Open multiple Eclipse workspaces on the Mac
- sql server 查询字符串指定字符出现的次数
- HW4.43
- HDOJ/HDU 1015 Safecracker(深搜)
- JAVA Web项目的编码过滤器
- 遍历数组中的元素(含es6方法)
- 接口登录CSDN发布博客---封装方法,使用unittest框架
- Generator自动生成DAO和POJO代码
- python第三方库 - dateutil
- JN5139 zigbee 资料
- 一篇很好的java异常框架讲解
- vue嵌套路由总结
- UrlUtils工具类,Java URL工具类,Java URL链接工具类
热门文章
- C# 实现身份验证之WCF篇(2)
- 2017-12-15python全栈9期第二天第七节之布尔值转数字
- db mysql / mysql cluster 5.7.19 / performance
- Canvas判断内容为空
- ibatis项目启动报错The string ";--"; is not permitted within comments【原】
- DirectX11 With Windows SDK--04 使用DirectX Tool Kit帮助开发
- HDU 1027(数字排列 STL)
- c++中sizeof的理解
- windows配置Java环境变量
- 安装Blend+SketchFlow Preview for Visual Studio 2012出现错误