You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2007/05/22 02:00:59 UTC

svn commit: r540371 [7/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...

Modified: directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/SamVerifier.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/SamVerifier.java?view=diff&rev=540371&r1=540370&r2=540371
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/SamVerifier.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/SamVerifier.java Mon May 21 17:00:43 2007
@@ -48,11 +48,17 @@
  */
 public interface SamVerifier
 {
-    /** Starts one of many pluggable SAM type subsystem*/
+    /**
+     * Starts one of many pluggable SAM type subsystem.
+     * 
+     * @throws SamException
+     */
     void startup() throws SamException;
 
 
-    /** Shuts down one of many pluggable SAM type subsystem*/
+    /**
+     * Shuts down one of many pluggable SAM type subsystem.
+     */
     void shutdown();
 
 
@@ -62,9 +68,9 @@
      * and supplies it to the verifier to check generated keys to conduct the
      * verification workflow.
      *
-     * @param keyChecker the integrity checker that validates whether or not a
+     * @param keyChecker The integrity checker that validates whether or not a
      * key can decrypt-decode preauth data (an encryped-encoded generalized
-     * timestamp)
+     * timestamp).
      */
     void setIntegrityChecker( KeyIntegrityChecker keyChecker );
 
@@ -72,8 +78,10 @@
     /**
      * Verifies the single use password supplied.
      *
-     * @param principal the kerberos principal to use
-     * @param sad single-use authentication data (encrypted generalized timestamp)
+     * @param principal The kerberos principal to use.
+     * @param sad Single-use authentication data (encrypted generalized timestamp).
+     * @return The {@link KerberosKey}.
+     * @throws SamException 
      */
     KerberosKey verify( KerberosPrincipal principal, byte[] sad ) throws SamException;
 
@@ -81,11 +89,15 @@
     /**
      * Gets the registered SAM algorithm type implemented by this SamVerifier.
      *
-     * @return the type value for the SAM algorithm used to verify the SUP.
+     * @return The type value for the SAM algorithm used to verify the SUP.
      */
     SamType getSamType();
 
 
-    /** sets the user context where users are stored for the primary realm */
+    /**
+     * Sets the user context where users are stored for the primary realm.
+     *  
+     * @param userContext
+     */
     void setUserContext( DirContext userContext );
 }

Modified: directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/TimestampChecker.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/TimestampChecker.java?view=diff&rev=540371&r1=540370&r2=540371
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/TimestampChecker.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/main/java/org/apache/directory/server/kerberos/sam/TimestampChecker.java Mon May 21 17:00:43 2007
@@ -24,14 +24,15 @@
 
 import javax.security.auth.kerberos.KerberosKey;
 
+import org.apache.directory.server.kerberos.shared.crypto.encryption.CipherTextHandler;
 import org.apache.directory.server.kerberos.shared.crypto.encryption.EncryptionType;
+import org.apache.directory.server.kerberos.shared.crypto.encryption.KeyUsage;
 import org.apache.directory.server.kerberos.shared.exceptions.KerberosException;
 import org.apache.directory.server.kerberos.shared.io.decoder.EncryptedDataDecoder;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedData;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptedTimeStamp;
 import org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey;
 import org.apache.directory.server.kerberos.shared.messages.value.KerberosTime;
-import org.apache.directory.server.kerberos.shared.service.LockBox;
 
 
 /**
@@ -41,7 +42,7 @@
 public class TimestampChecker implements KeyIntegrityChecker
 {
     private static final long FIVE_MINUTES = 300000;
-    private static final LockBox lockBox = new LockBox();
+    private static final CipherTextHandler cipherTextHandler = new CipherTextHandler();
 
 
     public boolean checkKeyIntegrity( byte[] encryptedData, KerberosKey kerberosKey )
@@ -57,8 +58,8 @@
 
             // Decrypt the EncryptedData structure to get the PA-ENC-TS-ENC
             // Decode the decrypted timestamp into our timestamp object.
-            EncryptedTimeStamp timestamp = ( EncryptedTimeStamp ) lockBox.unseal( EncryptedTimeStamp.class, key,
-                sadValue );
+            EncryptedTimeStamp timestamp = ( EncryptedTimeStamp ) cipherTextHandler.unseal( EncryptedTimeStamp.class, key,
+                sadValue, KeyUsage.NUMBER1 );
 
             // Since we got here we must have a valid timestamp structure that we can
             // validate to be within a five minute skew.

Modified: directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/messages/value/OptionsTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/messages/value/OptionsTest.java?view=diff&rev=540371&r1=540370&r2=540371
==============================================================================
--- directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/messages/value/OptionsTest.java (original)
+++ directory/apacheds/trunk/protocol-kerberos/src/test/java/org/apache/directory/server/kerberos/messages/value/OptionsTest.java Mon May 21 17:00:43 2007
@@ -22,11 +22,11 @@
 
 import java.util.Arrays;
 
+import junit.framework.TestCase;
+
 import org.apache.directory.server.kerberos.shared.messages.value.KdcOptions;
 import org.apache.directory.server.kerberos.shared.messages.value.TicketFlags;
 
-import junit.framework.TestCase;
-
 
 /**
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -38,6 +38,9 @@
         { ( byte ) 0x50, ( byte ) 0x00, ( byte ) 0x00, ( byte ) 0x10 };
 
 
+    /**
+     * Tests converting the ticket flags to a descriptive String.
+     */
     public void testToString()
     {
         TicketFlags flags = new TicketFlags();
@@ -49,6 +52,9 @@
     }
 
 
