directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r379013 [6/45] - in /directory/trunks/apacheds: ./ core-plugin/ core-plugin/src/main/java/org/apache/directory/server/core/tools/schema/ core-plugin/src/test/java/org/apache/directory/server/core/tools/schema/ core-shared/ core-shared/src/m...
Date Mon, 20 Feb 2006 03:58:21 GMT
Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java Sun Feb 19 19:57:02 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.directory.server.core;
 
+
 import java.util.HashMap;
 import java.util.Hashtable;
 import java.util.Iterator;
@@ -77,10 +78,10 @@
     private final DirectoryServiceConfiguration configuration = new DefaultDirectoryServiceConfiguration( this );
 
     private DirectoryServiceListener serviceListener;
-    
+
     /** the initial context environment that fired up the backend subsystem */
     private Hashtable environment;
-    
+
     /** the configuration */
     private StartupConfiguration startupConfiguration;
 
@@ -95,28 +96,28 @@
 
     /** The interceptor (or interceptor chain) for this service */
     private InterceptorChain interceptorChain;
-    
+
     /** whether or not this instance has been shutdown */
     private boolean started = false;
-    
+
+
     // ------------------------------------------------------------------------
     // Constructor
     // ------------------------------------------------------------------------
 
-    
     /**
      * Creates a new instance.
      */
-    public DefaultDirectoryService( String instanceId )
+    public DefaultDirectoryService(String instanceId)
     {
-        if( instanceId == null )
+        if ( instanceId == null )
         {
             throw new NullPointerException( "instanceId" );
         }
         this.instanceId = instanceId;
     }
 
-    
+
     // ------------------------------------------------------------------------
     // BackendSubsystem Interface Method Implemetations
     // ------------------------------------------------------------------------
@@ -126,36 +127,38 @@
         return this.getJndiContext( null, null, "none", rootDN );
     }
 
-    public synchronized Context getJndiContext( String principal, byte[] credential, String authentication, String rootDN ) throws NamingException
+
+    public synchronized Context getJndiContext( String principal, byte[] credential, String authentication,
+        String rootDN ) throws NamingException
     {
         checkSecuritySettings( principal, credential, authentication );
-        
+
         if ( !started )
         {
             return new DeadContext();
         }
-        
+
         Hashtable environment = getEnvironment();
         environment.remove( Context.SECURITY_PRINCIPAL );
         environment.remove( Context.SECURITY_CREDENTIALS );
         environment.remove( Context.SECURITY_AUTHENTICATION );
-        
-        if( principal != null )
+
+        if ( principal != null )
         {
             environment.put( Context.SECURITY_PRINCIPAL, principal );
         }
-        
-        if( credential != null )
+
+        if ( credential != null )
         {
             environment.put( Context.SECURITY_CREDENTIALS, credential );
         }
-        
-        if( authentication != null )
+
+        if ( authentication != null )
         {
             environment.put( Context.SECURITY_AUTHENTICATION, authentication );
         }
-        
-        if( rootDN == null )
+
+        if ( rootDN == null )
         {
             rootDN = "";
         }
@@ -164,9 +167,10 @@
         return new ServerLdapContext( this, environment );
     }
 
+
     public synchronized void startup( DirectoryServiceListener listener, Hashtable env ) throws NamingException
     {
-        if( started )
+        if ( started )
         {
             return;
         }
@@ -177,37 +181,37 @@
 
         if ( cfg.isShutdownHookEnabled() )
         {
-            Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() {
+            Runtime.getRuntime().addShutdownHook( new Thread( new Runnable()
+            {
                 public void run()
                 {
                     try
                     {
                         shutdown();
                     }
-                    catch( NamingException e )
+                    catch ( NamingException e )
                     {
-                        log.warn(
-                                "Failed to shut down the directory service: " +
-                                DefaultDirectoryService.this.instanceId, e );
+                        log.warn( "Failed to shut down the directory service: "
+                            + DefaultDirectoryService.this.instanceId, e );
                     }
                 }
             }, "ApacheDS Shutdown Hook (" + instanceId + ')' ) );
-            
+
             log.info( "ApacheDS shutdown hook has been registered with the runtime." );
         }
         else if ( log.isWarnEnabled() )
         {
-            log.warn( "ApacheDS shutdown hook has NOT been registered with the runtime." + 
-                "  This default setting for standalone operation has been overriden." );
+            log.warn( "ApacheDS shutdown hook has NOT been registered with the runtime."
+                + "  This default setting for standalone operation has been overriden." );
         }
 
         envCopy.put( Context.PROVIDER_URL, "" );
-        
+
         try
         {
             cfg.validate();
         }
-        catch( ConfigurationException e )
+        catch ( ConfigurationException e )
         {
             NamingException ne = new LdapConfigurationException( "Invalid configuration." );
             ne.initCause( e );
@@ -216,7 +220,7 @@
 
         this.environment = envCopy;
         this.startupConfiguration = cfg;
-        
+
         listener.beforeStartup( this );
 
         initialize();
@@ -224,13 +228,14 @@
         showSecurityWarnings();
         this.serviceListener = listener;
         started = true;
-        if ( ! startupConfiguration.getTestEntries().isEmpty() )
+        if ( !startupConfiguration.getTestEntries().isEmpty() )
         {
             createTestEntries( env );
         }
         listener.afterStartup( this );
     }
 
+
     public synchronized void sync() throws NamingException
     {
         if ( !started )
@@ -273,70 +278,81 @@
             serviceListener.afterShutdown( this );
         }
     }
-    
+
+
     public String getInstanceId()
     {
         return instanceId;
     }
-    
+
+
     public DirectoryServiceConfiguration getConfiguration()
     {
         return configuration;
     }
-    
-    
+
+
     public Hashtable getEnvironment()
     {
         return ( Hashtable ) environment.clone();
     }
-    
+
+
     public DirectoryServiceListener getServiceListener()
     {
         return serviceListener;
     }
-    
+
+
     public StartupConfiguration getStartupConfiguration()
     {
         return startupConfiguration;
     }
-    
+
+
     public GlobalRegistries getGlobalRegistries()
     {
         return globalRegistries;
     }
 
+
     public DirectoryPartitionNexus getPartitionNexus()
     {
         return partitionNexus;
     }
-    
+
+
     public InterceptorChain getInterceptorChain()
     {
         return interceptorChain;
     }
-    
+
+
     public boolean isFirstStart()
     {
         return firstStart;
     }
-    
+
+
     public boolean isStarted()
     {
         return started;
     }
-    
+
+
     /**
      * Checks to make sure security environment parameters are set correctly.
      *
      * @throws javax.naming.NamingException if the security settings are not correctly configured.
      */
-    private void checkSecuritySettings( String principal, byte[] credential, String authentication ) throws NamingException
+    private void checkSecuritySettings( String principal, byte[] credential, String authentication )
+        throws NamingException
     {
-        if( authentication == null )
+        if ( authentication == null )
         {
             authentication = "";
         }
-        
+
         /*
          * If bind is simple make sure we have the credentials and the
          * principal name set within the environment, otherwise complain
@@ -345,14 +361,14 @@
         {
             if ( credential == null )
             {
-                throw new LdapConfigurationException( "missing required "
-                        + Context.SECURITY_CREDENTIALS + " property for simple authentication" );
+                throw new LdapConfigurationException( "missing required " + Context.SECURITY_CREDENTIALS
+                    + " property for simple authentication" );
             }
 
             if ( principal == null )
             {
-                throw new LdapConfigurationException( "missing required "
-                        + Context.SECURITY_PRINCIPAL + " property for simple authentication" );
+                throw new LdapConfigurationException( "missing required " + Context.SECURITY_PRINCIPAL
+                    + " property for simple authentication" );
             }
         }
         /*
@@ -364,17 +380,17 @@
             if ( credential != null )
             {
                 throw new LdapConfigurationException( "ambiguous bind "
-                        + "settings encountered where bind is anonymous yet "
-                        + Context.SECURITY_CREDENTIALS + " property is set" );
+                    + "settings encountered where bind is anonymous yet " + Context.SECURITY_CREDENTIALS
+                    + " property is set" );
             }
             if ( principal != null )
             {
                 throw new LdapConfigurationException( "ambiguous bind "
-                        + "settings encountered where bind is anonymous yet "
-                        + Context.SECURITY_PRINCIPAL + " property is set" );
+                    + "settings encountered where bind is anonymous yet " + Context.SECURITY_PRINCIPAL
+                    + " property is set" );
             }
-            
-            if( !startupConfiguration.isAllowAnonymousAccess() )
+
+            if ( !startupConfiguration.isAllowAnonymousAccess() )
             {
                 throw new LdapNoPermissionException( "Anonymous access disabled." );
             }
@@ -385,7 +401,8 @@
              * If bind is anything other than simple or none we need to
              * complain because SASL is not a supported auth method yet
              */
-            throw new LdapAuthenticationNotSupportedException( "Unknown authentication type: '" + authentication + "'", ResultCodeEnum.AUTHMETHODNOTSUPPORTED );
+            throw new LdapAuthenticationNotSupportedException( "Unknown authentication type: '" + authentication + "'",
+                ResultCodeEnum.AUTHMETHODNOTSUPPORTED );
         }
     }
 
