public Collection<? extends LDAPConfiguration> getLDAPConfigurations() throws GuacamoleException {

        // Read/refresh configuration from YAML, if available
        File ldapServers = new File(environment.getGuacamoleHome(), LDAP_SERVERS_YML);
        if (ldapServers.exists()) {

            long oldLastModified = lastModified.get();
            long currentLastModified = ldapServers.lastModified();

            // Update cached copy of YAML if things have changed, ensuring only
            // one concurrent request updates the cache at any given time
            if (currentLastModified > oldLastModified && lastModified.compareAndSet(oldLastModified, currentLastModified)) {
                try {

                    logger.debug("Reading updated LDAP configuration from \"{}\"...", ldapServers);
                    Collection<JacksonLDAPConfiguration> configs = mapper.readValue(ldapServers, new TypeReference<Collection<JacksonLDAPConfiguration>>() {});

                    if (configs != null) {
                        logger.debug("Reading LDAP configuration defaults from guacamole.properties...");
                        LDAPConfiguration defaultConfig = new EnvironmentLDAPConfiguration(environment);
                        configs.forEach((config) -> config.setDefaults(defaultConfig));
                    }
                    else
                        logger.debug("Using only guacamole.properties for "
                                + "LDAP server definitions as \"{}\" is "
                                + "empty.", ldapServers);

                    cachedConfigurations = configs;

                }
                catch (IOException e) {
                    logger.error("\"{}\" could not be read/parsed: {}", ldapServers, e.getMessage());
                }
            }
            else
                logger.debug("Using cached LDAP configuration from \"{}\".", ldapServers);

        }

        // Clear cached YAML if it no longer exists
        else if (cachedConfigurations != null) {
            long oldLastModified = lastModified.get();
            if (lastModified.compareAndSet(oldLastModified, 0)) {
                logger.debug("Clearing cached LDAP configuration from \"{}\" (file no longer exists).", ldapServers);
                cachedConfigurations = null;
            }
        }

        // Use guacamole.properties if not using YAML
        if (cachedConfigurations == null) {
            logger.debug("Reading LDAP configuration from guacamole.properties...");
            return Collections.singletonList(new EnvironmentLDAPConfiguration(environment));
        }

        return cachedConfigurations;

    }
Returns the configuration information for all configured LDAP servers.
If multiple servers are returned, each should be tried in order until a
successful LDAP connection is established.

@return
    The configurations of all LDAP servers.

@throws GuacamoleException
    If the configuration information of the LDAP servers cannot be
    retrieved due to an error.
extensions/guacamole-auth-ldap/src/main/java/org/apache/guacamole/auth/ldap/conf/ConfigurationService.java