View Javadoc

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.KerberosConstants;
26  import org.apache.directory.server.kerberos.shared.messages.Encodable;
27  import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationData;
28  import org.apache.directory.server.kerberos.shared.messages.value.Checksum;
29  import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
30  import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
31  
32  
33  /**
34   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
35   * @version $Rev: 590676 $, $Date: 2007-10-31 14:55:38 +0100 (Mi, 31 Okt 2007) $
36   */
37  public class Authenticator implements Encodable
38  {
39      /**
40       * Constant for the authenticator version number.
41       */
42      public static final int AUTHENTICATOR_VNO = KerberosConstants.KERBEROS_V5;
43  
44      private int versionNumber;
45      private KerberosPrincipal clientPrincipal;
46      private Checksum checksum;
47      private int clientMicroSecond;
48      private KerberosTime clientTime;
49      private EncryptionKey subSessionKey;
50      private int sequenceNumber;
51      private AuthorizationData authorizationData;
52  
53  
54      /**
55       * Creates a new instance of Authenticator.
56       *
57       * @param clientPrincipal
58       * @param checksum
59       * @param clientMicroSecond
60       * @param clientTime
61       * @param subSessionKey
62       * @param sequenceNumber
63       * @param authorizationData
64       */
65      public Authenticator( KerberosPrincipal clientPrincipal, Checksum checksum, int clientMicroSecond,
66          KerberosTime clientTime, EncryptionKey subSessionKey, int sequenceNumber, AuthorizationData authorizationData )
67      {
68          this( AUTHENTICATOR_VNO, clientPrincipal, checksum, clientMicroSecond, clientTime, subSessionKey,
69              sequenceNumber, authorizationData );
70      }
71  
72  
73      /**
74       * Creates a new instance of Authenticator.
75       *
76       * @param versionNumber
77       * @param clientPrincipal
78       * @param checksum
79       * @param clientMicroSecond
80       * @param clientTime
81       * @param subSessionKey
82       * @param sequenceNumber
83       * @param authorizationData
84       */
85      public Authenticator( int versionNumber, KerberosPrincipal clientPrincipal, Checksum checksum,
86          int clientMicroSecond, KerberosTime clientTime, EncryptionKey subSessionKey, int sequenceNumber,
87          AuthorizationData authorizationData )
88      {
89          this.versionNumber = versionNumber;
90          this.clientPrincipal = clientPrincipal;
91          this.checksum = checksum;
92          this.clientMicroSecond = clientMicroSecond;
93          this.clientTime = clientTime;
94          this.subSessionKey = subSessionKey;
95          this.sequenceNumber = sequenceNumber;
96          this.authorizationData = authorizationData;
97      }
98  
99  
100     /**
101      * Returns the client {@link KerberosPrincipal}.
102      *
103      * @return The client {@link KerberosPrincipal}.
104      */
105     public KerberosPrincipal getClientPrincipal()
106     {
107         return clientPrincipal;
108     }
109 
110 
111     /**
112      * Returns the client {@link KerberosTime}.
113      *
114      * @return The client {@link KerberosTime}.
115      */
116     public KerberosTime getClientTime()
117     {
118         return clientTime;
119     }
120 
121 
122     /**
123      * Returns the client microsecond.
124      *
125      * @return The client microsecond.
126      */
127     public int getClientMicroSecond()
128     {
129         return clientMicroSecond;
130     }
131 
132 
133     /**
134      * Returns the {@link AuthorizationData}.
135      *
136      * @return The {@link AuthorizationData}.
137      */
138     public AuthorizationData getAuthorizationData()
139     {
140         return authorizationData;
141     }
142 
143 
144     /**
145      * Returns the {@link Checksum}.
146      *
147      * @return The {@link Checksum}.
148      */
149     public Checksum getChecksum()
150     {
151         return checksum;
152     }
153 
154 
155     /**
156      * Returns the sequence number.
157      *
158      * @return The sequence number.
159      */
160     public int getSequenceNumber()
161     {
162         return sequenceNumber;
163     }
164 
165 
166     /**
167      * Returns the sub-session key.
168      *
169      * @return The sub-session key.
170      */
171     public EncryptionKey getSubSessionKey()
172     {
173         return subSessionKey;
174     }
175 
176 
177     /**
178      * Returns the version number of the {@link Authenticator}.
179      *
180      * @return The version number of the {@link Authenticator}.
181      */
182     public int getVersionNumber()
183     {
184         return versionNumber;
185     }
186 }