@@ -428,8 +445,9 @@
             attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
             attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
             attributes.put( "displayName", "Directory Superuser" );
-            
-            partitionNexus.add( DirectoryPartitionNexus.ADMIN_PRINCIPAL, DirectoryPartitionNexus.getAdminName(), attributes );
+
+            partitionNexus.add( DirectoryPartitionNexus.ADMIN_PRINCIPAL, DirectoryPartitionNexus.getAdminName(),
+                attributes );
         }
 
         // -------------------------------------------------------------------
@@ -538,8 +556,8 @@
             attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
             attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( "ou=partitions,ou=configuration,ou=system",
-                    new LdapName( "ou=partitions,ou=configuration,ou=system" ), attributes );
+            partitionNexus.add( "ou=partitions,ou=configuration,ou=system", new LdapName(
+                "ou=partitions,ou=configuration,ou=system" ), attributes );
         }
 
         // -------------------------------------------------------------------
@@ -560,8 +578,8 @@
             attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
             attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( "ou=services,ou=configuration,ou=system",
-                    new LdapName( "ou=services,ou=configuration,ou=system" ), attributes );
+            partitionNexus.add( "ou=services,ou=configuration,ou=system", new LdapName(
+                "ou=services,ou=configuration,ou=system" ), attributes );
         }
 
         // -------------------------------------------------------------------
@@ -582,8 +600,8 @@
             attributes.put( "creatorsName", DirectoryPartitionNexus.ADMIN_PRINCIPAL );
             attributes.put( "createTimestamp", DateUtils.getGeneralizedTime() );
 
-            partitionNexus.add( "ou=interceptors,ou=configuration,ou=system",
-                    new LdapName( "ou=interceptors,ou=configuration,ou=system" ), attributes );
+            partitionNexus.add( "ou=interceptors,ou=configuration,ou=system", new LdapName(
+                "ou=interceptors,ou=configuration,ou=system" ), attributes );
         }
 
         // -------------------------------------------------------------------
@@ -612,7 +630,8 @@
 
         return firstStart;
     }
-    
+
+
     /**
      * Displays security warning messages if any possible secutiry issue is found.
      */
@@ -620,42 +639,40 @@
     {
         // Warn if the default password is not changed.
         boolean needToChangeAdminPassword = false;
-        
+
         Attributes adminEntry = partitionNexus.lookup( new LdapName( DirectoryPartitionNexus.ADMIN_PRINCIPAL ) );
         Object userPassword = adminEntry.get( "userPassword" ).get();
-        if( userPassword instanceof byte[] )
+        if ( userPassword instanceof byte[] )
         {
-            needToChangeAdminPassword = DirectoryPartitionNexus.ADMIN_PASSWORD.equals( new String( ( byte[] ) userPassword ) );
+            needToChangeAdminPassword = DirectoryPartitionNexus.ADMIN_PASSWORD.equals( new String(
+                ( byte[] ) userPassword ) );
         }
         else if ( userPassword.toString().equals( DirectoryPartitionNexus.ADMIN_PASSWORD ) )
         {
             needToChangeAdminPassword = DirectoryPartitionNexus.ADMIN_PASSWORD.equals( userPassword.toString() );
         }
-        
-        if( needToChangeAdminPassword )
+
+        if ( needToChangeAdminPassword )
         {
-            log.warn(
-                    "You didn't change the admin password of directory service " +
-                    "instance '" + instanceId + "'.  " +
-                    "Please update the admin password as soon as possible " +
-                    "to prevent a possible security breach." );
+            log.warn( "You didn't change the admin password of directory service " + "instance '" + instanceId + "'.  "
+                + "Please update the admin password as soon as possible " + "to prevent a possible security breach." );
         }
     }
