diff --git a/src/ldap.class.php b/src/ldap.class.php index 67babe5eb26008d8c3f053d153183a48fcb3ef87..a4d4de90f463c67e2322f375f2d9a3333bf56299 100755 --- a/src/ldap.class.php +++ b/src/ldap.class.php @@ -4,13 +4,18 @@ * * IML LDAP CONNECTOR * + * @author axel.hahn@unibe.ch + * @license GNU GPL v3 + * + * SOURCE: <https://git-repo.iml.unibe.ch/iml-open-source/ldap-php-class/> + * DOCS: <https://os-docs.iml.unibe.ch/ldap-php-class/index.html> + * * 2022-02-22 ah added objGet(), sanitizeFilter() * 2022-08-18 ah mask password (showing 4 chars only) * 2022-08-22 ah mhash is deprecated * 2022-08-26 ah fix verifyPassword * 2024-07-11 ah php8 only: use variable types; update phpdocs - * - * @author axel.hahn@unibe.ch + * 2024-07-12 ah remove connection port (use server value "ldaps://<host>:<port>" if needed) */ class imlldap { @@ -24,7 +29,6 @@ class imlldap */ private array $_aLdap = [ 'server' => false, - 'port' => false, 'DnLdapUser' => false, // ldap rdn oder dn 'PwLdapUser' => false, 'DnUserNode' => false, // ou=People... @@ -132,17 +136,15 @@ class imlldap // ---------------------------------------------------------------------- /** - * set a ldap config + * set a ldap config or modify existing value * - * @param array $aConfig new config items - * 'server' => 'ldaps://ldap.example.com', - * 'port' => 636, - * 'DnLdapUser' => 'cn=Lookup,ou=ServiceAccounts,dc=org,dc=example.com', // ldap rdn oder dn - * 'PwLdapUser' => 'IkHEFFzlZ...99j0h8WdI0LrLhxU', // password - * 'DnUserNode' => 'ou=People,ou=ORG,dc=org,dc=example.com', - * 'DnAppNode' => '' optional dn ... if a user must be member of a given group - * 'protoVersion' => 3 - * 'debugLevel' => 0 // for debugging set higher 0 AND call debugOn() + * @param array $aConfig new config items with these keys + * 'server' => 'ldaps://ldap.example.com', + * 'DnLdapUser' => 'cn=Lookup,ou=ServiceAccounts,dc=org,dc=example.com', // ldap rdn oder dn + * 'PwLdapUser' => 'PasswordOfLookupUser', // password + * 'DnUserNode' => 'ou=People,ou=ORG,dc=org,dc=example.com', + * 'protoVersion' => 3 + * 'debugLevel' => 0 // value for LDAP_OPT_DEBUG_LEVEL in debugOn() */ public function setConfig(array $aConfig = []): void { @@ -189,7 +191,7 @@ class imlldap $this->close(); } - $this->_w(__FUNCTION__ . ' connect to ' . $this->_aLdap['server'] . ':' . $this->_aLdap['port']); + $this->_w(__FUNCTION__ . ' connect to ' . $this->_aLdap['server']); $this->_ldapConn = ldap_connect($this->_aLdap['server']); if (!$this->_ldapConn) { $this->_wLdaperror(__FUNCTION__);