Skip to content

Commit

Permalink
Add missing ldap fields
Browse files Browse the repository at this point in the history
refs #3761
  • Loading branch information
Johannes Meyer committed Oct 11, 2013
1 parent 189cc50 commit 20221a0
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 20 deletions.
43 changes: 32 additions & 11 deletions installer/forms/AuthConfigForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,16 @@ public function create()
'allowEmpty' => false
)
);
$this->addElement(
'text',
'auth_ldap_port',
array(
'label' => 'Port',
'helptext' => 'Leave blank to use the default.',
'allowEmpty' => true,
'validators' => array('int')
)
);
$this->addElement(
'text',
'auth_ldap_root_dn',
Expand Down Expand Up @@ -159,11 +169,18 @@ public function create()
);
$this->addElement(
'text',
'auth_ldap_user_name_attributes',
'auth_ldap_user_name_attribute',
array(
'label' => 'user_name_attributes',
'required' => true,
'allowEmpty' => false
'label' => 'user_name_attribute',
'allowEmpty' => true
)
);
$this->addElement(
'text',
'auth_ldap_user_password_attribute',
array(
'label' => 'user_password_attribute',
'allowEmpty' => true
)
);
}
Expand All @@ -190,12 +207,14 @@ public function isValid($data)
$message = $this->checkLdapAuthentication(
new Zend_Config(
array(
'hostname' => $data['auth_ldap_hostname'],
'root_dn' => $data['auth_ldap_root_dn'],
'bind_dn' => $data['auth_ldap_bind_dn'],
'bind_pw' => $data['auth_ldap_bind_pw'],
'user_class' => $data['auth_ldap_user_class'],
'user_name_attribute' => $data['auth_ldap_user_name_attributes']
'hostname' => $data['auth_ldap_hostname'],
'port' => $data['auth_ldap_port'],
'root_dn' => $data['auth_ldap_root_dn'],
'bind_dn' => $data['auth_ldap_bind_dn'],
'bind_pw' => $data['auth_ldap_bind_pw'],
'user_class' => $data['auth_ldap_user_class'],
'user_name_attribute' => $data['auth_ldap_user_name_attribute'],
'user_password_attribute' => $data['auth_ldap_user_password_attribute']
)
)
);
Expand All @@ -222,11 +241,13 @@ public function getDetails()
'auth_preference_store' => $this->getValue('auth_preference_store'),
'auth_use_ldap' => $this->getValue('auth_use_ldap'),
'auth_ldap_hostname' => $this->getValue('auth_ldap_hostname'),
'auth_ldap_port' => $this->getValue('auth_ldap_port'),
'auth_ldap_root_dn' => $this->getValue('auth_ldap_root_dn'),
'auth_ldap_bind_dn' => $this->getValue('auth_ldap_bind_dn'),
'auth_ldap_bind_pw' => $this->getValue('auth_ldap_bind_pw'),
'auth_ldap_user_class' => $this->getValue('auth_ldap_user_class'),
'auth_ldap_user_name_attributes' => $this->getValue('auth_ldap_user_name_attributes')
'auth_ldap_user_name_attribute' => $this->getValue('auth_ldap_user_name_attribute'),
'auth_ldap_user_password_attribute' => $this->getValue('auth_ldap_user_password_attribute')
);
}
}
5 changes: 4 additions & 1 deletion installer/forms/ConfirmationForm.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,14 @@ public function create()
'<br />',
array(
'Hostname: ' . $session->authenticationDetails['auth_ldap_hostname'],
'Port: ' . (empty($session->authenticationDetails['auth_ldap_port']) ? 'Default port' :
$session->authenticationDetails['auth_ldap_port']),
'root_dn: ' . $session->authenticationDetails['auth_ldap_root_dn'],
'bind_dn: ' . $session->authenticationDetails['auth_ldap_bind_dn'],
'bind_pw: ' . $session->authenticationDetails['auth_ldap_bind_pw'],
'user_class: ' . $session->authenticationDetails['auth_ldap_user_class'],
'user_name_attributes: ' . $session->authenticationDetails['auth_ldap_user_name_attributes']
'user_name_attributes: ' . $session->authenticationDetails['auth_ldap_user_name_attribute'],
'user_password_attribute: ' . $session->authenticationDetails['auth_ldap_user_password_attribute']
)
)
);
Expand Down
18 changes: 10 additions & 8 deletions library/Icinga/Application/Installer.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,16 @@ private function setupAuthentication()

if ($authConfig->auth_use_ldap) {
$iniContent['ldap_authentication'] = array(
'hostname' => $authConfig->auth_ldap_hostname,
'root_dn' => $authConfig->auth_ldap_root_dn,
'bind_dn' => $authConfig->auth_ldap_bind_dn,
'bind_pw' => $authConfig->auth_ldap_bind_pw,
'user_class' => $authConfig->auth_ldap_user_class,
'user_name_attribute' => $authConfig->auth_ldap_user_name_attributes,
'target' => 'user',
'backend' => 'ldap'
'hostname' => $authConfig->auth_ldap_hostname,
'port' => $authConfig->auth_ldap_port,
'root_dn' => $authConfig->auth_ldap_root_dn,
'bind_dn' => $authConfig->auth_ldap_bind_dn,
'bind_pw' => $authConfig->auth_ldap_bind_pw,
'user_class' => $authConfig->auth_ldap_user_class,
'user_name_attribute' => $authConfig->auth_ldap_user_name_attribute,
'user_password_attribute' => $authConfig->auth_ldap_user_password_attribute,
'target' => 'user',
'backend' => 'ldap'
);
$this->log('Authentication configuration', 'Added LDAP authentication backend: ldap_authentication');
}
Expand Down

0 comments on commit 20221a0

Please sign in to comment.