directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r663780 - in /directory/apacheds/branches/bigbang/core/src: main/java/org/apache/directory/server/core/ main/java/org/apache/directory/server/core/authn/ main/java/org/apache/directory/server/core/interceptor/context/ main/java/org/apache/d...
Date Thu, 05 Jun 2008 23:29:30 GMT
Author: akarasulu
Date: Thu Jun  5 16:29:29 2008
New Revision: 663780

URL: http://svn.apache.org/viewvc?rev=663780&view=rev
Log:
cleaning up bind handling in the core

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
    directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DefaultDirectoryService.java
Thu Jun  5 16:29:29 2008
@@ -80,10 +80,7 @@
 import org.apache.directory.shared.ldap.NotImplementedException;
 import org.apache.directory.shared.ldap.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.constants.SchemaConstants;
-import org.apache.directory.shared.ldap.exception.LdapAuthenticationNotSupportedException;
-import org.apache.directory.shared.ldap.exception.LdapConfigurationException;
 import org.apache.directory.shared.ldap.exception.LdapNamingException;
-import org.apache.directory.shared.ldap.exception.LdapNoPermissionException;
 import org.apache.directory.shared.ldap.ldif.ChangeType;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.ldif.LdifReader;
@@ -97,7 +94,6 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import javax.naming.Context;
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
@@ -587,11 +583,26 @@
     }
     
     
-    public CoreSession getSession( LdapDN principalDn, byte[] credentials, String authentication
) 
+    public CoreSession getSession( LdapDN principalDn, byte[] credentials ) 
         throws Exception
     {
-        checkSecuritySettings( principalDn.toString(), credentials, authentication );
+        if ( ! started )
+        {
+            throw new IllegalStateException( "Service has not started." );
+        }
 
+        BindOperationContext bindContext = new BindOperationContext( null );
+        bindContext.setCredentials( credentials );
+        bindContext.setDn( principalDn );
+        operationManager.bind( bindContext );
+        
+        return bindContext.getSession();
+    }
+    
+    
+    public CoreSession getSession( LdapDN principalDn, byte[] credentials, String saslMechanism,
String saslAuthId ) 
+        throws Exception
+    {
         if ( ! started )
         {
             throw new IllegalStateException( "Service has not started." );
@@ -599,8 +610,7 @@
 
         BindOperationContext bindContext = new BindOperationContext( null );
         bindContext.setCredentials( credentials );
-        bindContext.setDn( new LdapDN() );
-        bindContext.setPrincipalDn( principalDn );
+        bindContext.setDn( principalDn );
         operationManager.bind( bindContext );
         
         return bindContext.getSession();
@@ -850,93 +860,11 @@
     }
 
 
-    public ServerEntry newEntry( LdapDN dn ) throws NamingException
+    public ServerEntry newEntry( LdapDN dn ) 
     {
         return new DefaultServerEntry( registries, dn );
     }
     
-    
-    /**
-     * Checks to make sure security environment parameters are set correctly.
-     *
-     * @throws javax.naming.NamingException if the security settings are not correctly configured.
-     * @param authentication the mechanism for authentication
-     * @param credential the password
-     * @param principal the distinguished name of the principal
-     */
-    private void checkSecuritySettings( String principal, byte[] credential, String authentication
)
-        throws NamingException
-    {
-        if ( authentication == null )
-        {
-            authentication = "";
-        }
-
-        /*
-         * If bind is strong make sure we have the principal name
-         * set within the environment, otherwise complain
-         */
-        if ( AuthenticationLevel.STRONG.toString().equalsIgnoreCase( authentication ) )
-        {
-            if ( principal == null )
-            {
-                throw new LdapConfigurationException( "missing required " + Context.SECURITY_PRINCIPAL
-                    + " property for strong authentication" );
-            }
-        }
-        /*
-         * If bind is simple make sure we have the credentials and the
-         * principal name set within the environment, otherwise complain
-         */
-        else if ( AuthenticationLevel.SIMPLE.toString().equalsIgnoreCase( authentication
) )
-        {
-            if ( credential == null )
-            {
-                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" );
-            }
-        }
-        /*
-         * If bind is none make sure credentials and the principal
-         * name are NOT set within the environment, otherwise complain
-         */
-        else if ( AuthenticationLevel.NONE.toString().equalsIgnoreCase( authentication )
)
-        {
-            if ( credential != null )
-            {
-                throw new LdapConfigurationException( "ambiguous bind "
-                    + "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" );
-            }
-
-            if ( !allowAnonymousAccess )
-            {
-                throw new LdapNoPermissionException( "Anonymous access disabled." );
-            }
-        }
-        else
-        {
-            /*
-             * If bind is anything other than strong, simple, or none we need to complain
-             */
-            throw new LdapAuthenticationNotSupportedException( "Unknown authentication type:
'" + authentication + "'",
-                ResultCodeEnum.AUTH_METHOD_NOT_SUPPORTED );
-        }
-    }
-
 
     /**
      * Returns true if we had to create the bootstrap entries on the first
@@ -1410,6 +1338,7 @@
         }
     }
     
+    
     /**
      * Read an entry (without DN)
      * 
@@ -1450,7 +1379,7 @@
                         oldAttribute.add( attribute.get() );
                         attributes.put( oldAttribute );
                     }
-                    catch (NamingException ne)
+                    catch ( NamingException ne )
                     {
                         // Do nothing
                     }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/DirectoryService.java
Thu Jun  5 16:29:29 2008
@@ -166,7 +166,19 @@
      *
      * @return a logical session as a specific user
      */
-    CoreSession getSession( LdapDN principalDn, byte[] credentials, String authentication
) throws Exception;
+    CoreSession getSession( LdapDN principalDn, byte[] credentials ) throws Exception;
+
+    
+    /**
+     * Gets a logical session to perform operations on this DirectoryService
+     * as a specific user with a separate authorization principal.  This 
+     * bypasses authentication without propagating a bind operation into the 
+     * core.
+     *
+     * @return a logical session as a specific user
+     */
+    CoreSession getSession( LdapDN principalDn, byte[] credentials, String saslMechanism,
String saslAuthId ) 
+        throws Exception;
 
     
     void setInstanceId( String instanceId );

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Thu Jun  5 16:29:29 2008
@@ -424,7 +424,7 @@
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( "bind: principal: " + opContext.getPrincipalDn() );
+            LOG.debug( "bind: principal: " + opContext.getDn() );
         }
 
         if ( opContext.getSession() != null && opContext.getSession().getEffectivePrincipal()
!= null )
@@ -434,17 +434,7 @@
         }
         
         // pick the first matching authenticator type
