You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by el...@apache.org on 2013/05/06 15:12:55 UTC
svn commit: r1479559 - in
/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn:
AuthenticationInterceptor.java SimpleAuthenticator.java
Author: elecharny
Date: Mon May 6 13:12:54 2013
New Revision: 1479559
URL: http://svn.apache.org/r1479559
Log:
o Get the pwdAttribute from the passwordPolicy configuration
Modified:
directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/AuthenticationInterceptor.java
directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.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=1479559&r1=1479558&r2=1479559&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 Mon May 6 13:12:54 2013
@@ -338,11 +338,21 @@ public class AuthenticationInterceptor e
checkPwdReset( addContext );
- if ( entry.get( SchemaConstants.USER_PASSWORD_AT ) != null )
+ // Get the password depending on the configuration
+ String passwordAttribute = SchemaConstants.USER_PASSWORD_AT;
+
+ if ( isPPolicyReqCtrlPresent )
+ {
+ passwordAttribute = policyConfig.getPwdAttribute();
+ }
+
+ Attribute userPasswordAttribute = entry.get( passwordAttribute );
+
+ if ( userPasswordAttribute != null )
{
String username = null;
- BinaryValue userPassword = ( BinaryValue ) entry.get( SchemaConstants.USER_PASSWORD_AT ).get();
+ BinaryValue userPassword = ( BinaryValue ) userPasswordAttribute.get();
try
{
Modified: directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java?rev=1479559&r1=1479558&r2=1479559&view=diff
==============================================================================
--- directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java (original)
+++ directory/apacheds/trunk/interceptors/authn/src/main/java/org/apache/directory/server/core/authn/SimpleAuthenticator.java Mon May 6 13:12:54 2013
@@ -43,7 +43,10 @@ import org.apache.directory.api.util.Bas
import org.apache.directory.api.util.StringConstants;
import org.apache.directory.api.util.Strings;
import org.apache.directory.api.util.UnixCrypt;
+import org.apache.directory.server.core.api.DirectoryService;
+import org.apache.directory.server.core.api.InterceptorEnum;
import org.apache.directory.server.core.api.LdapPrincipal;
+import org.apache.directory.server.core.api.authn.ppolicy.PasswordPolicyConfiguration;
import org.apache.directory.server.core.api.entry.ClonedServerEntry;
import org.apache.directory.server.core.api.interceptor.context.BindOperationContext;
import org.apache.directory.server.core.api.interceptor.context.LookupOperationContext;
@@ -261,9 +264,22 @@ public class SimpleAuthenticator extends
checkPwdPolicy( userEntry );
+ DirectoryService directoryService = getDirectoryService();
+ String userPasswordAttribute = SchemaConstants.USER_PASSWORD_AT;
+
+ if ( directoryService.isPwdPolicyEnabled() )
+ {
+ AuthenticationInterceptor authenticationInterceptor = ( AuthenticationInterceptor ) directoryService
+ .getInterceptor(
+ InterceptorEnum.AUTHENTICATION_INTERCEPTOR.getName() );
+ PasswordPolicyConfiguration pPolicyConfig = authenticationInterceptor.getPwdPolicy( userEntry );
+ userPasswordAttribute = pPolicyConfig.getPwdAttribute();
+
+ }
+
Value<?> userPassword;
- Attribute userPasswordAttr = userEntry.get( SchemaConstants.USER_PASSWORD_AT );
+ Attribute userPasswordAttr = userEntry.get( userPasswordAttribute );
bindContext.setEntry( new ClonedServerEntry( userEntry ) );