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.KerberosConstants; 026 import org.apache.directory.server.kerberos.shared.messages.Encodable; 027 import org.apache.directory.server.kerberos.shared.messages.value.AuthorizationData; 028 import org.apache.directory.server.kerberos.shared.messages.value.Checksum; 029 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey; 030 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime; 031 032 033 /** 034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 035 * @version $Rev: 590676 $, $Date: 2007-10-31 14:55:38 +0100 (Wed, 31 Oct 2007) $ 036 */ 037 public class Authenticator implements Encodable 038 { 039 /** 040 * Constant for the authenticator version number. 041 */ 042 public static final int AUTHENTICATOR_VNO = KerberosConstants.KERBEROS_V5; 043 044 private int versionNumber; 045 private KerberosPrincipal clientPrincipal; 046 private Checksum checksum; 047 private int clientMicroSecond; 048 private KerberosTime clientTime; 049 private EncryptionKey subSessionKey; 050 private int sequenceNumber; 051 private AuthorizationData authorizationData; 052 053 054 /** 055 * Creates a new instance of Authenticator. 056 * 057 * @param clientPrincipal 058 * @param checksum 059 * @param clientMicroSecond 060 * @param clientTime 061 * @param subSessionKey 062 * @param sequenceNumber 063 * @param authorizationData 064 */ 065 public Authenticator( KerberosPrincipal clientPrincipal, Checksum checksum, int clientMicroSecond, 066 KerberosTime clientTime, EncryptionKey subSessionKey, int sequenceNumber, AuthorizationData authorizationData ) 067 { 068 this( AUTHENTICATOR_VNO, clientPrincipal, checksum, clientMicroSecond, clientTime, subSessionKey, 069 sequenceNumber, authorizationData ); 070 } 071 072 073 /** 074 * Creates a new instance of Authenticator. 075 * 076 * @param versionNumber 077 * @param clientPrincipal 078 * @param checksum 079 * @param clientMicroSecond 080 * @param clientTime 081 * @param subSessionKey 082 * @param sequenceNumber 083 * @param authorizationData 084 */ 085 public Authenticator( int versionNumber, KerberosPrincipal clientPrincipal, Checksum checksum, 086 int clientMicroSecond, KerberosTime clientTime, EncryptionKey subSessionKey, int sequenceNumber, 087 AuthorizationData authorizationData ) 088 { 089 this.versionNumber = versionNumber; 090 this.clientPrincipal = clientPrincipal; 091 this.checksum = checksum; 092 this.clientMicroSecond = clientMicroSecond; 093 this.clientTime = clientTime; 094 this.subSessionKey = subSessionKey; 095 this.sequenceNumber = sequenceNumber; 096 this.authorizationData = authorizationData; 097 } 098 099 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 }