-        Collection<Authenticator> authenticators = null;
-
-        for ( String mechanism : opContext.getMechanisms() )
-        {
-            authenticators = getAuthenticators( mechanism );
-
-            if ( authenticators != null )
-            {
-                break;
-            }
-        }
+        Collection<Authenticator> authenticators = getAuthenticators( opContext.getSaslMechanism()
);
 
         if ( authenticators == null )
         {
@@ -457,7 +447,7 @@
 
             // bind succeeded if we got this far
             // TODO - authentication level not being set
-            LdapPrincipal principal = new LdapPrincipal( opContext.getPrincipalDn(), AuthenticationLevel.SIMPLE
);
+            LdapPrincipal principal = new LdapPrincipal( opContext.getDn(), AuthenticationLevel.SIMPLE
);
             CoreSession session = new DefaultCoreSession( principal, directoryService );
             opContext.setSession( session );
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
Thu Jun  5 16:29:29 2008
@@ -189,7 +189,7 @@
         
         synchronized( credentialCache )
         {
-            principal = ( LdapPrincipal ) credentialCache.get( opContext.getPrincipalDn().getNormName()
);
+            principal = ( LdapPrincipal ) credentialCache.get( opContext.getDn().getNormName()
);
         }
         
         byte[] storedPassword;
@@ -211,12 +211,12 @@
             }
 
             // Create the new principal before storing it in the cache
-            principal = new LdapPrincipal( opContext.getPrincipalDn(), AuthenticationLevel.SIMPLE,
storedPassword );
+            principal = new LdapPrincipal( opContext.getDn(), AuthenticationLevel.SIMPLE,
storedPassword );
             
             // Now, update the local cache.
             synchronized( credentialCache )
             {
-                credentialCache.put( opContext.getPrincipalDn().getNormName(), principal
);
+                credentialCache.put( opContext.getDn().getNormName(), principal );
             }
         }
         
