You are here

public static function LdapAuthenticationConfiguration::getEnabledAuthenticationServers in Lightweight Directory Access Protocol (LDAP) 8.3

Return list of enabled authentication servers.

Return value

\Drupal\ldap_servers\ServerFactory[] The list of available servers.

3 calls to LdapAuthenticationConfiguration::getEnabledAuthenticationServers()
LdapAuthenticationConfiguration::hasEnabledAuthenticationServers in ldap_authentication/src/Helper/LdapAuthenticationConfiguration.php
Are authentication servers available?
LoginValidator::testCredentials in ldap_authentication/src/Controller/LoginValidator.php
Credentials are tested.
LoginValidator::testSsoCredentials in ldap_authentication/src/Controller/LoginValidator.php
Test the SSO credentials.

File

ldap_authentication/src/Helper/LdapAuthenticationConfiguration.php, line 64

Class

LdapAuthenticationConfiguration
Configuration helper class for LDAP authentication.

Namespace

Drupal\ldap_authentication\Helper

Code

public static function getEnabledAuthenticationServers() {
  $servers = \Drupal::config('ldap_authentication.settings')
    ->get('sids');

  /** @var \Drupal\ldap_servers\ServerFactory $factory */
  $factory = \Drupal::service('ldap.servers');
  $result = [];
  foreach ($servers as $server) {
    if ($factory
      ->getServerByIdEnabled($server)) {
      $result[] = $server;
    }
  }
  return $result;
}