zoukankan      html  css  js  c++  java
  • 修改Spring Social默认提交地址

     1 package cn.coreqi.social.config;
     2 
     3 import org.springframework.social.security.SocialAuthenticationFilter;
     4 import org.springframework.social.security.SpringSocialConfigurer;
     5 
     6 public class CoreqiSpringSocialConfig extends SpringSocialConfigurer {
     7 
     8     @Override
     9     protected <T> T postProcess(T object) {
    10         SocialAuthenticationFilter filter = (SocialAuthenticationFilter)super.postProcess(object);
    11         filter.setFilterProcessesUrl("/coreqi/auth");
    12         return (T) filter;
    13     }
    14 }

     1 package cn.coreqi.social.config;
     2 
     3 import org.springframework.beans.factory.annotation.Autowired;
     4 import org.springframework.context.annotation.Bean;
     5 import org.springframework.context.annotation.Configuration;
     6 import org.springframework.security.crypto.encrypt.Encryptors;
     7 import org.springframework.social.config.annotation.EnableSocial;
     8 import org.springframework.social.config.annotation.SocialConfigurerAdapter;
     9 import org.springframework.social.connect.ConnectionFactoryLocator;
    10 import org.springframework.social.connect.UsersConnectionRepository;
    11 import org.springframework.social.connect.jdbc.JdbcUsersConnectionRepository;
    12 import org.springframework.social.security.SpringSocialConfigurer;
    13 
    14 import javax.sql.DataSource;
    15 
    16 @Configuration
    17 @EnableSocial
    18 public class SocialConfig extends SocialConfigurerAdapter {
    19 
    20     @Autowired
    21     private DataSource dataSource;
    22 
    23     /**
    24      *
    25      * @param connectionFactoryLocator  作用是去根据条件去查找应该用那个connectionFactory,因为系统中可能有很多的connectionFactory。
    26      * @return
    27      */
    28     @Override
    29     public UsersConnectionRepository getUsersConnectionRepository(ConnectionFactoryLocator connectionFactoryLocator) {
    30         //第三个参数的作用是把插入到数据库的数据进行加解密
    31         JdbcUsersConnectionRepository jdbcUsersConnectionRepository = new JdbcUsersConnectionRepository(dataSource,connectionFactoryLocator, Encryptors.noOpText());
    32         //jdbcUsersConnectionRepository.setTablePrefix(); //设置数据表的前缀
    33         return jdbcUsersConnectionRepository;
    34     }
    35 
    36     /**
    37      * 声明后还需要加在SpringSecurity过滤器链上
    38      * @return
    39      */
    40     @Bean
    41     public SpringSocialConfigurer coreqiSocialSecurityConfig(){
    42         return new CoreqiSpringSocialConfig();
    43     }
    44 }

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

  • 相关阅读:
    gain 基尼系数
    luogu P5826 【模板】子序列自动机 主席树 vector 二分
    牛客挑战赛39 树与异或 离线 树上莫队 树状数组 约数
    4.22 省选模拟赛 三元组 manacher 回文自动机
    4.22 省选模拟赛 最优价值 网络流 最大权闭合子图
    4.18 省选模拟赛 消息传递 树剖 倍增 线段树维护等比数列
    luogu P4008 [NOI2003]文本编辑器 splay 块状链表
    牛客挑战赛39 密码系统 后缀数组
    luogu P1526 [NOI2003]智破连环阵 搜索+最大匹配+剪枝
    luogu P4095 [HEOI2013]Eden 的新背包问题 多重背包 背包的合并
  • 原文地址:https://www.cnblogs.com/fanqisoft/p/10639822.html
Copyright © 2011-2022 走看看