directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1078093 - in /directory/apacheds/trunk: core-api/src/main/java/org/apache/directory/server/core/ core-api/src/main/java/org/apache/directory/server/core/changelog/ core-api/src/main/java/org/apache/directory/server/core/interceptor/context...
Date Fri, 04 Mar 2011 18:38:25 GMT
Author: elecharny
Date: Fri Mar  4 18:38:24 2011
New Revision: 1078093

URL: http://svn.apache.org/viewvc?rev=1078093&view=rev
Log:
Replaced the serializers

Modified:
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipal.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
    directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java
    directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
    directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
    directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
    directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipal.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipal.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipal.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipal.java
Fri Mar  4 18:38:24 2011
@@ -20,17 +20,12 @@
 package org.apache.directory.server.core;
 
 
-import java.io.Externalizable;
-import java.io.IOException;
-import java.io.ObjectInput;
-import java.io.ObjectOutput;
 import java.security.Principal;
 
 import org.apache.directory.server.i18n.I18n;
 import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
 import org.apache.directory.shared.ldap.model.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.model.name.Dn;
-import org.apache.directory.shared.ldap.model.name.DnSerializer;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.apache.directory.shared.util.Strings;
 
@@ -41,7 +36,7 @@ import org.apache.directory.shared.util.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public final class LdapPrincipal implements Principal, Cloneable, Externalizable
+public final class LdapPrincipal implements Principal, Cloneable
 {
     private static final long serialVersionUID = 3906650782395676720L;
 
@@ -126,24 +121,12 @@ public final class LdapPrincipal impleme
 
 
     /**
-     * Gets a reference to the distinguished name of this
-     * principal as a {@link org.apache.directory.shared.ldap.model.name.Dn}.
-     *
-     * @return the distinguished name of the principal as a {@link org.apache.directory.shared.ldap.model.name.Dn}
-     */
-    public Dn getDNRef()
-    {
-        return dn;
-    }
-
-
-    /**
      * Gets a cloned copy of the normalized distinguished name of this
      * principal as a {@link org.apache.directory.shared.ldap.model.name.Dn}.
      *
      * @return the cloned distinguished name of the principal as a {@link org.apache.directory.shared.ldap.model.name.Dn}
      */
-    public Dn getDN()
+    public Dn getDn()
     {
         return dn;
     }
@@ -200,65 +183,6 @@ public final class LdapPrincipal impleme
     
     
     /**
-     * @see Externalizable#readExternal(ObjectInput)
-     * 
-     * @param in The stream from which the LdapPrincipal is read
-     * @throws IOException If the stream can't be read
-     * @throws ClassNotFoundException If the LdapPrincipal can't be created 
-     */
-    public void readExternal( ObjectInput in ) throws IOException , ClassNotFoundException
-    {
-        // Read the name
-        try
-        {
-            dn = DnSerializer.deserialize( schemaManager, in );
-        }
-        catch ( LdapInvalidDnException lide )
-        {
-            throw new IOException( lide.getMessage() );
-        }
-        
-        // read the authentication level
-        int level = in.readInt();
-        
-        authenticationLevel = AuthenticationLevel.getLevel( level );
-    }
-
-
-    /**
-     * Note: The password won't be written !
-     * 
-     * @see Externalizable#readExternal(ObjectInput)
-     *
-     * @param out The stream in which the LdapPrincipal will be serialized. 
-     *
-     * @throws IOException If the serialization fail
-     */
-    public void writeExternal( ObjectOutput out ) throws IOException
-    {
-        // Write the name
-        if ( dn == null )
-        {
-            DnSerializer.serialize( Dn.EMPTY_DN, out );
-        }
-        else
-        {
-            DnSerializer.serialize( dn, out );
-        }
-        
-        // write the authentication level
-        if ( authenticationLevel == null )
-        {
-            out.writeInt( AuthenticationLevel.NONE.getLevel() );
-        }
-        else
-        {
-            out.writeInt( authenticationLevel.getLevel() );
-        }
-    }
-
-
-    /**
      * @return the schemaManager
      */
     public SchemaManager getSchemaManager()

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/LdapPrincipalSerializer.java
Fri Mar  4 18:38:24 2011
@@ -52,8 +52,8 @@ public final class LdapPrincipalSerializ
     /**
      * Serializes a LdapPrincipal instance.
      * 
-     * @param principal The LsapPrincipal instance to serialize
-     * @param out The stream into which we will write teh serialized instance
+     * @param principal The LdapPrincipal instance to serialize
+     * @param out The stream into which we will write the serialized instance
      * @throws IOException If the stream can't be written
      */
     public static void serialize( LdapPrincipal principal, ObjectOutput out ) throws IOException
@@ -62,13 +62,13 @@ public final class LdapPrincipalSerializ
         out.writeInt( principal.getAuthenticationLevel().getLevel() );
         
         // The principal's DN
-        if ( principal.getDN() == null )
+        if ( principal.getDn() == null )
         {
             DnSerializer.serialize( Dn.EMPTY_DN, out );
         }
         else
         {
-            DnSerializer.serialize( principal.getDN(), out );
+            DnSerializer.serialize( principal.getDn(), out );
         }
     }
     
