directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From smckin...@apache.org
Subject [directory-fortress-core] branch FC-238 updated: cleanup password policy processing
Date Thu, 24 Jun 2021 17:27:17 GMT
This is an automated email from the ASF dual-hosted git repository.

smckinney pushed a commit to branch FC-238
in repository https://gitbox.apache.org/repos/asf/directory-fortress-core.git


The following commit(s) were added to refs/heads/FC-238 by this push:
     new 98429ff  cleanup password policy processing
98429ff is described below

commit 98429ffed8ee3fd2237dcdf4fd5f7ccc1e9f0d49
Author: Shawn McKinney <smckinney@symas.com>
AuthorDate: Thu Jun 24 12:27:10 2021 -0500

    cleanup password policy processing
---
 .../apache/directory/fortress/core/impl/UserDAO.java | 18 ++++--------------
 .../fortress/core/ldap/LdapDataProvider.java         | 20 +-------------------
 2 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
index 53742f1..831b455 100755
--- a/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
+++ b/src/main/java/org/apache/directory/fortress/core/impl/UserDAO.java
@@ -30,11 +30,7 @@ import java.util.TreeMap;
 import org.apache.commons.collections4.CollectionUtils;
 import org.apache.commons.lang.ArrayUtils;
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecService;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
-//import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseFactory;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.CursorException;
 import org.apache.directory.api.ldap.model.cursor.SearchCursor;
@@ -54,7 +50,6 @@ import org.apache.directory.api.ldap.model.exception.LdapNoPermissionException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchAttributeException;
 import org.apache.directory.api.ldap.model.exception.LdapNoSuchObjectException;
 import org.apache.directory.api.ldap.model.message.BindResponse;
-import org.apache.directory.api.ldap.model.message.Control;
 import org.apache.directory.api.ldap.model.message.ResultCodeEnum;
 import org.apache.directory.api.ldap.model.message.SearchScope;
 import org.apache.directory.fortress.core.CfgException;
@@ -76,7 +71,6 @@ import org.apache.directory.ldap.client.api.LdapConnection;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyErrorEnum.*;
 import static org.apache.directory.fortress.core.impl.RoleDAO.IS_RFC2307;
 
 
@@ -840,13 +834,8 @@ final class UserDAO extends LdapDataProvider implements PropUpdater
                 session.setErrorId( GlobalErrIds.USER_PW_INVLD );
             }
 
-            //PasswordPolicy respCtrl = getPwdRespCtrl( bindResponse );
-            PasswordPolicyResponse respCtrl = getPwdRespCtrl( bindResponse );
-            if ( respCtrl != null )
-            {
-                // check IETF password policies here
-                checkPwPolicies( session, respCtrl );
-            }
+            // check IETF password policies here
+            checkPwPolicies( session, bindResponse );
 
             if ( session.getErrorId() == 0 )
             {
@@ -877,11 +866,12 @@ final class UserDAO extends LdapDataProvider implements PropUpdater
     }
 
 
-    private void checkPwPolicies( PwMessage pwMsg, PasswordPolicyResponse respCtrl )
+    private void checkPwPolicies( PwMessage pwMsg, BindResponse bindResponse )
     {
         int rc = 0;
         boolean result = false;
         String msgHdr = "checkPwPolicies for userId [" + pwMsg.getUserId() + "] ";
+        PasswordPolicyResponse respCtrl = getPwdRespCtrl( bindResponse );
         if ( respCtrl != null )
         {
             String errMsg = null;
diff --git a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
index 925417c..58b14db 100644
--- a/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
+++ b/src/main/java/org/apache/directory/fortress/core/ldap/LdapDataProvider.java
@@ -30,26 +30,9 @@ import java.util.Set;
 import java.util.TreeSet;
 
 import org.apache.commons.lang.StringUtils;
-import org.apache.directory.api.ldap.codec.api.LdapApiService;
-import org.apache.directory.api.ldap.codec.api.LdapApiServiceFactory;
-import org.apache.directory.api.ldap.codec.osgi.DefaultLdapCodecService;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
-
-//import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyImpl;
-//import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyDecorator;
-
-
-//import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicy;
-//import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyImpl;
-//import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyDecorator;
-//import org.apache.directory.api.ldap.extras.controls.ppolicy.*;
-//import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequest;
-//import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyRequestImpl;
-
-
 import org.apache.directory.api.ldap.extras.controls.ppolicy.PasswordPolicyResponse;
-import org.apache.directory.api.ldap.extras.controls.ppolicy_impl.PasswordPolicyResponseFactory;
 import org.apache.directory.api.ldap.model.constants.SchemaConstants;
 import org.apache.directory.api.ldap.model.cursor.CursorException;
 import org.apache.directory.api.ldap.model.cursor.SearchCursor;
@@ -1214,8 +1197,7 @@ public abstract class LdapDataProvider
      */
     protected PasswordPolicyResponse getPwdRespCtrl(BindResponse resp )
     {
-        Control control = resp.getControls().get( PasswordPolicyResponse.OID );
-        return ( PasswordPolicyResponse ) control;
+        return ( PasswordPolicyResponse ) resp.getControls().get( PasswordPolicyRequest.OID
);
     }
 
 

Mime
View raw message