-    
+
+
     private void createTestEntries( Hashtable env ) throws NamingException
     {
         String principal = AbstractContextFactory.getPrincipal( env );
         byte[] credential = AbstractContextFactory.getCredential( env );
         String authentication = AbstractContextFactory.getAuthentication( env );
-        ServerLdapContext ctx = ( ServerLdapContext ) getJndiContext( principal, credential, 
-            authentication, "" );
-        
+        ServerLdapContext ctx = ( ServerLdapContext ) getJndiContext( principal, credential, authentication, "" );
+
         Iterator i = startupConfiguration.getTestEntries().iterator();
-        while( i.hasNext() )
+        while ( i.hasNext() )
         {
             Attributes entry = ( Attributes ) ( ( Attributes ) i.next() ).clone();
             String dn = ( String ) entry.remove( "dn" ).get();
-            
+
             try
             {
                 ctx.createSubcontext( dn, entry );
@@ -667,70 +684,72 @@
         }
     }
 
+
     private void setupOidsMap( BootstrapRegistries bootstrapRegistries ) throws NamingException
     {
         Iterator keys = bootstrapRegistries.getOidRegistry().getOidByName().keySet().iterator();
-        
+
         Map oidsMap = new HashMap();
         Map oidName = new HashMap();
-        
+
         while ( keys.hasNext() )
         {
-        	String name = StringTools.deepTrimToLower( (String)keys.next() );
-        	String principal = null;
-        	
-        	if ( OID.isOID( name ) )
-        	{
-        		continue;
-        	}
-        	
-        	String oid =  bootstrapRegistries.getOidRegistry().getOid( name );
-        	
-        	OidNormalizer oidNormalizer = null;
-        	
-        	if ( oidName.containsKey( oid ) )
-        	{
-        		principal = StringTools.deepTrimToLower( (String)oidName.get( oid ) );
-        		
-        		if ( principal.length() > name.length() )
-        		{
-        			OidNormalizer oldOidNormalizer = (OidNormalizer)oidsMap.get( principal );
-
-        			
-        			oidNormalizer = new OidNormalizer( name, oldOidNormalizer.getNormalizer() );
-
-        			oidName.remove( oid );
-        			oidName.put( oid, name );
-        			oidsMap.remove( principal );
-        			oidsMap.remove( oid );
-        			oidsMap.put( principal, oidNormalizer );
-        			oidsMap.put( name, oidNormalizer );
-        			oidsMap.put( oid, oidNormalizer );
-        	        continue;
-        		}
-        	}
-        	else
-        	{
-        		principal = name;
-            	oidName.put( oid, principal );
-
-            	if ( bootstrapRegistries.getNormalizerRegistry().hasNormalizer( oid ) )
-	        	{
-	        		oidNormalizer = new OidNormalizer( principal, bootstrapRegistries.getNormalizerRegistry().lookup( oid ) );
-	        	}
-	        	else
-	        	{
-	        		oidNormalizer = new OidNormalizer( principal, new NoOpNormalizer() );
-	        	}
-	        	
-	        	oidsMap.put( name, oidNormalizer );
-	        	oidsMap.put( oid, oidNormalizer );
-        	}
+            String name = StringTools.deepTrimToLower( ( String ) keys.next() );
+            String principal = null;
+
+            if ( OID.isOID( name ) )
+            {
+                continue;
+            }
+
+            String oid = bootstrapRegistries.getOidRegistry().getOid( name );
+
+            OidNormalizer oidNormalizer = null;
+
+            if ( oidName.containsKey( oid ) )
+            {
+                principal = StringTools.deepTrimToLower( ( String ) oidName.get( oid ) );
+
+                if ( principal.length() > name.length() )
+                {
+                    OidNormalizer oldOidNormalizer = ( OidNormalizer ) oidsMap.get( principal );
+
+                    oidNormalizer = new OidNormalizer( name, oldOidNormalizer.getNormalizer() );
+
+                    oidName.remove( oid );
+                    oidName.put( oid, name );
+                    oidsMap.remove( principal );
+                    oidsMap.remove( oid );
+                    oidsMap.put( principal, oidNormalizer );
+                    oidsMap.put( name, oidNormalizer );
+                    oidsMap.put( oid, oidNormalizer );
+                    continue;
+                }
+            }
+            else
+            {
+                principal = name;
+                oidName.put( oid, principal );
+
+                if ( bootstrapRegistries.getNormalizerRegistry().hasNormalizer( oid ) )
+                {
+                    oidNormalizer = new OidNormalizer( principal, bootstrapRegistries.getNormalizerRegistry().lookup(
+                        oid ) );
+                }
+                else
+                {
+                    oidNormalizer = new OidNormalizer( principal, new NoOpNormalizer() );
+                }
+
+                oidsMap.put( name, oidNormalizer );
+                oidsMap.put( oid, oidNormalizer );
+            }
         }
-        
+
         DnOidContainer.setOids( oidsMap );
     }
 
+
     /**
      * Kicks off the initialization of the entire system.
      *
@@ -738,12 +757,12 @@
      */
     private void initialize() throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "---> Initializing the DefaultDirectoryService " );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "---> Initializing the DefaultDirectoryService " );
+        }
 
-    	// --------------------------------------------------------------------
+        // --------------------------------------------------------------------
         // Load the schema here and check that it is ok!
         // --------------------------------------------------------------------
 
@@ -776,13 +795,13 @@
             {
                 if ( log.isWarnEnabled() )
                 {
-                    log.warn( BINARY_KEY + " in startup environment contains null value.  " +
-                        "Using only schema info to set binary attributeTypes." );
+                    log.warn( BINARY_KEY + " in startup environment contains null value.  "
+                        + "Using only schema info to set binary attributeTypes." );
                 }
             }
             else
             {
-                if ( ! StringTools.isEmpty( binaryIds ) )
+                if ( !StringTools.isEmpty( binaryIds ) )
                 {
                     String[] binaryArray = binaryIds.split( " " );
 
@@ -795,7 +814,7 @@
                 if ( log.isInfoEnabled() )
                 {
                     log.info( "Setting binaries to union of schema defined binaries and those provided in "
-                            + BINARY_KEY );
+                        + BINARY_KEY );
                 }
             }
         }
@@ -806,7 +825,7 @@
         while ( list.hasNext() )
         {
             AttributeType type = ( AttributeType ) list.next();
-            if ( ! type.getSyntax().isHumanReadible() )
+            if ( !type.getSyntax().isHumanReadible() )
             {
                 // add the OID for the attributeType
                 binaries.add( type.getOid() );
@@ -828,13 +847,13 @@
 
         partitionNexus = new DefaultDirectoryPartitionNexus( new LockableAttributesImpl() );
         partitionNexus.init( configuration, null );
-        
+
         interceptorChain = new InterceptorChain();
         interceptorChain.init( configuration );
-        
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "<--- DefaultDirectoryService initialized" );
-    	}
+
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "<--- DefaultDirectoryService initialized" );
+        }
     }
 }

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java Sun Feb 19 19:57:02 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.directory.server.core;
 
+
 import java.util.Hashtable;
 
 import javax.naming.Context;
