]> source.dussan.org Git - archiva.git/commitdiff
do not use harcoded userManager impl
authorOlivier Lamy <olamy@apache.org>
Thu, 22 Nov 2012 21:52:50 +0000 (21:52 +0000)
committerOlivier Lamy <olamy@apache.org>
Thu, 22 Nov 2012 21:52:50 +0000 (21:52 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1412680 13f79535-47bb-0310-9956-ffa450edef68

redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java
redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java
redback-users/redback-authentication-users/src/main/java/org/apache/archiva/redback/authentication/users/UserManagerAuthenticator.java

index 4fd536edb3fe41ebdb6e9b0f7bf5f591c46b7bfb..2cd6a50cb139c522b2bf0c8bf88332da37309bad 100644 (file)
@@ -98,7 +98,7 @@ public class LdapBindAuthenticator
             + ( mapper.getUserFilter() != null ? mapper.getUserFilter() : "" ) + "(" + mapper.getUserIdAttribute() + "="
             + source.getPrincipal() + "))";
 
-        log.info( "Searching for users with filter: \'{}\'" + " from base dn: {}", filter, mapper.getUserBaseDn() );
+        log.info( "Searching for users with filter: '{}'" + " from base dn: {}", filter, mapper.getUserBaseDn() );
                                                               
         LdapConnection ldapConnection = getLdapConnection();
         LdapConnection authLdapConnection = null;
@@ -135,7 +135,7 @@ public class LdapBindAuthenticator
                 }
             }
 
-            log.info( "Attempting Authenication: {}", userDn );
+            log.info( "Attempting Authenication: {}", userDn );
 
             authLdapConnection = connectionFactory.getConnection( userDn, source.getPassword() );
 
index 3e9b881c173f3b646077072152a2a9632670fe4d..8780670f2590000aec780be30f3d31e528af1dce 100644 (file)
@@ -71,7 +71,7 @@ public class LockedAdminEnvironmentCheck
      */
     public void validateEnvironment( List<String> violations )
     {
-        if ( !checked && !userManager.isReadOnly() )
+        if ( !checked ) //&& !userManager.isReadOnly() )
         {
             List<String> roles = new ArrayList<String>();
             roles.add( RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE );
index 865b226fe23e3b87cdbea9f7190e1cec7d680ffc..3296f9ff425d7232a96e248905a7a3977ff8427b 100644 (file)
@@ -19,20 +19,20 @@ package org.apache.archiva.redback.authentication.users;
  * under the License.
  */
 
-import org.apache.archiva.redback.authentication.Authenticator;
-import org.apache.archiva.redback.policy.AccountLockedException;
-import org.apache.archiva.redback.policy.PasswordEncoder;
-import org.apache.archiva.redback.policy.UserSecurityPolicy;
-import org.apache.archiva.redback.users.UserManager;
-import org.apache.archiva.redback.users.UserNotFoundException;
 import org.apache.archiva.redback.authentication.AuthenticationConstants;
 import org.apache.archiva.redback.authentication.AuthenticationDataSource;
 import org.apache.archiva.redback.authentication.AuthenticationException;
 import org.apache.archiva.redback.authentication.AuthenticationResult;
+import org.apache.archiva.redback.authentication.Authenticator;
 import org.apache.archiva.redback.authentication.PasswordBasedAuthenticationDataSource;
+import org.apache.archiva.redback.policy.AccountLockedException;
 import org.apache.archiva.redback.policy.MustChangePasswordException;
+import org.apache.archiva.redback.policy.PasswordEncoder;
 import org.apache.archiva.redback.policy.PolicyViolationException;
+import org.apache.archiva.redback.policy.UserSecurityPolicy;
 import org.apache.archiva.redback.users.User;
+import org.apache.archiva.redback.users.UserManager;
+import org.apache.archiva.redback.users.UserNotFoundException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.stereotype.Service;
@@ -46,16 +46,15 @@ import java.util.Map;
  * {@link Authenticator} implementation that uses a wrapped {@link UserManager} to authenticate.
  *
  * @author <a href='mailto:rahul.thakur.xdev@gmail.com'>Rahul Thakur</a>
- *
  */
-@Service( "authenticator#user-manager" )
+@Service ("authenticator#user-manager")
 public class UserManagerAuthenticator
     implements Authenticator
 {
-    private Logger log = LoggerFactory.getLogger( UserManagerAuthenticator.class );
+    private Logger log = LoggerFactory.getLogger( getClass() );
 
     @Inject
-    @Named( value = "userManager#jdo" )
+    @Named (value = "userManager#configurable")
     private UserManager userManager;
 
     @Inject
@@ -148,7 +147,7 @@ public class UserManagerAuthenticator
         }
         catch ( UserNotFoundException e )
         {
-            log.warn( "Login for user " + source.getPrincipal() + " failed. user not found." );
+            log.warn( "Login for user {} failed. user not found.", source.getPrincipal() );
             resultException = e;
             authnResultExceptionsMap.put( AuthenticationConstants.AUTHN_NO_SUCH_USER,
                                           "Login for user \" + source.getPrincipal() + \" failed. user not found." );