|
|
|
@ -20,9 +20,10 @@ import org.springframework.core.Ordered; |
|
|
|
|
@Configuration |
|
|
|
|
public class CasFilterConfig { |
|
|
|
|
|
|
|
|
|
//生效的cas配置
|
|
|
|
|
private static final String CAS_URL= "https://idas.uestc.edu.cn/authserver"; |
|
|
|
|
|
|
|
|
|
private static final String APP_URL= "http://222.197.183.3:8090"; |
|
|
|
|
private static final String APP_URL= "https://finance.uestc.cn"; |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public ServletListenerRegistrationBean<SingleSignOutHttpSessionListener> servletListenerRegistrationBean(){ |
|
|
|
@ -40,7 +41,7 @@ public class CasFilterConfig { |
|
|
|
|
public FilterRegistrationBean<SingleSignOutFilter> singleSignOutFilter(){ |
|
|
|
|
FilterRegistrationBean<SingleSignOutFilter> registrationBean = new FilterRegistrationBean<>(); |
|
|
|
|
registrationBean.setFilter(new SingleSignOutFilter()); |
|
|
|
|
registrationBean.addUrlPatterns("/*"); |
|
|
|
|
registrationBean.addUrlPatterns("/userInfo/loginOut"); |
|
|
|
|
registrationBean.addInitParameter("casServerUrlPrefix", CAS_URL ); |
|
|
|
|
registrationBean.setName("CAS Single Sign Out Filter"); |
|
|
|
|
registrationBean.setOrder(2); |
|
|
|
@ -51,12 +52,11 @@ public class CasFilterConfig { |
|
|
|
|
* 单点登录认证 |
|
|
|
|
* @return registrationBean |
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public FilterRegistrationBean<AuthenticationFilter> authenticationFilter(){ |
|
|
|
|
FilterRegistrationBean<AuthenticationFilter> registrationBean = new FilterRegistrationBean<>(); |
|
|
|
|
registrationBean.setFilter(new AuthenticationFilter()); |
|
|
|
|
registrationBean.addUrlPatterns("/*"); |
|
|
|
|
registrationBean.addUrlPatterns("/userInfo/loginSchoolClient"); |
|
|
|
|
registrationBean.setName("CAS Filter"); |
|
|
|
|
registrationBean.addInitParameter("casServerLoginUrl",CAS_URL); |
|
|
|
|
registrationBean.addInitParameter("serverName", APP_URL ); |
|
|
|
@ -73,7 +73,7 @@ public class CasFilterConfig { |
|
|
|
|
public FilterRegistrationBean<Cas20ProxyReceivingTicketValidationFilter> cas20ProxyReceivingTicketValidationFilter(){ |
|
|
|
|
FilterRegistrationBean<Cas20ProxyReceivingTicketValidationFilter> registrationBean = new FilterRegistrationBean<>(); |
|
|
|
|
registrationBean.setFilter(new Cas20ProxyReceivingTicketValidationFilter()); |
|
|
|
|
registrationBean.addUrlPatterns("/*"); |
|
|
|
|
registrationBean.addUrlPatterns("/userInfo/loginSchoolClient"); |
|
|
|
|
registrationBean.setName("CAS Validation Filter"); |
|
|
|
|
registrationBean.addInitParameter("casServerUrlPrefix", CAS_URL ); |
|
|
|
|
registrationBean.addInitParameter("serverName", APP_URL ); |
|
|
|
@ -90,7 +90,7 @@ public class CasFilterConfig { |
|
|
|
|
public FilterRegistrationBean<HttpServletRequestWrapperFilter> httpServletRequestWrapperFilter(){ |
|
|
|
|
FilterRegistrationBean<HttpServletRequestWrapperFilter> registrationBean = new FilterRegistrationBean<>(); |
|
|
|
|
registrationBean.setFilter(new HttpServletRequestWrapperFilter()); |
|
|
|
|
registrationBean.addUrlPatterns("/*"); |
|
|
|
|
registrationBean.addUrlPatterns("/userInfo/loginSchoolClient"); |
|
|
|
|
registrationBean.setName("CAS HttpServletRequest Wrapper Filter"); |
|
|
|
|
registrationBean.setOrder(5); |
|
|
|
|
return registrationBean; |
|
|
|
@ -103,10 +103,11 @@ public class CasFilterConfig { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public FilterRegistrationBean<LocalUserInfoFilter> localUserInfoFilter(){ |
|
|
|
|
|
|
|
|
|
FilterRegistrationBean<LocalUserInfoFilter> registrationBean = new FilterRegistrationBean<>(); |
|
|
|
|
registrationBean.setFilter(new LocalUserInfoFilter()); |
|
|
|
|
|
|
|
|
|
registrationBean.addUrlPatterns("/*"); |
|
|
|
|
registrationBean.addUrlPatterns("/userInfo/loginSchoolClient"); |
|
|
|
|
registrationBean.setName("localUserInfoFilter"); |
|
|
|
|
registrationBean.setOrder(6); |
|
|
|
|
return registrationBean; |
|
|
|
@ -114,9 +115,11 @@ public class CasFilterConfig { |
|
|
|
|
|
|
|
|
|
@Bean |
|
|
|
|
public FilterRegistrationBean<AssertionThreadLocalFilter> assertionThreadLocalFilter(){ |
|
|
|
|
|
|
|
|
|
FilterRegistrationBean<AssertionThreadLocalFilter> registrationBean |
|
|
|
|
= new FilterRegistrationBean<>(); |
|
|
|
|
registrationBean.setFilter(new AssertionThreadLocalFilter()); |
|
|
|
|
registrationBean.setOrder(4); |
|
|
|
|
return registrationBean; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|