Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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());
    }
  }

...