|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| TicketResponse.java | 100% | 100% | 100% | 100% |
|
||||||||||||||
| 1 | /* Copyright 2004 Acegi Technology Pty Limited | |
| 2 | * | |
| 3 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 4 | * you may not use this file except in compliance with the License. | |
| 5 | * You may obtain a copy of the License at | |
| 6 | * | |
| 7 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 8 | * | |
| 9 | * 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 | /** | |
| 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 | //~ Instance fields ======================================================== | |
| 30 | ||
| 31 | private List proxyList; | |
| 32 | private String proxyGrantingTicketIou; | |
| 33 | private String user; | |
| 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 | * 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 | 8 | public TicketResponse(String user, List proxyList, |
| 56 | String proxyGrantingTicketIou) { | |
| 57 | 8 | if (proxyList == null) { |
| 58 | 2 | proxyList = new Vector(); |
| 59 | } | |
| 60 | ||
| 61 | 8 | if (proxyGrantingTicketIou == null) { |
| 62 | 1 | proxyGrantingTicketIou = ""; |
| 63 | } | |
| 64 | ||
| 65 | 8 | if ((user == null) || "".equals(user)) { |
| 66 | 1 | throw new IllegalArgumentException( |
| 67 | "Cannot pass null or empty String for User"); | |
| 68 | } | |
| 69 | ||
| 70 | 7 | this.user = user; |
| 71 | 7 | this.proxyList = proxyList; |
| 72 | 7 | this.proxyGrantingTicketIou = proxyGrantingTicketIou; |
| 73 | } | |
| 74 | ||
| 75 | 1 | protected TicketResponse() { |
| 76 | 1 | throw new IllegalArgumentException("Cannot use default constructor"); |
| 77 | } | |
| 78 | ||
| 79 | //~ Methods ================================================================ | |
| 80 | ||
| 81 | 4 | public String getProxyGrantingTicketIou() { |
| 82 | 4 | return proxyGrantingTicketIou; |
| 83 | } | |
| 84 | ||
| 85 | 6 | public List getProxyList() { |
| 86 | 6 | return proxyList; |
| 87 | } | |
| 88 | ||
| 89 | 6 | public String getUser() { |
| 90 | 6 | return user; |
| 91 | } | |
| 92 | ||
| 93 | 1 | public String toString() { |
| 94 | 1 | StringBuffer sb = new StringBuffer(); |
| 95 | 1 | sb.append(super.toString()); |
| 96 | 1 | sb.append(": User: " + this.user); |
| 97 | 1 | sb.append("; Proxy-Granting Ticket IOU: " + this.proxyGrantingTicketIou); |
| 98 | 1 | sb.append("; Proxy List: " + this.proxyList.toString()); |
| 99 | ||
| 100 | 1 | return sb.toString(); |
| 101 | } | |
| 102 | } |
|
||||||||||