Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

In web.xml, you can adjust ticket timeouts. Specifically, the ticket granting ticket timeout is specified as the context parameter "edu.yale.its.tp.cas.grantingTimeout". It is specifed in seconds, and its default value is two hours.

Code Block
xml
xml
    <!-- Timeout for granting tickets -->
    <context-param>
        <param-name>edu.yale.its.tp.cas.grantingTimeout</param-name>
        <param-value>7200</param-value>
    </context-param>

Since the timeouts are stored as integers (max value 2,147,483,647) and converted to milliseconds, the maximum timeout in seconds is: 2147483 (almost 25 days).  If you need longer timeouts than that, you will have to change 'int' to 'long' for timeouts and tolerances in the CAS java code.

Implementing "remember me"

...

Code Block
java
java
titleLogin.java sendTgc method

 
/**
   * Creates, sends (to the given ServletResponse), and returns a
   * TicketGrantingTicket for the given username.
   */
  private TicketGrantingTicket sendTgc(String username,
               HttpServletRequest request,
               HttpServletResponse response) throws ServletException {
    try {
      TicketGrantingTicket t = new TicketGrantingTicket(username);
      String token = tgcCache.addTicket(t);
      Cookie tgc = new Cookie(TGC_ID, token);
      tgc.setSecure(true);
      tgc.setMaxAge(-1);
      tgc.setPath(request.getContextPath());
      response.addCookie(tgc);
      return t;
    } catch (TicketException ex) {
      throw new ServletException(ex.toString());
    }
  }

...

Code Block
java
java
1Setting the cookie to last a week
tgc.setMaxAge(302400);

In CAS 3

Out of the box parameters

In /WEB-INF/cas.properties, you can adjust ticket expiration policy. Specifically, to change the ticket granting ticket timeout, you would adjust policy.expiration.granting.timeOut=7200000 , which specifies ticket granting ticket expiration in milliseconds. Its default value is two hours.

Implementing "remember me"

...