cas 单点的java,php客户端 跳过SSL认证,用http形式登录

cas 单点的java,php客户端 跳过SSL认证,用http模式登录


这里可以简单说一下修改的内容,也是之前从网上查询的!

下面是jar包的修改内容和java,php客户端的相应需要修改的配置说明!

 

1.\WEB-INF\deployerConfigContext.xml

<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"

                  p:httpClient-ref="httpClient" />

         增加参数p:requireSecure="false",是否需要安全验证,即HTTPSfalse为不采用,加上去之后如下:

<bean class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"

                                               p:httpClient-ref="httpClient"  p:requireSecure="false"/>

 

 

2.      \WEB-INF\ cas-servlet.xml

<bean id="warnCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"

       p:cookieSecure="false"

       p:cookieMaxAge="-1"

       p:cookieName="CASPRIVACY"

       p:cookiePath="/cas" />

参数p:cookieSecure="true",同理为HTTPS验证相关,TRUE为采用HTTPS验证,与deployerConfigContext.xml的参数保持一致。

参数p:cookieMaxAge="-1",简单说是COOKIE的最大生命周期,-1为无生命周期,即只在当前打开的IE窗口有效,IE关闭或重新打开其它窗口,仍会要求验证。

 

<bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"

       p:cookieSecure="false"

       p:cookieMaxAge="-1"

       p:cookieName="CASTGC"

       p:cookiePath="/cas" />

两个参数与上面同理。

说明:如果p:cookieSecure="true" 表示只能https请求才能读到cookie中的值,而http访问时不能从cookie中取的值.

 

 

 

 

java客户端的修改:

下面绿色部分是修改部分,将原来的https地址换成http

  <filter>

     <filter-name>CASFilter</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>http://localhost:8080/cas/login</param-value> 

     </init-param> 

     <init-param> 

         <param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name> 

         <param-value>http://localhost:8080/cas/proxyValidate</param-value> 

     </init-param> 

     <init-param> 

             <param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name> 

             <param-value>localhost:8088</param-value> 

     </init-param> 

</filter>

<filter-mapping> 

     <filter-name>CASFilter</filter-name> 

     <url-pattern>/*</url-pattern> 

</filter-mapping>