zoukankan      html  css  js  c++  java
  • cas server 配置

    1.修改cas server的deployerConfigContext.xml
        
     <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource">
        <property name="driverClassName">
          <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
        </property>
        <property name="url">
          <value>jdbc:sqlserver://localhost;databaseName=base;</value>
        </property>
        <property name="username"><value>sa</value></property>
        <property name="password"><value>sasa</value></property>
      </bean>
     
     
     
     
      <bean class="org.jasig.cas.adaptors.jdbc.SearchModeSearchDatabaseAuthenticationHandler">
        <property name="tableUsers"><value>users</value></property>
        <property name="fieldUser"><value>username</value></property>
        <property name="fieldPassword"><value>password</value></property>
        <property name="dataSource" ref="dataSource"/>
      </bean>
     
    2.配置cas client的 web.xml。

    <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://zhangyg-pc:8443/cas/login</param-value>
    </init-param><!--这里是服务端的主机名-->
    <init-param>
    <param-name>edu.yale.its.tp.cas.client.filter.validateUrl</param-name>
    <param-value>http://zhangyg-pc:8443/cas/proxyValidate</param-value>
    </init-param><!--这里是服务端的主机名,而且必须是-->
    <init-param>
    <param-name>edu.yale.its.tp.cas.client.filter.serverName</param-name>
    <param-value>192.168.10.98:8080</param-value><!--client:port就是需要CAS需要拦截的地址和端口,一般就是Client端的IP和port-->
    </init-param>
    </filter>

    <filter-mapping>
    <filter-name>CASFilter</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>


     3.需要注意的是我们在这里去掉了https的支持。

    主要修改了

    1.edu.yale.its.tp.cas.util.SecureURL

    2.edu.yale.its.tp.cas.client.filter.CASFilter

    中的https验证。

    如:

    //        if (casServiceUrl != null){
    //            if (! (casServiceUrl.startsWith("https://")|| (casServiceUrl.startsWith("http://") ))){
    //                throw new ServletException("service URL must start with http:// or https://; its current value is [" + casServiceUrl + "]");
    //            }
    //        }

    4.系统注销

    由于登录后,是否登录是通过session验证的。所以注销的时候除了调用 cas的http://serverip/cas/logout,同时需要对删除session。

    需要写一个 logout页面。代码如下:

    <%
     session.invalidate();
     response.sendRedirect("http://serverip:8080/cas/logout?service=http://clientip:8080/casclient/index.jsp");
    %>

  • 相关阅读:
    django页面分类和继承
    django前端从数据库获取请求参数
    pycharm配置django工程
    django 应用各个py文件代码
    CF. 1428G2. Lucky Numbers(背包DP 二进制优化 贪心)
    HDU. 6566. The Hanged Man(树形背包DP DFS序 重链剖分)
    小米邀请赛 决赛. B. Rikka with Maximum Segment Sum(分治 决策单调性)
    区间树 学习笔记
    CF GYM. 102861M. Machine Gun(主席树)
    2016-2017 ACM-ICPC East Central North America Regional Contest (ECNA 2016) (B, D, G, H)
  • 原文地址:https://www.cnblogs.com/yg_zhang/p/1903864.html
Copyright © 2011-2022 走看看