@@ -258,7 +258,7 @@
     {
         if ( IS_DEBUG )
         {
-            LOG.debug( "Authenticating {}", opContext.getPrincipalDn() );
+            LOG.debug( "Authenticating {}", opContext.getDn() );
         }
         
         // ---- extract password from JNDI environment
@@ -275,7 +275,7 @@
         {
             if ( IS_DEBUG )
             {
-                LOG.debug( "{} Authenticated", opContext.getPrincipalDn() );
+                LOG.debug( "{} Authenticated", opContext.getDn() );
             }
             
         	return principal;
@@ -304,7 +304,7 @@
             {
                 if ( IS_DEBUG )
                 {
-                    LOG.debug( "{} Authenticated", opContext.getPrincipalDn() );
+                    LOG.debug( "{} Authenticated", opContext.getDn() );
                 }
 
                 return principal;
@@ -312,7 +312,7 @@
             else
             {
                 // Bad password ...
-                String message = "Password not correct for user '" + opContext.getPrincipalDn().getUpName()
+ "'";
+                String message = "Password not correct for user '" + opContext.getDn().getUpName()
+ "'";
                 LOG.info( message );
                 throw new LdapAuthenticationException(message);
             }
@@ -320,7 +320,7 @@
         else
         {
             // Bad password ...
-            String message = "Password not correct for user '" + opContext.getPrincipalDn().getUpName()
+ "'";
+            String message = "Password not correct for user '" + opContext.getDn().getUpName()
+ "'";
             LOG.info( message );
             throw new LdapAuthenticationException(message);
         }
@@ -540,12 +540,12 @@
 
         try
         {
-            userEntry = opContext.lookup( opContext.getPrincipalDn(), USERLOOKUP_BYPASS );
+            userEntry = opContext.lookup( opContext.getDn(), USERLOOKUP_BYPASS );
 
             if ( userEntry == null )
             {
                 throw new LdapAuthenticationException( "Failed to lookup user for authentication:
" 
-                    + opContext.getPrincipalDn() );
+                    + opContext.getDn() );
             }
         }
         catch ( Exception cause )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/authn/StrongAuthenticator.java
Thu Jun  5 16:29:29 2008
@@ -53,6 +53,6 @@
     public LdapPrincipal authenticate( BindOperationContext opContext ) throws NamingException
     {
         // Possibly check if user account is disabled, other account checks.
-        return new LdapPrincipal( opContext.getPrincipalDn(), AuthenticationLevel.STRONG
);
+        return new LdapPrincipal( opContext.getDn(), AuthenticationLevel.STRONG );
     }
 }

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/interceptor/context/BindOperationContext.java
Thu Jun  5 16:29:29 2008
@@ -20,11 +20,8 @@
 package org.apache.directory.server.core.interceptor.context;
  
 
-import java.util.List;
-
 import org.apache.directory.server.core.CoreSession;
 import org.apache.directory.shared.ldap.message.MessageTypeEnum;
-import org.apache.directory.shared.ldap.name.LdapDN;
 import org.apache.directory.shared.ldap.util.StringTools;
 
 
@@ -37,17 +34,15 @@
  */
 public class BindOperationContext extends AbstractOperationContext
 {
-    /** The list of supported mechanisms */
-    private List<String> mechanisms;
-    
     /** The password */
     private byte[] credentials;
+
+    /** The SASL mechanism */
+    private String saslMechanism;
     
     /** The SASL identifier */
     private String saslAuthId;
     
-    /** the authenticating principal's distinguished name */
-    private LdapDN principalDn;
     
     
     /**
@@ -60,17 +55,17 @@
 
     
     /**
-     * @return The list of supported mechanisms
+     * @return the SASL mechanisms
      */
-    public List<String> getMechanisms()
+    public String getSaslMechanism()
     {
-        return mechanisms;
+        return saslMechanism;
     }
 
     
-    public void setMechanisms( List<String> mechanisms )
+    public void setSaslMechanism( String saslMechanism )
     {
-        this.mechanisms = mechanisms;
+        this.saslMechanism = saslMechanism;
     }
 
     
@@ -104,6 +99,12 @@
     }
     
     
+    public boolean isSaslBind()
+    {
+        return saslMechanism != null;
+    }
+    
+    
     /**
      * @return the operation name
      */
@@ -112,7 +113,7 @@
         return MessageTypeEnum.BIND_REQUEST.name();
     }
 
-    
+
     /**
      * @see Object#toString()
      */