@@ -36,63 +37,76 @@
 class DefaultDirectoryServiceConfiguration implements DirectoryServiceConfiguration
 {
     private DefaultDirectoryService parent;
-    
-    DefaultDirectoryServiceConfiguration( DefaultDirectoryService parent )
+
+
+    DefaultDirectoryServiceConfiguration(DefaultDirectoryService parent)
     {
         this.parent = parent;
     }
-    
+
+
     public String getInstanceId()
     {
         return parent.getInstanceId();
     }
-    
+
+
     public DirectoryService getService()
     {
         return parent;
     }
 
+
     public DirectoryServiceListener getServiceListener()
     {
         return parent.getServiceListener();
     }
 
+
     public Hashtable getEnvironment()
     {
         return parent.getEnvironment();
     }
-    
+
+
     public StartupConfiguration getStartupConfiguration()
     {
         return parent.getStartupConfiguration();
     }
-    
+
+
     public GlobalRegistries getGlobalRegistries()
     {
         return parent.getGlobalRegistries();
     }
 
+
     public DirectoryPartitionNexus getPartitionNexus()
     {
         return parent.getPartitionNexus();
     }
-    
+
+
     public InterceptorChain getInterceptorChain()
     {
         return parent.getInterceptorChain();
     }
-    
+
+
     public boolean isFirstStart()
     {
         return parent.isFirstStart();
     }
 
+
     public Context getJndiContext( String baseName ) throws NamingException
     {
         return parent.getJndiContext( baseName );
     }
 
-    public Context getJndiContext( String principal, byte[] credential, String authentication, String baseName ) throws NamingException
+
+    public Context getJndiContext( String principal, byte[] credential, String authentication, String baseName )
+        throws NamingException
     {
         return parent.getJndiContext( principal, credential, authentication, baseName );
     }

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryServiceConfiguration.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java Sun Feb 19 19:57:02 2006
@@ -1,126 +1,139 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.directory.server.core;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Hashtable;
-import java.util.Map;
-import java.util.Set;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-
-import org.apache.directory.server.core.configuration.Configuration;
-import org.apache.directory.server.core.jndi.AbstractContextFactory;
-import org.apache.directory.server.core.partition.DirectoryPartition;
-
-/**
- * Provides JNDI service to {@link AbstractContextFactory}.
- *
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- */
-public abstract class DirectoryService
-{
-    private static final Map instances = new HashMap();
-
-    /**
-     * Returns the default instance.  This method is identical with calling
-     * <tt>getInstance( Configuration.DEFAULT_INSTANCE_ID )</tt>.
-     */
-    public static DirectoryService getInstance()
-    {
-        return getInstance( Configuration.DEFAULT_INSTANCE_ID );
-    }
-    
-    /**
-     * Returns {@link DirectoryService} with the specified instance ID.
-     */
-    public synchronized static DirectoryService getInstance( String instanceId )
-    {
-        instanceId = instanceId.trim();
-        DirectoryService service = ( DirectoryService ) instances.get( instanceId );
-        if( service == null )
-        {
-            service = new DefaultDirectoryService( instanceId );
-            instances.put( instanceId, service );
-        }
-        
-        return service;
-    }
-    
-    /**
-     * Returns all instances of instantiated {@link DirectoryService}.
-     */
-    public synchronized static Set getAllInstances()
-    {
-        return new HashSet( instances.values() );
-    }
-
-    /**
-     * Starts up this service.
-     * 
-     * @param listener a listener that listens to the lifecycle of this service
-     * @param environment JNDI {@link InitialContext} environment
-     * 
-     * @throws NamingException if failed to start up
-     */
-    public abstract void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException;
-    
-    /**
-     * Shuts down this service.
-     * 
-     * @throws NamingException if failed to shut down
-     */
-    public abstract void shutdown() throws NamingException;
-    
-    /**
-     * Calls {@link DirectoryPartition#sync()} for all registered {@link DirectoryPartition}s.
-     * @throws NamingException if synchronization failed
-     */
-    public abstract void sync() throws NamingException;
-    
-    /**
-     * Returns <tt>true</tt> if this service is started.
-     */
-    public abstract boolean isStarted();
-    
-    /**
-     * Returns the configuration of this service.
-     */
-    public abstract DirectoryServiceConfiguration getConfiguration();
-
-    /**
-     * Returns an anonymous JNDI {@link Context} with the specified <tt>baseName</tt>
-     * @throws NamingException if failed to create a context
-     */
-    public abstract Context getJndiContext( String baseName ) throws NamingException;
-    
-    /**
-     * Returns a JNDI {@link Context} with the specified authentication information
-     * (<tt>principal</tt>, <tt>credential</tt>, and <tt>authentication</tt>) and
-     * <tt>baseName</tt>.
-     * 
-     * @param principal {@link Context#SECURITY_PRINCIPAL} value
-     * @param credential {@link Context#SECURITY_CREDENTIALS} value
-     * @param authentication {@link Context#SECURITY_AUTHENTICATION} value
-     * @throws NamingException if failed to create a context
-     */
-    public abstract Context getJndiContext( String principal, byte[] credential, String authentication, String baseName ) throws NamingException;
-}
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core;
+
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.Set;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+import org.apache.directory.server.core.configuration.Configuration;
+import org.apache.directory.server.core.jndi.AbstractContextFactory;
+import org.apache.directory.server.core.partition.DirectoryPartition;
+
+
+/**
+ * Provides JNDI service to {@link AbstractContextFactory}.
+ *
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public abstract class DirectoryService
+{
+    private static final Map instances = new HashMap();
+
+
+    /**
+     * Returns the default instance.  This method is identical with calling
+     * <tt>getInstance( Configuration.DEFAULT_INSTANCE_ID )</tt>.
+     */
+    public static DirectoryService getInstance()
+    {
+        return getInstance( Configuration.DEFAULT_INSTANCE_ID );
+    }
+
+
+    /**
+     * Returns {@link DirectoryService} with the specified instance ID.
+     */
+    public synchronized static DirectoryService getInstance( String instanceId )
+    {
+        instanceId = instanceId.trim();
+        DirectoryService service = ( DirectoryService ) instances.get( instanceId );
+        if ( service == null )
+        {
+            service = new DefaultDirectoryService( instanceId );
+            instances.put( instanceId, service );
+        }
+
+        return service;
+    }
+
+
+    /**
+     * Returns all instances of instantiated {@link DirectoryService}.
+     */
+    public synchronized static Set getAllInstances()
+    {
+        return new HashSet( instances.values() );
+    }
+
+
+    /**
+     * Starts up this service.
+     * 
+     * @param listener a listener that listens to the lifecycle of this service
+     * @param environment JNDI {@link InitialContext} environment
+     * 
+     * @throws NamingException if failed to start up
+     */
+    public abstract void startup( DirectoryServiceListener listener, Hashtable environment ) throws NamingException;
+
+
+    /**
+     * Shuts down this service.
+     * 
+     * @throws NamingException if failed to shut down
+     */
+    public abstract void shutdown() throws NamingException;
+
+
+    /**
+     * Calls {@link DirectoryPartition#sync()} for all registered {@link DirectoryPartition}s.
+     * @throws NamingException if synchronization failed
+     */
+    public abstract void sync() throws NamingException;
+
+
+    /**
+     * Returns <tt>true</tt> if this service is started.
+     */
+    public abstract boolean isStarted();
+
+
+    /**
+     * Returns the configuration of this service.
+     */
+    public abstract DirectoryServiceConfiguration getConfiguration();
+
+
+    /**
+     * Returns an anonymous JNDI {@link Context} with the specified <tt>baseName</tt>
+     * @throws NamingException if failed to create a context
+     */
+    public abstract Context getJndiContext( String baseName ) throws NamingException;
+
+
+    /**
+     * Returns a JNDI {@link Context} with the specified authentication information
+     * (<tt>principal</tt>, <tt>credential</tt>, and <tt>authentication</tt>) and
+     * <tt>baseName</tt>.
+     * 
+     * @param principal {@link Context#SECURITY_PRINCIPAL} value
+     * @param credential {@link Context#SECURITY_CREDENTIALS} value
+     * @param authentication {@link Context#SECURITY_AUTHENTICATION} value
+     * @throws NamingException if failed to create a context
+     */
+    public abstract Context getJndiContext( String principal, byte[] credential, String authentication, String baseName )
+        throws NamingException;
+}

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java Sun Feb 19 19:57:02 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.directory.server.core;
 
+
 import java.util.Hashtable;
 
 import javax.naming.Context;
@@ -25,6 +26,7 @@
 import org.apache.directory.server.core.partition.DirectoryPartitionNexus;
 import org.apache.directory.server.core.schema.GlobalRegistries;
 
