Return-Path: Delivered-To: apmail-directory-commits-archive@www.apache.org Received: (qmail 72420 invoked from network); 22 May 2007 00:01:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 22 May 2007 00:01:41 -0000 Received: (qmail 98442 invoked by uid 500); 22 May 2007 00:01:45 -0000 Delivered-To: apmail-directory-commits-archive@directory.apache.org Received: (qmail 98398 invoked by uid 500); 22 May 2007 00:01:45 -0000 Mailing-List: contact commits-help@directory.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@directory.apache.org Delivered-To: mailing list commits@directory.apache.org Received: (qmail 98289 invoked by uid 99); 22 May 2007 00:01:45 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 17:01:45 -0700 X-ASF-Spam-Status: No, hits=-99.5 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 21 May 2007 17:01:32 -0700 Received: by eris.apache.org (Postfix, from userid 65534) id 5ACA11A9825; Mon, 21 May 2007 17:01:12 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r540371 [4/7] - in /directory/apacheds/trunk: kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/checksum/ kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/crypto/encryption/ kerberos-s... Date: Tue, 22 May 2007 00:00:59 -0000 To: commits@directory.apache.org From: erodriguez@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070522000112.5ACA11A9825@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddressType.java Mon May 21 17:00:43 2007 @@ -32,36 +32,127 @@ public final class HostAddressType implements Comparable { /** - * Enumeration elements are constructed once upon class loading. - * Order of appearance here determines the order of compareTo. + * Constant for the "null" host address type. */ public static final HostAddressType NULL = new HostAddressType( 0, "null" ); + + /** + * Constant for the "Unix" host address type. + */ public static final HostAddressType ADDRTYPE_UNIX = new HostAddressType( 1, "Unix" ); + + /** + * Constant for the "Internet" host address type. + */ public static final HostAddressType ADDRTYPE_INET = new HostAddressType( 2, "Internet" ); + + /** + * Constant for the "Arpanet" host address type. + */ public static final HostAddressType ADDRTYPE_IMPLINK = new HostAddressType( 3, "Arpanet" ); + + /** + * Constant for the "PUP" host address type. + */ public static final HostAddressType ADDRTYPE_PUP = new HostAddressType( 4, "PUP" ); + + /** + * Constant for the "CHAOS" host address type. + */ public static final HostAddressType ADDRTYPE_CHAOS = new HostAddressType( 5, "CHAOS" ); + + /** + * Constant for the "XEROX Network Services" host address type. + */ public static final HostAddressType ADDRTYPE_XNS = new HostAddressType( 6, "XEROX Network Services" ); + + /** + * Constant for the "IPX" host address type. + */ public static final HostAddressType ADDRTYPE_IPX = new HostAddressType( 6, "IPX" ); + + /** + * Constant for the "OSI" host address type. + */ public static final HostAddressType ADDRTYPE_OSI = new HostAddressType( 7, "OSI" ); + + /** + * Constant for the "European Computer Manufacturers" host address type. + */ public static final HostAddressType ADDRTYPE_ECMA = new HostAddressType( 8, "European Computer Manufacturers" ); + + /** + * Constant for the "Datakit" host address type. + */ public static final HostAddressType ADDRTYPE_DATAKIT = new HostAddressType( 9, "Datakit" ); + + /** + * Constant for the "CCITT" host address type. + */ public static final HostAddressType ADDRTYPE_CCITT = new HostAddressType( 10, "CCITT" ); + + /** + * Constant for the "SNA" host address type. + */ public static final HostAddressType ADDRTYPE_SNA = new HostAddressType( 11, "SNA" ); + + /** + * Constant for the "DECnet" host address type. + */ public static final HostAddressType ADDRTYPE_DECNET = new HostAddressType( 12, "DECnet" ); + + /** + * Constant for the "Direct Data Link Interface" host address type. + */ public static final HostAddressType ADDRTYPE_DLI = new HostAddressType( 13, "Direct Data Link Interface" ); + + /** + * Constant for the "LAT" host address type. + */ public static final HostAddressType ADDRTYPE_LAT = new HostAddressType( 14, "LAT" ); + + /** + * Constant for the "NSC Hyperchannel" host address type. + */ public static final HostAddressType ADDRTYPE_HYLINK = new HostAddressType( 15, "NSC Hyperchannel" ); + + /** + * Constant for the "AppleTalk" host address type. + */ public static final HostAddressType ADDRTYPE_APPLETALK = new HostAddressType( 16, "AppleTalk" ); + + /** + * Constant for the "NetBios" host address type. + */ public static final HostAddressType ADDRTYPE_NETBIOS = new HostAddressType( 17, "NetBios" ); + + /** + * Constant for the "VoiceView" host address type. + */ public static final HostAddressType ADDRTYPE_VOICEVIEW = new HostAddressType( 18, "VoiceView" ); + + /** + * Constant for the "Firefox" host address type. + */ public static final HostAddressType ADDRTYPE_FIREFOX = new HostAddressType( 19, "Firefox" ); + + /** + * Constant for the "Banyan" host address type. + */ public static final HostAddressType ADDRTYPE_BAN = new HostAddressType( 21, "Banyan" ); + + /** + * Constant for the "ATM" host address type. + */ public static final HostAddressType ADDRTYPE_ATM = new HostAddressType( 22, "ATM" ); + + /** + * Constant for the "Internet Protocol V6" host address type. + */ public static final HostAddressType ADDRTYPE_INET6 = new HostAddressType( 23, "Internet Protocol V6" ); /** - * These two lines are all that's necessary to export a List of VALUES. + * Array for building a List of VALUES. */ private static final HostAddressType[] values = { NULL, ADDRTYPE_UNIX, ADDRTYPE_INET, ADDRTYPE_IMPLINK, ADDRTYPE_PUP, ADDRTYPE_CHAOS, ADDRTYPE_XNS, @@ -69,34 +160,38 @@ ADDRTYPE_DLI, ADDRTYPE_LAT, ADDRTYPE_HYLINK, ADDRTYPE_APPLETALK, ADDRTYPE_NETBIOS, ADDRTYPE_VOICEVIEW, ADDRTYPE_FIREFOX, ADDRTYPE_BAN, ADDRTYPE_ATM, ADDRTYPE_INET6 }; + /** + * A List of all the host address type constants. + */ public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); + /** + * The name of the host address type. + */ private final String name; + + /** + * The value/code for the host address type. + */ private final int ordinal; /** * Private constructor prevents construction outside of this class. */ - private HostAddressType(int ordinal, String name) + private HostAddressType( int ordinal, String name ) { this.ordinal = ordinal; this.name = name; } - public String toString() - { - return name + " (" + ordinal + ")"; - } - - - public int compareTo( Object that ) - { - return ordinal - ( ( HostAddressType ) that ).ordinal; - } - - + /** + * Returns the host address type when specified by its ordinal. + * + * @param type + * @return The host address type. + */ public static HostAddressType getTypeByOrdinal( int type ) { for ( int ii = 0; ii < values.length; ii++ ) @@ -111,8 +206,25 @@ } + /** + * Returns the number associated with this host address type. + * + * @return The host address type ordinal. + */ public int getOrdinal() { return ordinal; + } + + + public int compareTo( Object that ) + { + return ordinal - ( ( HostAddressType ) that ).ordinal; + } + + + public String toString() + { + return name + " (" + ordinal + ")"; } } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/HostAddresses.java Mon May 21 17:00:43 2007 @@ -30,14 +30,22 @@ /** - * Class constructors + * Creates a new instance of HostAddresses. + * + * @param addresses */ - public HostAddresses(HostAddress[] addresses) + public HostAddresses( HostAddress[] addresses ) { this.addresses = addresses; } + /** + * Returns true if this {@link HostAddresses} contains a specified {@link HostAddress}. + * + * @param address + * @return true if this {@link HostAddresses} contains a specified {@link HostAddress}. + */ public boolean contains( HostAddress address ) { if ( addresses != null ) @@ -55,6 +63,12 @@ } + /** + * Returns true if two {@link HostAddresses} are equal. + * + * @param that + * @return true if two {@link HostAddresses} are equal. + */ public boolean equals( HostAddresses that ) { if ( ( this.addresses == null && that.addresses != null ) @@ -83,6 +97,11 @@ } + /** + * Returns the contained {@link HostAddress}s as an array. + * + * @return An array of {@link HostAddress}s. + */ public HostAddress[] getAddresses() { return addresses; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KdcOptions.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KdcOptions.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KdcOptions.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KdcOptions.java Mon May 21 17:00:43 2007 @@ -26,51 +26,108 @@ */ public class KdcOptions extends Options { - // KDC option - reserved + /** + * KDC option - reserved. + */ public static final int RESERVED = 0; - // KDC option - forwardable + /** + * KDC option - forwardable. + */ public static final int FORWARDABLE = 1; - // KDC option - forwarded + + /** + * KDC option - forwarded. + */ public static final int FORWARDED = 2; - // KDC option - proxiable + + /** + * KDC option - proxiable. + */ public static final int PROXIABLE = 3; - // KDC option - proxy + + /** + * KDC option - proxy. + */ public static final int PROXY = 4; - // KDC option - allow postdate + + /** + * KDC option - allow postdate. + */ public static final int ALLOW_POSTDATE = 5; - // KDC option - postdated + + /** + * KDC option - postdated. + */ public static final int POSTDATED = 6; - // KDC option - unused7 + + /** + * KDC option - unused7. + */ public static final int UNUSED7 = 7; - // KDC option - renewable + + /** + * KDC option - renewable. + */ public static final int RENEWABLE = 8; - // KDC option - unused9 + + /** + * KDC option - unused9. + */ public static final int UNUSED9 = 9; - // KDC option - unused10 + + /** + * KDC option - unused10. + */ public static final int UNUSED10 = 10; - // KDC option - unused11 + + /** + * KDC option - unused11. + */ public static final int UNUSED11 = 11; - // KDC option - unused12 + + /** + * KDC option - unused12. + */ public static final int UNUSED12 = 12; - // KDC option - unused13 + + /** + * KDC option - unused13. + */ public static final int UNUSED13 = 13; - // KDC option - disable transisted checked + + /** + * KDC option - disable transisted checked. + */ public static final int DISABLE_TRANSISTED_CHECKED = 26; - // KDC option - renewable is ok + + /** + * KDC option - renewable is ok. + */ public static final int RENEWABLE_OK = 27; - // KDC option - encrypted key in skey + + /** + * KDC option - encrypted key in skey. + */ public static final int ENC_TKT_IN_SKEY = 28; - // KDC option - renew + + /** + * KDC option - renew. + */ public static final int RENEW = 30; - // KDC option - validate + + /** + * KDC option - validate. + */ public static final int VALIDATE = 31; - // KDC option - maximum value + /** + * KDC option - maximum value. + */ public static final int MAX_VALUE = 32; /** - * Class constructors + * Creates a new instance of KdcOptions. */ public KdcOptions() { @@ -78,7 +135,12 @@ } - public KdcOptions(byte[] bytes) + /** + * Creates a new instance of KdcOptions. + * + * @param bytes + */ + public KdcOptions( byte[] bytes ) { super( MAX_VALUE ); setBytes( bytes ); @@ -86,7 +148,7 @@ /** - * Converts the object to a printable string + * Converts the object to a printable string. */ public String toString() { Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosPrincipalModifier.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosPrincipalModifier.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosPrincipalModifier.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosPrincipalModifier.java Mon May 21 17:00:43 2007 @@ -35,6 +35,11 @@ String realm; + /** + * Returns the {@link KerberosPrincipal}. + * + * @return The {@link KerberosPrincipal}. + */ public KerberosPrincipal getKerberosPrincipal() { if ( nameComponent != null ) @@ -55,12 +60,22 @@ } + /** + * Sets the {@link PrincipalName}. + * + * @param principalName + */ public void setPrincipalName( PrincipalName principalName ) { nameComponent = principalName; } + /** + * Sets the realm. + * + * @param realm + */ public void setRealm( String realm ) { this.realm = realm; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosTime.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosTime.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosTime.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KerberosTime.java Mon May 21 17:00:43 2007 @@ -32,8 +32,11 @@ * @author Apache Directory Project * @version $Rev$, $Date$ */ -public class KerberosTime implements Comparable +public class KerberosTime implements Comparable { + /** + * Constant for the {@link KerberosTime} "infinity." + */ public static final KerberosTime INFINITY = new KerberosTime( Long.MAX_VALUE ); private static final TimeZone UTC_TIME_ZONE = TimeZone.getTimeZone( "UTC" ); @@ -47,24 +50,44 @@ private long kerberosTime; + /** + * Creates a new instance of KerberosTime. + */ public KerberosTime() { kerberosTime = System.currentTimeMillis(); } - public KerberosTime(long time) + /** + * Creates a new instance of KerberosTime. + * + * @param time + */ + public KerberosTime( long time ) { kerberosTime = time; } - public KerberosTime(Date time) + /** + * Creates a new instance of KerberosTime. + * + * @param time + */ + public KerberosTime( Date time ) { kerberosTime = time.getTime(); } - + + /** + * Returns the {@link KerberosTime} for a given zulu time. + * + * @param zuluTime + * @return The {@link KerberosTime}. + * @throws ParseException + */ public static KerberosTime getTime( String zuluTime ) throws ParseException { Date date = null; @@ -75,24 +98,19 @@ return new KerberosTime( date ); } - - public int compareTo( Object o ) + + public int compareTo( KerberosTime that ) { final int BEFORE = -1; final int EQUAL = 0; final int AFTER = 1; // this optimization is usually worthwhile, and can always be added - if ( this == o ) + if ( this == that ) { return EQUAL; } - // Performing explicit checks for nullity and type are made redundant by - // the following cast, which will throw NullPointerException and - // ClassCastException in these respective cases. - final KerberosTime that = ( KerberosTime ) o; - // primitive numbers follow this form if ( this.kerberosTime < that.kerberosTime ) { @@ -108,42 +126,81 @@ } + /** + * Returns the {@link KerberosTime} as a long. + * + * @return The {@link KerberosTime} as a long. + */ public long getTime() { return kerberosTime; } + /** + * Returns the {@link KerberosTime} as a {@link Date}. + * + * @return The {@link KerberosTime} as a {@link Date}. + */ public Date toDate() { return new Date( kerberosTime ); } + /** + * Returns whether this {@link KerberosTime} is within the given clockskew. + * + * @param clockSkew + * @return true if this {@link KerberosTime} is within the given clockskew. + */ public boolean isInClockSkew( long clockSkew ) { return Math.abs( kerberosTime - System.currentTimeMillis() ) < clockSkew; } + /** + * Returns whether this {@link KerberosTime} is greater than a given {@link KerberosTime}. + * + * @param time + * @return true if this {@link KerberosTime} is greater than a given {@link KerberosTime}. + */ public boolean greaterThan( KerberosTime time ) { return kerberosTime > time.kerberosTime; } + /** + * Returns whether this {@link KerberosTime} is less than a given {@link KerberosTime}. + * + * @param time + * @return true if this {@link KerberosTime} is less than a given {@link KerberosTime}. + */ public boolean lessThan( KerberosTime time ) { return kerberosTime < time.kerberosTime; } + /** + * Returns whether this {@link KerberosTime} is equal to another {@link KerberosTime}. + * + * @param time + * @return true if the two {@link KerberosTime}s are equal. + */ public boolean equals( KerberosTime time ) { return kerberosTime == time.kerberosTime; } + /** + * Returns whether this {@link KerberosTime} is zero. + * + * @return true if this {@link KerberosTime} is zero. + */ public boolean isZero() { return kerberosTime == 0; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KrbCredInfo.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KrbCredInfo.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KrbCredInfo.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/KrbCredInfo.java Mon May 21 17:00:43 2007 @@ -42,9 +42,22 @@ private HostAddresses clientAddresses; //optional - public KrbCredInfo(EncryptionKey key, KerberosPrincipal clientPrincipal, TicketFlags flags, KerberosTime authTime, + /** + * Creates a new instance of KrbCredInfo. + * + * @param key + * @param clientPrincipal + * @param flags + * @param authTime + * @param startTime + * @param endTime + * @param renewTill + * @param serverPrincipal + * @param clientAddresses + */ + public KrbCredInfo( EncryptionKey key, KerberosPrincipal clientPrincipal, TicketFlags flags, KerberosTime authTime, KerberosTime startTime, KerberosTime endTime, KerberosTime renewTill, KerberosPrincipal serverPrincipal, - HostAddresses clientAddresses) + HostAddresses clientAddresses ) { this.key = key; this.clientPrincipal = clientPrincipal; @@ -58,54 +71,99 @@ } + /** + * Returns the auth {@link KerberosTime}. + * + * @return The auth {@link KerberosTime}. + */ public KerberosTime getAuthTime() { return authTime; } + /** + * Returns the client {@link HostAddresses}. + * + * @return The client {@link HostAddresses}. + */ public HostAddresses getClientAddresses() { return clientAddresses; } + /** + * Returns the end {@link KerberosTime}. + * + * @return The end {@link KerberosTime}. + */ public KerberosTime getEndTime() { return endTime; } + /** + * Returns the {@link TicketFlags}. + * + * @return The {@link TicketFlags}. + */ public TicketFlags getFlags() { return flags; } + /** + * Returns the {@link EncryptionKey}. + * + * @return The {@link EncryptionKey}. + */ public EncryptionKey getKey() { return key; } + /** + * Returns the client {@link KerberosPrincipal}. + * + * @return The client {@link KerberosPrincipal}. + */ public KerberosPrincipal getClientPrincipal() { return clientPrincipal; } + /** + * Returns the renew till {@link KerberosTime}. + * + * @return The renew till {@link KerberosTime}. + */ public KerberosTime getRenewTill() { return renewTill; } + /** + * Returns the server {@link KerberosPrincipal}. + * + * @return The server {@link KerberosPrincipal}. + */ public KerberosPrincipal getServerPrincipal() { return serverPrincipal; } + /** + * Returns the start {@link KerberosTime}. + * + * @return The start {@link KerberosTime}. + */ public KerberosTime getStartTime() { return startTime; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequest.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequest.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequest.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequest.java Mon May 21 17:00:43 2007 @@ -29,18 +29,31 @@ private LastRequestEntry[] entries = new LastRequestEntry[1]; + /** + * Creates a new instance of LastRequest. + */ public LastRequest() { entries[0] = new LastRequestEntry( LastRequestType.NONE, new KerberosTime() ); } - public LastRequest(LastRequestEntry[] entries) + /** + * Creates a new instance of LastRequest. + * + * @param entries + */ + public LastRequest( LastRequestEntry[] entries ) { this.entries = entries; } + /** + * Returns an array of {@link LastRequestEntry}s. + * + * @return The array of {@link LastRequestEntry}s. + */ public LastRequestEntry[] getEntries() { return entries; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestEntry.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestEntry.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestEntry.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestEntry.java Mon May 21 17:00:43 2007 @@ -30,19 +30,35 @@ private KerberosTime lastRequestValue; - public LastRequestEntry(LastRequestType type, KerberosTime value) + /** + * Creates a new instance of LastRequestEntry. + * + * @param type + * @param value + */ + public LastRequestEntry( LastRequestType type, KerberosTime value ) { lastRequestType = type; lastRequestValue = value; } + /** + * Returns the {@link LastRequestType}. + * + * @return The {@link LastRequestType}. + */ public LastRequestType getLastRequestType() { return lastRequestType; } + /** + * Returns the {@link KerberosTime} of the last request. + * + * @return The {@link KerberosTime} of the last request. + */ public KerberosTime getLastRequestValue() { return lastRequestValue; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestType.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestType.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestType.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/LastRequestType.java Mon May 21 17:00:43 2007 @@ -32,30 +32,79 @@ public final class LastRequestType implements Comparable { /** - * Enumeration elements are constructed once upon class loading. - * Order of appearance here determines the order of compareTo. + * Constant for the "none" last request type. */ public static final LastRequestType NONE = new LastRequestType( 0, "none" ); + + /** + * Constant for the "time of initial ticket" last request type. + */ public static final LastRequestType TIME_OF_INITIAL_TGT = new LastRequestType( 1, "time of initial ticket" ); + + /** + * Constant for the "time of initial request" last request type. + */ public static final LastRequestType TIME_OF_INITIAL_REQ = new LastRequestType( 2, "time of initial request" ); + + /** + * Constant for the "time of newest ticket" last request type. + */ public static final LastRequestType TIME_OF_NEWEST_TGT = new LastRequestType( 3, "time of newest ticket" ); + + /** + * Constant for the "time of last renewal" last request type. + */ public static final LastRequestType TIME_OF_LAST_RENEWAL = new LastRequestType( 4, "time of last renewal" ); + + /** + * Constant for the "time of last request" last request type. + */ public static final LastRequestType TIME_OF_LAST_REQ = new LastRequestType( 5, "time of last request" ); + + /** + * Constant for the "time of password expiration" last request type. + */ public static final LastRequestType TIME_OF_PASSWORD_EXP = new LastRequestType( 6, "time of password expiration" ); + /** + * Array for building a List of VALUES. + */ + private static final LastRequestType[] values = + { NONE, TIME_OF_INITIAL_TGT, TIME_OF_INITIAL_REQ, TIME_OF_NEWEST_TGT, TIME_OF_LAST_RENEWAL, TIME_OF_LAST_REQ, + TIME_OF_PASSWORD_EXP }; - public String toString() - { - return name + " (" + ordinal + ")"; - } + /** + * A List of all the last request type constants. + */ + public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); + /** + * The name of the checksum type. + */ + private final String name; - public int compareTo( Object that ) + /** + * The value/code for the checksum type. + */ + private final int ordinal; + + + /** + * Private constructor prevents construction outside of this class. + */ + private LastRequestType( int ordinal, String name ) { - return ordinal - ( ( LastRequestType ) that ).ordinal; + this.ordinal = ordinal; + this.name = name; } + /** + * Returns the last request type when specified by its ordinal. + * + * @param type + * @return The last request type. + */ public static LastRequestType getTypeByOrdinal( int type ) { for ( int ii = 0; ii < values.length; ii++ ) @@ -70,31 +119,25 @@ } + /** + * Returns the number associated with this last request type. + * + * @return The last request type ordinal. + */ public int getOrdinal() { return ordinal; } - /// PRIVATE ///// - private final String name; - private final int ordinal; - - /** - * Private constructor prevents construction outside of this class. - */ - private LastRequestType(int ordinal, String name) + public int compareTo( Object that ) { - this.ordinal = ordinal; - this.name = name; + return ordinal - ( ( LastRequestType ) that ).ordinal; } - /** - * These two lines are all that's necessary to export a List of VALUES. - */ - private static final LastRequestType[] values = - { NONE, TIME_OF_INITIAL_TGT, TIME_OF_INITIAL_REQ, TIME_OF_NEWEST_TGT, TIME_OF_LAST_RENEWAL, TIME_OF_LAST_REQ, - TIME_OF_PASSWORD_EXP }; - // VALUES needs to be located here, otherwise illegal forward reference - public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); + + public String toString() + { + return name + " (" + ordinal + ")"; + } } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Options.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Options.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Options.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/Options.java Mon May 21 17:00:43 2007 @@ -33,41 +33,66 @@ private int maxSize; - protected Options(int maxSize) + protected Options( int maxSize ) { this.maxSize = maxSize; options = new BitSet( maxSize ); } + /** + * Returns whether the option at a given index matches the option in this {@link Options}. + * + * @param options + * @param option + * @return true if two options are the same. + */ public boolean match( Options options, int option ) { return options.get( option ) == this.get( option ); } + /** + * Returns the value of the option at the given index. + * + * @param index + * @return true if the option at the given index is set. + */ public boolean get( int index ) { return options.get( index ); } + /** + * Sets the option at a given index. + * + * @param index + */ public void set( int index ) { options.set( index ); } + /** + * Clears (sets false) the option at a given index. + * + * @param index + */ public void clear( int index ) { options.clear( index ); } - /* + /** * Byte-reversing methods are an anomaly of the BouncyCastle * DERBitString endianness. Thes methods can be removed if the * Apache Directory Snickers codecs operate differently. + * + * @return The raw {@link Options} bytes. */ public byte[] getBytes() { Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationData.java Mon May 21 17:00:43 2007 @@ -30,19 +30,35 @@ private byte[] dataValue; - public PreAuthenticationData(PreAuthenticationDataType dataType, byte[] dataValue) + /** + * Creates a new instance of PreAuthenticationData. + * + * @param dataType + * @param dataValue + */ + public PreAuthenticationData( PreAuthenticationDataType dataType, byte[] dataValue ) { this.dataType = dataType; this.dataValue = dataValue; } + /** + * Returns the {@link PreAuthenticationDataType}. + * + * @return The {@link PreAuthenticationDataType}. + */ public PreAuthenticationDataType getDataType() { return dataType; } + /** + * Returns the raw bytes of the {@link PreAuthenticationData}. + * + * @return The raw bytes of the {@link PreAuthenticationData}. + */ public byte[] getDataValue() { return dataValue; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataModifier.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataModifier.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataModifier.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataModifier.java Mon May 21 17:00:43 2007 @@ -30,18 +30,33 @@ private byte[] dataValue; + /** + * Returns the {@link PreAuthenticationData}. + * + * @return The {@link PreAuthenticationData}. + */ public PreAuthenticationData getPreAuthenticationData() { return new PreAuthenticationData( dataType, dataValue ); } + /** + * Sets the {@link PreAuthenticationDataType}. + * + * @param dataType + */ public void setDataType( PreAuthenticationDataType dataType ) { this.dataType = dataType; } + /** + * Sets the raw bytes of this {@link PreAuthenticationData}. + * + * @param dataValue + */ public void setDataValue( byte[] dataValue ) { this.dataValue = dataValue; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataType.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataType.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataType.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PreAuthenticationDataType.java Mon May 21 17:00:43 2007 @@ -32,72 +32,141 @@ public class PreAuthenticationDataType implements Comparable { /** - * Enumeration elements are constructed once upon class loading. - * Order of appearance here determines the order of compareTo. + * Constant for the "null" pre-authentication data type. */ public static final PreAuthenticationDataType NULL = new PreAuthenticationDataType( 0, "null" ); - public static final PreAuthenticationDataType PA_TGS_REQ = new PreAuthenticationDataType( 1, "TGS Request." ); + + /** + * Constant for the "TGS request" pre-authentication data type. + */ + public static final PreAuthenticationDataType PA_TGS_REQ = new PreAuthenticationDataType( 1, "TGS request." ); + + /** + * Constant for the "encrypted timestamp" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_ENC_TIMESTAMP = new PreAuthenticationDataType( 2, "Encrypted timestamp." ); + + /** + * Constant for the "password salt" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_PW_SALT = new PreAuthenticationDataType( 3, "password salt" ); + + /** + * Constant for the "enc unix time" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_ENC_UNIX_TIME = new PreAuthenticationDataType( 5, "enc unix time" ); + + /** + * Constant for the "sandia secureid" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_SANDIA_SECUREID = new PreAuthenticationDataType( 6, "sandia secureid" ); + + /** + * Constant for the "sesame" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_SESAME = new PreAuthenticationDataType( 7, "sesame" ); + + /** + * Constant for the "OSF DCE" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_OSF_DCE = new PreAuthenticationDataType( 8, "OSF DCE" ); + + /** + * Constant for the "cybersafe secureid" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_CYBERSAFE_SECUREID = new PreAuthenticationDataType( 9, "cybersafe secureid" ); + + /** + * Constant for the "ASF3 salt" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_ASF3_SALT = new PreAuthenticationDataType( 10, "ASF3 salt" ); + + /** + * Constant for the "encryption info" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_ENCTYPE_INFO = new PreAuthenticationDataType( 11, "Encryption info." ); + + /** + * Constant for the "SAM challenge" pre-authentication data type. + */ public static final PreAuthenticationDataType SAM_CHALLENGE = new PreAuthenticationDataType( 12, "SAM challenge." ); + + /** + * Constant for the "SAM response" pre-authentication data type. + */ public static final PreAuthenticationDataType SAM_RESPONSE = new PreAuthenticationDataType( 13, "SAM response." ); + + /** + * Constant for the "PK as request" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_PK_AS_REQ = new PreAuthenticationDataType( 14, "PK as request" ); + + /** + * Constant for the "PK as response" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_PK_AS_REP = new PreAuthenticationDataType( 15, "PK as response" ); + + /** + * Constant for the "use specified key version" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_USE_SPECIFIED_KVNO = new PreAuthenticationDataType( 20, "use specified key version" ); + + /** + * Constant for the "SAM redirect" pre-authentication data type. + */ public static final PreAuthenticationDataType SAM_REDIRECT = new PreAuthenticationDataType( 21, "SAM redirect." ); + + /** + * Constant for the "get from typed data" pre-authentication data type. + */ public static final PreAuthenticationDataType PA_GET_FROM_TYPED_DATA = new PreAuthenticationDataType( 22, "Get from typed data" ); - /** Array for building a List of VALUES. */ + /** + * Array for building a List of VALUES. + */ private static final PreAuthenticationDataType[] values = { NULL, PA_TGS_REQ, PA_ENC_TIMESTAMP, PA_PW_SALT, PA_ENC_UNIX_TIME, PA_SANDIA_SECUREID, PA_SESAME, PA_OSF_DCE, PA_CYBERSAFE_SECUREID, PA_ASF3_SALT, PA_ENCTYPE_INFO, SAM_CHALLENGE, SAM_RESPONSE, PA_PK_AS_REQ, PA_PK_AS_REP, PA_USE_SPECIFIED_KVNO, SAM_REDIRECT, PA_GET_FROM_TYPED_DATA }; - /** A list of all the pre-authentication type constants. */ + /** + * A list of all the pre-authentication type constants. + */ public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); - /** The name of the pre-authentication type. */ + /** + * The name of the pre-authentication type. + */ private final String name; - /** The value/code for the pre-authentication type. */ + /** + * The value/code for the pre-authentication type. + */ private final int ordinal; /** * Private constructor prevents construction outside of this class. */ - private PreAuthenticationDataType(int ordinal, String name) + private PreAuthenticationDataType( int ordinal, String name ) { this.ordinal = ordinal; this.name = name; } - public String toString() - { - return name + " (" + ordinal + ")"; - } - - - public int compareTo( Object that ) - { - return ordinal - ( ( PreAuthenticationDataType ) that ).ordinal; - } - - + /** + * Returns the pre-authentication type when specified by its ordinal. + * + * @param type + * @return The pre-authentication type. + */ public static PreAuthenticationDataType getTypeByOrdinal( int type ) { for ( int ii = 0; ii < values.length; ii++ ) @@ -112,8 +181,25 @@ } + /** + * Returns the number associated with this pre-authentication type. + * + * @return The pre-authentication type ordinal. + */ public int getOrdinal() { return ordinal; + } + + + public int compareTo( Object that ) + { + return ordinal - ( ( PreAuthenticationDataType ) that ).ordinal; + } + + + public String toString() + { + return name + " (" + ordinal + ")"; } } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalName.java Mon May 21 17:00:43 2007 @@ -30,19 +30,35 @@ private int nameType; - public PrincipalName(String nameComponent, int nameType) + /** + * Creates a new instance of PrincipalName. + * + * @param nameComponent + * @param nameType + */ + public PrincipalName( String nameComponent, int nameType ) { this.nameComponent = nameComponent; this.nameType = nameType; } + /** + * Returns the type of the {@link PrincipalName}. + * + * @return The type of the {@link PrincipalName}. + */ public int getNameType() { return nameType; } + /** + * Returns the name component. + * + * @return The name component. + */ public String getNameComponent() { return nameComponent; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameModifier.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameModifier.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameModifier.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameModifier.java Mon May 21 17:00:43 2007 @@ -33,18 +33,23 @@ { private static final String COMPONENT_SEPARATOR = "/"; - List components = new ArrayList(); + List components = new ArrayList(); int nameType; + /** + * Returns the {@link PrincipalName}. + * + * @return The {@link PrincipalName}. + */ public PrincipalName getPrincipalName() { StringBuffer sb = new StringBuffer(); - Iterator it = components.iterator(); + Iterator it = components.iterator(); while ( it.hasNext() ) { - String component = ( String ) it.next(); + String component = it.next(); sb.append( component ); if ( it.hasNext() ) @@ -57,12 +62,22 @@ } + /** + * Sets the type. + * + * @param type + */ public void setType( int type ) { nameType = type; } + /** + * Adds a name component. + * + * @param name + */ public void addName( String name ) { components.add( name ); Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameType.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameType.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameType.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/PrincipalNameType.java Mon May 21 17:00:43 2007 @@ -32,34 +32,83 @@ public final class PrincipalNameType implements Comparable { /** - * Enumeration elements are constructed once upon class loading. - * Order of appearance here determines the order of compareTo. + * Constant for the "unknown name type" principal name type. */ public static final PrincipalNameType KRB_NT_UNKNOWN = new PrincipalNameType( 0, "unknown name type" ); + + /** + * Constant for the "user principal name type" principal name type. + */ public static final PrincipalNameType KRB_NT_PRINCIPAL = new PrincipalNameType( 1, "user principal name type" ); + + /** + * Constant for the "service and other unique instance (krbtgt) name type" principal name type. + */ public static final PrincipalNameType KRB_NT_SRV_INST = new PrincipalNameType( 2, "service and other unique instance (krbtgt) name type" ); + + /** + * Constant for the "service with host name as instance (telnet, rcommands)" principal name type. + */ public static final PrincipalNameType KRB_NT_SRV_HST = new PrincipalNameType( 3, "service with host name as instance (telnet, rcommands)" ); + + /** + * Constant for the "service with host name as instance (telnet, rcommands) name type" principal name type. + */ public static final PrincipalNameType KRB_NT_SRV_XHST = new PrincipalNameType( 4, "service with host name as instance (telnet, rcommands) name type" ); + + /** + * Constant for the "unique ID name type" principal name type. + */ public static final PrincipalNameType KRB_NT_UID = new PrincipalNameType( 5, "unique ID name type" ); + + /** + * Constant for the "nt x500 principal; encoded X.509 Distinguished name [RFC 2253]" principal name type. + */ public static final PrincipalNameType KRB_NT_X500_PRINCIPAL = new PrincipalNameType( 6, "nt x500 principal; encoded X.509 Distinguished name [RFC 2253]" ); + /** + * Array for building a List of VALUES. + */ + private static final PrincipalNameType[] values = + { KRB_NT_UNKNOWN, KRB_NT_PRINCIPAL, KRB_NT_SRV_INST, KRB_NT_SRV_HST, KRB_NT_SRV_XHST, KRB_NT_UID, + KRB_NT_X500_PRINCIPAL }; - public String toString() - { - return name + " (" + ordinal + ")"; - } + /** + * A List of all the principal name type constants. + */ + public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); + /** + * The name of the principal name type. + */ + private final String name; - public int compareTo( Object that ) + /** + * The value/code for the principal name type. + */ + private final int ordinal; + + + /** + * Private constructor prevents construction outside of this class. + */ + private PrincipalNameType( int ordinal, String name ) { - return ordinal - ( ( PrincipalNameType ) that ).ordinal; + this.ordinal = ordinal; + this.name = name; } + /** + * Returns the principal name type when specified by its ordinal. + * + * @param type + * @return The principal name type. + */ public static PrincipalNameType getTypeByOrdinal( int type ) { for ( int ii = 0; ii < values.length; ii++ ) @@ -74,31 +123,25 @@ } + /** + * Returns the number associated with this principal name type. + * + * @return The principal name type ordinal. + */ public int getOrdinal() { return ordinal; } - /// PRIVATE ///// - private final String name; - private final int ordinal; - - /** - * Private constructor prevents construction outside of this class. - */ - private PrincipalNameType(int ordinal, String name) + public int compareTo( Object that ) { - this.ordinal = ordinal; - this.name = name; + return ordinal - ( ( PrincipalNameType ) that ).ordinal; } - /** - * These two lines are all that's necessary to export a List of VALUES. - */ - private static final PrincipalNameType[] values = - { KRB_NT_UNKNOWN, KRB_NT_PRINCIPAL, KRB_NT_SRV_INST, KRB_NT_SRV_HST, KRB_NT_SRV_XHST, KRB_NT_UID, - KRB_NT_X500_PRINCIPAL }; - // VALUES needs to be located here, otherwise illegal forward reference - public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); + + public String toString() + { + return name + " (" + ordinal + ")"; + } } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBody.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBody.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBody.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBody.java Mon May 21 17:00:43 2007 @@ -45,9 +45,24 @@ private Ticket[] additionalTickets; //optional - public RequestBody(KdcOptions kdcOptions, KerberosPrincipal clientPrincipal, KerberosPrincipal serverPrincipal, + /** + * Creates a new instance of RequestBody. + * + * @param kdcOptions + * @param clientPrincipal + * @param serverPrincipal + * @param from + * @param till + * @param rtime + * @param nonce + * @param eType + * @param addresses + * @param encAuthorizationData + * @param additionalTickets + */ + public RequestBody( KdcOptions kdcOptions, KerberosPrincipal clientPrincipal, KerberosPrincipal serverPrincipal, KerberosTime from, KerberosTime till, KerberosTime rtime, int nonce, EncryptionType[] eType, - HostAddresses addresses, EncryptedData encAuthorizationData, Ticket[] additionalTickets) + HostAddresses addresses, EncryptedData encAuthorizationData, Ticket[] additionalTickets ) { this.kdcOptions = kdcOptions; this.clientPrincipal = clientPrincipal; @@ -63,66 +78,121 @@ } + /** + * Returns the additional {@link Ticket}s. + * + * @return The additional {@link Ticket}s. + */ public Ticket[] getAdditionalTickets() { return additionalTickets; } + /** + * Returns the {@link HostAddresses}. + * + * @return The {@link HostAddresses}. + */ public HostAddresses getAddresses() { return addresses; } + /** + * Returns the client {@link KerberosPrincipal}. + * + * @return The client {@link KerberosPrincipal}. + */ public KerberosPrincipal getClientPrincipal() { return clientPrincipal; } + /** + * Returns the server {@link KerberosPrincipal}. + * + * @return The server {@link KerberosPrincipal}. + */ public KerberosPrincipal getServerPrincipal() { return serverPrincipal; } + /** + * Returns the encrypted {@link AuthorizationData} as {@link EncryptedData}. + * + * @return The encrypted {@link AuthorizationData} as {@link EncryptedData}. + */ public EncryptedData getEncAuthorizationData() { return encAuthorizationData; } + /** + * Returns the requested {@link EncryptionType}s. + * + * @return The requested {@link EncryptionType}s. + */ public EncryptionType[] getEType() { return eType; } + /** + * Returns the from {@link KerberosTime}. + * + * @return The from {@link KerberosTime}. + */ public KerberosTime getFrom() { return from; } + /** + * Returns the {@link KdcOptions}. + * + * @return The {@link KdcOptions}. + */ public KdcOptions getKdcOptions() { return kdcOptions; } + /** + * Returns the nonce. + * + * @return The nonce. + */ public int getNonce() { return nonce; } + /** + * Returns the "R" {@link KerberosTime}. + * + * @return The "R" {@link KerberosTime}. + */ public KerberosTime getRtime() { return rtime; } + /** + * Returns the till {@link KerberosTime}. + * + * @return The till {@link KerberosTime}. + */ public KerberosTime getTill() { return till; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBodyModifier.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBodyModifier.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBodyModifier.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/RequestBodyModifier.java Mon May 21 17:00:43 2007 @@ -45,6 +45,11 @@ private Ticket[] additionalTickets; //optional + /** + * Returns the {@link RequestBody}. + * + * @return The {@link RequestBody}. + */ public RequestBody getRequestBody() { KerberosPrincipal clientPrincipal = clientModifier.getKerberosPrincipal(); @@ -55,18 +60,33 @@ } + /** + * Sets the client {@link PrincipalName}. + * + * @param clientName + */ public void setClientName( PrincipalName clientName ) { clientModifier.setPrincipalName( clientName ); } + /** + * Sets the server {@link PrincipalName}. + * + * @param serverName + */ public void setServerName( PrincipalName serverName ) { serverModifier.setPrincipalName( serverName ); } + /** + * Sets the realm. + * + * @param realm + */ public void setRealm( String realm ) { clientModifier.setRealm( realm ); @@ -74,54 +94,99 @@ } + /** + * Sets additional {@link Ticket}s. + * + * @param tickets + */ public void setAdditionalTickets( Ticket[] tickets ) { additionalTickets = tickets; } + /** + * Sets the {@link HostAddresses}. + * + * @param addresses + */ public void setAddresses( HostAddresses addresses ) { this.addresses = addresses; } + /** + * Sets the encrypted authorization data. + * + * @param authorizationData + */ public void setEncAuthorizationData( EncryptedData authorizationData ) { encAuthorizationData = authorizationData; } + /** + * Sets the requested {@link EncryptionType}s. + * + * @param type + */ public void setEType( EncryptionType[] type ) { eType = type; } + /** + * Sets the from {@link KerberosTime}. + * + * @param from + */ public void setFrom( KerberosTime from ) { this.from = from; } + /** + * Sets the {@link KdcOptions}. + * + * @param options + */ public void setKdcOptions( KdcOptions options ) { kdcOptions = options; } + /** + * Sets the nonce. + * + * @param nonce + */ public void setNonce( int nonce ) { this.nonce = nonce; } + /** + * Sets the "R" {@link KerberosTime}. + * + * @param rtime + */ public void setRtime( KerberosTime rtime ) { this.rtime = rtime; } + /** + * Sets the till {@link KerberosTime}. + * + * @param till + */ public void setTill( KerberosTime till ) { this.till = till; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TicketFlags.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TicketFlags.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TicketFlags.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TicketFlags.java Mon May 21 17:00:43 2007 @@ -26,36 +26,78 @@ */ public class TicketFlags extends Options { - // Ticket flag - reserved + /** + * Ticket flag - reserved + */ public static final int RESERVED = 0; - // Ticket flag - forwardable + + /** + * Ticket flag - forwardable + */ public static final int FORWARDABLE = 1; - // Ticket flag - forwarded + + /** + * Ticket flag - forwarded + */ public static final int FORWARDED = 2; - // Ticket flag - proxiable + + /** + * Ticket flag - proxiable + */ public static final int PROXIABLE = 3; - // Ticket flag - proxy + + /** + * Ticket flag - proxy + */ public static final int PROXY = 4; - // Ticket flag - may be postdated + + /** + * Ticket flag - may be postdated + */ public static final int MAY_POSTDATE = 5; - // Ticket flag - postdated + + /** + * Ticket flag - postdated + */ public static final int POSTDATED = 6; - // Ticket flag - invalid + /** + * Ticket flag - invalid + */ public static final int INVALID = 7; - // Ticket flag - renewable + + /** + * Ticket flag - renewable + */ public static final int RENEWABLE = 8; - // Ticket flag - initial + + /** + * Ticket flag - initial + */ public static final int INITIAL = 9; - // Ticket flag - pre-authentication + + /** + * Ticket flag - pre-authentication + */ public static final int PRE_AUTHENT = 10; - // Ticket flag - hardware authentication + + /** + * Ticket flag - hardware authentication + */ public static final int HW_AUTHENT = 11; - // Ticket flag - transitedEncoding policy checked + + /** + * Ticket flag - transitedEncoding policy checked + */ public static final int TRANSITED_POLICY_CHECKED = 12; - // Ticket flag - OK as delegate + + /** + * Ticket flag - OK as delegate + */ public static final int OK_AS_DELEGATE = 13; - // Ticket flag - maximum value + /** + * Ticket flag - maximum value + */ public static final int MAX_VALUE = 32; @@ -68,7 +110,12 @@ } - public TicketFlags(byte[] options) + /** + * Creates a new instance of TicketFlags. + * + * @param options + */ + public TicketFlags( byte[] options ) { super( MAX_VALUE ); setBytes( options ); @@ -76,7 +123,7 @@ /** - * Converts the object to a printable string + * Converts the object to a printable string. */ public String toString() { Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncoding.java Mon May 21 17:00:43 2007 @@ -30,6 +30,9 @@ private byte[] contents; + /** + * Creates a new instance of TransitedEncoding. + */ public TransitedEncoding() { type = TransitedEncodingType.NULL; @@ -37,19 +40,35 @@ } - public TransitedEncoding(TransitedEncodingType type, byte[] contents) + /** + * Creates a new instance of TransitedEncoding. + * + * @param type + * @param contents + */ + public TransitedEncoding( TransitedEncodingType type, byte[] contents ) { this.type = type; this.contents = contents; } + /** + * Returns the contents. + * + * @return The contents. + */ public byte[] getContents() { return contents; } + /** + * Returns the {@link TransitedEncodingType}. + * + * @return The {@link TransitedEncodingType}. + */ public TransitedEncodingType getType() { return type; Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncodingType.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncodingType.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncodingType.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/TransitedEncodingType.java Mon May 21 17:00:43 2007 @@ -32,26 +32,54 @@ public final class TransitedEncodingType implements Comparable { /** - * Enumeration elements are constructed once upon class loading. - * Order of appearance here determines the order of compareTo. + * Constant for the "null" transited encoding type. */ public static final TransitedEncodingType NULL = new TransitedEncodingType( 0, "null" ); + + /** + * Constant for the "Domain X500 compress" transited encoding type. + */ public static final TransitedEncodingType DOMAIN_X500_COMPRESS = new TransitedEncodingType( 1, "Domain X500 compress" ); + /** + * Array for building a List of VALUES. + */ + private static final TransitedEncodingType[] values = + { NULL, DOMAIN_X500_COMPRESS }; - public String toString() - { - return name + " (" + ordinal + ")"; - } + /** + * A List of all the transited encoding type constants. + */ + public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); + /** + * The name of the transited encoding type. + */ + private final String name; - public int compareTo( Object that ) + /** + * The value/code for the transited encoding type. + */ + private final int ordinal; + + + /** + * Private constructor prevents construction outside of this class. + */ + private TransitedEncodingType( int ordinal, String name ) { - return ordinal - ( ( TransitedEncodingType ) that ).ordinal; + this.ordinal = ordinal; + this.name = name; } + /** + * Returns the transited encoding type when specified by its ordinal. + * + * @param type + * @return The transited encoding type. + */ public static TransitedEncodingType getTypeByOrdinal( int type ) { for ( int ii = 0; ii < values.length; ii++ ) @@ -66,30 +94,25 @@ } + /** + * Returns the number associated with this transited encoding type. + * + * @return The transited encoding type ordinal. + */ public int getOrdinal() { return ordinal; } - /// PRIVATE ///// - private final String name; - private final int ordinal; - - /** - * Private constructor prevents construction outside of this class. - */ - private TransitedEncodingType(int ordinal, String name) + public int compareTo( Object that ) { - this.ordinal = ordinal; - this.name = name; + return ordinal - ( ( TransitedEncodingType ) that ).ordinal; } - /** - * These two lines are all that's necessary to export a List of VALUES. - */ - private static final TransitedEncodingType[] values = - { NULL, DOMAIN_X500_COMPRESS }; - // VALUES needs to be located here, otherwise illegal forward reference - public static final List VALUES = Collections.unmodifiableList( Arrays.asList( values ) ); + + public String toString() + { + return name + " (" + ordinal + ")"; + } } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/InMemoryReplayCache.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/InMemoryReplayCache.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/InMemoryReplayCache.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/InMemoryReplayCache.java Mon May 21 17:00:43 2007 @@ -38,7 +38,7 @@ { private static final long TWO_WEEKS = 1000 * 60 * 60 * 24 * 14; - private List list = new ArrayList(); + private List list = new ArrayList(); public synchronized boolean isReplay( KerberosTime clientTime, KerberosPrincipal clientPrincipal ) @@ -90,19 +90,38 @@ private KerberosPrincipal clientPrincipal; - public ReplayCacheEntry(KerberosTime time, KerberosPrincipal principal) + /** + * Creates a new instance of ReplayCacheEntry. + * + * @param time + * @param principal + */ + public ReplayCacheEntry( KerberosTime time, KerberosPrincipal principal ) { clientTime = time; clientPrincipal = principal; } + /** + * Returns whether this {@link ReplayCacheEntry} is equal another {@link ReplayCacheEntry}. + * {@link ReplayCacheEntry}'s are equal when the client time and the client principal are equal. + * + * @param other + * @return true if the ReplayCacheEntry's are equal. + */ public boolean equals( ReplayCacheEntry other ) { return clientTime.equals( other.clientTime ) && clientPrincipal.equals( other.clientPrincipal ); } + /** + * Return whether this {@link ReplayCacheEntry} is older than a given time. + * + * @param time + * @return true if the {@link ReplayCacheEntry} is older. + */ public boolean olderThan( KerberosTime time ) { return time.greaterThan( clientTime ); Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCache.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCache.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCache.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/replay/ReplayCache.java Mon May 21 17:00:43 2007 @@ -31,8 +31,21 @@ */ public interface ReplayCache { + /** + * Returns whether a request is a replay, based on the client time and client principal. + * + * @param clientTime + * @param clientPrincipal + * @return true if the request is a replay. + */ boolean isReplay( KerberosTime clientTime, KerberosPrincipal clientPrincipal ); + /** + * Saves the client time and client principal to the replay cache. + * + * @param clientTime + * @param clientPrincipal + */ void save( KerberosTime clientTime, KerberosPrincipal clientPrincipal ); } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/GetPrincipalStoreEntry.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/GetPrincipalStoreEntry.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/GetPrincipalStoreEntry.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/GetPrincipalStoreEntry.java Mon May 21 17:00:43 2007 @@ -37,6 +37,17 @@ { private String contextKey = "context"; + + /** + * Get a PrincipalStoreEntry given a principal. The ErrorType is used to indicate + * whether any resulting error pertains to a server or client. + * + * @param principal + * @param store + * @param errorType + * @return The PrincipalStoreEntry + * @throws Exception + */ public PrincipalStoreEntry getEntry( KerberosPrincipal principal, PrincipalStore store, ErrorType errorType ) throws Exception { @@ -51,7 +62,7 @@ throw new KerberosException( errorType ); } - if ( entry == null || entry.getEncryptionKey() == null ) + if ( entry == null || entry.getKeyMap().isEmpty() ) { throw new KerberosException( errorType ); } @@ -60,7 +71,7 @@ } - public String getContextKey() + protected String getContextKey() { return ( this.contextKey ); } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyAuthHeader.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyAuthHeader.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyAuthHeader.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyAuthHeader.java Mon May 21 17:00:43 2007 @@ -22,6 +22,8 @@ import java.net.InetAddress; +import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler; +import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage; import org.apache.directory.server.kerberos.shared.exceptions.ErrorType; import org.apache.directory.server.kerberos.shared.exceptions.KerberosException; import org.apache.directory.server.kerberos.shared.messages.ApplicationRequest; @@ -48,10 +50,25 @@ { private String contextKey = "context"; - // RFC 1510 A.10. KRB_AP_REQ verification + + /** + * Verifies an AuthHeader using guidelines from RFC 1510 section A.10., "KRB_AP_REQ verification." + * + * @param authHeader + * @param ticket + * @param serverKey + * @param clockSkew + * @param replayCache + * @param emptyAddressesAllowed + * @param clientAddress + * @param lockBox + * @param authenticatorKeyUsage + * @return The authenticator. + * @throws KerberosException + */ public Authenticator verifyAuthHeader( ApplicationRequest authHeader, Ticket ticket, EncryptionKey serverKey, long clockSkew, ReplayCache replayCache, boolean emptyAddressesAllowed, InetAddress clientAddress, - LockBox lockBox ) throws KerberosException + CipherTextHandler lockBox, KeyUsage authenticatorKeyUsage ) throws KerberosException { if ( authHeader.getProtocolVersionNumber() != 5 ) { @@ -90,11 +107,12 @@ throw new KerberosException( ErrorType.KRB_AP_ERR_NOKEY ); } - EncTicketPart encPart = ( EncTicketPart ) lockBox.unseal( EncTicketPart.class, ticketKey, ticket.getEncPart() ); + EncTicketPart encPart = ( EncTicketPart ) lockBox.unseal( EncTicketPart.class, ticketKey, ticket.getEncPart(), + KeyUsage.NUMBER2 ); ticket.setEncTicketPart( encPart ); Authenticator authenticator = ( Authenticator ) lockBox.unseal( Authenticator.class, ticket.getSessionKey(), - authHeader.getEncPart() ); + authHeader.getEncPart(), authenticatorKeyUsage ); if ( !authenticator.getClientPrincipal().getName().equals( ticket.getClientPrincipal().getName() ) ) { @@ -147,7 +165,7 @@ } - public String getContextKey() + protected String getContextKey() { return ( this.contextKey ); } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyTicket.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyTicket.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyTicket.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/service/VerifyTicket.java Mon May 21 17:00:43 2007 @@ -38,6 +38,15 @@ { private String contextKey = "context"; + + /** + * Verifies a Ticket given a realm and the server principal. + * + * @param ticket + * @param primaryRealm + * @param serverPrincipal + * @throws Exception + */ public void verifyTicket( Ticket ticket, String primaryRealm, KerberosPrincipal serverPrincipal ) throws Exception { if ( !ticket.getRealm().equals( primaryRealm ) && !ticket.getServerPrincipal().equals( serverPrincipal ) ) @@ -47,7 +56,7 @@ } - public String getContextKey() + protected String getContextKey() { return ( this.contextKey ); } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/JndiPrincipalStoreImpl.java Mon May 21 17:00:43 2007 @@ -21,7 +21,6 @@ import javax.naming.spi.InitialContextFactory; -import javax.security.auth.kerberos.KerberosKey; import javax.security.auth.kerberos.KerberosPrincipal; import org.apache.directory.server.protocol.shared.ServiceConfiguration; @@ -47,7 +46,13 @@ private PrincipalStore store; - public JndiPrincipalStoreImpl(ServiceConfiguration config, InitialContextFactory factory) + /** + * Creates a new instance of JndiPrincipalStoreImpl. + * + * @param config + * @param factory + */ + public JndiPrincipalStoreImpl( ServiceConfiguration config, InitialContextFactory factory ) { this.config = config; this.factory = factory; @@ -80,9 +85,9 @@ } - public String changePassword( KerberosPrincipal principal, KerberosKey newKey ) throws Exception + public String changePassword( KerberosPrincipal principal, String newPassword ) throws Exception { - return store.changePassword( principal, newKey ); + return store.changePassword( principal, newPassword ); } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosCatalog.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosCatalog.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosCatalog.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/KerberosCatalog.java Mon May 21 17:00:43 2007 @@ -37,7 +37,12 @@ private Map map; - public KerberosCatalog(Map map) + /** + * Creates a new instance of KerberosCatalog. + * + * @param map + */ + public KerberosCatalog( Map map ) { this.map = map; } Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/MultiBaseSearch.java Mon May 21 17:00:43 2007 @@ -28,7 +28,6 @@ import javax.naming.NamingException; import javax.naming.directory.DirContext; import javax.naming.spi.InitialContextFactory; -import javax.security.auth.kerberos.KerberosKey; import javax.security.auth.kerberos.KerberosPrincipal; import org.apache.directory.server.core.configuration.ConfigurationException; @@ -54,16 +53,16 @@ class MultiBaseSearch implements PrincipalStore { private InitialContextFactory factory; - private Hashtable env; + private Hashtable env; private Catalog catalog; - MultiBaseSearch(ServiceConfiguration config, InitialContextFactory factory) + MultiBaseSearch( ServiceConfiguration config, InitialContextFactory factory ) { this.factory = factory; - env = new Hashtable( config.toJndiEnvironment() ); + env = new Hashtable( config.toJndiEnvironment() ); env.put( Context.INITIAL_CONTEXT_FACTORY, config.getInitialContextFactory() ); env.put( Context.PROVIDER_URL, config.getCatalogBaseDn() ); @@ -148,14 +147,14 @@ } - public String changePassword( KerberosPrincipal principal, KerberosKey newKey ) throws Exception + public String changePassword( KerberosPrincipal principal, String newPassword ) throws Exception { env.put( Context.PROVIDER_URL, catalog.getBaseDn( principal.getRealm() ) ); try { DirContext ctx = ( DirContext ) factory.getInitialContext( env ); - return ( String ) execute( ctx, new ChangePassword( principal, newKey ) ); + return ( String ) execute( ctx, new ChangePassword( principal, newPassword ) ); } catch ( NamingException ne ) { Modified: directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStore.java URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStore.java?view=diff&rev=540371&r1=540370&r2=540371 ============================================================================== --- directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStore.java (original) +++ directory/apacheds/trunk/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/store/PrincipalStore.java Mon May 21 17:00:43 2007 @@ -20,7 +20,6 @@ package org.apache.directory.server.kerberos.shared.store; -import javax.security.auth.kerberos.KerberosKey; import javax.security.auth.kerberos.KerberosPrincipal; @@ -32,17 +31,53 @@ */ public interface PrincipalStore { + /** + * Add a principal. + * + * @param entry + * @return The name of the principal being added. + * @throws Exception + */ public String addPrincipal( PrincipalStoreEntry entry ) throws Exception; - public String changePassword( KerberosPrincipal principal, KerberosKey newKey ) throws Exception; - - + /** + * Change a principal's password. + * + * @param principal + * @param newPassword + * @return The name of the principal whose password is being changed. + * @throws Exception + */ + public String changePassword( KerberosPrincipal principal, String newPassword ) throws Exception; + + + /** + * Delete a principal. + * + * @param principal + * @return The name of the principal being deleted. + * @throws Exception + */ public String deletePrincipal( KerberosPrincipal principal ) throws Exception; + /** + * Get all principals for a given realm. + * + * @param realm + * @return An array of {@link PrincipalStoreEntry}'s. + * @throws Exception + */ public PrincipalStoreEntry[] getAllPrincipals( String realm ) throws Exception; + /** + * Get a {@link PrincipalStoreEntry} given a Kerberos principal. + * + * @param principal + * @return The {@link PrincipalStoreEntry} for the given Kerberos principal. + * @throws Exception + */ public PrincipalStoreEntry getPrincipal( KerberosPrincipal principal ) throws Exception; }