directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r514901 - in /directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core: authn/ configuration/ jndi/ operational/ schema/
Date Mon, 05 Mar 2007 22:45:42 GMT
Author: elecharny
Date: Mon Mar  5 14:45:40 2007
New Revision: 514901

URL: http://svn.apache.org/viewvc?view=rev&rev=514901
Log:
Reflected the modification done in Rdn and LdapDN (getUpType() and getNormType())

Modified:
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationService.java
Mon Mar  5 14:45:40 2007
@@ -47,6 +47,7 @@
 import org.apache.directory.shared.ldap.exception.LdapAuthenticationException;
 import org.apache.directory.shared.ldap.filter.ExprNode;
 import org.apache.directory.shared.ldap.util.AttributeUtils;
+import org.apache.directory.shared.ldap.message.MessageTypeEnum;
 import org.apache.directory.shared.ldap.message.ModificationItemImpl;
 import org.apache.directory.shared.ldap.name.LdapDN;
 
@@ -88,12 +89,11 @@
         this.factoryCfg = factoryCfg;
 
         // Register all authenticators
-        Iterator i = factoryCfg.getStartupConfiguration().getAuthenticatorConfigurations().iterator();
-        while ( i.hasNext() )
+        for ( AuthenticatorConfiguration config:factoryCfg.getStartupConfiguration().getAuthenticatorConfigurations()
)
         {
             try
             {
-                this.register( ( AuthenticatorConfiguration ) i.next() );
+                this.register( config );
             }
             catch ( Exception e )
             {
@@ -112,10 +112,12 @@
     {
         Set<Collection<Authenticator>> clonedAuthenticatorCollections = new HashSet<Collection<Authenticator>>();
         clonedAuthenticatorCollections.addAll( authenticators.values() );
+        
         for ( Collection<Authenticator> collection:clonedAuthenticatorCollections )
         {
             Set <Authenticator> clonedAuthenticators = new HashSet<Authenticator>();
             clonedAuthenticators.addAll( collection );
+            
             for ( Authenticator authenticator:clonedAuthenticators )
             {
                 unregister( authenticator );
@@ -135,6 +137,7 @@
         cfg.getAuthenticator().init( factoryCfg, cfg );
 
         Collection<Authenticator> authenticatorList = getAuthenticators( cfg.getAuthenticator().getAuthenticatorType()
);
+        
         if ( authenticatorList == null )
         {
             authenticatorList = new ArrayList<Authenticator>();
@@ -199,7 +202,7 @@
                     + normName.getUpName() + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.ADD_REQUEST );
         next.add(normName, entry );
     }
 
@@ -211,7 +214,7 @@
             log.debug( "Deleting name = '" + name.toString() + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.DEL_REQUEST );
         next.delete( name );
         invalidateAuthenticatorCaches( name );
     }
@@ -347,7 +350,7 @@
             log.debug( "Modifying name = '" + name.toString() + "', modifs = " + AttributeUtils.toString(
mods ) );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.MODIFY_REQUEST );
         next.modify( name, modOp, mods );
         invalidateAuthenticatorCaches( name );
     }
@@ -360,7 +363,7 @@
             log.debug( "Modifying name = '" + name.toString() + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.MODIFY_REQUEST );
         next.modify( name, mods );
         invalidateAuthenticatorCaches( name );
     }
@@ -374,7 +377,7 @@
                 + deleteOldRn + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.MOD_DN_REQUEST );
         next.modifyRn( name, newRn, deleteOldRn );
         invalidateAuthenticatorCaches( name );
     }
@@ -389,7 +392,7 @@
                 + newRn + "', oldRDN = '" + deleteOldRn + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.MOD_DN_REQUEST );
         next.move( oriChildName, newParentName, newRn, deleteOldRn );
         invalidateAuthenticatorCaches( oriChildName );
     }
@@ -402,7 +405,7 @@
             log.debug( "Moving name = '" + oriChildName.toString() + " to name = '" + newParentName
+ "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.MOD_DN_REQUEST );
         next.move( oriChildName, newParentName );
         invalidateAuthenticatorCaches( oriChildName );
     }
