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.store; 021 022 023 import java.util.Map; 024 025 import javax.security.auth.kerberos.KerberosPrincipal; 026 027 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType; 028 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey; 029 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime; 030 import org.apache.directory.server.kerberos.shared.messages.value.SamType; 031 032 033 /** 034 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 035 * @version $Rev: 544729 $, $Date: 2007-06-06 07:01:24 +0200 (Wed, 06 Jun 2007) $ 036 */ 037 public class PrincipalStoreEntry 038 { 039 // principal 040 private String distinguishedName; 041 private String commonName; 042 private KerberosPrincipal principal; 043 private String realmName; 044 045 // uidObject 046 private String userId; 047 048 // KDCEntry 049 private KerberosTime validStart; 050 private KerberosTime validEnd; 051 private KerberosTime passwordEnd; 052 private int keyVersionNumber; 053 private int maxLife; 054 private int maxRenew; 055 private int kdcFlags; 056 private SamType samType; 057 058 private boolean disabled; 059 private boolean lockedOut; 060 private KerberosTime expiration; 061 062 private Map<EncryptionType, EncryptionKey> keyMap; 063 064 065 PrincipalStoreEntry( String distinguishedName, String commonName, String userId, KerberosPrincipal principal, 066 int keyVersionNumber, KerberosTime validStart, KerberosTime validEnd, KerberosTime passwordEnd, int maxLife, 067 int maxRenew, int kdcFlags, Map<EncryptionType, EncryptionKey> keyMap, String realmName, SamType samType, 068 boolean disabled, boolean lockedOut, KerberosTime expiration ) 069 { 070 this.distinguishedName = distinguishedName; 071 this.commonName = commonName; 072 this.userId = userId; 073 this.principal = principal; 074 this.validStart = validStart; 075 this.validEnd = validEnd; 076 this.passwordEnd = passwordEnd; 077 this.keyVersionNumber = keyVersionNumber; 078 this.maxLife = maxLife; 079 this.maxRenew = maxRenew; 080 this.kdcFlags = kdcFlags; 081 this.realmName = realmName; 082 this.disabled = disabled; 083 this.lockedOut = lockedOut; 084 this.expiration = expiration; 085 this.samType = samType; 086 this.keyMap = keyMap; 087 } 088 089 090 /** 091 * Returns whether this account is disabled. 092 * 093 * @return Whether this account is disabled. 094 */ 095 public boolean isDisabled() 096 { 097 return disabled; 098 } 099 100 101 /** 102 * Returns whether this account is locked-out. 103 * 104 * @return Whether this account is locked-out. 105 */ 106 public boolean isLockedOut() 107 { 108 return lockedOut; 109 } 110 111 112 /** 113 * Returns the expiration time. 114 * 115 * @return The expiration time. 116 */ 117 public KerberosTime getExpiration() 118 { 119 return expiration; 120 } 121 122 123 /** 124 * Returns the distinguished name. 125 * 126 * @return The distinguished name. 127 */ 128 public String getDistinguishedName() 129 { 130 return distinguishedName; 131 } 132 133 134 /** 135 * Returns the common name. 136 * 137 * @return The common name. 138 */ 139 public String getCommonName() 140 { 141 return commonName; 142 } 143 144 145 /** 146 * Returns the user ID. 147 * 148 * @return The user ID. 149 */ 150 public String getUserId() 151 { 152 return userId; 153 } 154 155 156 /** 157 * Returns the key map. 158 * 159 * @return The key map. 160 */ 161 public Map<EncryptionType, EncryptionKey> getKeyMap() 162 { 163 return keyMap; 164 } 165 166 167 /** 168 * Returns the KDC flags. 169 * 170 * @return The KDC flags. 171 */ 172 public int getKDCFlags() 173 { 174 return kdcFlags; 175 } 176 177 178 /** 179 * Returns the key version number (kvno). 180 * 181 * @return The key version number (kvno). 182 */ 183 public int getKeyVersionNumber() 184 { 185 return keyVersionNumber; 186 } 187 188 189 /** 190 * Returns the max life. 191 * 192 * @return The max life. 193 */ 194 public int getMaxLife() 195 { 196 return maxLife; 197 } 198 199 200 /** 201 * Returns the maximum renew time. 202 * 203 * @return The maximum renew time. 204 */ 205 public int getMaxRenew() 206 { 207 return maxRenew; 208 } 209 210 211 /** 212 * Returns the expiration time for the password. 213 * 214 * @return The expiration time for the password. 215 */ 216 public KerberosTime getPasswordEnd() 217 { 218 return passwordEnd; 219 } 220 221 222 /** 223 * Returns the principal. 224 * 225 * @return The principal. 226 */ 227 public KerberosPrincipal getPrincipal() 228 { 229 return principal; 230 } 231 232 233 /** 234 * Returns the realm name. 235 * 236 * @return The realm name. 237 */ 238 public String getRealmName() 239 { 240 return realmName; 241 } 242 243 244 /** 245 * Returns the end of validity. 246 * 247 * @return The end of validity. 248 */ 249 public KerberosTime getValidEnd() 250 { 251 return validEnd; 252 } 253 254 255 /** 256 * Returns the start of validity. 257 * 258 * @return The start of validity. 259 */ 260 public KerberosTime getValidStart() 261 { 262 return validStart; 263 } 264 265 266 /** 267 * Returns the single-use authentication (SAM) type. 268 * 269 * @return The single-use authentication (SAM) type. 270 */ 271 public SamType getSamType() 272 { 273 return samType; 274 } 275 }