2.1.5 • Published 5 years ago

ldapts-search v2.1.5

Weekly downloads
4
License
MIT
Repository
github
Last release
5 years ago

ldapts-search npm.io

Utility to help search through active directory.

Definition:

class LdapSearch<Result> {
  constructor(params: {
    host: string;
    port: number;
    dn: string;
    password: string;
    searchBase: string;
    attributes?: string[];
  });
  match: (filter: string, sizeLimit?: number | undefined) => Promise<Result[]>;
}

Example usage:

type Result = {
  sAMAccountName: string;
  name: string;
  dn: string;
};

const ldapSearch = new LdapSearch<Result>({
  dn: "dn=test",
  host: "0.0.0.0",
  port: 1234,
  password: "password",
  searchBase: "dn=some,cn=searchbase",
  attributes: [
    "sAMAccountName",
    "name",
    "dn"
  ]
});

export function searchActiveDirectory(name: string): ActiveDirectoryRecord[] {
  return await ldapSearch.match(`(&(objectClass=Person)(sAMAccountName=${name}))`); // returns Result[]
}
2.1.5

5 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.2

5 years ago

2.1.1

5 years ago

2.1.0

5 years ago

2.0.2

5 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.1.3

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago