java cas 单点登录web.xml配置

  1. <!-- CAS 单点登录(SSO) 过滤器配置 (start) -->  
  2.       
  3.     <!-- 该过滤器用于实现单点登出功能。-->  
  4.     <filter>  
  5.         <filter-name>CAS Single Sign Out Filter</filter-name>  
  6.         <filter-class>org.jasig.cas.client.session.SingleSignOutFilter</filter-class>  
  7.     </filter>  
  8.     <filter-mapping>  
  9.         <filter-name>CAS Single Sign Out Filter</filter-name>  
  10.         <url-pattern>/*</url-pattern>  
  11.     </filter-mapping>  
  12.     <!-- CAS: 用于单点退出 -->  
  13.     <listener>  
  14.         <listener-class>org.jasig.cas.client.session.SingleSignOutHttpSessionListener</listener-class>  
  15.     </listener>  
  16.       
  17.     <!-- 该过滤器负责用户的认证工作,必须启用它 -->  
  18.     <filter>  
  19.         <filter-name>CASFilter</filter-name>  
  20.         <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>  
  21.         <init-param>  
  22.             <param-name>casServerLoginUrl</param-name>  
  23.             <!-- 下面的URL是Cas服务器的登录地址 -->  
  24.             <param-value>http://CAS服务端所在服务器IP:8080/cas/login</param-value>  
  25.         </init-param>  
  26.         <init-param>  
  27.             <param-name>serverName</param-name>  
  28.             <!-- 下面的URL是具体某一个应用的访问地址 -->  
  29.             <param-value>http://具体web应用程序所在服务器IP:8080</param-value>  
  30.         </init-param>  
  31.     </filter>  
  32.     <filter-mapping>  
  33.         <filter-name>CASFilter</filter-name>  
  34.         <url-pattern>/*</url-pattern>  
  35.     </filter-mapping>  
  36.        
  37.     <!-- 该过滤器负责对Ticket的校验工作,必须启用它 -->  
  38.     <filter>  
  39.         <filter-name>CAS Validation Filter</filter-name>  
  40.         <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>  
  41.         <init-param>  
  42.             <param-name>casServerUrlPrefix</param-name>  
  43.             <!-- 下面的URL是Cas服务器的认证地址 -->  
  44.             <param-value>http://CAS服务端所在服务器IP:8080/cas</param-value>  
  45.         </init-param>  
  46.         <init-param>  
  47.             <param-name>serverName</param-name>  
  48.             <!-- 下面的URL是具体某一个应用的访问地址 -->  
  49.             <param-value>http://具体web应用程序所在服务器IP:8080</param-value>  
  50.         </init-param>  
  51.         <init-param>  
  52.           <param-name>renew</param-name>  
  53.           <param-value>false</param-value>  
  54.         </init-param>  
  55.         <init-param>  
  56.           <param-name>gateway</param-name>  
  57.           <param-value>false</param-value>  
  58.         </init-param>  
  59.     </filter>  
  60.     <filter-mapping>  
  61.         <filter-name>CAS Validation Filter</filter-name>  
  62.         <url-pattern>/*</url-pattern>  
  63.     </filter-mapping>  
  64.        
  65.     <!--  
  66.     该过滤器负责实现HttpServletRequest请求的包裹,  
  67.     比如允许开发者通过HttpServletRequest的getRemoteUser()方法获得SSO登录用户的登录名,可选配置。  
  68.     -->  
  69.     <filter>  
  70.         <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>  
  71.         <filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>  
  72.     </filter>  
  73.     <filter-mapping>  
  74.         <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>  
  75.         <url-pattern>/*</url-pattern>  
  76.     </filter-mapping>  
  77.        
  78.     <!--  
  79.     该过滤器使得开发者可以通过org.jasig.cas.client.util.AssertionHolder来获取用户的登录名。  
  80.     比如AssertionHolder.getAssertion().getPrincipal().getName()。  
  81.     -->  
  82.     <filter>  
  83.         <filter-name>CAS Assertion Thread Local Filter</filter-name>  
  84.         <filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class>  
  85.     </filter>  
  86.     <filter-mapping>  
  87.         <filter-name>CAS Assertion Thread Local Filter</filter-name>  
  88.         <url-pattern>/*</url-pattern>  
  89.     </filter-mapping>  
  90.        
  91.     <!-- 自动根据单点登录的结果设置本系统的用户信息(具体某一个应用实现) -->  
  92.     <filter>  
  93.         <filter-name>CasForInvokeContextFilter</filter-name>  
  94.         <filter-class>com.cm.demo.filter.CasForInvokeContextFilter</filter-class>  
  95.         <init-param>  
  96.           <param-name>appId</param-name>  
  97.           <param-value>a5ea611bbff7474a81753697a1714fb0</param-value>  
  98.         </init-param>  
  99.     </filter>  
  100.     <filter-mapping>  
  101.         <filter-name>CasForInvokeContextFilter</filter-name>  
  102.         <url-pattern>/*</url-pattern>  
  103.     </filter-mapping>  
  104.     <!-- CAS 单点登录(SSO) 过滤器配置 (end) -->  
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值