+    /**
+     * Tests that setting flags is idempotent.
+     */
     public void testDuplicateSetting()
     {
         TicketFlags flags = new TicketFlags();
@@ -61,6 +67,9 @@
     }
 
 
+    /**
+     * Tests the basic construction of the {@link KdcOptions}.
+     */
     public void testConstruction()
     {
         KdcOptions options = new KdcOptions( fpriOptions );

Modified: directory/apacheds/trunk/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java?view=diff&rev=540371&r1=540370&r2=540371
==============================================================================
--- directory/apacheds/trunk/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java (original)
+++ directory/apacheds/trunk/protocol-ntp/src/main/java/org/apache/directory/server/ntp/NtpConfiguration.java Mon May 21 17:00:43 2007
@@ -65,20 +65,20 @@
      * Creates a new instance with default settings that operates on the
      * {@link DirectoryService} with the specified ID.
      */
-    public NtpConfiguration(String instanceId)
+    public NtpConfiguration( String instanceId )
     {
         this( getDefaultConfig(), LoadStrategy.LDAP );
         setInstanceId( instanceId );
     }
 
 
-    public NtpConfiguration( Map<String, String> properties )
+    public NtpConfiguration( Map<String, Object> properties )
     {
         this( properties, LoadStrategy.LDAP );
     }
 
 
-    public NtpConfiguration( Map<String, String> properties, int strategy )
+    public NtpConfiguration( Map<String, Object> properties, int strategy )
     {
         if ( properties == null )
         {
@@ -98,9 +98,9 @@
     }
 
 
-    public static Map<String, String> getDefaultConfig()
+    public static Map<String, Object> getDefaultConfig()
     {
-        Map<String, String> defaults = new HashMap<String, String>();
+        Map<String, Object> defaults = new HashMap<String, Object>();
 
         defaults.put( SERVICE_PID, DEFAULT_PID );
         defaults.put( IP_PORT_KEY, DEFAULT_IP_PORT );

Modified: directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ServiceConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ServiceConfiguration.java?view=diff&rev=540371&r1=540370&r2=540371
==============================================================================
--- directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ServiceConfiguration.java (original)
+++ directory/apacheds/trunk/protocol-shared/src/main/java/org/apache/directory/server/protocol/shared/ServiceConfiguration.java Mon May 21 17:00:43 2007
@@ -76,7 +76,7 @@
     public static final int MINUTE = 60000;
 
     /** the map of configuration */
-    protected Map configuration = new HashMap();
+    protected Map<String, Object> configuration = new HashMap<String, Object>();
 
 
     public String getCatalogBaseDn()
@@ -118,9 +118,9 @@
     }
 
 
-    public Hashtable toJndiEnvironment()
+    public Hashtable<String, Object> toJndiEnvironment()
     {
-        Hashtable env = new Hashtable();
+        Hashtable<String, Object> env = new Hashtable<String, Object>();
         env.put( JNDI_KEY, this );
         env.putAll( configuration );
 

Modified: directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java?view=diff&rev=540371&r1=540370&r2=540371
==============================================================================
--- directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java (original)
+++ directory/apacheds/trunk/server-unit/src/main/java/org/apache/directory/server/unit/AbstractServerTest.java Mon May 21 17:00:43 2007
@@ -59,6 +59,9 @@
     /** the context root for the rootDSE */
     protected LdapContext rootDSE;
 
+    /** the context root for the schema */
+    protected LdapContext schemaRoot;
+
     /** flag whether to delete database files for each test or not */
     protected boolean doDelete = true;
 
@@ -139,6 +142,9 @@
         
         envFinal.put( Context.PROVIDER_URL, "" );
         rootDSE = new InitialLdapContext( envFinal, null );
+
+        envFinal.put( Context.PROVIDER_URL, "ou=schema" );
+        schemaRoot = new InitialLdapContext( envFinal, null );
     }