Asymptote Club Account Manager: LDAP account manager, made for Asymptote Club https://account.asymptote.club/
ldap
made-for-asymptote
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

promised-ldap.ts 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import { Filter, Control, Change, SearchOptions, Client } from 'ldapjs';
  2. import * as Logger from 'bunyan';
  3. import { TlsOptions } from 'tls';
  4. import { EventEmitter } from 'events';
  5. interface Options {
  6. url?: string;
  7. socketPath?: string;
  8. log?: Logger;
  9. timeout?: number;
  10. connectTimeout?: number;
  11. tlsOptions?: TlsOptions;
  12. idleTimeout?: number;
  13. strictDN?: boolean;
  14. }
  15. interface SearchResult {
  16. entries: any[];
  17. references: any[];
  18. }
  19. /*
  20. LDAP account manager, made for Asymptote Club
  21. Copyright (C) 2018 Zebulon McCorkle and Asymptote Club contributors
  22. This program is free software: you can redistribute it and/or modify
  23. it under the terms of the GNU Affero General Public License as published by
  24. the Free Software Foundation, either version 3 of the License, or
  25. (at your option) any later version.
  26. This program is distributed in the hope that it will be useful,
  27. but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. GNU Affero General Public License for more details.
  30. You should have received a copy of the GNU Affero General Public License
  31. along with this program. If not, see <http://www.gnu.org/licenses/>.
  32. */
  33. interface AuthenticateUserResult {
  34. name: string;
  35. email: string;
  36. groups: string[];
  37. }
  38. declare class LdapClientClass {
  39. constructor(options: Options);
  40. bind(dn: string, password: string, controls?: Control[]): Promise<void>;
  41. add(dn: string, entry: { [key: string]: string | string[] }, controls?: Control[]): Promise<void>;
  42. compare(dn: string, attribute: string, value: string, controls?: Control[]): Promise<string>;
  43. del(dn: string, controls?: Control[]): Promise<void>;
  44. modify(name: string, changes: Change, controls?: Control[]): Promise<void>;
  45. modifyDN(dn: string, newDN: string, controls?: Control[]): Promise<void>;
  46. _search(base: string | Filter, options: SearchOptions, controls?: Control[]): Promise<EventEmitter>;
  47. search(base: string | Filter, options: SearchOptions, controls?: Control[]): Promise<SearchResult>;
  48. starttls(options?: TlsOptions, controls?: Control[]): Promise<void>;
  49. unbind(): Promise<void>;
  50. authenticate(base: string, cn: string, password: string): Promise<object | null>;
  51. authenticateUser(base: string, cn: string, password: string): Promise<AuthenticateUserResult>;
  52. client: Client;
  53. }
  54. export const LdapClient: typeof LdapClientClass = require('promised-ldap');
  55. export type LdapClient = LdapClientClass;