@@ -416,11 +419,25 @@
             log.debug( "Search for base = '" + base.toString() + "'" );
         }
 
-        checkAuthenticated();
+        checkAuthenticated( MessageTypeEnum.SEARCH_REQUEST );
         return next.search( base, env, filter, searchCtls );
     }
 
 
+    private void checkAuthenticated( MessageTypeEnum operation ) throws NamingException
+    {
+        try
+        {
+            checkAuthenticated();
+        }
+        catch( IllegalStateException ise )
+        {
+            log.error( "Attempted operation {} by unauthenticated caller.", operation.name()
);
+
+            throw new IllegalStateException( "Attempted operation by unauthenticated caller."
);
+        }
+    }
+
     private void checkAuthenticated() throws NamingException
     {
         ServerContext ctx = ( ServerContext ) InvocationStack.getInstance().peek().getCaller();
@@ -431,6 +448,7 @@
             {
                 ctx.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
             }
+            
             return;
         }
 
@@ -442,13 +460,19 @@
         throws NamingException
     {
         
-        log.debug( "bind: bindDn: " + bindDn );
+        if ( IS_DEBUG )
+        {
+            log.debug( "Bind operation. bindDn: " + bindDn );
+        }
         
         // 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();
 
-        log.debug( "bind: principal: " + ctx.getPrincipal() );
+        if ( IS_DEBUG )
+        {
+            log.debug( "bind: principal: " + ctx.getPrincipal() );
+        }
         
         if ( ctx.getPrincipal() != null )
         {
@@ -456,6 +480,7 @@
             {
                 ctx.removeFromEnvironment( Context.SECURITY_CREDENTIALS );
             }
+            
             return;
         }
 
@@ -518,6 +543,11 @@
             }
         }
 
+        if ( log.isInfoEnabled() )
+        {
+            log.info( "Cannot bind to the server " );
+        }
+        
         throw new LdapAuthenticationException();
     }
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
Mon Mar  5 14:45:40 2007
@@ -194,7 +194,7 @@
     /**
      * Returns {@link AuthenticatorConfiguration}s to use for authenticating clients.
      */
-    public Set getAuthenticatorConfigurations()
+    public Set<AuthenticatorConfiguration> getAuthenticatorConfigurations()
     {
         return ConfigurationUtil.getClonedSet( authenticatorConfigurations );
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Mon Mar  5 14:45:40 2007
@@ -355,14 +355,14 @@
         Rdn rdn = target.getRdn( target.size() - 1 );
         if ( rdn.size() == 1 )
         {
-            attributes.put( rdn.getType(), rdn.getValue() );
+            attributes.put( rdn.getUpType(), rdn.getValue() );
         }
         else
         {
             for ( Iterator ii = rdn.iterator(); ii.hasNext(); /**/ )
             {
                 AttributeTypeAndValue atav = ( AttributeTypeAndValue ) ii.next();
-                attributes.put( atav.getType(), atav.getValue() );
+                attributes.put( atav.getUpType(), atav.getValue() );
             }
         }
     }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/jndi/ServerDirContext.java
Mon Mar  5 14:45:40 2007
@@ -375,7 +375,7 @@
         Attributes attributes = ( Attributes ) attrs.clone();
         if ( rdn.size() == 1 )
         {
-            String rdnAttribute = rdn.getType();
+            String rdnAttribute = rdn.getUpType();
             String rdnValue = (String)rdn.getValue();
 
             // Add the Rdn attribute
@@ -395,13 +395,13 @@
                 AttributeTypeAndValue atav = ( AttributeTypeAndValue ) ii.next();
 
                 // Add the Rdn attribute
-                boolean doRdnPut = attributes.get( atav.getType() ) == null;
-                doRdnPut = doRdnPut || attributes.get( atav.getType() ).size() == 0;
-                doRdnPut = doRdnPut || !attributes.get( atav.getType() ).contains( atav.getValue()
);
+                boolean doRdnPut = attributes.get( atav.getNormType() ) == null;
+                doRdnPut = doRdnPut || attributes.get( atav.getNormType() ).size() == 0;
+                doRdnPut = doRdnPut || !attributes.get( atav.getNormType() ).contains( atav.getValue()
);
         
                 if ( doRdnPut )
                 {
-                    attributes.put( atav.getType(), atav.getValue() );
+                    attributes.put( atav.getNormType(), atav.getValue() );
                 }
             }
         }

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeService.java
Mon Mar  5 14:45:40 2007
@@ -453,7 +453,7 @@
             }
             else if ( rdn.size() == 1 )
             {
-                newDn.add( new Rdn( registry.lookup( rdn.getType() ).getName(), (String)rdn.getAtav().getValue()
) );
+                newDn.add( new Rdn( registry.lookup( rdn.getNormType() ).getName(), (String)rdn.getAtav().getValue()
) );
                 continue;
             }
 
