C:\WINDOWS\system32\drivers\etc\hosts中添加
127.0.0.1 www.chenbo.com
建文件夹 D:/keys/temp
1.生成密钥
keytool -genkey -alias chenboCas -keyalg RSA -keystore d:/keys/temp/tomcat.keystore
keytool -genkey -alias chenboCas -keyalg RSA -keystore d:/keys/temp/tomcat.keystore -selfcert -validity 7200
注意:-validity 7200 这个就是加时效的参数,7200单位是“天”。
密码:changeit
[Unknown]: www.chenbo.com
// 注意: 此必须填写"域名" , 否则在与CAS 整合的过程中将会遇到 : java.security.cert.CertificateException: No name matching cas.gogoyuan.cn found 的异常
2.导出密钥
keytool -export -file d:/keys/temp/chenboCas.crt -alias chenboCas -keystore d:/keys/temp/tomcat.keystore
密码为刚才设置的密码:changeit
3.在客户端系统的服务器上导入 密钥
keytool -import -keystore D:/Java/jdk1.6.0_10/jre/lib/security/cacerts -file D:/keys/temp/chenboCas.crt -alias chenboCas
或
keytool -import -keystore "%JAVA_HOME%/jre/lib/security/cacerts" -file D:/keys/temp/chenboCas.crt -alias chenboCas
注意,密码为:changeit,不是之前设置密码
<filter>
<filter-name>CASFilter</filter-name>
<filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
<init-param>
<param-name>casServerLoginUrl</param-name>
<param-value></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>CASFilter</filter-name>
<url-pattern>/web/newBody/index.jsp</url-pattern>
</filter-mapping>
<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>
<param-value>https://www.chenbo.com:8443/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 Validation Filter</filter-name>
<url-pattern>/web/newBody/index.jsp</url-pattern>
</filter-mapping>
<filter>
<filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
<filter-class>org.jasig.cas.client.util.HttpServletRequestWrapperFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>CAS HttpServletRequest Wrapper Filter</filter-name>
<url-pattern>/web/newBody/index.jsp</url-pattern>
</filter-mapping>
[Unknown]: www.chenbo.com
// 注意: 此必须填写"域名" , 否则在与CAS 整合的过程中将会遇到 : java.security.cert.CertificateException: No name matching cas.gogoyuan.cn found 的异常
配置 “casServerLoginUrl”与“casServerUrlPrefix”是要输入以上的姓氏"www.chenbo.com" 配置serverName是可以是ip 地址
配置时,只要是web浏览器所在机器能访问的地址就行,域名或ip,而那些配置hosts文件的只是开发的时候,配置了hosts那台机器可以访问。
最后cas都转成这个路径访问系统,一下这两个地址,web浏览器所在的机器要全能识别才行
https://www.chenbo.com:8443/cas/login?service=http%3A%2F%2F192.168.1.82%3A8080%2FInDigLib%2Fweb%2FnewBody%2Findex.jsp