edgeport - v1.0.3
    Preparing search index...

    Function authenticate

    • Authenticates a user by the bind-search-bind pattern.

      Connects and binds as the service account (LdapConnectOptions.bindDN / AuthenticateOptions.bindPassword), or anonymously when no bindDN is given; searches under base for the entry matching userFilter (capped at one result); then re-binds as that entry's DN with the user's AuthenticateOptions.password. The session is always closed before returning.

      Parameters

      Returns Promise<LdapEntry | null>

      The matched entry on a successful password bind, or null when no entry matches or the password is wrong.

      If the connection or TLS upgrade fails.

      If the service-account bind is rejected (a wrong user password returns null instead).

      If the server misbehaves during search or bind.

      1.0.2

      const entry = await authenticate({
      hostname: 'ldap.example.org',
      bindDN: 'cn=admin,dc=example,dc=org',
      bindPassword: 'service-secret',
      base: 'ou=people,dc=example,dc=org',
      userFilter: eq('uid', 'jdoe'),
      password: 'the-user-password'
      });
      if (entry) {
      // authenticated; entry.dn is the bound user
      }