@@ -462,7 +462,7 @@
             for ( Iterator jj = rdn.iterator(); jj.hasNext(); /**/ )
             {
                 AttributeTypeAndValue atav = ( AttributeTypeAndValue ) jj.next();
-                String type = registry.lookup( rdn.getType() ).getName();
+                String type = registry.lookup( rdn.getNormType() ).getName();
                 buf.append( type ).append( '=' ).append( atav.getValue() );
                 if ( jj.hasNext() )
                 {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaAttributeTypeHandler.java
Mon Mar  5 14:45:40 2007
@@ -246,7 +246,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getType() ).equals( OU_OID )
)
+        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID
) )
         {
             throw new LdapInvalidNameException( "The parent entry of a attributeType should
be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaComparatorHandler.java
Mon Mar  5 14:45:40 2007
@@ -318,7 +318,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getType() ).equals( OU_OID )
)
+        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID
) )
         {
             throw new LdapInvalidNameException( "The parent entry of a comparator should
be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaMatchingRuleHandler.java
Mon Mar  5 14:45:40 2007
@@ -231,7 +231,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getType() ).equals( OU_OID )
)
+        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID
) )
         {
             throw new LdapInvalidNameException( "The parent entry of a matchingRule should
be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaNormalizerHandler.java
Mon Mar  5 14:45:40 2007
@@ -318,7 +318,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getType() ).equals( OU_OID )
)
+        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID
) )
         {
             throw new LdapInvalidNameException( "The parent entry of a normalizer should
be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaObjectClassHandler.java
Mon Mar  5 14:45:40 2007
@@ -233,7 +233,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getType() ).equals( OU_OID )
)
+        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID
) )
         {
             throw new LdapInvalidNameException( "The parent entry of a objectClass should
be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxCheckerHandler.java
Mon Mar  5 14:45:40 2007
@@ -325,7 +325,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getType() ).equals( OU_OID )
)
+        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID
) )
         {
             throw new LdapInvalidNameException( "The parent entry of a syntaxChecker should
be an organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/MetaSyntaxHandler.java
Mon Mar  5 14:45:40 2007
@@ -244,7 +244,7 @@
         }
         
         Rdn rdn = newParent.getRdn();
-        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getType() ).equals( OU_OID )
)
+        if ( ! targetRegistries.getOidRegistry().getOid( rdn.getNormType() ).equals( OU_OID
) )
         {
             throw new LdapInvalidNameException( "The parent entry of a syntax should be an
organizationalUnit.", 
                 ResultCodeEnum.NAMING_VIOLATION );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java?view=diff&rev=514901&r1=514900&r2=514901
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/schema/SchemaPartitionDao.java
Mon Mar  5 14:45:40 2007
@@ -440,10 +440,10 @@
         }
         
         Rdn rdn = dn.getRdn( 1 );
-        if ( ! rdn.getType().equalsIgnoreCase( CN_OID ) )
+        if ( ! rdn.getNormType().equalsIgnoreCase( CN_OID ) )
         {
             throw new NamingException( "Attribute of second rdn in dn '" + dn.toNormName()

-                + "' expected to be CN oid of " + CN_OID + " but was " + rdn.getType() );
+                + "' expected to be CN oid of " + CN_OID + " but was " + rdn.getNormType()
);
         }
         
         return ( String ) rdn.getValue();



Mime
View raw message