UNPKG

adauth

Version:

Authenticate against an Active Directory domain via LDAP

48 lines (47 loc) 1.54 kB
/// <reference types="node" /> import { EventEmitter } from 'events'; import { ConnectionOptions } from 'tls'; import ldap from 'ldapjs'; declare namespace ADAuth { type Scope = 'base' | 'one' | 'sub'; interface GroupSearchFilterFunction { (user: any): string; } interface Options extends ldap.ClientOptions { domainDN: string; bindDN?: undefined; bindCredentials?: undefined; searchBase?: string; searchFilterByDN?: string; searchFilterByUPN?: string; searchFilterBySAN?: string; searchScope?: Scope; searchAttributes?: string[]; groupSearchBase?: string; groupSearchFilter?: string | GroupSearchFilterFunction; groupSearchScope?: Scope; groupSearchAttributes?: string[]; bindProperty?: string; groupDNProperty?: string; includeRaw?: boolean; cache?: boolean; starttls?: boolean; tlsOptions?: ConnectionOptions; debug?: boolean; } interface SIDSearchOptions extends ldap.SearchOptions { baseDN?: string; } } declare class ADAuth extends EventEmitter { #private; readonly options: ADAuth.Options; readonly clientOptions: ldap.ClientOptions; constructor(init: ADAuth.Options); initialise(): Promise<void>; static create(init: ADAuth.Options): Promise<ADAuth>; authenticate(username: string, password: string): Promise<any>; close(): Promise<void>; dispose(): Promise<void>; } export default ADAuth;