欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

CAS实战(cas-server-3.3.4 + cas-client-3.1.3)八 博客分类: CAS cas-server-3.3.4 + cas-client-3.1.3

程序员文章站 2024-02-13 12:39:22
...

3.1.3的配置

下面是3.1.3版本的配置方式,我目前使用的就是3.1.3

我的子系统和CAS服务器是在2tomcat,2tomcat分别使用不同的JDK(2JDK都得导入密钥,否则会无法认证通过,CAS无响应错误,当然用同一个JDK也是可以的)CSA服务器是用的8080端口,HTTPS 8443端口,子系统使用的是9090端口

同样,打开子系统的web.xml,增加如下配置:

 

<!-- CAS -->

<!--  -->

<filter>

<filter-name>CAS Authentication Filter</filter-name>        <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>

        <!-- CAS login 服务地址--> 

        <init-param>

            <param-name>casServerLoginUrl</param-name>

            <param-value>https://casserver:8443/cas/login</param-value>

        </init-param>

        <init-param> 

            <param-name>renew</param-name> 

            <param-value>false</param-value> 

        </init-param> 

        <init-param> 

            <param-name>gateway</param-name> 

            <param-value>false</param-value> 

        </init-param> 

        <!-- 客户端应用服务地址--> 

        <init-param> 

            <param-name>serverName</param-name> 

            <param-value>http://server1:9090</param-value> 

        </init-param>

    </filter>

 

    <!--负责Ticket校验--> 

    <filter> 

<filter-name>CAS Validation Filter</filter-name>        <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class> 

        <init-param> 

            <param-name>casServerUrlPrefix</param-name> 

            <!--  casserver产生密钥的时候输入的"姓名(CN)",并且要有这个域名,或者hosts文件中要有定义 -->

            <param-value>https://casserver:8443/casTest</param-value> 

        </init-param>

        <init-param>

           <param-name>serverName</param-name>

           <param-value>http://server1:9090</param-value>

       </init-param>

       <init-param>

           <param-name>useSession</param-name>

           <param-value>true</param-value>

       </init-param>

       <init-param>

           <param-name>redirectAfterValidation</param-name>

           <param-value>true</param-value>

       </init-param>        

    </filter>

   

    <filter>

        <filter-name>CAS HttpServletRequest WrapperFilter</filter-name>

<filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>

    </filter>

   

    <filter>

<filter-name>CAS Assertion Thread Local Filter</filter-name>

<filter-class>org.jasig.cas.client.util.AssertionThreadLocalFilter</filter-class>

    </filter>

 

    <filter-mapping> 

       <filter-name>CAS Authentication Filter</filter-name> 

        <url-pattern>/*</url-pattern> 

    </filter-mapping> 

   

    <filter-mapping> 

        <filter-name>CAS Validation Filter</filter-name> 

        <url-pattern>/*</url-pattern> 

    </filter-mapping>   

   

    <filter-mapping> 

        <filter-name>CAS HttpServletRequest Wrapper Filter</filter-name> 

        <url-pattern>/*</url-pattern> 

    </filter-mapping> 

   

    <filter-mapping> 

        <filter-name>CAS Assertion Thread Local Filter</filter-name> 

        <url-pattern>/*</url-pattern> 

    </filter-mapping>  

     <!-- END CAS -->