mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-09-26 03:09:10 +02:00
Add `base_dn' directive to LDAP backend config
This commit is contained in:
parent
1cbe2451a8
commit
04e83a53c5
@ -70,6 +70,15 @@ class LdapBackendForm extends Form
|
|||||||
: array()
|
: array()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
$this->addElement(
|
||||||
|
'text',
|
||||||
|
'base_dn',
|
||||||
|
array(
|
||||||
|
'required' => true,
|
||||||
|
'label' => t('Bind DN'),
|
||||||
|
'description' => t('The path where users can be found on the ldap server')
|
||||||
|
)
|
||||||
|
);
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'text',
|
'text',
|
||||||
'user_class',
|
'user_class',
|
||||||
@ -127,7 +136,8 @@ class LdapBackendForm extends Form
|
|||||||
$ldapUserBackend = new LdapUserBackend(
|
$ldapUserBackend = new LdapUserBackend(
|
||||||
ResourceFactory::createResource($form->getResourceConfig()),
|
ResourceFactory::createResource($form->getResourceConfig()),
|
||||||
$form->getElement('user_class')->getValue(),
|
$form->getElement('user_class')->getValue(),
|
||||||
$form->getElement('user_name_attribute')->getValue()
|
$form->getElement('user_name_attribute')->getValue(),
|
||||||
|
$form->getElement('base_dn')->getValue()
|
||||||
);
|
);
|
||||||
$ldapUserBackend->assertAuthenticationPossible();
|
$ldapUserBackend->assertAuthenticationPossible();
|
||||||
} catch (AuthenticationException $e) {
|
} catch (AuthenticationException $e) {
|
||||||
|
@ -244,7 +244,8 @@ class AdminAccountPage extends Form
|
|||||||
$backend = new LdapUserBackend(
|
$backend = new LdapUserBackend(
|
||||||
ResourceFactory::createResource(new Zend_Config($this->resourceConfig)),
|
ResourceFactory::createResource(new Zend_Config($this->resourceConfig)),
|
||||||
$this->backendConfig['user_class'],
|
$this->backendConfig['user_class'],
|
||||||
$this->backendConfig['user_name_attribute']
|
$this->backendConfig['user_name_attribute'],
|
||||||
|
$this->backendConfig['base_dn']
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw new LogicException(
|
throw new LogicException(
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
namespace Icinga\Authentication\Backend;
|
namespace Icinga\Authentication\Backend;
|
||||||
|
|
||||||
use Icinga\Logger\Logger;
|
|
||||||
use Icinga\User;
|
use Icinga\User;
|
||||||
use Icinga\Authentication\UserBackend;
|
use Icinga\Authentication\UserBackend;
|
||||||
use Icinga\Protocol\Ldap\Connection;
|
use Icinga\Protocol\Ldap\Connection;
|
||||||
@ -20,15 +19,18 @@ class LdapUserBackend extends UserBackend
|
|||||||
**/
|
**/
|
||||||
protected $conn;
|
protected $conn;
|
||||||
|
|
||||||
|
protected $baseDn;
|
||||||
|
|
||||||
protected $userClass;
|
protected $userClass;
|
||||||
|
|
||||||
protected $userNameAttribute;
|
protected $userNameAttribute;
|
||||||
|
|
||||||
protected $groupOptions;
|
protected $groupOptions;
|
||||||
|
|
||||||
public function __construct(Connection $conn, $userClass, $userNameAttribute, $groupOptions = null)
|
public function __construct(Connection $conn, $userClass, $userNameAttribute, $baseDn, $groupOptions = null)
|
||||||
{
|
{
|
||||||
$this->conn = $conn;
|
$this->conn = $conn;
|
||||||
|
$this->baseDn = $baseDn;
|
||||||
$this->userClass = $userClass;
|
$this->userClass = $userClass;
|
||||||
$this->userNameAttribute = $userNameAttribute;
|
$this->userNameAttribute = $userNameAttribute;
|
||||||
$this->groupOptions = $groupOptions;
|
$this->groupOptions = $groupOptions;
|
||||||
@ -74,7 +76,7 @@ class LdapUserBackend extends UserBackend
|
|||||||
throw new AuthenticationException(
|
throw new AuthenticationException(
|
||||||
'No objects with objectClass="%s" in DN="%s" found.',
|
'No objects with objectClass="%s" in DN="%s" found.',
|
||||||
$this->userClass,
|
$this->userClass,
|
||||||
$this->conn->getDN()
|
$this->baseDn
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,6 +103,7 @@ abstract class UserBackend implements Countable
|
|||||||
$resource,
|
$resource,
|
||||||
$backendConfig->get('user_class', 'user'),
|
$backendConfig->get('user_class', 'user'),
|
||||||
$backendConfig->get('user_name_attribute', 'sAMAccountName'),
|
$backendConfig->get('user_name_attribute', 'sAMAccountName'),
|
||||||
|
$backendConfig->get('base_dn', $resource->getDN()),
|
||||||
$groupOptions
|
$groupOptions
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
@ -129,6 +130,7 @@ abstract class UserBackend implements Countable
|
|||||||
$resource,
|
$resource,
|
||||||
$backendConfig->user_class,
|
$backendConfig->user_class,
|
||||||
$backendConfig->user_name_attribute,
|
$backendConfig->user_name_attribute,
|
||||||
|
$backendConfig->get('base_dn', $resource->getDN()),
|
||||||
$groupOptions
|
$groupOptions
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user