001    /*
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements.  See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership.  The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License.  You may obtain a copy of the License at
009     *
010     *     http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied.  See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    package org.apache.shiro.cas;
020    
021    import org.apache.shiro.authc.RememberMeAuthenticationToken;
022    
023    /**
024     * This class represents a token for a CAS authentication (service ticket + user id + remember me).
025     *
026     * @since 1.2
027     */
028    public class CasToken implements RememberMeAuthenticationToken {
029        
030        private static final long serialVersionUID = 8587329689973009598L;
031        
032        // the service ticket returned by the CAS server
033        private String ticket = null;
034        
035        // the user identifier
036        private String userId = null;
037        
038        // is the user in a remember me mode ?
039        private boolean isRememberMe = false;
040        
041        public CasToken(String ticket) {
042            this.ticket = ticket;
043        }
044        
045        public Object getPrincipal() {
046            return userId;
047        }
048        
049        public Object getCredentials() {
050            return ticket;
051        }
052        
053        public void setUserId(String userId) {
054            this.userId = userId;
055        }
056        
057        public boolean isRememberMe() {
058            return isRememberMe;
059        }
060        
061        public void setRememberMe(boolean isRememberMe) {
062            this.isRememberMe = isRememberMe;
063        }
064    }