版权声明:欢迎转载,请注明原文地址:http://blog.csdn.net/c1481118216 https://blog.csdn.net/c1481118216/article/details/80397284
目录
去掉https验证
- cas默认是采用https模式的,我们没有配置证书,所以去掉https验证取消https的过滤,让http协议也能访问
- 4.0.0 版本一共需要修改三个地方
1. 修改deployerConfigContext.xml添加p:requireSecure=”false”
- 找到tomcat下
cas/WEB-INF/deployerConfigContext.xml
// 找到如下bean配置
<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
p:httpClient-ref="httpClient"/>
// 添加参数p:requireSecure="false"
// 修改后为:
<!-- 修改为不进行安全验证 -->
<bean id="proxyAuthenticationHandler"
class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
p:httpClient-ref="httpClient" p:requireSecure="false"/>
2. 修改ticketGrantingTicketCookieGenerator.xml修改p:cookieSecure=”false”
- 找到tomcat下
cas/WEB-INF/spring-configuration/ticketGrantingTicketCookieGenerator.xml
// 找到如下配置
<bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
p:cookieSecure="true"
p:cookieMaxAge="-1"
p:cookieName="CASTGC"
p:cookiePath="/cas" />
// 修改p:cookieSecure="false"
// 修改后为:
<bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
p:cookieSecure="false"
p:cookieMaxAge="-1"
p:cookieName="CASTGC"
p:cookiePath="/cas" />
3. 修改warnCookieGenerator.xml修改p:cookieSecure=”false”
- 找到tomcat下
cas/WEB-INF/spring-configuration/warnCookieGenerator.xml
// 找到如下配置
<bean id="warnCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
p:cookieSecure="true"
p:cookieMaxAge="-1"
p:cookieName="CASPRIVACY"
p:cookiePath="/cas" />
// 修改p:cookieSecure="false"
// 修改后为:
<bean id="warnCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
p:cookieSecure="false"
p:cookieMaxAge="-1"
p:cookieName="CASPRIVACY"
p:cookiePath="/cas" />
去掉登录页面的提示
去掉https验证后 保证了http访问也能进行正常交互。但是原生的cas server页面上的提示是不会根据设置自动消失的。只能我们手动去除。
- 找到tomcat下:apache-tomcat-8.0.52\webapps\cas\WEB-INF\view\jsp\default\ui\
casLoginView.jsp
// 找到如下代码 直接删掉
<c:if test="${not pageContext.request.secure}">
<div id="msg" class="errors">
<h2>Non-secure Connection</h2>
<p>You are currently accessing CAS over a non-secure connection. Single Sign On WILL NOT WORK. In order to have single sign on work, you MUST log in over HTTPS.</p>
</div>
</c:if>