001/**
002 * Copyright 2005-2016 The Kuali Foundation
003 *
004 * Licensed under the Educational Community License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 * http://www.opensource.org/licenses/ecl2.php
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.kuali.rice.kim.client.acegi;
017
018import java.util.List;
019
020import org.acegisecurity.providers.cas.TicketResponse;
021
022
023/**
024 * Adds <code>distributedSessionToken</code> to the 
025 * <code>TicketResponse</code>.
026 *  
027 * @author Kuali Rice Team (rice.collab@kuali.org)
028 *
029 */
030public class KualiTicketResponse extends TicketResponse{
031    //~ Instance fields ================================================================================================
032
033    private String distributedSessionToken;
034
035    //~ Constructors ===================================================================================================
036  
037/**
038     * Constructor.
039     * 
040     * <P>
041     * If <code>null</code> is passed into the <code>proxyList</code> or
042     * <code>proxyGrantingTicketIou</code>, suitable defaults are established.
043     * However, <code>null</code> cannot be passed for the <code>user</code>
044     * or <code>distributedSessionToken</code>arguments.
045     * </p>
046     *
047     * @param user the user as indicated by CAS (cannot be <code>null</code> or
048     *        an empty <code>String</code>)
049     * @param proxyList as provided by CAS (may be <code>null</code>)
050     * @param proxyGrantingTicketIou as provided by CAS (may be
051     *        <code>null</code>)
052     * @param distributedSessionToken as provided by CAS (may be
053     *        <code>null</code>)
054     *
055     * @throws IllegalArgumentException DOCUMENT ME!
056     */
057    public KualiTicketResponse(String user, List proxyList, String proxyGrantingTicketIou, String distributedSessionToken) {
058        super(user,proxyList,proxyGrantingTicketIou);
059
060        if ((distributedSessionToken == null) || "".equals(distributedSessionToken)) {
061            throw new IllegalArgumentException("Cannot pass null or empty String for distributedSessionToken");
062        }
063        
064        this.distributedSessionToken = distributedSessionToken;
065    }
066
067    //~ Methods ========================================================================================================
068
069   
070    /**
071     * Returns the distributed session token
072     * 
073     * @return
074     */
075    public String getDistributedSessionToken() {
076        return distributedSessionToken;
077    }
078
079    public String toString() {
080        StringBuffer sb = new StringBuffer();
081        sb.append(super.toString());
082        sb.append("; SessionID: " + this.distributedSessionToken);
083
084        return sb.toString();
085    }
086}