+
 /**
  * Represents the global configuration of currently running
  * {@link DirectoryService}.  You can access all properties of
@@ -33,48 +35,56 @@
  */
 public interface DirectoryServiceConfiguration
 {
-    
+
     /**
      * Returns the {@link DirectoryService} for this configuration.
      */
     DirectoryService getService();
-    
+
+
     /**
      * Returns the instance ID of the {@link DirectoryService}.
      */
     String getInstanceId();
-    
+
+
     /**
      * Returns the listener that listens to service events.
      */
     DirectoryServiceListener getServiceListener();
-    
+
+
     /**
      * Returns the initial context environment of the {@link DirectoryService}.
      */
     Hashtable getEnvironment();
-    
+
+
     /**
      * Returns the startup configuration of the {@link DirectoryService}.
      */
     StartupConfiguration getStartupConfiguration();
-    
+
+
     /**
      * Returns the registries for system schema objects of the {@link DirectoryService}.
      */
     GlobalRegistries getGlobalRegistries();
 
+
     /**
      * Returns the {@link DirectoryPartitionNexus} of the {@link DirectoryService}
      * which bypasses the interceptor chain.
      */
     DirectoryPartitionNexus getPartitionNexus();
-    
+
+
     /**
      * Returns the interceptor chain of the {@link DirectoryService}.
      */
     InterceptorChain getInterceptorChain();
-    
+
+
     /**
      * Returns <tt>true</tt> if this service is started
      * and bootstrap entries have been created for the first time.

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceConfiguration.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java Sun Feb 19 19:57:02 2006
@@ -1,54 +1,66 @@
-/*
- *   Copyright 2004 The Apache Software Foundation
- *
- *   Licensed under the Apache License, Version 2.0 (the "License");
- *   you may not use this file except in compliance with the License.
- *   You may obtain a copy of the License at
- *
- *       http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing, software
- *   distributed under the License is distributed on an "AS IS" BASIS,
- *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *   See the License for the specific language governing permissions and
- *   limitations under the License.
- *
- */
-package org.apache.directory.server.core;
-
-import javax.naming.NamingException;
-
-/**
- * An event handler that listens to the changes occurs to
- * {@link DirectoryService}.
- * 
- * @author The Apache Directory Project
- * @version $Rev$, $Date$
- */
-public interface DirectoryServiceListener
-{
-    /**
-     * Invoked before starting up {@link DirectoryService}.
-     */
-    void beforeStartup( DirectoryService service ) throws NamingException;
-    /**
-     * Invoked after starting up {@link DirectoryService}.
-     */
-    void afterStartup( DirectoryService service ) throws NamingException;
-    /**
-     * Invoked before shutting down {@link DirectoryService}.
-     */
-    void beforeShutdown( DirectoryService service ) throws NamingException;
-    /**
-     * Invoked after shutting down {@link DirectoryService}.
-     */
-    void afterShutdown( DirectoryService service ) throws NamingException;
-    /**
-     * Invoked before calling {@link DirectoryService#sync()}.
-     */
-    void beforeSync( DirectoryService service ) throws NamingException;
-    /**
-     * Invoked after calling {@link DirectoryService#sync()}.
-     */
-    void afterSync( DirectoryService service ) throws NamingException;
-}
+/*
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.directory.server.core;
+
+
+import javax.naming.NamingException;
+
+
+/**
+ * An event handler that listens to the changes occurs to
+ * {@link DirectoryService}.
+ * 
+ * @author The Apache Directory Project
+ * @version $Rev$, $Date$
+ */
+public interface DirectoryServiceListener
+{
+    /**
+     * Invoked before starting up {@link DirectoryService}.
+     */
+    void beforeStartup( DirectoryService service ) throws NamingException;
+
+
+    /**
+     * Invoked after starting up {@link DirectoryService}.
+     */
+    void afterStartup( DirectoryService service ) throws NamingException;
+
+
+    /**
+     * Invoked before shutting down {@link DirectoryService}.
+     */
+    void beforeShutdown( DirectoryService service ) throws NamingException;
+
+
+    /**
+     * Invoked after shutting down {@link DirectoryService}.
+     */
+    void afterShutdown( DirectoryService service ) throws NamingException;
+
+
+    /**
+     * Invoked before calling {@link DirectoryService#sync()}.
+     */
+    void beforeSync( DirectoryService service ) throws NamingException;
+
+
+    /**
+     * Invoked after calling {@link DirectoryService#sync()}.
+     */
+    void afterSync( DirectoryService service ) throws NamingException;
+}

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/DirectoryServiceListener.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java Sun Feb 19 19:57:02 2006
@@ -47,7 +47,7 @@
      *
      * @param type the type of this authenticator (e.g. <tt>'simple'</tt>, <tt>'none'</tt>...)
      */
-    protected AbstractAuthenticator( String type )
+    protected AbstractAuthenticator(String type)
     {
         this.authenticatorType = type;
     }
@@ -62,6 +62,7 @@
         return factoryCfg;
     }
 
+
     /**
      * Returns the configuration of this authenticator.
      */
@@ -70,6 +71,7 @@
         return cfg;
     }
 
