Author: olamy
Date: Thu Dec 13 20:02:47 2012
New Revision: 1421463
URL: http://svn.apache.org/viewvc?rev=1421463&view=rev
Log:
add a method to be able to test a LdapConnectionConfiguration
Modified:
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/ConfigurableLdapConnectionFactory.java
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/LdapConnectionFactory.java
Modified:
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/ConfigurableLdapConnectionFactory.java
URL:
http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/ConfigurableLdapConnectionFactory.java?rev=1421463&r1=1421462&r2=1421463&view=diff
==============================================================================
---
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/ConfigurableLdapConnectionFactory.java
(original)
+++
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/ConfigurableLdapConnectionFactory.java
Thu Dec 13 20:02:47 2012
@@ -36,7 +36,7 @@ import java.util.Properties;
/**
* @author <a href="mailto:[email protected]">Trygve Laugstøl</a>
*/
-@Service( "ldapConnectionFactory#configurable" )
+@Service("ldapConnectionFactory#configurable")
public class ConfigurableLdapConnectionFactory
implements LdapConnectionFactory
{
@@ -63,7 +63,7 @@ public class ConfigurableLdapConnectionF
@Inject
- @Named( value = "userConfiguration#default" )
+ @Named(value = "userConfiguration#default")
private UserConfiguration userConf;
// ----------------------------------------------------------------------
@@ -75,14 +75,18 @@ public class ConfigurableLdapConnectionF
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 ConfigurableLdapConnectionF
return new LdapConnection( getLdapConnectionConfiguration(), bindDn,
password );
}
+ public LdapConnection getConnection( LdapConnectionConfiguration
ldapConnectionConfiguration )
+ throws LdapException
+ {
+ return new LdapConnection( ldapConnectionConfiguration, null );
+ }
+
public LdapName getBaseDnLdapName()
throws LdapException
{
Modified:
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/LdapConnectionFactory.java
URL:
http://svn.apache.org/viewvc/archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/LdapConnectionFactory.java?rev=1421463&r1=1421462&r2=1421463&view=diff
==============================================================================
---
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/LdapConnectionFactory.java
(original)
+++
archiva/redback/redback-core/trunk/redback-common/redback-common-ldap/src/main/java/org/apache/archiva/redback/common/ldap/connection/LdapConnectionFactory.java
Thu Dec 13 20:02:47 2012
@@ -33,6 +33,9 @@ public interface LdapConnectionFactory
LdapConnection getConnection()
throws LdapException;
+ LdapConnection getConnection( LdapConnectionConfiguration
ldapConnectionConfiguration )
+ throws LdapException;
+
LdapConnection getConnection( Rdn subRdn )
throws LdapException;