class AuthenticationServers in Lightweight Directory Access Protocol (LDAP) 8.4
Authentication serves.
Hierarchy
- class \Drupal\ldap_authentication\AuthenticationServers
Expanded class hierarchy of AuthenticationServers
1 file declares its use of AuthenticationServers
- LoginValidatorBase.php in ldap_authentication/
src/ Controller/ LoginValidatorBase.php
1 string reference to 'AuthenticationServers'
- ldap_authentication.services.yml in ldap_authentication/
ldap_authentication.services.yml - ldap_authentication/ldap_authentication.services.yml
1 service uses AuthenticationServers
File
- ldap_authentication/
src/ AuthenticationServers.php, line 13
Namespace
Drupal\ldap_authenticationView source
class AuthenticationServers {
/**
* Entity Storage.
*
* @var \Drupal\Core\Entity\EntityStorageInterface
*/
protected $storage;
/**
* Config.
*
* @var \Drupal\Core\Config\ImmutableConfig
*/
protected $config;
/**
* Constructs a new AuthenticationServers object.
*
* @param \Drupal\Core\Entity\EntityTypeManagerInterface $entity_type_manager
* Entity type manager.
* @param \Drupal\Core\Config\ConfigFactoryInterface $config_factory
* Config factory.
*/
public function __construct(EntityTypeManagerInterface $entity_type_manager, ConfigFactoryInterface $config_factory) {
$this->storage = $entity_type_manager
->getStorage('ldap_server');
$this->config = $config_factory
->get('ldap_authentication.settings');
}
/**
* Authentication servers available.
*
* @return bool
* Available.
*/
public function authenticationServersAvailable() : bool {
if (empty($this
->getAvailableAuthenticationServers())) {
return FALSE;
}
return TRUE;
}
/**
* Get available authentication servers.
*
* @return array
* Server IDs.
*/
public function getAvailableAuthenticationServers() : array {
/** @var array $available_servers */
$available_servers = $this->storage
->getQuery()
->condition('status', 1)
->execute();
$result = [];
foreach ($this->config
->get('sids') as $configured_server) {
if (isset($available_servers[$configured_server])) {
$result[] = $configured_server;
}
}
return $result;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AuthenticationServers:: |
protected | property | Config. | |
AuthenticationServers:: |
protected | property | Entity Storage. | |
AuthenticationServers:: |
public | function | Authentication servers available. | |
AuthenticationServers:: |
public | function | Get available authentication servers. | |
AuthenticationServers:: |
public | function | Constructs a new AuthenticationServers object. |