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     */
020    package org.apache.directory.server.kerberos.shared.messages.components;
021    
022    
023    import javax.security.auth.kerberos.KerberosPrincipal;
024    
025    import org.apache.directory.server.kerberos.shared.messages.Encodable;
026    import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationData;
027    import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
028    import org.apache.directory.server.kerberos.shared.messages.value.HostAddresses;
029    import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
030    import org.apache.directory.server.kerberos.shared.messages.value.TransitedEncoding;
031    import org.apache.directory.server.kerberos.shared.messages.value.flags.TicketFlags;
032    
033    
034    /**
035     * Encrypted part of Tickets.
036     * 
037     * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
038     * @version $Rev: 591019 $, $Date: 2007-11-01 15:16:34 +0100 (Thu, 01 Nov 2007) $
039     */
040    public class EncTicketPart implements Encodable
041    {
042        private TicketFlags flags;
043        private EncryptionKey sessionKey;
044        private KerberosPrincipal clientPrincipal;
045        private TransitedEncoding transitedEncoding;
046        private KerberosTime authtime;
047        private KerberosTime startTime; //optional
048        private KerberosTime endTime;
049        private KerberosTime renewTill; //optional
050        private HostAddresses clientAddresses; //optional
051        private AuthorizationData authorizationData; //optional
052    
053    
054        /**
055         * Creates a new instance of EncTicketPart.
056         *
057         * @param flags
058         * @param key
059         * @param clientPrincipal
060         * @param transited
061         * @param authtime
062         * @param starttime
063         * @param endtime
064         * @param renewTill
065         * @param caddr
066         * @param authorizationData
067         */
068        public EncTicketPart( TicketFlags flags, EncryptionKey key, KerberosPrincipal clientPrincipal,
069            TransitedEncoding transited, KerberosTime authtime, KerberosTime starttime, KerberosTime endtime,
070            KerberosTime renewTill, HostAddresses caddr, AuthorizationData authorizationData )
071        {
072            this.flags = flags;
073            this.sessionKey = key;
074            this.clientPrincipal = clientPrincipal;
075            this.transitedEncoding = transited;
076            this.authtime = authtime;
077            this.startTime = starttime;
078            this.endTime = endtime;
079            this.renewTill = renewTill;
080            this.clientAddresses = caddr;
081            this.authorizationData = authorizationData;
082        }
083    
084    
085        /**
086         * Returns the {@link AuthorizationData}.
087         *
088         * @return The {@link AuthorizationData}.
089         */
090        public AuthorizationData getAuthorizationData()
091        {
092            return authorizationData;
093        }
094    
095    
096        /**
097         * Returns the auth {@link KerberosTime}
098         *
099         * @return The auth {@link KerberosTime}
100         */
101        public KerberosTime getAuthTime()
102        {
103            return authtime;
104        }
105    
106    
107        /**
108         * Returns the client {@link HostAddresses}.
109         *
110         * @return The client {@link HostAddresses}.
111         */
112        public HostAddresses getClientAddresses()
113        {
114            return clientAddresses;
115        }
116    
117    
118        /**
119         * Returns the client {@link KerberosPrincipal}.
120         *
121         * @return The client {@link KerberosPrincipal}.
122         */
123        public KerberosPrincipal getClientPrincipal()
124        {
125            return clientPrincipal;
126        }
127    
128    
129        /**
130         * Returns the client realm.
131         *
132         * @return The client realm.
133         */
134        public String getClientRealm()
135        {
136            return clientPrincipal.getRealm();
137        }
138    
139    
140        /**
141         * Returns the end {@link KerberosTime}
142         *
143         * @return The end {@link KerberosTime}
144         */
145        public KerberosTime getEndTime()
146        {
147            return endTime;
148        }
149    
150    
151        /**
152         * Returns the {@link TicketFlags}.
153         *
154         * @return The {@link TicketFlags}.
155         */
156        public TicketFlags getFlags()
157        {
158            return flags;
159        }
160    
161    
162        /**
163         * Returns the session {@link EncryptionKey}.
164         *
165         * @return The session {@link EncryptionKey}.
166         */
167        public EncryptionKey getSessionKey()
168        {
169            return sessionKey;
170        }
171    
172    
173        /**
174         * Returns the renew till {@link KerberosTime}
175         *
176         * @return The renew till {@link KerberosTime}
177         */
178        public KerberosTime getRenewTill()
179        {
180            return renewTill;
181        }
182    
183    
184        /**
185         * Returns the start {@link KerberosTime}
186         *
187         * @return The start {@link KerberosTime}
188         */
189        public KerberosTime getStartTime()
190        {
191            return startTime;
192        }
193    
194    
195        /**
196         * Returns the {@link TransitedEncoding}.
197         *
198         * @return The {@link TransitedEncoding}.
199         */
200        public TransitedEncoding getTransitedEncoding()
201        {
202            return transitedEncoding;
203        }
204    }