From: Olivier Lamy Date: Thu, 22 Nov 2012 21:52:50 +0000 (+0000) Subject: do not use harcoded userManager impl X-Git-Tag: redback-2.1~264 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5825a992f90e3f0b0626f025d611cc0c37417fc2;p=archiva.git do not use harcoded userManager impl git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1412680 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java b/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java index 4fd536edb..2cd6a50cb 100644 --- a/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java +++ b/redback-authentication/redback-authentication-providers/redback-authentication-ldap/src/main/java/org/apache/archiva/redback/authentication/ldap/LdapBindAuthenticator.java @@ -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() ); diff --git a/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java b/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java index 3e9b881c1..8780670f2 100644 --- a/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java +++ b/redback-integrations/redback-common-integrations/src/main/java/org/apache/archiva/redback/integration/checks/security/LockedAdminEnvironmentCheck.java @@ -71,7 +71,7 @@ public class LockedAdminEnvironmentCheck */ public void validateEnvironment( List violations ) { - if ( !checked && !userManager.isReadOnly() ) + if ( !checked ) //&& !userManager.isReadOnly() ) { List roles = new ArrayList(); roles.add( RedbackRoleConstants.SYSTEM_ADMINISTRATOR_ROLE ); diff --git a/redback-users/redback-authentication-users/src/main/java/org/apache/archiva/redback/authentication/users/UserManagerAuthenticator.java b/redback-users/redback-authentication-users/src/main/java/org/apache/archiva/redback/authentication/users/UserManagerAuthenticator.java index 865b226fe..3296f9ff4 100644 --- a/redback-users/redback-authentication-users/src/main/java/org/apache/archiva/redback/authentication/users/UserManagerAuthenticator.java +++ b/redback-users/redback-authentication-users/src/main/java/org/apache/archiva/redback/authentication/users/UserManagerAuthenticator.java @@ -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 Rahul Thakur - * */ -@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." );