CAS4.0 server 环境的搭建

一、上cas的官网下载cas server 官网地址:https://github.com/Jasig/cas/releases,下载好后html

    解压下载的 cas-server-4.0.0-release.zip 压缩包,把cas-server-4.0.0\modules\cas-server-webapp-4.0.0.warmysql

     重命名为cas.wargit

二、cas.war 放到tomcat的webapps目录下github

三、CAS 默认认证方式使用的是HTTPS协议,通常对安全性不高的话建议取消改为HTTP方式。开启的话会常常提示证书过时、须要用户确认等,对客户的感知很差,当前有须要的能够开启web

取消HTTPS协议spring

webapps\cas\WEB-INF\spring-configuration\warnCookieGenerator.xml ,找到以下配置sql

<bean id="warnCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
        p:cookieSecure="true"
        p:cookieMaxAge="-1"
        p:cookieName="CASPRIVACY"
        p:cookiePath="/cas"/>
修改  p:cookieSecure="true" 为 p:cookieSecure="false"

webapps\cas\WEB-INF\spring-configuration\ticketGrantingTicketCookieGenerator.xml ,找到以下配置tomcat

<bean id="ticketGrantingTicketCookieGenerator" class="org.jasig.cas.web.support.CookieRetrievingCookieGenerator"
        p:cookieSecure="true"
        p:cookieMaxAge="-1"
        p:cookieName="CASTGC"
        p:cookiePath="/cas"/>

修改  p:cookieSecure="true" 为 p:cookieSecure="false"

webapps\cas\WEB-INF\deployerConfigContext.xml 文件 ,找到以下配置:安全

<bean id="proxyAuthenticationHandler" 
class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
          p:httpClient-ref="httpClient"/>

增长p:requireSecure="false"即HTTPS为不采用。
修改后为:

  <bean id="proxyAuthenticationHandler"
class="org.jasig.cas.authentication.handler.support.HttpBasedServiceCredentialsAuthenticationHandler"
          p:httpClient-ref="httpClient" p:requireSecure="false"/>

四、启动tomcat ,访问  http://localhost:8085/cas  则能够看到登录界面,4.0 以后默认是配置在 deployerConfigContext.xml 配置文件中,能够看到用户名密码为 casuser/Melloncookie

五、deployerConfigContext.xml  链接mysql的配置详情见:http://www.cnblogs.com/wuweidu/p/4567824.html

相关文章
相关标签/搜索