Skip to content
Snippets Groups Projects
Commit 78972e03 authored by Hendrik Grahl's avatar Hendrik Grahl
Browse files

Fixes validation for incorrect binding check

parent 787497a5
Branches
Tags 8.x-1.0-beta3
No related merge requests found
......@@ -115,18 +115,18 @@ class LdapSsoAdminForm extends ConfigFormBase {
$factory = \Drupal::service('ldap.servers');
$enabled_servers = $factory->getEnabledServers();
foreach ($form_state->get('sid') as $sid => $discard) {
if ($enabled_servers[$sid]->get('bind_method') == 'user' || $enabled_servers[$sid]->get('bind_method') == 'anon_user') {
/* @var \Drupal\ldap_servers\Entity\Server $server */
foreach ($enabled_servers as $server) {
if ($server->get('bind_method') == 'user' || $server->get('bind_method') == 'anon_user') {
$methods = [
'user' => $this->t('Bind with Users Credentials'),
'anon_user' => $this->t('Anonymous Bind for search, then Bind with Users Credentials'),
];
$form_state->setErrorByName('ssoEnabled', $this->t(
'Single sign-on is not valid with the server !edit (id=%sid) because that server configuration uses %bind_method. Since the user\'s credentials are never available to this module with single sign-on enabled, there is no way for the ldap module to bind to the ldap server with credentials.',
$form_state->setErrorByName('ssoEnabled', $this->t('Single sign-on is not valid with the server %sid because that server configuration uses %bind_method. Since the user\'s credentials are never available to this module with single sign-on enabled, there is no way for the ldap module to bind to the ldap server with credentials.',
[
'%sid' => $sid,
'%bind_method' => $methods[$enabled_servers[$sid]->get('bind_method')],
'%sid' => $server->id(),
'%bind_method' => $server->getFormattedBind(),
]
));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment