ensure we use ssl and ldaps is deprecated

git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1477967 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2013-05-01 12:15:54 +00:00
parent 99c3321358
commit 29ab886c64
1 changed files with 7 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
import javax.naming.Context; import javax.naming.Context;
import javax.naming.NamingException; import javax.naming.NamingException;
import javax.naming.directory.DirContext; import javax.naming.directory.DirContext;
import javax.naming.directory.InitialDirContext;
import javax.naming.ldap.LdapName; import javax.naming.ldap.LdapName;
import javax.naming.ldap.Rdn; import javax.naming.ldap.Rdn;
import java.util.Collections; import java.util.Collections;
@ -153,7 +154,7 @@ public class LdapConnection
if ( config.getHostname() != null ) if ( config.getHostname() != null )
{ {
String protocol = config.isSsl() ? "ldaps" : "ldap"; String protocol = "ldap";// config.isSsl() ? "ldaps" : "ldap";
if ( config.getPort() != 0 ) if ( config.getPort() != 0 )
{ {
env.put( Context.PROVIDER_URL, protocol + "://" + config.getHostname() + ":" + config.getPort() + "/" ); env.put( Context.PROVIDER_URL, protocol + "://" + config.getHostname() + ":" + config.getPort() + "/" );
@ -164,6 +165,11 @@ public class LdapConnection
} }
} }
if ( config.isSsl() )
{
env.put( Context.SECURITY_PROTOCOL, "ssl" );
}
if ( config.getAuthenticationMethod() != null ) if ( config.getAuthenticationMethod() != null )
{ {
env.put( Context.SECURITY_AUTHENTICATION, config.getAuthenticationMethod() ); env.put( Context.SECURITY_AUTHENTICATION, config.getAuthenticationMethod() );