1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.acegisecurity.providers.cas;
17
18 import java.util.List;
19 import java.util.Vector;
20
21
22 /***
23 * Represents a CAS service ticket in native CAS form.
24 *
25 * @author Ben Alex
26 * @version $Id: TicketResponse.java,v 1.2 2005/11/17 00:55:47 benalex Exp $
27 */
28 public class TicketResponse {
29
30
31 private List proxyList;
32 private String proxyGrantingTicketIou;
33 private String user;
34
35
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 * argument.
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 *
53 * @throws IllegalArgumentException DOCUMENT ME!
54 */
55 public TicketResponse(String user, List proxyList,
56 String proxyGrantingTicketIou) {
57 if (proxyList == null) {
58 proxyList = new Vector();
59 }
60
61 if (proxyGrantingTicketIou == null) {
62 proxyGrantingTicketIou = "";
63 }
64
65 if ((user == null) || "".equals(user)) {
66 throw new IllegalArgumentException(
67 "Cannot pass null or empty String for User");
68 }
69
70 this.user = user;
71 this.proxyList = proxyList;
72 this.proxyGrantingTicketIou = proxyGrantingTicketIou;
73 }
74
75 protected TicketResponse() {
76 throw new IllegalArgumentException("Cannot use default constructor");
77 }
78
79
80
81 public String getProxyGrantingTicketIou() {
82 return proxyGrantingTicketIou;
83 }
84
85 public List getProxyList() {
86 return proxyList;
87 }
88
89 public String getUser() {
90 return user;
91 }
92
93 public String toString() {
94 StringBuffer sb = new StringBuffer();
95 sb.append(super.toString());
96 sb.append(": User: " + this.user);
97 sb.append("; Proxy-Granting Ticket IOU: " + this.proxyGrantingTicketIou);
98 sb.append("; Proxy List: " + this.proxyList.toString());
99
100 return sb.toString();
101 }
102 }