diff --git a/src/ldap/ldap.service.ts b/src/ldap/ldap.service.ts index 0020012..383f21b 100644 --- a/src/ldap/ldap.service.ts +++ b/src/ldap/ldap.service.ts @@ -119,19 +119,19 @@ export class LdapService { const cn = reqDN['rdns'][0].attrs.cn.value; const matchedUser = await this.userService.findOne(cn) console.log(matchedUser) - // if (matchedUser) { - // const record = await getDBRecordForUserId(matchedUser.attributes.uid); - // if (record && validateUserPassword(record.password, req.credentials)) { - // res.end(); - // return next(); - // } else { - // console.debug('password failed'); - // return next(new ldap.InvalidCredentialsError()); - // } - // } else { - // console.debug('user not found'); - // return next(new ldap.InvalidCredentialsError()); - // } + if (matchedUser) { + const record = await getDBRecordForUserId(matchedUser.attributes.uid); + if (record && validateUserPassword(record.password, req.credentials)) { + res.end(); + return next(); + } else { + console.debug('password failed'); + return next(new ldap.InvalidCredentialsError()); + } + } else { + console.debug('user not found'); + return next(new ldap.InvalidCredentialsError()); + } } return next(new InsufficientAccessRightsError());