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