2020-02-23 19:42:36 +00:00
|
|
|
import 'mocha';
|
|
|
|
import { expect } from 'chai';
|
|
|
|
import * as fs from 'fs';
|
|
|
|
import { LDAPAuth } from '../../src/auth/LDAPAuth';
|
|
|
|
|
|
|
|
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',
|
|
|
|
tlsOptions: {
|
|
|
|
servername: 'ldap.google.com',
|
|
|
|
key: fs.readFileSync('./ldap.gsuite.hokify.com.40567.key'),
|
2020-02-23 19:49:57 +00:00
|
|
|
cert: fs.readFileSync('./ldap.gsuite.hokify.com.40567.crt')
|
2020-02-23 19:42:36 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
const result = await auth.authenticate('username', 'password');
|
|
|
|
|
|
|
|
expect(result).to.equal(true);
|
|
|
|
});
|
|
|
|
});
|