0.1.9 • Published 3 years ago
@ppprisma/gm-ldap-client v0.1.9
LDAP-TS
Used for connecting to an AD server. Originally used in Gradesmanager. Uses LDAPJS library.
Original Authors
Updated by
Client usage
import { DnParser, LdapClient } from '@ppprisma/gm-ldap-client';
const url = 'ldap://192.168.1.10:389';
// Instatiate a new client.
const client = new LdapClient(url);
// Bind to enable communcation with ldap server.
// You should use `process.env` and not put these
// credentials directly into your code like the example.
await client.bind('CN=your_user,DC=your,DC=domain', 'your_password'); // Now you can interact with the server
// Environment configuration.
const config = {
base: 'DC=your,DC=base,DC=domain',
studentsOU: 'students_ou',
teachersOU: 'teachers_ou'
};
// Get a DN for a username (SAMAccountName).
const dn = await client.getDnFor('user.name', config);