ldap/src/main/java/org/springframework/security/ldap/DefaultSpringSecurityContextSource.java
private static String buildProviderUrl(List<String> urls, String baseDn) {
		Assert.notNull(baseDn, "The Base DN for the LDAP server must not be null.");
		Assert.notEmpty(urls, "At least one LDAP server URL must be provided.");

		String trimmedBaseDn = baseDn.trim();
		StringBuilder providerUrl = new StringBuilder();

		for (String serverUrl : urls) {
			String trimmedUrl = serverUrl.trim();
			if ("".equals(trimmedUrl)) {
				continue;
			}

			providerUrl.append(trimmedUrl);
			if (!trimmedUrl.endsWith("/")) {
				providerUrl.append("/");
			}
			providerUrl.append(trimmedBaseDn);
			providerUrl.append(" ");
		}

		return providerUrl.toString();

	}
private static String buildProviderUrl(List<String> urls, String baseDn) {
		Assert.notNull(baseDn, "The Base DN for the LDAP server must not be null.");
		Assert.notEmpty(urls, "At least one LDAP server URL must be provided.");

		String trimmedBaseDn = baseDn.trim();
		StringBuilder providerUrl = new StringBuilder();

		for (String serverUrl : urls) {
			String trimmedUrl = serverUrl.trim();
			if ("".equals(trimmedUrl)) {
				continue;
			}

			providerUrl.append(trimmedUrl);
			if (!trimmedUrl.endsWith("/")) {
				providerUrl.append("/");
			}
			providerUrl.append(trimmedBaseDn);
			providerUrl.append(" ");
		}

		return providerUrl.toString();

	}
Builds a Spring LDAP-compliant Provider URL string, i.e. a space-separated list of
LDAP servers with their base DNs. As the base DN must be identical for all servers,
it needs to be supplied only once.

@param urls A list of string values which are LDAP server URLs. An example would be

<pre>
ldap://ldap.company.com:389
</pre>

. LDAPS URLs may be used as well, given that Spring Security is able to connect to
the server.
@param baseDn The common Base DN for all provided servers, e.g.

<pre>
dc=company,dc=com
</pre>

.
@return A Spring Security/Spring LDAP-compliant Provider URL string.