@@ -77,8 +77,8 @@ public final class LdapPrincipalSerializ
      * Deserializes a LdapPrincipal instance.
      * 
      * @param schemaManager The SchemaManager (can be null)
-     * @param in The input stream from which the Rdn is read
-     * @return a deserialized Rdn
+     * @param in The input stream from which the LdapPrincipal is read
+     * @return a deserialized LdapPrincipal
      * @throws IOException If the stream can't be read
      */
     public static LdapPrincipal deserialize( SchemaManager schemaManager, ObjectInput in
)

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/changelog/ChangeLogEvent.java
Fri Mar  4 18:38:24 2011
@@ -38,25 +38,22 @@ import org.apache.directory.shared.util.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class ChangeLogEvent implements Externalizable
+public class ChangeLogEvent
 {
-    private static final long serialVersionUID = 1L;
+    /** */
     private String zuluTime;
+    
+    /** The committer */
+    private LdapPrincipal committer;
+    
+    /** The revision number for this event */
     private long revision;
+    
+    /** The modification */
     private LdifEntry forwardLdif;
     
     /** The revert changes. Can contain more than one single change */
     private List<LdifEntry> reverseLdifs;
-    private LdapPrincipal committer;
-
-
-    /**
-     * Creates a new instance of ChangeLogEvent, used during the deserialization
-     * process
-     */
-    public ChangeLogEvent()
-    {
-    }
 
 
     /**

Modified: directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java
(original)
+++ directory/apacheds/trunk/core-api/src/main/java/org/apache/directory/server/core/interceptor/context/UnbindOperationContext.java
Fri Mar  4 18:38:24 2011
@@ -38,13 +38,13 @@ public class UnbindOperationContext exte
      */
     public UnbindOperationContext( CoreSession session )
     {
-        super( session, session.getEffectivePrincipal().getDN() );
+        super( session, session.getEffectivePrincipal().getDn() );
     }
     
 
     public UnbindOperationContext( CoreSession session, UnbindRequest unbindRequest )
     {
-        super( session, session.getEffectivePrincipal().getDN() );
+        super( session, session.getEffectivePrincipal().getDn() );
         this.setRequestControls( unbindRequest.getControls() );
     }
 

Modified: directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
(original)
+++ directory/apacheds/trunk/core-integ/src/test/java/org/apache/directory/server/core/authz/AddAuthorizationIT.java
Fri Mar  4 18:38:24 2011
@@ -39,7 +39,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -188,7 +187,6 @@ public class AddAuthorizationIT extends 
      * @throws Exception if the test encounters an error
      */
     @Test
-    @Ignore
     public void testGrantAddByName() throws Exception
     {
         // create the non-admin user
@@ -227,7 +225,6 @@ public class AddAuthorizationIT extends 
      * @throws Exception if the test encounters an error
      */
     @Test
-    @Ignore
     public void testGrantAddBySubtree() throws Exception
     {
         // create the non-admin user
@@ -269,7 +266,6 @@ public class AddAuthorizationIT extends 
      * @throws Exception if the test encounters an error
      */
     @Test
-    @Ignore
     public void testGrantAddAllUsers() throws Exception
     {
         // create the non-admin user

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/DefaultCoreSession.java
Fri Mar  4 18:38:24 2011
@@ -816,7 +816,7 @@ public class DefaultCoreSession implemen
 
     public boolean isAnonymous()
     {
-        return getEffectivePrincipal().getDNRef().isEmpty();
+        return getEffectivePrincipal().getDn().isEmpty();
     }
 
 

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Fri Mar  4 18:38:24 2011
@@ -512,7 +512,7 @@ public class AuthenticationInterceptor e
         PasswordPolicyConfiguration policyConfig = directoryService.getPwdPolicy( modifyContext.getOriginalEntry()
);
         
         boolean isPPolicyReqCtrlPresent = modifyContext.hasRequestControl( PasswordPolicy.OID
);
-        Dn userDn = modifyContext.getSession().getAuthenticatedPrincipal().getDN();
+        Dn userDn = modifyContext.getSession().getAuthenticatedPrincipal().getDn();
 
         PwdModDetailsHolder pwdModDetails = null;
         if ( policyConfig.isPwdSafeModify() || pwdResetSet.contains( userDn ) || ( policyConfig.getPwdMinAge()
> 0 ) )
@@ -1380,7 +1380,7 @@ public class AuthenticationInterceptor e
         {
             CoreSession session = opContext.getSession();
 
-            Dn userDn = session.getAuthenticatedPrincipal().getDN();
+            Dn userDn = session.getAuthenticatedPrincipal().getDn();
 
             if ( pwdResetSet.contains( userDn ) )
             {

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/AciAuthorizationInterceptor.java
Fri Mar  4 18:38:24 2011
@@ -304,7 +304,7 @@ public class AciAuthorizationInterceptor
 
     private void protectCriticalEntries( Dn dn ) throws LdapException
     {
-        Dn principalDn = getPrincipal().getDNRef();
+        Dn principalDn = getPrincipal().getDn();
 
         if ( dn.isEmpty() )
         {
@@ -508,7 +508,7 @@ public class AciAuthorizationInterceptor
 
         // Access the principal requesting the operation, and bypass checks if it is the
admin
         LdapPrincipal principal = addContext.getSession().getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
 
         Entry serverEntry = addContext.getEntry();
 
@@ -605,7 +605,7 @@ public class AciAuthorizationInterceptor
 
         Dn dn = deleteContext.getDn();
         LdapPrincipal principal = session.getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
 
         Entry entry = deleteContext.getEntry();
 
@@ -656,7 +656,7 @@ public class AciAuthorizationInterceptor
         Entry entry = modifyContext.getEntry();
 
         LdapPrincipal principal = modifyContext.getSession().getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
 
         // bypass authz code if we are disabled
         if ( !modifyContext.getSession().getDirectoryService().isAccessControlEnabled() )
@@ -824,7 +824,7 @@ public class AciAuthorizationInterceptor
 
         // TODO - eventually replace this with a check on session.isAnAdministrator()
         LdapPrincipal principal = hasEntryContext.getSession().getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
 
         if ( isPrincipalAnAdministrator( principalDn ) )
         {
@@ -880,7 +880,7 @@ public class AciAuthorizationInterceptor
         }
 
         LdapPrincipal principal = lookupContext.getSession().getEffectivePrincipal();
-        Dn userName = principal.getDN();
+        Dn userName = principal.getDn();
         Set<Dn> userGroups = groupCache.getGroups( userName.getNormName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
         addPerscriptiveAciTuples( lookupContext, tuples, dn, entry );
@@ -931,7 +931,7 @@ public class AciAuthorizationInterceptor
         DirectoryService directoryService = session.getDirectoryService();
 
         LdapPrincipal principal = session.getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
 
         if ( !principalDn.isNormalized() )
         {
@@ -964,7 +964,7 @@ public class AciAuthorizationInterceptor
         }
 
         LdapPrincipal principal = renameContext.getSession().getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
         Dn newName = renameContext.getNewDn();
 
         // bypass authz code if we are disabled
@@ -1019,7 +1019,7 @@ public class AciAuthorizationInterceptor
         Entry entry = moveAndRenameContext.getOriginalEntry();
 
         LdapPrincipal principal = moveAndRenameContext.getSession().getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
         Dn newDn = moveAndRenameContext.getNewDn();
 
         // bypass authz code if we are disabled
@@ -1116,7 +1116,7 @@ public class AciAuthorizationInterceptor
         Dn newDn = moveContext.getNewDn();
 
         LdapPrincipal principal = moveContext.getSession().getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
 
         // bypass authz code if we are disabled
         if ( !moveContext.getSession().getDirectoryService().isAccessControlEnabled() )
@@ -1202,7 +1202,7 @@ public class AciAuthorizationInterceptor
         LdapPrincipal user = listContext.getSession().getEffectivePrincipal();
         EntryFilteringCursor cursor = next.list( listContext );
 
-        if ( isPrincipalAnAdministrator( user.getDNRef() )
+        if ( isPrincipalAnAdministrator( user.getDn() )
             || !listContext.getSession().getDirectoryService().isAccessControlEnabled() )
         {
             return cursor;
@@ -1217,7 +1217,7 @@ public class AciAuthorizationInterceptor
     public EntryFilteringCursor search( NextInterceptor next, SearchOperationContext searchContext
) throws LdapException
     {
         LdapPrincipal user = searchContext.getSession().getEffectivePrincipal();
-        Dn principalDn = user.getDN();
+        Dn principalDn = user.getDn();
         EntryFilteringCursor cursor = next.search( searchContext );
 
         boolean isSubschemaSubentryLookup = subschemaSubentryDn.equals( searchContext.getDn().getNormName()
);
@@ -1256,7 +1256,7 @@ public class AciAuthorizationInterceptor
         Entry entry = compareContext.getOriginalEntry();
 
         LdapPrincipal principal = session.getEffectivePrincipal();
-        Dn principalDn = principal.getDN();
+        Dn principalDn = principal.getDn();
 
         if ( isPrincipalAnAdministrator( principalDn ) || !session.getDirectoryService().isAccessControlEnabled()
)
         {
@@ -1313,7 +1313,7 @@ public class AciAuthorizationInterceptor
          */
 
         LdapPrincipal principal = opContext.getSession().getEffectivePrincipal();
-        Dn userDn = principal.getDN();
+        Dn userDn = principal.getDn();
         Set<Dn> userGroups = groupCache.getGroups( userDn.getNormName() );
         Collection<ACITuple> tuples = new HashSet<ACITuple>();
         addPerscriptiveAciTuples( opContext, tuples, normName, clonedEntry );

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/authz/DefaultAuthorizationInterceptor.java
Fri Mar  4 18:38:24 2011
@@ -166,7 +166,7 @@ public class DefaultAuthorizationInterce
             throw new LdapNoPermissionException( msg );
         }
 
-        Dn principalDn = getPrincipal().getDNRef();
+        Dn principalDn = getPrincipal().getDn();
 
         if ( dn.equals( ADMIN_SYSTEM_DN ) )
         {
@@ -242,7 +242,7 @@ public class DefaultAuthorizationInterce
 
     private void protectModifyAlterations( Dn dn ) throws LdapException
     {
-        Dn principalDn = getPrincipal().getDN();
+        Dn principalDn = getPrincipal().getDn();
 
         if ( dn.isEmpty() )
         {
@@ -334,7 +334,7 @@ public class DefaultAuthorizationInterce
 
     private void protectDnAlterations( Dn dn ) throws LdapException
     {
-        Dn principalDn = getPrincipal().getDN();
+        Dn principalDn = getPrincipal().getDn();
 
         if ( dn.isEmpty() )
         {
@@ -383,7 +383,7 @@ public class DefaultAuthorizationInterce
             return entry;
         }
 
-        protectLookUp( session.getEffectivePrincipal().getDNRef(), lookupContext.getDn()
);
+        protectLookUp( session.getEffectivePrincipal().getDn(), lookupContext.getDn() );
 
         return entry;
     }
@@ -484,7 +484,7 @@ public class DefaultAuthorizationInterce
     @SuppressWarnings("PMD.CollapsibleIfStatements")
     private boolean isSearchable( OperationContext opContext, ClonedServerEntry result )
throws Exception
     {
-        Dn principalDn = opContext.getSession().getEffectivePrincipal().getDN();
+        Dn principalDn = opContext.getSession().getEffectivePrincipal().getDn();
         Dn dn = result.getDn();
 
         if ( !dn.isNormalized() )

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/changelog/MemoryChangeLogStore.java
Fri Mar  4 18:38:24 2011
@@ -348,7 +348,7 @@ public class MemoryChangeLogStore implem
 
                 for ( int i = 0; i < size; i++ )
                 {
-                    ChangeLogEvent event = ( ChangeLogEvent ) in.readObject();
+                    ChangeLogEvent event = ChangeLogEventSerializer.deserialize( directoryService.getSchemaManager(),
in );
                     event.getCommitterPrincipal().setSchemaManager( directoryService.getSchemaManager()
);
                     changeLogEvents.add( event );
                 }
@@ -412,7 +412,7 @@ public class MemoryChangeLogStore implem
             
             for ( ChangeLogEvent event : events )
             {
-                out.writeObject( event );
+                ChangeLogEventSerializer.serialize( event, out  );
             }
 
             out.flush();

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/operational/OperationalAttributeInterceptor.java
Fri Mar  4 18:38:24 2011
@@ -237,7 +237,7 @@ public class OperationalAttributeInterce
         // otherwise, inject those values into the list of modifications
         List<Modification> mods = modifyContext.getModItems();
 
-        boolean isAdmin = modifyContext.getSession().getAuthenticatedPrincipal().getDN().equals(
adminDn );
+        boolean isAdmin = modifyContext.getSession().getAuthenticatedPrincipal().getDn().equals(
adminDn );
 
         boolean modifierAtPresent = false;
         boolean modifiedTimeAtPresent = false;

Modified: directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java
(original)
+++ directory/apacheds/trunk/core/src/main/java/org/apache/directory/server/core/trigger/SimpleTriggerExecutionAuthorizer.java
Fri Mar  4 18:38:24 2011
@@ -44,7 +44,7 @@ public class SimpleTriggerExecutionAutho
     
     public boolean hasPermission( OperationContext opContext ) throws LdapException
     {
-        Dn principalName = opContext.getSession().getEffectivePrincipal().getDN();
-        return principalName.equals( opContext.getSession().getDirectoryService().getAdminSession().getAuthenticatedPrincipal().getDN()
);
+        Dn principalName = opContext.getSession().getEffectivePrincipal().getDn();
+        return principalName.equals( opContext.getSession().getDirectoryService().getAdminSession().getAuthenticatedPrincipal().getDn()
);
     }
 }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/authn/LdapPrincipalTest.java
Fri Mar  4 18:38:24 2011
@@ -27,6 +27,12 @@ import java.io.ObjectInputStream;
 import java.io.ObjectOutputStream;
 
 import org.apache.directory.server.core.LdapPrincipal;
+import org.apache.directory.server.core.LdapPrincipalSerializer;
+import org.apache.directory.shared.ldap.model.constants.AuthenticationLevel;
+import org.apache.directory.shared.ldap.model.name.Dn;
+import org.apache.directory.shared.ldap.model.schema.SchemaManager;
+import org.apache.directory.shared.ldap.schemamanager.impl.DefaultSchemaManager;
+import org.junit.BeforeClass;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -44,6 +50,16 @@ import com.mycila.junit.concurrent.Concu
 @Concurrency()
 public class LdapPrincipalTest
 {
+    /** The schema manager instance */
+    private static SchemaManager schemaManager;
+
+    @BeforeClass
+    public static void setUp() throws Exception
+    {
+        schemaManager = new DefaultSchemaManager();
+    }
+
+
     /**
      * Test the serialization of an empty LdapPrincipal
      */
@@ -55,12 +71,36 @@ public class LdapPrincipalTest
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
-        out.writeObject( principal );
+        LdapPrincipalSerializer.serialize( principal, out );
+        out.flush();
+
+        byte[] data = baos.toByteArray();
+        ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
+
+        LdapPrincipal readPrincipal = LdapPrincipalSerializer.deserialize( null, in );
+        assertEquals( principal.getAuthenticationLevel(), readPrincipal.getAuthenticationLevel()
);
+        assertEquals( principal.getName(), readPrincipal.getName() );
+    }
+    
+    
+    /**
+     * Test the serialization of an empty LdapPrincipal
+     */
+    @Test
+    public void testStaticSerializeLdapPrincipalWithSchemaManager() throws Exception
+    {
+        LdapPrincipal principal = new LdapPrincipal( schemaManager, new Dn( schemaManager,
"uid=admin,ou=system" ), AuthenticationLevel.STRONG );
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream( baos );
+
+        LdapPrincipalSerializer.serialize( principal, out );
+        out.flush();
 
         byte[] data = baos.toByteArray();
         ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
 
-        LdapPrincipal readPrincipal = (LdapPrincipal)in.readObject();
+        LdapPrincipal readPrincipal = LdapPrincipalSerializer.deserialize( null, in );
         assertEquals( principal.getAuthenticationLevel(), readPrincipal.getAuthenticationLevel()
);
         assertEquals( principal.getName(), readPrincipal.getName() );
     }

Modified: directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
(original)
+++ directory/apacheds/trunk/core/src/test/java/org/apache/directory/server/core/changelog/MemoryChangeLogStoreTest.java
Fri Mar  4 18:38:24 2011
@@ -125,12 +125,12 @@ public class MemoryChangeLogStoreTest
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         ObjectOutputStream out = new ObjectOutputStream( baos );
 
-        out.writeObject( event );
+        ChangeLogEventSerializer.serialize( event, out );
         
         byte[] data = baos.toByteArray();
         ObjectInputStream in = new ObjectInputStream( new ByteArrayInputStream( data ) );
         
-        ChangeLogEvent read = (ChangeLogEvent)in.readObject(); 
+        ChangeLogEvent read = ChangeLogEventSerializer.deserialize( schemaManager, in );

         
         // The read event should not be equal to the written event, as
         // the principal's password has not been stored
@@ -140,7 +140,7 @@ public class MemoryChangeLogStoreTest
         
         assertEquals( principal.getAuthenticationLevel(), readPrincipal.getAuthenticationLevel()
);
         assertEquals( principal.getName(), readPrincipal.getName() );
-        assertEquals( principal.getDN(), readPrincipal.getDN() );
+        assertEquals( principal.getDn(), readPrincipal.getDn() );
         assertNull( readPrincipal.getUserPassword() );
         
         assertEquals( zuluTime, read.getZuluTime() );

Modified: directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java?rev=1078093&r1=1078092&r2=1078093&view=diff
==============================================================================
--- directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
(original)
+++ directory/apacheds/trunk/protocol-ldap/src/main/java/org/apache/directory/server/ldap/handlers/BindHandler.java
Fri Mar  4 18:38:24 2011
@@ -310,7 +310,7 @@ public class BindHandler extends LdapReq
                 {
                     DirectoryService ds = ldapSession.getLdapServer().getDirectoryService();
                     String saslMechanism = bindRequest.getSaslMechanism();
-                    CoreSession userSession = ds.getSession( ldapPrincipal.getDN(), ldapPrincipal.getUserPassword(),
+                    CoreSession userSession = ds.getSession( ldapPrincipal.getDn(), ldapPrincipal.getUserPassword(),
                         saslMechanism, null );
 
                     // Set the user session into the ldap session 



Mime
View raw message