nestjs-ldap
v3.5.1
Published
NestJS library to access LDAP
Downloads
230
Readme
NestJS LDAP
Description
A NestJS library for LDAP (ActiveDirectory)
Installation
$ yarn add nestjs-ldap
Usage
import { LdapModule, ldapADattributes } from 'nestjs-ldap';
@Module({
imports: [
...
LdapModule.registerAsync({
inject: [ConfigService],
useFactory: async (configService: ConfigService) => (
{
cache: new Redis(), /* optional */
cacheUrl: 'redis://username:[email protected]:6379/0', /* optional */
cacheTtl: 600, /* optional */
domains: [
'example.com' => {
url: 'ldaps://pdc.example.local:389',
bindDN: 'CN=Administrator,DC=example,DC=local',
bindCredentials: 'PaSsWoRd123',
searchBase: 'DC=example,DC=local',
searchFilter: '(&(&(|(&(objectClass=user)(objectCategory=person))(&(objectClass=contact)(objectCategory=person)))))',
searchScope: 'sub' as Scope,
groupSearchBase: 'DC=example,DC=local',
groupSearchFilter: '(&(objectClass=group)(member={{dn}}))',
groupSearchScope: 'sub' as Scope,
groupDnProperty: 'dn',
hideSynchronization: false,
searchBaseAllUsers: 'DC=example,DC=local',
searchFilterAllUsers: '(&(&(|(&(objectClass=user)(objectCategory=person))(&(objectClass=contact)(objectCategory=person)))))',
searchFilterAllGroups: 'objectClass=group',
searchScopeAllUsers: 'sub' as Scope,
newObject: 'OU=User,DC=example,DC=local',
reconnect: true,
groupSearchAttributes: ldapADattributes,
searchAttributes: ldapADattributes,
searchAttributesAllUsers: ldapADattributes,
},
]
}),
}),
...
]
})
export class AppModule {}
License
NestJS-ldap is MIT licensed.