Cas 客户端配置

首先下载CAS客户端 , 里面含有必要的 Jar

1: 启动cas 服务器端: 即 启动集成有 cas 的tomcat

2: 新建一个webapp 工程:client1

web.xml 配置如下:

<?xml version="1.0" encoding="UTF-8"?> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <filter> <filter-name>CAS Authentication Filter</filter-name> <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> <init-param> <!-- CAS服务端登录地址 --> <param-name>casServerLoginUrl</param-name> <param-value>https://localhost/cas/</param-value> </init-param> <init-param> <!-- 当前网站域名 --> <param-name>serverName</param-name> <param-value>http://localhost:8080</param-value> </init-param> </filter> <filter-mapping> <filter-name>CAS Authentication Filter</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> </web-app>

注意: serverName 不需要添加工程的context 上下文(/client1)

导入 jar

cas-client-core-3.1.10.jar
commons-logging-1.1.jar

http://localhost:8080/client1 (error)

3: 启动 tomcat 客户端: (注意客户端不比配置 SSL 支持)

http://localhost:8080/client1

进行访问 index.jsp 页面 ; 但是此时会被 web.xml 中配置的 filter 拦截:

进而跳转到 指定的 casServerLoginUrl 进行验证

然后输入 用户名,密码 如果验证成功, 将会成功跳转到 index.jsp

4: 新建一个 新的web 工程 client2

配置与 第三步一样, 发布到 Tomcat 中

再浏览器中 http://localhost:8080/client2/

此时不要要 验证 直接跳转到 index.jsp 中

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值