001    /*
002     * Copyright 2007-2008 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     */
016    
017    package org.kuali.rice.kim.client.acegi;
018    
019    import java.util.List;
020    
021    import org.acegisecurity.providers.cas.TicketResponse;
022    
023    
024    /**
025     * Adds <code>distributedSessionToken</code> to the 
026     * <code>TicketResponse</code>.
027     *  
028     * @author Kuali Rice Team (rice.collab@kuali.org)
029     *
030     */
031    public class KualiTicketResponse extends TicketResponse{
032        //~ Instance fields ================================================================================================
033    
034        private String distributedSessionToken;
035    
036        //~ Constructors ===================================================================================================
037      
038    /**
039         * Constructor.
040         * 
041         * <P>
042         * If <code>null</code> is passed into the <code>proxyList</code> or
043         * <code>proxyGrantingTicketIou</code>, suitable defaults are established.
044         * However, <code>null</code> cannot be passed for the <code>user</code>
045         * or <code>distributedSessionToken</code>arguments.
046         * </p>
047         *
048         * @param user the user as indicated by CAS (cannot be <code>null</code> or
049         *        an empty <code>String</code>)
050         * @param proxyList as provided by CAS (may be <code>null</code>)
051         * @param proxyGrantingTicketIou as provided by CAS (may be
052         *        <code>null</code>)
053         * @param distributedSessionToken as provided by CAS (may be
054         *        <code>null</code>)
055         *
056         * @throws IllegalArgumentException DOCUMENT ME!
057         */
058        public KualiTicketResponse(String user, List proxyList, String proxyGrantingTicketIou, String distributedSessionToken) {
059            super(user,proxyList,proxyGrantingTicketIou);
060    
061            if ((distributedSessionToken == null) || "".equals(distributedSessionToken)) {
062                throw new IllegalArgumentException("Cannot pass null or empty String for distributedSessionToken");
063            }
064            
065            this.distributedSessionToken = distributedSessionToken;
066        }
067    
068        //~ Methods ========================================================================================================
069    
070       
071        /**
072         * Returns the distributed session token
073         * 
074         * @return
075         */
076        public String getDistributedSessionToken() {
077            return distributedSessionToken;
078        }
079    
080        public String toString() {
081            StringBuffer sb = new StringBuffer();
082            sb.append(super.toString());
083            sb.append("; SessionID: " + this.distributedSessionToken);
084    
085            return sb.toString();
086        }
087    }