add a method to be able to test a LdapConnectionConfiguration
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1421463 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
626a747eac
commit
ea77187178
|
@ -36,7 +36,7 @@ import java.util.Properties;
|
|||
/**
|
||||
* @author <a href="mailto:trygvis@inamo.no">Trygve Laugstøl</a>
|
||||
*/
|
||||
@Service( "ldapConnectionFactory#configurable" )
|
||||
@Service("ldapConnectionFactory#configurable")
|
||||
public class ConfigurableLdapConnectionFactory
|
||||
implements LdapConnectionFactory
|
||||
{
|
||||
|
@ -63,7 +63,7 @@ public class ConfigurableLdapConnectionFactory
|
|||
|
||||
|
||||
@Inject
|
||||
@Named( value = "userConfiguration#default" )
|
||||
@Named(value = "userConfiguration#default")
|
||||
private UserConfiguration userConf;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
@ -75,14 +75,18 @@ public class ConfigurableLdapConnectionFactory
|
|||
try
|
||||
{
|
||||
ldapConnectionConfiguration = new LdapConnectionConfiguration();
|
||||
ldapConnectionConfiguration.setHostname( userConf.getString( UserConfigurationKeys.LDAP_HOSTNAME, hostname ) );
|
||||
ldapConnectionConfiguration.setHostname(
|
||||
userConf.getString( UserConfigurationKeys.LDAP_HOSTNAME, hostname ) );
|
||||
ldapConnectionConfiguration.setPort( userConf.getInt( UserConfigurationKeys.LDAP_PORT, port ) );
|
||||
ldapConnectionConfiguration.setSsl( userConf.getBoolean( UserConfigurationKeys.LDAP_SSL, ssl ) );
|
||||
ldapConnectionConfiguration.setBaseDn( userConf.getConcatenatedList( UserConfigurationKeys.LDAP_BASEDN, baseDn ) );
|
||||
ldapConnectionConfiguration.setBaseDn(
|
||||
userConf.getConcatenatedList( UserConfigurationKeys.LDAP_BASEDN, baseDn ) );
|
||||
ldapConnectionConfiguration.setContextFactory(
|
||||
userConf.getString( UserConfigurationKeys.LDAP_CONTEX_FACTORY, contextFactory ) );
|
||||
ldapConnectionConfiguration.setBindDn( userConf.getConcatenatedList( UserConfigurationKeys.LDAP_BINDDN, bindDn ) );
|
||||
ldapConnectionConfiguration.setPassword( userConf.getString( UserConfigurationKeys.LDAP_PASSWORD, password ) );
|
||||
ldapConnectionConfiguration.setBindDn(
|
||||
userConf.getConcatenatedList( UserConfigurationKeys.LDAP_BINDDN, bindDn ) );
|
||||
ldapConnectionConfiguration.setPassword(
|
||||
userConf.getString( UserConfigurationKeys.LDAP_PASSWORD, password ) );
|
||||
ldapConnectionConfiguration.setAuthenticationMethod(
|
||||
userConf.getString( UserConfigurationKeys.LDAP_AUTHENTICATION_METHOD, authenticationMethod ) );
|
||||
ldapConnectionConfiguration.setExtraProperties( extraProperties );
|
||||
|
@ -115,6 +119,12 @@ public class ConfigurableLdapConnectionFactory
|
|||
return new LdapConnection( getLdapConnectionConfiguration(), bindDn, password );
|
||||
}
|
||||
|
||||
public LdapConnection getConnection( LdapConnectionConfiguration ldapConnectionConfiguration )
|
||||
throws LdapException
|
||||
{
|
||||
return new LdapConnection( ldapConnectionConfiguration, null );
|
||||
}
|
||||
|
||||
public LdapName getBaseDnLdapName()
|
||||
throws LdapException
|
||||
{
|
||||
|
|
|
@ -33,6 +33,9 @@ public interface LdapConnectionFactory
|
|||
LdapConnection getConnection()
|
||||
throws LdapException;
|
||||
|
||||
LdapConnection getConnection( LdapConnectionConfiguration ldapConnectionConfiguration )
|
||||
throws LdapException;
|
||||
|
||||
LdapConnection getConnection( Rdn subRdn )
|
||||
throws LdapException;
|
||||
|
||||
|
|
Loading…
Reference in New Issue