@@ -120,27 +121,9 @@
     {
         return "BindContext for DN '" + getDn().getUpName() + "', credentials <" +
             ( credentials != null ? StringTools.dumpBytes( credentials ) : "" ) + ">"
+
-            ( ( mechanisms != null ) ? ", mechanisms : <" + StringTools.listToString(
mechanisms ) + ">" : "" ) +
+            ( saslMechanism != null ? ", saslMechanism : <" + saslMechanism + ">" :
"" ) +
             ( saslAuthId != null ? ", saslAuthId <" + saslAuthId + ">" : "" );
     }
-
-
-    /**
-     * @param principalDn the principalDn to set
-     */
-    public void setPrincipalDn( LdapDN principalDn )
-    {
-        this.principalDn = principalDn;
-    }
-
-
-    /**
-     * @return the principalDn
-     */
-    public LdapDN getPrincipalDn()
-    {
-        return principalDn;
-    }
     
     
     public void setSession( CoreSession session )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/CoreContextFactory.java
Thu Jun  5 16:29:29 2008
@@ -75,7 +75,7 @@
         ServerLdapContext ctx = null;
         try
         {
-            CoreSession session = service.getSession( principalDn, credential, authentication
);
+            CoreSession session = service.getSession( principalDn, credential );
             ctx = new ServerLdapContext( service, session, new LdapDN( providerUrl ) );
         }
         catch ( Exception e )

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/LdapJndiProperties.java
Thu Jun  5 16:29:29 2008
@@ -20,10 +20,7 @@
 package org.apache.directory.server.core.jndi;
 
 
-import java.util.ArrayList;
-import java.util.Collections;
 import java.util.Hashtable;
-import java.util.List;
 
 import javax.naming.Context;
 import javax.naming.NamingException;
@@ -49,7 +46,7 @@
     private LdapDN bindDn;
     private String saslAuthId;
     private AuthenticationLevel level;
-    private List<String> mechanisms = new ArrayList<String>();
+    private String saslMechanism;
     private byte[] credentials;
 
 
@@ -150,12 +147,10 @@
             if ( credobj == null )
             {
                 props.level = AuthenticationLevel.NONE;
-                props.mechanisms.add( AuthenticationLevel.NONE.toString() );
             }
             else
             {
                 props.level = AuthenticationLevel.SIMPLE;
-                props.mechanisms.add( AuthenticationLevel.SIMPLE.toString() );
             }
         }
         else if ( !( authentication instanceof String ) )
@@ -168,24 +163,23 @@
             if ( AuthenticationLevel.NONE.toString().equals( authentication ) )
             {
                 props.level = AuthenticationLevel.NONE;
-                props.mechanisms.add( AuthenticationLevel.NONE.toString() );
             }
             else if ( AuthenticationLevel.SIMPLE.toString().equals( authentication ) )
             {
                 props.level = AuthenticationLevel.SIMPLE;
-                props.mechanisms.add( AuthenticationLevel.SIMPLE.toString() );
             }
             else
             {
                 props.level = AuthenticationLevel.STRONG;
-                String[] mechList = ( ( String ) authentication ).trim().split( " " );
-                for ( String mech : mechList )
-                {
-                    if ( !mech.trim().equals( "" ) )
-                    {
-                        props.mechanisms.add( mech );
-                    }
-                }
+                props.saslMechanism = ( String ) authentication;
+//                String[] mechList = ( ( String ) authentication ).trim().split( " " );
+//                for ( String mech : mechList )
+//                {
+//                    if ( !mech.trim().equals( "" ) )
+//                    {
+//                        props.mechanisms.add( mech );
+//                    }
+//                }
             }
         }
 
@@ -284,9 +278,9 @@
     }
 
 
-    public List<String> getAuthenticationMechanisms()
+    public String getSaslMechanism()
     {
-        return Collections.unmodifiableList( mechanisms );
+        return saslMechanism;
     }
 
 

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/jndi/ServerContext.java
Thu Jun  5 16:29:29 2008
@@ -156,7 +156,7 @@
         dn = props.getProviderDn();
 
         // need to issue a bind operation here
