This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.
There is no license information available for the latest version (dev-master) of this package.

package to handle ldap actions (no authentication, but read and write)

Installs: 465

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 1

Type:typo3-flow-package

dev-master 2015-11-19 16:54 UTC

This package is auto-updated.

Last update: 2021-10-06 02:43:36 UTC


README

Settings

Parts of the Settings are inherited from TYPO3.LDAP, all the other stuff has to be configured via Settings.yaml.

KayStrobach:
  Ldap:
    host:
    port:
    admin:
      dn:
      password:

Usage

If you use TYPO3.Flow you can use the dependency injection, as the factory takes care of initializing the connection.

    /**
     * @var \KayStrobach\Ldap\Service\LdapInterface
     * @Flow\Inject
     */
    protected $ldapConnection;

To change a LDAP Passwort, which can really be a hard with pure PHP you can use the following code example:

    $account = $this->ldapConnection->search('dc=example,dc=com', '(uid=' . $this->username . ')');
    if($account->count() === 1) {
        $account->next();
        $this->ldapConnection->bindAsAdmin();
        $account->current()->modify(
            array('userpassword' => KayStrobach\Ldap\Service\Ldap\PasswordUtility::getPasswordArray($newPassword)
            )
        );
        $this->ldapConnection->unbind();
        $this->userSession->setPassword($newPassword);
    } 
    // else ... show some error messages 

The Password Utility will then generate all typically needed Password hashes for you (SHA, SSHA, MD4 / NTLM, MD5, SHA256, SHA512)

Searching in LDAP

Simply use $this->ldapConnection->search the method signature is similar to the one from php directly, the difference is, that all is done object oriented, so that you can ommit the connection and the result resources.