directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1692797 - /directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Date Sun, 26 Jul 2015 23:27:40 GMT
Author: elecharny
Date: Sun Jul 26 23:27:40 2015
New Revision: 1692797

URL: http://svn.apache.org/r1692797
Log:
Added a new private method used by the modify() operation

Modified:
    directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java

Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java?rev=1692797&r1=1692796&r2=1692797&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
(original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
Sun Jul 26 23:27:40 2015
@@ -882,7 +882,6 @@ public class AuthenticationInterceptor e
         if ( !directoryService.isPwdPolicyEnabled() || modifyContext.isReplEvent() )
         {
             processStandardModify( modifyContext );
-            return;
         }
         else
         {
@@ -1095,47 +1094,8 @@ public class AuthenticationInterceptor e
                 }
             }
 
-            // these two attributes will be removed irrespective  of add or delete
-            Attribute pwdFailureTimeAt = entry.get( AT_PWD_FAILURE_TIME );
-
-            if ( pwdFailureTimeAt != null )
-            {
-                mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdFailureTimeAt ) );
-            }
-
-            Attribute pwdGraceUseTimeAt = entry.get( AT_PWD_GRACE_USE_TIME );
-
-            if ( pwdGraceUseTimeAt != null )
-            {
-                mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdGraceUseTimeAt )
);
-            }
-
-            if ( pwdModDetails.isDelete() )
-            {
-                Attribute pwdHistory = entry.get( AT_PWD_HISTORY );
-                if ( pwdHistory != null )
-                {
-                    mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdHistory ) );
-                }
-
-                Attribute pwdChangedTimeAt = entry.get( AT_PWD_CHANGED_TIME );
-                if ( pwdChangedTimeAt != null )
-                {
-                    mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdChangedTimeAt
) );
-                }
-
-                Attribute pwdMustChangeAt = entry.get( AT_PWD_RESET );
-                if ( pwdMustChangeAt != null )
-                {
-                    mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdMustChangeAt
) );
-                }
-
-                Attribute pwdAccountLockedTimeAt = entry.get( AT_PWD_ACCOUNT_LOCKED_TIME
);
-                if ( pwdAccountLockedTimeAt != null )
-                {
-                    mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdAccountLockedTimeAt
) );
-                }
-            }
+            // Add the attributes that have been modified following a Add/Replace password
+            processModifyAddPwdAttributes( entry, mods, pwdModDetails );
 
             String csnVal = directoryService.getCSN().toString();
             Modification csnMod = new DefaultModification( REPLACE_ATTRIBUTE, ENTRY_CSN_AT,
csnVal );
@@ -1155,6 +1115,58 @@ public class AuthenticationInterceptor e
             }
         }
     }
+    
+    
+    /**
+     * Add the passwordPolicy related Attributes from the modified entry
+     */
+    private void processModifyAddPwdAttributes( Entry entry, List<Modification> mods,
PwdModDetailsHolder pwdModDetails )
+    {
+        Attribute pwdFailureTimeAt = entry.get( AT_PWD_FAILURE_TIME );
+    
+        if ( pwdFailureTimeAt != null )
+        {
+            mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdFailureTimeAt ) );
+        }
+    
+        Attribute pwdGraceUseTimeAt = entry.get( AT_PWD_GRACE_USE_TIME );
+    
+        if ( pwdGraceUseTimeAt != null )
+        {
+            mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdGraceUseTimeAt ) );
+        }
+    
+        if ( pwdModDetails.isDelete() )
+        {
+            Attribute pwdHistory = entry.get( AT_PWD_HISTORY );
+            
+            if ( pwdHistory != null )
+            {
+                mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdHistory ) );
+            }
+    
+            Attribute pwdChangedTimeAt = entry.get( AT_PWD_CHANGED_TIME );
+            
+            if ( pwdChangedTimeAt != null )
+            {
+                mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdChangedTimeAt ) );
+            }
+    
+            Attribute pwdMustChangeAt = entry.get( AT_PWD_RESET );
+            
+            if ( pwdMustChangeAt != null )
+            {
+                mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdMustChangeAt ) );
+            }
+    
+            Attribute pwdAccountLockedTimeAt = entry.get( AT_PWD_ACCOUNT_LOCKED_TIME );
+            
+            if ( pwdAccountLockedTimeAt != null )
+            {
+                mods.add( new DefaultModification( REMOVE_ATTRIBUTE, pwdAccountLockedTimeAt
) );
+            }
+        }
+    }
 
     
     /**



Mime
View raw message