-        doBindOperation( props.getBindDn(), props.getCredentials(), props.getAuthenticationMechanisms(),
props
+        doBindOperation( props.getBindDn(), props.getCredentials(), props.getSaslMechanism(),
props
             .getSaslAuthId() );
 
         session = new DefaultCoreSession( principal, service );
@@ -367,14 +367,14 @@
     /**
      * Used to encapsulate [de]marshalling of controls before and after bind operations.
      */
-    protected BindOperationContext doBindOperation( LdapDN bindDn, byte[] credentials, List<String>
mechanisms, 
+    protected BindOperationContext doBindOperation( LdapDN bindDn, byte[] credentials, String
saslMechanism, 
         String saslAuthId ) throws Exception
     {
         // setup the op context and populate with request controls
         BindOperationContext opCtx = new BindOperationContext( null );
         opCtx.setDn( bindDn );
         opCtx.setCredentials( credentials );
-        opCtx.setMechanisms( mechanisms );
+        opCtx.setSaslMechanism( saslMechanism );
         opCtx.setSaslAuthId( saslAuthId );
         opCtx.addRequestControls( requestControls );
 

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/authz/support/MaxImmSubFilterTest.java
Thu Jun  5 16:29:29 2008
@@ -702,7 +702,14 @@
         }
 
 
-        public CoreSession getSession( LdapDN principalDn, byte[] credentials, String authentication
) throws Exception
+        public CoreSession getSession( LdapDN principalDn, byte[] credentials ) throws Exception
+        {
+            return null;
+        }
+
+        
+        public CoreSession getSession( LdapDN principalDn, byte[] credentials, String saslMechanism,
String saslAuthId )
+            throws Exception
         {
             return null;
         }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/interceptor/InterceptorChainTest.java
Thu Jun  5 16:29:29 2008
@@ -578,7 +578,14 @@
         }
 
 
-        public CoreSession getSession( LdapDN principalDn, byte[] credentials, String authentication
) throws Exception
+        public CoreSession getSession( LdapDN principalDn, byte[] credentials ) throws Exception
+        {
+            return null;
+        }
+
+
+        public CoreSession getSession( LdapDN principalDn, byte[] credentials, String saslMechanism,
String saslAuthId )
+            throws Exception
         {
             return null;
         }

Modified: directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java?rev=663780&r1=663779&r2=663780&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java
(original)
+++ directory/apacheds/branches/bigbang/core/src/test/java/org/apache/directory/server/core/jndi/LdapJndiPropertiesTest.java
Thu Jun  5 16:29:29 2008
@@ -75,8 +75,6 @@
         env.put( Context.PROVIDER_URL, "" );
         LdapJndiProperties props = LdapJndiProperties.getLdapJndiProperties( env );
         assertEquals( AuthenticationLevel.SIMPLE, props.getAuthenticationLevel() );
-        assertEquals( 1, props.getAuthenticationMechanisms().size() );
-        assertEquals( "simple", props.getAuthenticationMechanisms().get( 0 ) );
         assertTrue( ArrayUtils.isEquals( StringTools.getBytesUtf8( "asdf" ), props.getCredentials()
) );
     }
 
@@ -88,8 +86,6 @@
         env.put( Context.PROVIDER_URL, "" );
         LdapJndiProperties props = LdapJndiProperties.getLdapJndiProperties( env );
         assertEquals( AuthenticationLevel.NONE, props.getAuthenticationLevel() );
-        assertEquals( 1, props.getAuthenticationMechanisms().size() );
-        assertEquals( "none", props.getAuthenticationMechanisms().get( 0 ) );
         assertTrue( props.getCredentials() == null );
     }
 
@@ -118,9 +114,6 @@
         env.put( Context.PROVIDER_URL, "" );
         LdapJndiProperties props = LdapJndiProperties.getLdapJndiProperties( env );
         assertEquals( AuthenticationLevel.STRONG, props.getAuthenticationLevel() );
-        assertEquals( 2, props.getAuthenticationMechanisms().size() );
-        assertEquals( "DIGEST-MD5", props.getAuthenticationMechanisms().get( 0 ) );
-        assertEquals( "CRAM-MD5", props.getAuthenticationMechanisms().get( 1 ) );
         assertTrue( props.getCredentials() == null );
     }
 
@@ -134,9 +127,6 @@
         env.put( Context.PROVIDER_URL, "" );
         LdapJndiProperties props = LdapJndiProperties.getLdapJndiProperties( env );
         assertEquals( AuthenticationLevel.STRONG, props.getAuthenticationLevel() );
-        assertEquals( 2, props.getAuthenticationMechanisms().size() );
-        assertEquals( "DIGEST-MD5", props.getAuthenticationMechanisms().get( 0 ) );
-        assertEquals( "CRAM-MD5", props.getAuthenticationMechanisms().get( 1 ) );
         assertTrue( ArrayUtils.isEquals( StringTools.getBytesUtf8( "asdf" ), props.getCredentials()
) );
     }
 }



Mime
View raw message