# localhost name resolution is handled within DNS itself. # 127.0.0.1 localhost # ::1 localhost 127.0.0.1 www.mycas.com
2.2 导出证书:web
方便复制:keytool -import -keystore "C:\Program Files\Java\jdk1.8.0_40\jre\lib\securit
y\cacerts" -file E://cas/mykey.cer -alias mykey
这里输入的密码:changeit
2.4 修改tomcat配置
打开tomcat的conf目录下server.xml,找到spring
1 <!-- 2 <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" 3 maxThreads="150" SSLEnabled="true" scheme="https" secure="true" 4 clientAuth="false" sslProtocol="TLS" /> 5 -->
将注释打开,并改成apache
1 <Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" 2 maxThreads="150" SSLEnabled="true" scheme="https" secure="true" 3 clientAuth="false" sslProtocol="TLS" 4 keystoreFile="E:/cas/mykey.keystore" keystorePass="123456" />
其中keystoreFile是生成证书的路径,keystorePass是证书的密码tomcat
1 <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" 2 p:httpClient-ref="httpClient" />
添加参数requireSecure为false,以下:cookie
1 <bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler" 2 p:httpClient-ref="httpClient" 3 p:requireSecure="false" />
4.2 找到WEB-INF/spring-configuration/ticketGrantingTicketCookieGenerator.xml下app
1 <bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator" 2 p:cookieSecure="true" 3 p:cookieMaxAge="-1" 4 p:cookieName="CASTGC" 5 p:cookiePath="/cas" />
将cookieSecure改成false,以下:webapp
1 <bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator" 2 p:cookieSecure="false" 3 p:cookieMaxAge="-1" 4 p:cookieName="CASTGC" 5 p:cookiePath="/cas" />
4.3 找到WEB-INF\spring-configuration\warnCookieGenerator.xml下工具
1 <bean id="warnCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator" 2 p:cookieSecure="true" 3 p:cookieMaxAge="-1" 4 p:cookieName="CASPRIVACY" 5 p:cookiePath="/cas" />
将cookieSecure改成false,以下学习
1 <bean id="warnCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator" 2 p:cookieSecure="false" 3 p:cookieMaxAge="-1" 4 p:cookieName="CASPRIVACY" 5 p:cookiePath="/cas" />
4.4 找到tomcat的conf目录下server.xml
把以前打开的注释关闭。测试以下:测试
方便复制:http://www.mycas.com:8088/cas-server-webapp-3.5.2/login
这里我把tomcat的端口改为了8088。