mirror of https://github.com/apache/archiva.git
Improving error handling for LDAP configuration
Error is only displayed, if LDAP is used as repository. The error messages are more detailed and internationalized.
This commit is contained in:
parent
229276f8d9
commit
1fd9c951e1
|
@ -132,6 +132,20 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
rbacManagerChanged || ( redbackRuntimeConfiguration.getRbacManagerImpls().toString().hashCode()
|
||||
!= redbackRuntimeConfigurationAdmin.getRedbackRuntimeConfiguration().getRbacManagerImpls().toString().hashCode() );
|
||||
|
||||
boolean ldapConfigured = false;
|
||||
for (String um : redbackRuntimeConfiguration.getUserManagerImpls()) {
|
||||
if (um.contains("ldap")) {
|
||||
ldapConfigured=true;
|
||||
}
|
||||
}
|
||||
if (!ldapConfigured) {
|
||||
for (String rbm : redbackRuntimeConfiguration.getRbacManagerImpls()) {
|
||||
if (rbm.contains("ldap")) {
|
||||
ldapConfigured = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
redbackRuntimeConfigurationAdmin.updateRedbackRuntimeConfiguration( redbackRuntimeConfiguration );
|
||||
|
||||
if ( userManagerChanged )
|
||||
|
@ -149,8 +163,15 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
roleManager.initialize();
|
||||
}
|
||||
|
||||
ldapConnectionFactory.initialize();
|
||||
|
||||
if (ldapConfigured) {
|
||||
try {
|
||||
ldapConnectionFactory.initialize();
|
||||
} catch (Exception e) {
|
||||
ArchivaRestServiceException newEx = new ArchivaRestServiceException(e.getMessage(), e);
|
||||
newEx.setErrorKey("error.ldap.connectionFactory.init.failed");
|
||||
throw newEx;
|
||||
}
|
||||
}
|
||||
Collection<PasswordRule> passwordRules = applicationContext.getBeansOfType( PasswordRule.class ).values();
|
||||
|
||||
for ( PasswordRule passwordRule : passwordRules )
|
||||
|
@ -184,16 +205,27 @@ public class DefaultRedbackRuntimeConfigurationService
|
|||
usersCache.setMaxElementsOnDisk(
|
||||
redbackRuntimeConfiguration.getUsersCacheConfiguration().getMaxElementsOnDisk() );
|
||||
|
||||
ldapUserMapper.initialize();
|
||||
if (ldapConfigured) {
|
||||
try {
|
||||
ldapUserMapper.initialize();
|
||||
} catch (Exception e) {
|
||||
ArchivaRestServiceException newEx = new ArchivaRestServiceException(e.getMessage(), e);
|
||||
newEx.setErrorKey("error.ldap.userMapper.init.failed");
|
||||
throw newEx;
|
||||
}
|
||||
}
|
||||
|
||||
//check repositories roles are here !!!
|
||||
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
catch ( Exception e )
|
||||
catch (ArchivaRestServiceException e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw e;
|
||||
} catch ( Exception e )
|
||||
{
|
||||
log.error( e.getMessage(), e );
|
||||
throw new ArchivaRestServiceException( e.getMessage(), e );
|
||||
throw new ArchivaRestServiceException(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -612,6 +612,7 @@ redback-runtime-configuration.title=Redback Runtime Configuration
|
|||
redback-runtime-configuration.updated=Redback Runtime Configuration updated.
|
||||
archiva.redback.usermanager.ldap=LDAP User Manager
|
||||
archiva.redback.usermanager.jdo=Database User Manager
|
||||
archiva.redback.usermanager.jpa=Database JPA User Manager
|
||||
redback.runtime.properties.help.title=Property Description
|
||||
security.policy.password.rule.alphacount.enabled.help.content=Minimum of letter characters in the password.
|
||||
security.policy.password.rule.reuse.enabled.help.content=Prevent reuse of previous passwords.
|
||||
|
@ -672,6 +673,7 @@ redback.runtime.users.cache.title=Users Cache
|
|||
|
||||
archiva.redback.rbacmanager.ldap=LDAP RBac Manager
|
||||
archiva.redback.rbacmanager.jdo=Database RBac Manager
|
||||
archiva.redback.rbackmanager.jpa=Database JPA RBac Manager
|
||||
archiva.redback.rbacmanager.cached=Cached RBac Manager
|
||||
redback.runtime.rbac-managers.impls.chose=RbacManager(s) chosen
|
||||
redback.runtime.rbac-managers.impls.available=Available RbacManagers
|
||||
|
@ -717,3 +719,6 @@ navigation.next=Next
|
|||
navigation.first=First
|
||||
navigation.last=Last
|
||||
|
||||
# Error messages for LDAP configuration
|
||||
error.ldap.connectionFactory.init.failed=Could not initialize LDAP connection factory. Check your LDAP configuration.
|
||||
error.ldap.userMapper.init.failed=Could not initialize LDAP user mapper. Check your LDAP configuration.
|
||||
|
|
Loading…
Reference in New Issue