import ldap from 'ldapjs'; /** * ActiveDirectory LDAP Options * @typedef {Object} ActiveDirectoryOptions - LDAP Options */ interface ActiveDirectoryOptions { url: string; tlsOptions: Object; username: string; password: string; clientOptions: ldap.ClientOptions; } /** * Group modify operations * @type {('add'|'delete')} Available modify operations */ type ModifyOperation = 'add' | 'delete'; /** * Creates a new LDAP client * @class ActiveDirectory */ export default class ActiveDirectory { #private; url: string; tlsOptions: Object; username: string; clientOptions: ldap.ClientOptions; client: any; constructor(options: ActiveDirectoryOptions); /** * Bind to the LDAP Server */ bind(): Promise; /** * Unbind the connection */ unbind(): Promise; /** * Perform a LDAP search: http://ldapjs.org/client.html#search * @param dn * @param options */ search(dn: string, options: object): Promise; /** * Find Group objects * @param dn * @param attributes ['cn', 'dn', 'member'] */ findGroup(groupDN: string, attributes: string[]): Promise; /** * Check if entry is member in group * @param groupDN * @param memberDN */ isGroupMember(groupDN: string, memberDN: string): Promise; /** * Add or delete group members * @param groupDN * @param members * @param operation */ modifyGroupMember(groupDN: string, members: string | string[], operation: ModifyOperation): Promise; /** * Delete one group member * @param groupDN * @param memberDN */ addGroupMember(groupDN: string, memberDN: string): Promise; /** * Remove one group member * @param groupDN * @param memberDN */ deleteGroupMember(groupDN: string, memberDN: string): Promise; /** * Find a user objects * @param dn * @param attributes ['cn', 'dn', 'memberOf'] */ findUser(userDN: string, attributes: string[]): Promise; } export {};