+
     public String getAuthenticatorType()
     {
         return authenticatorType;
@@ -81,7 +83,8 @@
      * <tt>configuration</tt>, and calls {@link #doInit()} method.
      * Please put your initialization code into {@link #doInit()}.
      */
-    public final void init( DirectoryServiceConfiguration factoryCfg, AuthenticatorConfiguration cfg ) throws NamingException
+    public final void init( DirectoryServiceConfiguration factoryCfg, AuthenticatorConfiguration cfg )
+        throws NamingException
     {
         this.factoryCfg = factoryCfg;
         this.cfg = cfg;
@@ -96,6 +99,7 @@
     {
     }
 
+
     /**
      * Calls {@link #doDestroy()} method, and clears default properties
      * (<tt>factoryConfiguration</tt> and <tt>configuration</tt>).
@@ -114,6 +118,7 @@
         }
     }
 
+
     /**
      * Implement your deinitialization code here.
      */
@@ -121,6 +126,7 @@
     {
     }
 
+
     public abstract LdapPrincipal authenticate( ServerContext ctx ) throws NamingException;
 
 
@@ -134,7 +140,8 @@
      * @throws NamingException if there is a problem parsing <tt>name</tt>
      */
     // does not seem to be used
-    protected static LdapPrincipal createLdapPrincipal( String name, AuthenticationLevel authenticationLeve ) throws NamingException
+    protected static LdapPrincipal createLdapPrincipal( String name, AuthenticationLevel authenticationLeve )
+        throws NamingException
     {
         LdapName principalDn = new LdapName( name );
         return new LdapPrincipal( principalDn, AuthenticationLevel.SIMPLE );

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AbstractAuthenticator.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java Sun Feb 19 19:57:02 2006
@@ -16,11 +16,13 @@
  */
 package org.apache.directory.server.core.authn;
 
+
 import javax.naming.NamingException;
 
 import org.apache.directory.server.core.jndi.ServerContext;
 import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 
+
 /**
  * An {@link Authenticator} that handles anonymous connections
  * (type <tt>'none'</tt>).
@@ -37,6 +39,7 @@
         super( "none" );
     }
 
+
     /**
      * If the context is not configured to allow anonymous connections,
      * this method throws a {@link javax.naming.NoPermissionException}.
@@ -45,7 +48,7 @@
     {
         if ( getFactoryConfiguration().getStartupConfiguration().isAllowAnonymousAccess() )
         {
-            return LdapPrincipal.ANONYMOUS ;
+            return LdapPrincipal.ANONYMOUS;
         }
         else
         {

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AnonymousAuthenticator.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java Sun Feb 19 19:57:02 2006
@@ -59,12 +59,13 @@
 public class AuthenticationService extends BaseInterceptor
 {
     private static final Logger log = LoggerFactory.getLogger( AuthenticationService.class );
-    
+
     /** authenticators **/
     public Map authenticators = new HashMap();
 
     private DirectoryServiceConfiguration factoryCfg;
 
+
     /**
      * Creates an authentication service interceptor.
      */
@@ -72,6 +73,7 @@
     {
     }
 
+
     /**
      * Registers and initializes all {@link Authenticator}s to this service.
      */
@@ -81,7 +83,7 @@
 
         // Register all authenticators
         Iterator i = factoryCfg.getStartupConfiguration().getAuthenticatorConfigurations().iterator();
-        while( i.hasNext() )
+        while ( i.hasNext() )
         {
             try
             {
@@ -90,30 +92,31 @@
             catch ( Exception e )
             {
                 destroy();
-                throw ( NamingException ) new NamingException(
-                        "Failed to register authenticator." ).initCause( e );
+                throw ( NamingException ) new NamingException( "Failed to register authenticator." ).initCause( e );
             }
         }
     }
-    
+
+
     /**
      * Deinitializes and deregisters all {@link Authenticator}s from this service.
      */
     public void destroy()
     {
         Iterator i = new ArrayList( authenticators.values() ).iterator();
-        while( i.hasNext() )
+        while ( i.hasNext() )
         {
             Iterator j = new ArrayList( ( Collection ) i.next() ).iterator();
-            while( j.hasNext() )
+            while ( j.hasNext() )
             {
                 unregister( ( Authenticator ) j.next() );
             }
         }
-        
+
         authenticators.clear();
     }
 
+
     /**
      * Initializes the specified {@link Authenticator} and registers it to
      * this service.
@@ -132,6 +135,7 @@
         authenticatorList.add( cfg.getAuthenticator() );
     }
 
+
     /**
      * Deinitializes the specified {@link Authenticator} and deregisters it from
      * this service.
@@ -146,17 +150,18 @@
         }
 
         authenticatorList.remove( authenticator );
-        
+
         try
         {
             authenticator.destroy();
         }
-        catch( Throwable t )
+        catch ( Throwable t )
         {
             log.warn( "Failed to destroy an authenticator.", t );
         }
     }
 
+
     /**
      * Returns the list of {@link Authenticator}s with the specified type.
      * 
@@ -165,7 +170,7 @@
     private Collection getAuthenticators( String type )
     {
         Collection result = ( Collection ) authenticators.get( type );
-        if( result != null && result.size() > 0 )
+        if ( result != null && result.size() > 0 )
         {
             return result;
         }
@@ -174,15 +179,15 @@
             return null;
         }
     }
-    
+
 
     public void add( NextInterceptor next, String upName, Name normName, Attributes entry ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Adding the entry " + AttributeUtils.toString( entry ) + " for DN = '"  + upName + "'" );
-    	}
-    	
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Adding the entry " + AttributeUtils.toString( entry ) + " for DN = '" + upName + "'" );
+        }
+
         checkAuthenticated();
         next.add( upName, normName, entry );
     }
@@ -190,11 +195,11 @@
 
     public void delete( NextInterceptor next, Name name ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Deleting name = '" + name.toString() + "'" );
-    	}
-    	
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Deleting name = '" + name.toString() + "'" );
+        }
+
         checkAuthenticated();
         next.delete( name );
     }
@@ -202,22 +207,22 @@
 
     public Name getMatchedName( NextInterceptor next, Name dn, boolean normalized ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Matching name = '" + dn.toString() + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Matching name = '" + dn.toString() + "'" );
+        }
 
-    	checkAuthenticated();
+        checkAuthenticated();
         return next.getMatchedName( dn, normalized );
     }
 
 
     public Attributes getRootDSE( NextInterceptor next ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Getting root DSE" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Getting root DSE" );
+        }
 
         checkAuthenticated();
         return next.getRootDSE();
@@ -226,10 +231,10 @@
 
     public Name getSuffix( NextInterceptor next, Name dn, boolean normalized ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Getting suffix for name = '" + dn.toString() + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Getting suffix for name = '" + dn.toString() + "'" );
+        }
 
         checkAuthenticated();
         return next.getSuffix( dn, normalized );
@@ -238,10 +243,10 @@
 
     public boolean hasEntry( NextInterceptor next, Name name ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Testing if entry name = '" + name.toString() + "' exists");
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Testing if entry name = '" + name.toString() + "' exists" );
+        }
 
         checkAuthenticated();
         return next.hasEntry( name );
@@ -250,10 +255,10 @@
 
     public boolean isSuffix( NextInterceptor next, Name name ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Testing suffix for name = '" + name.toString() + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Testing suffix for name = '" + name.toString() + "'" );
+        }
 
         checkAuthenticated();
         return next.isSuffix( name );
@@ -262,10 +267,10 @@
 
     public NamingEnumeration list( NextInterceptor next, Name base ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Listing base = '" + base.toString() + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Listing base = '" + base.toString() + "'" );
+        }
 
         checkAuthenticated();
         return next.list( base );
@@ -274,10 +279,10 @@
 
     public Iterator listSuffixes( NextInterceptor next, boolean normalized ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Listing suffixes" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Listing suffixes" );
+        }
 
         checkAuthenticated();
         return next.listSuffixes( normalized );
@@ -286,10 +291,10 @@
 
     public Attributes lookup( NextInterceptor next, Name dn, String[] attrIds ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Lookup name = '" + dn.toString() + "', attributes = " + attrIds );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Lookup name = '" + dn.toString() + "', attributes = " + attrIds );
+        }
 
         checkAuthenticated();
         return next.lookup( dn, attrIds );
@@ -298,10 +303,10 @@
 
     public Attributes lookup( NextInterceptor next, Name name ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Lookup name = '" + name.toString() + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Lookup name = '" + name.toString() + "'" );
+        }
 
         checkAuthenticated();
         return next.lookup( name );
@@ -310,10 +315,10 @@
 
     public void modify( NextInterceptor next, Name name, int modOp, Attributes mods ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Modifying name = '" + name.toString() + "', modifs = " + AttributeUtils.toString( mods ) );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Modifying name = '" + name.toString() + "', modifs = " + AttributeUtils.toString( mods ) );
+        }
 
         checkAuthenticated();
         next.modify( name, modOp, mods );
@@ -322,10 +327,10 @@
 
     public void modify( NextInterceptor next, Name name, ModificationItem[] mods ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Modifying name = '" + name.toString() + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Modifying name = '" + name.toString() + "'" );
+        }
 
         checkAuthenticated();
         next.modify( name, mods );
@@ -334,22 +339,25 @@
 
     public void modifyRn( NextInterceptor next, Name name, String newRn, boolean deleteOldRn ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Modifying name = '" + name.toString() + "', new RDN = '" + newRn + "', oldRDN = '" + deleteOldRn + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Modifying name = '" + name.toString() + "', new RDN = '" + newRn + "', oldRDN = '"
+                + deleteOldRn + "'" );
+        }
 
         checkAuthenticated();
         next.modifyRn( name, newRn, deleteOldRn );
     }
 
 
-    public void move( NextInterceptor next, Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn ) throws NamingException
+    public void move( NextInterceptor next, Name oriChildName, Name newParentName, String newRn, boolean deleteOldRn )
+        throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Moving name = '" + oriChildName.toString() + "' to name = '" + newParentName + "', new RDN = '" + newRn + "', oldRDN = '" + deleteOldRn + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Moving name = '" + oriChildName.toString() + "' to name = '" + newParentName + "', new RDN = '"
+                + newRn + "', oldRDN = '" + deleteOldRn + "'" );
+        }
 
         checkAuthenticated();
         next.move( oriChildName, newParentName, newRn, deleteOldRn );
@@ -358,22 +366,23 @@
 
     public void move( NextInterceptor next, Name oriChildName, Name newParentName ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Moving name = '" + oriChildName.toString() + " to name = '" + newParentName + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Moving name = '" + oriChildName.toString() + " to name = '" + newParentName + "'" );
+        }
 
         checkAuthenticated();
         next.move( oriChildName, newParentName );
     }
 
 
-    public NamingEnumeration search( NextInterceptor next, Name base, Map env, ExprNode filter, SearchControls searchCtls ) throws NamingException
+    public NamingEnumeration search( NextInterceptor next, Name base, Map env, ExprNode filter,
+        SearchControls searchCtls ) throws NamingException
     {
-    	if ( log.isDebugEnabled() )
-    	{
-    		log.debug( "Search for base = '" + base.toString() + "'" );
-    	}
+        if ( log.isDebugEnabled() )
+        {
+            log.debug( "Search for base = '" + base.toString() + "'" );
+        }
 
         checkAuthenticated();
         return next.search( base, env, filter, searchCtls );
@@ -395,15 +404,14 @@
 
         throw new IllegalStateException( "Attempted operation by unauthenticated caller." );
     }
-    
-    
-    public void bind( NextInterceptor next, Name bindDn, byte[] credentials, List mechanisms, String saslAuthId ) 
+
+
+    public void bind( NextInterceptor next, Name bindDn, byte[] credentials, List mechanisms, String saslAuthId )
         throws NamingException
     {
         // check if we are already authenticated and if so we return making
         // sure first that the credentials are not exposed within context
-        ServerContext ctx =
-            ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
+        ServerContext ctx = ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
 
         if ( ctx.getPrincipal() != null )
         {
@@ -416,7 +424,7 @@
 
         // pick the first matching authenticator type
         Collection authenticators = null;
-        for ( int ii = 0; ii < mechanisms.size(); ii++)
+        for ( int ii = 0; ii < mechanisms.size(); ii++ )
         {
             authenticators = getAuthenticators( ( String ) mechanisms.get( ii ) );
 
@@ -433,8 +441,8 @@
             next.bind( bindDn, credentials, mechanisms, saslAuthId );
             log.debug( "Nexus succeeded on bind operation." );
             // bind succeeded if we got this far 
-            ctx.setPrincipal( new TrustedPrincipalWrapper( 
-                new LdapPrincipal( bindDn, LdapJndiProperties.getAuthenticationLevel( ctx.getEnvironment() ) ) ) );
+            ctx.setPrincipal( new TrustedPrincipalWrapper( new LdapPrincipal( bindDn, LdapJndiProperties
+                .getAuthenticationLevel( ctx.getEnvironment() ) ) ) );
             // remove creds so there is no security risk
             ctx.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
             return;
@@ -454,15 +462,15 @@
                 ctx.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
                 return;
             }
-            catch( LdapAuthenticationException e )
+            catch ( LdapAuthenticationException e )
             {
                 // authentication failed, try the next authenticator
                 if ( log.isInfoEnabled() )
                 {
-                    log.info( "Authenticator "+authenticator.getClass()+" failed to authenticate " + bindDn );
+                    log.info( "Authenticator " + authenticator.getClass() + " failed to authenticate " + bindDn );
                 }
             }
-            catch( Exception e )
+            catch ( Exception e )
             {
                 // Log other exceptions than LdapAuthenticationException
                 if ( log.isWarnEnabled() )
@@ -475,7 +483,6 @@
         throw new LdapAuthenticationException();
     }
 
-
     /**
      * FIXME This doesn't secure anything actually.
      * 
@@ -500,7 +507,7 @@
          *
          * @param principal the LdapPrincipal to wrap
          */
-        private TrustedPrincipalWrapper( LdapPrincipal principal )
+        private TrustedPrincipalWrapper(LdapPrincipal principal)
         {
             this.principal = principal;
         }

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java Sun Feb 19 19:57:02 2006
@@ -49,18 +49,21 @@
      * <tt>'none'</tt>,...).
      */
     public String getAuthenticatorType();
-    
+
+
     /**
      * Called by {@link AuthenticationService} to indicate that this
      * authenticator is being placed into service.
      */
     public void init( DirectoryServiceConfiguration factoryCfg, AuthenticatorConfiguration cfg ) throws NamingException;
-    
+
+
     /**
      * Called by {@link AuthenticationService} to indicate that this
      * authenticator is being removed from service.
      */
     public void destroy();
+
 
     /**
      * Performs authentication and returns the principal if succeeded.

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/Authenticator.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java Sun Feb 19 19:57:02 2006
@@ -55,7 +55,7 @@
      * @param name the normalized distinguished name of the principal
      * @param authenticationLevel
      */
-    LdapPrincipal( Name name, AuthenticationLevel authenticationLevel )
+    LdapPrincipal(Name name, AuthenticationLevel authenticationLevel)
     {
         this.name = name;
         this.authenticationLevel = authenticationLevel;

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/LdapPrincipal.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id

Modified: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewcvs/directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=379013&r1=379012&r2=379013&view=diff
==============================================================================
--- directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Sun Feb 19 19:57:02 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.directory.server.core.authn;
 
+
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.Collection;
@@ -40,6 +41,7 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 /**
  * A simple {@link Authenticator} that authenticates clear text passwords
  * contained within the <code>userPassword</code> attribute in DIT. If the
@@ -71,7 +73,7 @@
     /**
      * Creates a new instance.
      */
-    public SimpleAuthenticator( )
+    public SimpleAuthenticator()
     {
         super( "simple" );
     }
@@ -101,7 +103,7 @@
 
         String principal;
 
-        if ( ! ctx.getEnvironment().containsKey( Context.SECURITY_PRINCIPAL ) )
+        if ( !ctx.getEnvironment().containsKey( Context.SECURITY_PRINCIPAL ) )
         {
             throw new LdapAuthenticationException();
         }
@@ -124,14 +126,15 @@
 
         try
         {
-            userEntry = proxy.lookup( principalDn, new String[] { "userPassword" }, USERLOOKUP_BYPASS );
+            userEntry = proxy.lookup( principalDn, new String[]
+                { "userPassword" }, USERLOOKUP_BYPASS );
 
             if ( userEntry == null )
             {
                 throw new LdapAuthenticationException( "Failed to lookup user for authentication: " + principal );
             }
         }
-        catch( Exception cause )
+        catch ( Exception cause )
         {
             log.error( "Authentication error : " + cause.getMessage() );
             LdapAuthenticationException e = new LdapAuthenticationException();
@@ -139,7 +142,6 @@
             throw e;
         }
 
-
         Object userPassword;
 
         Attribute userPasswordAttr = userEntry.get( "userPassword" );
@@ -148,42 +150,58 @@
 
         boolean credentialsMatch = false;
 
-        if (userPasswordAttr == null) {
+        if ( userPasswordAttr == null )
+        {
             userPassword = ArrayUtils.EMPTY_BYTE_ARRAY;
-        } else {
+        }
+        else
+        {
             userPassword = userPasswordAttr.get();
 
-            if (userPassword instanceof String) {
-                userPassword = ((String) userPassword).getBytes();
+            if ( userPassword instanceof String )
+            {
+                userPassword = ( ( String ) userPassword ).getBytes();
             }
         }
 
         // Check if password is stored as a message digest, i.e. one-way
         // encrypted
-        if (this.isPasswordOneWayEncrypted(userPassword)) {
-            try {
+        if ( this.isPasswordOneWayEncrypted( userPassword ) )
+        {
+            try
+            {
                 // create a corresponding digested password from creds
-                String algorithm = this.getAlgorithmForHashedPassword(userPassword);
-                String digestedCredits = this.createDigestedPassword(algorithm, creds);
+                String algorithm = this.getAlgorithmForHashedPassword( userPassword );
+                String digestedCredits = this.createDigestedPassword( algorithm, creds );
 
-                credentialsMatch = ArrayUtils.isEquals(digestedCredits.getBytes(), userPassword);
-            } catch (NoSuchAlgorithmException nsae) {
-                log.warn("Password stored with unknown algorithm.", nsae);
-            } catch (IllegalArgumentException e) {
-                log.warn("Exception during authentication", e);
+                credentialsMatch = ArrayUtils.isEquals( digestedCredits.getBytes(), userPassword );
+            }
+            catch ( NoSuchAlgorithmException nsae )
+            {
+                log.warn( "Password stored with unknown algorithm.", nsae );
             }
-        } else {
+            catch ( IllegalArgumentException e )
+            {
+                log.warn( "Exception during authentication", e );
+            }
+        }
+        else
+        {
             // password is not stored one-way encrypted
-            credentialsMatch = ArrayUtils.isEquals(creds, userPassword);
+            credentialsMatch = ArrayUtils.isEquals( creds, userPassword );
         }
 
-        if (credentialsMatch) {
-            return new LdapPrincipal(principalDn, AuthenticationLevel.SIMPLE);
-        } else {
+        if ( credentialsMatch )
+        {
+            return new LdapPrincipal( principalDn, AuthenticationLevel.SIMPLE );
+        }
+        else
+        {
             throw new LdapAuthenticationException();
         }
     }
 
+
     /**
      * Checks if the argument is one-way encryped. If it is a string or a
      * byte-array which looks like "{XYZ}...", and XYZ is a known lessage
@@ -194,17 +212,21 @@
      *            agument, either a string or a byte-array
      * @return true, if the value is a digested password with algorithm included
      */
-    protected boolean isPasswordOneWayEncrypted(Object password)
+    protected boolean isPasswordOneWayEncrypted( Object password )
     {
         boolean result = false;
-        try {
-            String algorithm = getAlgorithmForHashedPassword(password);
-            result = (algorithm != null);
-        } catch (IllegalArgumentException ignored) {
+        try
+        {
+            String algorithm = getAlgorithmForHashedPassword( password );
+            result = ( algorithm != null );
+        }
+        catch ( IllegalArgumentException ignored )
+        {
         }
         return result;
     }
 
+
     /**
      * Get the algorithm of a password, which is stored in the form "{XYZ}...".
      * The method returns null, if the argument is not in this form. It returns
@@ -215,34 +237,45 @@
      *            either a String or a byte[]
      * @return included message digest alorithm, if any
      */
-    protected String getAlgorithmForHashedPassword(Object password) throws IllegalArgumentException
+    protected String getAlgorithmForHashedPassword( Object password ) throws IllegalArgumentException
     {
         String result = null;
 
         // Check if password arg is string or byte[]
         String sPassword = null;
-        if (password instanceof byte[]) {
-            sPassword = new String((byte[]) password);
-        } else if (password instanceof String) {
-            sPassword = (String) password;
-        } else {
-            throw new IllegalArgumentException("password is neither a String nor a byte-Array.");
+        if ( password instanceof byte[] )
+        {
+            sPassword = new String( ( byte[] ) password );
+        }
+        else if ( password instanceof String )
+        {
+            sPassword = ( String ) password;
+        }
+        else
+        {
+            throw new IllegalArgumentException( "password is neither a String nor a byte-Array." );
         }
 
-        if (sPassword != null && sPassword.length() > 2 && sPassword.charAt(0) == '{' && sPassword.indexOf('}') > -1) {
-            int algPosEnd = sPassword.indexOf('}');
-            String algorithm = sPassword.substring(1, algPosEnd);
-            try {
-                MessageDigest.getInstance(algorithm);
+        if ( sPassword != null && sPassword.length() > 2 && sPassword.charAt( 0 ) == '{'
+            && sPassword.indexOf( '}' ) > -1 )
+        {
+            int algPosEnd = sPassword.indexOf( '}' );
+            String algorithm = sPassword.substring( 1, algPosEnd );
+            try
+            {
+                MessageDigest.getInstance( algorithm );
                 result = algorithm;
-            } catch (NoSuchAlgorithmException e) {
-                log.warn("Unknown message digest algorithm in password: " + algorithm, e);
+            }
+            catch ( NoSuchAlgorithmException e )
+            {
+                log.warn( "Unknown message digest algorithm in password: " + algorithm, e );
             }
         }
 
         return result;
     }
 
+
     /**
      * Creates a digested password. For a given hash algorithm and a password
      * value, the algorithm is applied to the password, and the result is Base64
@@ -263,37 +296,45 @@
      *             if password is neither a String nor a byte[], or algorithm is
      *             not known to java.security.MessageDigest class
      */
-    protected String createDigestedPassword(String algorithm, Object password) throws NoSuchAlgorithmException,
-            IllegalArgumentException
+    protected String createDigestedPassword( String algorithm, Object password ) throws NoSuchAlgorithmException,
+        IllegalArgumentException
     {
         // Check if password arg is string or byte[]
         byte[] data = null;
-        if (password instanceof byte[]) {
-            data = (byte[]) password;
-        } else if (password instanceof String) {
-            data = ((String) password).getBytes();
-        } else {
-            throw new IllegalArgumentException("password is neither a String nor a byte-Array.");
+        if ( password instanceof byte[] )
+        {
+            data = ( byte[] ) password;
+        }
+        else if ( password instanceof String )
+        {
+            data = ( ( String ) password ).getBytes();
+        }
+        else
+        {
+            throw new IllegalArgumentException( "password is neither a String nor a byte-Array." );
         }
 
         // create message digest object
         MessageDigest digest = null;
-        try {
-            digest = MessageDigest.getInstance(algorithm);
-        } catch (NoSuchAlgorithmException nsae) {
-            throw new IllegalArgumentException(nsae.getMessage());
+        try
+        {
+            digest = MessageDigest.getInstance( algorithm );
+        }
+        catch ( NoSuchAlgorithmException nsae )
+        {
+            throw new IllegalArgumentException( nsae.getMessage() );
         }
 
         // calculate hashed value of password
-        byte[] fingerPrint = digest.digest(data);
-        char[] encoded = Base64.encode(fingerPrint);
+        byte[] fingerPrint = digest.digest( data );
+        char[] encoded = Base64.encode( fingerPrint );
 
         // create return result of form "{alg}bbbbbbb"
         StringBuffer result = new StringBuffer();
-        result.append('{');
-        result.append(algorithm);
-        result.append('}');
-        result.append(encoded);
+        result.append( '{' );
+        result.append( algorithm );
+        result.append( '}' );
+        result.append( encoded );
 
         return result.toString();
     }

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: directory/trunks/apacheds/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
------------------------------------------------------------------------------
--- svn:keywords (original)
+++ svn:keywords Sun Feb 19 19:57:02 2006
@@ -1 +1,4 @@
-HeadURL Id LastChangedBy LastChangedDate LastChangedRevision
+Rev
+Revision
+Date
+Id



Mime
View raw message