View Javadoc
1   /**
2    * Copyright 2005-2015 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kim.client.acegi;
17  
18  import java.util.List;
19  
20  import org.acegisecurity.providers.cas.TicketResponse;
21  
22  
23  /**
24   * Adds <code>distributedSessionToken</code> to the 
25   * <code>TicketResponse</code>.
26   *  
27   * @author Kuali Rice Team (rice.collab@kuali.org)
28   *
29   */
30  public class KualiTicketResponse extends TicketResponse{
31      //~ Instance fields ================================================================================================
32  
33      private String distributedSessionToken;
34  
35      //~ Constructors ===================================================================================================
36    
37  /**
38       * Constructor.
39       * 
40       * <P>
41       * If <code>null</code> is passed into the <code>proxyList</code> or
42       * <code>proxyGrantingTicketIou</code>, suitable defaults are established.
43       * However, <code>null</code> cannot be passed for the <code>user</code>
44       * or <code>distributedSessionToken</code>arguments.
45       * </p>
46       *
47       * @param user the user as indicated by CAS (cannot be <code>null</code> or
48       *        an empty <code>String</code>)
49       * @param proxyList as provided by CAS (may be <code>null</code>)
50       * @param proxyGrantingTicketIou as provided by CAS (may be
51       *        <code>null</code>)
52       * @param distributedSessionToken as provided by CAS (may be
53       *        <code>null</code>)
54       *
55       * @throws IllegalArgumentException DOCUMENT ME!
56       */
57      public KualiTicketResponse(String user, List proxyList, String proxyGrantingTicketIou, String distributedSessionToken) {
58          super(user,proxyList,proxyGrantingTicketIou);
59  
60          if ((distributedSessionToken == null) || "".equals(distributedSessionToken)) {
61              throw new IllegalArgumentException("Cannot pass null or empty String for distributedSessionToken");
62          }
63          
64          this.distributedSessionToken = distributedSessionToken;
65      }
66  
67      //~ Methods ========================================================================================================
68  
69     
70      /**
71       * Returns the distributed session token
72       * 
73       * @return
74       */
75      public String getDistributedSessionToken() {
76          return distributedSessionToken;
77      }
78  
79      public String toString() {
80          StringBuffer sb = new StringBuffer();
81          sb.append(super.toString());
82          sb.append("; SessionID: " + this.distributedSessionToken);
83  
84          return sb.toString();
85      }
86  }