tomcat + cas_server + cas_client

姚飞昂
2023-12-01

software:
apache-tomcat-5.5.33 (need 2)
eclipse-j2ee

1.configure cas server
reference tomcat + ssl

2.configure cas client
create a dynamic web project casTest2, enable maven dependency management
create a index.html under WebContent
add the following to pom.xml:

<dependency>
    <groupId>cas</groupId>
    <artifactId>casclient</artifactId>
    <version>2.1.1</version>
    <exclusions>
        <exclusion>
            <artifactId>servlet-api</artifactId>
            <groupId>javax.servlet</groupId>
        </exclusion>
    </exclusions>
</dependency>

add the following to web.xml

<filter>
    <filter-name>CAS Filter</filter-name>
    <filter-class>edu.yale.its.tp.cas.client.filter.CASFilter</filter-class>
    <init-param>
        <param-name>edu.yale.its.tp.cas.client.filter.loginUrl</param-name>
        <param-value>https://localhost:8443/cas/login</param-value>
    </init-param>
    <init-param>
        <param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name>
        <param-value>https://localhost:8443/cas/serviceValidate</param-value>
    </init-param>
    <init-param>
        <param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name>
        <param-value>localhost:8081</param-value>
    </init-param>
    <init-param>
        <param-name>edu.yale.its.tp.cas.client.filter.wrapRequest</param-name>
        <param-value>true</param-value>
    </init-param>
</filter>


depoly the web project to tomcat, port is 8081(amend the port so there is no conflict)
brows url http://localhost:8081/castTest2/index.html

 类似资料: