feat: add more auth providers and cleanup google auth
it's no longer needed to use stunnel ;-)
This commit is contained in:
1
__tests__/.gitignore
vendored
Normal file
1
__tests__/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*hokify*
|
||||
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);
|
||||
});
|
||||
});
|
||||
BIN
__tests__/eapol_test
Executable file
BIN
__tests__/eapol_test
Executable file
Binary file not shown.
7
__tests__/tsconfig.json
Normal file
7
__tests__/tsconfig.json
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
|
||||
},
|
||||
"include": ["__tests__/*.ts", "*.ts", "../src/**/*.ts"]
|
||||
}
|
||||
16
__tests__/ttls-pap.conf
Normal file
16
__tests__/ttls-pap.conf
Normal file
@@ -0,0 +1,16 @@
|
||||
#
|
||||
# eapol_test -c ttls-pap.conf -s testing123
|
||||
#
|
||||
network={
|
||||
ssid="example"
|
||||
key_mgmt=WPA-EAP
|
||||
eap=TTLS
|
||||
identity="user"
|
||||
anonymous_identity="anonymous"
|
||||
password="pwd"
|
||||
phase2="auth=PAP"
|
||||
|
||||
#
|
||||
# Uncomment the following to perform server certificate validation.
|
||||
ca_cert="./ssl/cert/ca.pem"
|
||||
}
|
||||
Reference in New Issue
Block a user