zoukankan      html  css  js  c++  java
  • CAS增加免登陆(Remember Me)功能

    1. 打开deployerConfigContext.xml

      在 authenticationManager 的bean中增加

    <property name="authenticationMetaDataPopulators">
          <list>
             <bean class="org.jasig.cas.authentication.principal.RememberMeAuthenticationMetaDataPopulator" />
          </list>
    </property>

    2. login-webflow.xml

      在该文件定位viewLoginForm,可以找到:

    <view-state id="viewLoginForm" view="casLoginView" model="credentials">
          <binder>
              <binding property="username" />
              <binding property="password" />
          <binding property="rememberMe" />
    </binder> <on-entry> <set name="viewScope.commandName" value="'credentials'" /> </on-entry> <transition on="submit" bind="true" validate="true" to="realSubmit"> <evaluate expression="authenticationViaFormAction.doBind(flowRequestContext, flowScope.credentials)" /> </transition> </view-state>
    在上面的binder中增加:<binding property="rememberMe" />
     
    3.  ticketExpirationPolicies.xml
      将grantingTicketExpirationPolicy的bean替换为:
      
    <bean id="grantingTicketExpirationPolicy" class="org.jasig.cas.ticket.support.RememberMeDelegatingExpirationPolicy">
       <property name="sessionExpirationPolicy">
        <bean class="org.jasig.cas.ticket.support.TimeoutExpirationPolicy">
               <constructor-arg index="0" value="7200000" />
        </bean>
       </property>
       <property name="rememberMeExpirationPolicy">
        <bean class="org.jasig.cas.ticket.support.TimeoutExpirationPolicy">
               <constructor-arg index="0" value="7200000" />
        </bean>
       </property>
    </bean>

    其中的7200000为毫秒数。

     
    4. ticketGrantingTicketCookieGenerator.xml
      在ticketGrantingTicketCookieGenerator的bean中增加 p:rememberMeMaxAge="7200000" ,要注意的是这里的7200000为秒数。并且要注意和上面 ticketExpirationPolicies.xml中设置的保持一致。
     
    5. casLoginView.jsp
      在该登陆页面增加
    <div class="row check">
        <input id="rememberMe" name="rememberMe" value="true" tabindex="4" type="checkbox" />
        <label for="rememberMe">remeberMe</label>
    </div>

    到此,配置完成。

    另外,附上官网的添加免登陆的网页地址:

     
  • 相关阅读:
    POJ Problem 2631 Roads in the North【树的直径】
    POJ Problem 1985 Cow Marathon 【树的直径】
    Light OJ 1049 Farthest Nodes in a Tree【树的直径】
    HDU Problem 4707 Pet【并查集】
    HDU Problem 1325 Is It A Tree?【并查集】
    HDU Problem 5631 Rikka with Graph【并查集】
    HDU Problem 5326 Work 【并查集】
    文件比较软件修改比较文件时间戳方法
    什么是Oracle 数据泵
    文件对比工具文件上传 FTP如何匹配本地文件
  • 原文地址:https://www.cnblogs.com/cxyj/p/3884607.html
Copyright © 2011-2022 走看看