feat: add more auth providers and cleanup google auth
it's no longer needed to use stunnel ;-)
This commit is contained in:
21
__tests__/auth/google-ldap.test.ts
Normal file
21
__tests__/auth/google-ldap.test.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import * as fs from 'fs';
|
||||
import { GoogleLDAPAuth } from '../../src/auth/GoogleLDAPAuth';
|
||||
|
||||
describe('test google ldap auth', function() {
|
||||
this.timeout(10000);
|
||||
it('authenticate against ldap server', async () => {
|
||||
const auth = new GoogleLDAPAuth({
|
||||
base: 'dc=hokify,dc=com',
|
||||
tlsOptions: {
|
||||
key: fs.readFileSync('./ldap.gsuite.hokify.com.40567.key'),
|
||||
cert: fs.readFileSync('./ldap.gsuite.hokify.com.40567.crt')
|
||||
}
|
||||
});
|
||||
|
||||
const result = await auth.authenticate('username', 'password');
|
||||
|
||||
expect(result).to.equal(true);
|
||||
});
|
||||
});
|
||||
18
__tests__/auth/imap.test.ts
Normal file
18
__tests__/auth/imap.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { IMAPAuth } from '../../src/auth/IMAPAuth';
|
||||
|
||||
describe('test imap auth', () => {
|
||||
it('authenticate against imap server', async () => {
|
||||
const auth = new IMAPAuth({
|
||||
host: 'imap.gmail.com',
|
||||
port: 993,
|
||||
useSecureTransport: true,
|
||||
validHosts: ['gmail.com']
|
||||
});
|
||||
|
||||
const result = await auth.authenticate('username', 'password');
|
||||
|
||||
expect(result).to.equal(true);
|
||||
});
|
||||
});
|
||||
23
__tests__/auth/ldap.test.ts
Normal file
23
__tests__/auth/ldap.test.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
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'),
|
||||
cert: fs.readFileSync('./ldap.gsuite.hokify.com.40567.crt'),
|
||||
}
|
||||
});
|
||||
|
||||
const result = await auth.authenticate('username', 'password');
|
||||
|
||||
expect(result).to.equal(true);
|
||||
});
|
||||
});
|
||||
18
__tests__/auth/smtp.test.ts
Normal file
18
__tests__/auth/smtp.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import 'mocha';
|
||||
import { expect } from 'chai';
|
||||
import { SMTPAuth } from '../../src/auth/SMTPAuth';
|
||||
|
||||
describe('test smtp auth', () => {
|
||||
it('authenticate against smtp server', async () => {
|
||||
const auth = new SMTPAuth({
|
||||
host: 'smtp.gmail.com',
|
||||
port: 465,
|
||||
useSecureTransport: true,
|
||||
validHosts: ['gmail.com']
|
||||
});
|
||||
|
||||
const result = await auth.authenticate('username', 'password');
|
||||
|
||||
expect(result).to.equal(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user