01: /* Copyright 2004, 2005, 2006 Acegi Technology Pty Limited
02: *
03: * Licensed under the Apache License, Version 2.0 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at
06: *
07: * http://www.apache.org/licenses/LICENSE-2.0
08: *
09: * Unless required by applicable law or agreed to in writing, software
10: * distributed under the License is distributed on an "AS IS" BASIS,
11: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: * See the License for the specific language governing permissions and
13: * limitations under the License.
14: */
15:
16: package org.acegisecurity.providers.cas;
17:
18: import java.util.List;
19: import java.util.Vector;
20:
21: /**
22: * Represents a CAS service ticket in native CAS form.
23: *
24: * @author Ben Alex
25: * @version $Id: TicketResponse.java 1496 2006-05-23 13:38:33Z benalex $
26: */
27: public class TicketResponse {
28: //~ Instance fields ================================================================================================
29:
30: private List proxyList;
31: private String proxyGrantingTicketIou;
32: private String user;
33:
34: //~ Constructors ===================================================================================================
35:
36: /**
37: * Constructor.
38: *
39: * <P>
40: * If <code>null</code> is passed into the <code>proxyList</code> or
41: * <code>proxyGrantingTicketIou</code>, suitable defaults are established.
42: * However, <code>null</code> cannot be passed for the <code>user</code>
43: * argument.
44: * </p>
45: *
46: * @param user the user as indicated by CAS (cannot be <code>null</code> or
47: * an empty <code>String</code>)
48: * @param proxyList as provided by CAS (may be <code>null</code>)
49: * @param proxyGrantingTicketIou as provided by CAS (may be
50: * <code>null</code>)
51: *
52: * @throws IllegalArgumentException DOCUMENT ME!
53: */
54: public TicketResponse(String user, List proxyList,
55: String proxyGrantingTicketIou) {
56: if (proxyList == null) {
57: proxyList = new Vector();
58: }
59:
60: if (proxyGrantingTicketIou == null) {
61: proxyGrantingTicketIou = "";
62: }
63:
64: if ((user == null) || "".equals(user)) {
65: throw new IllegalArgumentException(
66: "Cannot pass null or empty String for User");
67: }
68:
69: this .user = user;
70: this .proxyList = proxyList;
71: this .proxyGrantingTicketIou = proxyGrantingTicketIou;
72: }
73:
74: //~ Methods ========================================================================================================
75:
76: public String getProxyGrantingTicketIou() {
77: return proxyGrantingTicketIou;
78: }
79:
80: public List getProxyList() {
81: return proxyList;
82: }
83:
84: public String getUser() {
85: return user;
86: }
87:
88: public String toString() {
89: StringBuffer sb = new StringBuffer();
90: sb.append(super .toString());
91: sb.append(": User: " + this .user);
92: sb.append("; Proxy-Granting Ticket IOU: "
93: + this .proxyGrantingTicketIou);
94: sb.append("; Proxy List: " + this.proxyList.toString());
95:
96: return sb.toString();
97: }
98: }
|