node-radius-server/__tests__/auth/ldap.test.ts

25 lines
574 B
TypeScript
Raw Normal View History

import 'mocha';
import { expect } from 'chai';
import { LDAPAuth } from '../../src/auth/LDAPAuth';
2020-05-14 13:02:15 +00:00
describe('test ldap auth', function () {
this.timeout(10000);
it('authenticate against ldap server', async () => {
const auth = new LDAPAuth({
url: 'ldaps://ldap.google.com:636',
base: 'dc=hokify,dc=com',
2020-05-14 13:02:15 +00:00
tls: {
keyFile: './ldap.gsuite.key',
certFile: './ldap.gsuite.crt',
},
tlsOptions: {
servername: 'ldap.google.com',
2020-05-14 13:02:15 +00:00
},
});
const result = await auth.authenticate('username', 'password');
expect(result).to.equal(true);
});
});