Skip to content

Commit 261e5b1

Browse files
committed
ldap: use ldaps:// scheme when adding LDAP config if SSL is enabled
addConfigurationInternal always built the connectivity-test provider URL with the plain ldap:// scheme, even when domain/global SSL (truststore) settings are configured, unlike LdapConfiguration.getProviderUrl() used elsewhere which already selects ldaps:// based on SSL status.
1 parent dfaae63 commit 261e5b1

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

‎plugins/user-authenticators/ldap/src/main/java/org/apache/cloudstack/ldap/LdapManagerImpl.java‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,8 @@ private LdapConfigurationResponse addConfigurationInternal(final String hostname
180180
if (configuration == null) {
181181
LdapContext context = null;
182182
try {
183-
final String providerUrl = "ldap://" + hostname + ":" + port;
183+
final String protocol = LdapConfiguration.getSSLStatus(domainId) ? "ldaps://" : "ldap://";
184+
final String providerUrl = protocol + hostname + ":" + port;
184185
context = _ldapContextFactory.createBindContext(providerUrl,domainId);
185186
configuration = new LdapConfigurationVO(hostname, port, domainId);
186187
_ldapConfigurationDao.persist(configuration);

0 commit comments

Comments
 (0)