1 /*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *
19 */
20 package org.apache.directory.server.kerberos.shared.messages.components;
21
22
23 import javax.security.auth.kerberos.KerberosPrincipal;
24
25 import org.apache.directory.server.kerberos.shared.messages.Encodable;
26 import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationData;
27 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
28 import org.apache.directory.server.kerberos.shared.messages.value.HostAddresses;
29 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
30 import org.apache.directory.server.kerberos.shared.messages.value.TransitedEncoding;
31 import org.apache.directory.server.kerberos.shared.messages.value.flags.TicketFlags;
32
33
34 /**
35 * Encrypted part of Tickets.
36 *
37 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
38 * @version $Rev: 591019 $, $Date: 2007-11-01 15:16:34 +0100 (Do, 01 Nov 2007) $
39 */
40 public class EncTicketPart implements Encodable
41 {
42 private TicketFlags flags;
43 private EncryptionKey sessionKey;
44 private KerberosPrincipal clientPrincipal;
45 private TransitedEncoding transitedEncoding;
46 private KerberosTime authtime;
47 private KerberosTime startTime; //optional
48 private KerberosTime endTime;
49 private KerberosTime renewTill; //optional
50 private HostAddresses clientAddresses; //optional
51 private AuthorizationData authorizationData; //optional
52
53
54 /**
55 * Creates a new instance of EncTicketPart.
56 *
57 * @param flags
58 * @param key
59 * @param clientPrincipal
60 * @param transited
61 * @param authtime
62 * @param starttime
63 * @param endtime
64 * @param renewTill
65 * @param caddr
66 * @param authorizationData
67 */
68 public EncTicketPart( TicketFlags flags, EncryptionKey key, KerberosPrincipal clientPrincipal,
69 TransitedEncoding transited, KerberosTime authtime, KerberosTime starttime, KerberosTime endtime,
70 KerberosTime renewTill, HostAddresses caddr, AuthorizationData authorizationData )
71 {
72 this.flags = flags;
73 this.sessionKey = key;
74 this.clientPrincipal = clientPrincipal;
75 this.transitedEncoding = transited;
76 this.authtime = authtime;
77 this.startTime = starttime;
78 this.endTime = endtime;
79 this.renewTill = renewTill;
80 this.clientAddresses = caddr;
81 this.authorizationData = authorizationData;
82 }
83
84
85 /**
86 * Returns the {@link AuthorizationData}.
87 *
88 * @return The {@link AuthorizationData}.
89 */
90 public AuthorizationData getAuthorizationData()
91 {
92 return authorizationData;
93 }
94
95
96 /**
97 * Returns the auth {@link KerberosTime}
98 *
99 * @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 }