Merge pull request #50 from clems4ever/fix-build-dist
Fix example environment and add system testspull/51/head
commit
532405578f
|
@ -13,9 +13,6 @@ src/.baseDir.ts
|
|||
|
||||
*.swp
|
||||
|
||||
/config.yml
|
||||
|
||||
npm-debug.log
|
||||
|
||||
# Directory used by example
|
||||
notifications/
|
||||
|
@ -29,3 +26,7 @@ dist/
|
|||
.nyc_output/
|
||||
|
||||
*.tgz
|
||||
|
||||
# Specific files
|
||||
/config.yml
|
||||
/test/integration/nginx.conf
|
||||
|
|
11
Gruntfile.js
11
Gruntfile.js
|
@ -14,12 +14,16 @@ module.exports = function (grunt) {
|
|||
},
|
||||
"test": {
|
||||
cmd: "./node_modules/.bin/mocha",
|
||||
args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/client', 'test/server']
|
||||
args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/unit']
|
||||
},
|
||||
"test-int": {
|
||||
cmd: "./node_modules/.bin/mocha",
|
||||
args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/integration']
|
||||
},
|
||||
"test-system": {
|
||||
cmd: "./node_modules/.bin/mocha",
|
||||
args: ['--compilers', 'ts:ts-node/register', '--recursive', 'test/system']
|
||||
},
|
||||
"docker-build": {
|
||||
cmd: "docker",
|
||||
args: ['build', '-t', 'clems4ever/authelia', '.']
|
||||
|
@ -154,8 +158,9 @@ module.exports = function (grunt) {
|
|||
|
||||
grunt.registerTask('build-resources', ['copy:resources', 'copy:views', 'copy:images', 'copy:thirdparties', 'concat:css']);
|
||||
|
||||
grunt.registerTask('build-dev', ['run:tslint', 'run:build', 'browserify:dist', 'build-resources', 'run:make-dev-views']);
|
||||
grunt.registerTask('build-dist', ['build-dev', 'run:minify', 'cssmin']);
|
||||
grunt.registerTask('build-common', ['run:tslint', 'run:build', 'browserify:dist', 'build-resources']);
|
||||
grunt.registerTask('build-dev', ['build-common', 'run:make-dev-views']);
|
||||
grunt.registerTask('build-dist', ['build-common', 'run:minify', 'cssmin']);
|
||||
|
||||
grunt.registerTask('docker-build', ['run:docker-build']);
|
||||
grunt.registerTask('docker-restart', ['run:docker-restart']);
|
||||
|
|
|
@ -103,7 +103,7 @@ Deploy **Authelia** example with the following command:
|
|||
|
||||
npm install --only=dev
|
||||
./node_modules/.bin/grunt build-dist
|
||||
./scripts/deploy-example.sh
|
||||
./scripts/example/deploy-example.sh
|
||||
|
||||
After few seconds the services should be running and you should be able to visit
|
||||
[https://home.test.local:8080/](https://home.test.local:8080/).
|
||||
|
|
|
@ -12,7 +12,7 @@ logs_level: info
|
|||
# Example: for user john, the DN will be cn=john,ou=users,dc=example,dc=com
|
||||
ldap:
|
||||
# The url of the ldap server
|
||||
url: ldap://openldap-restriction
|
||||
url: ldap://openldap
|
||||
|
||||
# The base dn for every entries
|
||||
base_dn: dc=example,dc=com
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
version: '2'
|
||||
|
||||
networks:
|
||||
example-network:
|
||||
driver: bridge
|
||||
|
|
|
@ -12,13 +12,13 @@ services:
|
|||
depends_on:
|
||||
- authelia
|
||||
networks:
|
||||
example-network:
|
||||
aliases:
|
||||
- home.test.local
|
||||
- secret.test.local
|
||||
- secret1.test.local
|
||||
- secret2.test.local
|
||||
- mx1.mail.test.local
|
||||
- mx2.mail.test.local
|
||||
- auth.test.local
|
||||
- example-network
|
||||
# aliases:
|
||||
# - home.test.local
|
||||
# - secret.test.local
|
||||
# - secret1.test.local
|
||||
# - secret2.test.local
|
||||
# - mx1.mail.test.local
|
||||
# - mx2.mail.test.local
|
||||
# - auth.test.local
|
||||
|
||||
|
|
|
@ -40,9 +40,11 @@ http {
|
|||
|
||||
proxy_intercept_errors on;
|
||||
|
||||
error_page 401 = /error/401;
|
||||
error_page 403 = /error/403;
|
||||
error_page 404 = /error/404;
|
||||
if ($request_method !~ ^(POST)$){
|
||||
error_page 401 = /error/401;
|
||||
error_page 403 = /error/403;
|
||||
error_page 404 = /error/404;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
docker-compose -f docker-compose.base.yml -f example/redis/docker-compose.yml -f example/ldap/docker-compose.yml -f test/integration/docker-compose.yml $*
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
./scripts/dc-example.sh build
|
||||
./scripts/dc-example.sh up -d
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
service_count=`docker ps -a | grep "Up " | wc -l`
|
||||
|
||||
if [ "${service_count}" -eq "4" ]
|
||||
if [ "${service_count}" -eq "5" ]
|
||||
then
|
||||
echo "Service are up and running."
|
||||
exit 0
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
set -e
|
||||
|
||||
docker-compose -f docker-compose.base.yml -f docker-compose.yml -f example/redis/docker-compose.yml -f example/nginx/docker-compose.yml -f example/ldap/docker-compose.yml $*
|
||||
docker-compose -f docker-compose.base.yml -f docker-compose.yml -f example/redis/docker-compose.yml -f example/nginx/docker-compose.yml -f example/ldap/docker-compose.yml -f test/integration/docker-compose.yml $*
|
|
@ -0,0 +1,6 @@
|
|||
#!/bin/bash
|
||||
|
||||
DC_SCRIPT=./scripts/example/dc-example.sh
|
||||
|
||||
$DC_SCRIPT build
|
||||
$DC_SCRIPT up -d
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
DC_SCRIPT=./scripts/example/dc-example.sh
|
||||
|
||||
$DC_SCRIPT down
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/bash
|
||||
|
||||
DC_SCRIPT=./scripts/example/dc-example.sh
|
||||
|
||||
run_services() {
|
||||
$DC_SCRIPT up -d redis openldap
|
||||
sleep 2
|
||||
$DC_SCRIPT up -d authelia nginx nginx-tests
|
||||
sleep 3
|
||||
}
|
||||
|
||||
set -e
|
||||
|
||||
echo "Make sure services are not already running"
|
||||
$DC_SCRIPT down
|
||||
|
||||
|
||||
# Prepare & run integration tests
|
||||
|
||||
echo "Prepare nginx-test configuration"
|
||||
cat example/nginx/nginx.conf | sed 's/listen 443 ssl/listen 8080 ssl/g' | dd of="test/integration/nginx.conf"
|
||||
|
||||
echo "Build services images..."
|
||||
$DC_SCRIPT build
|
||||
|
||||
echo "Start services..."
|
||||
run_services
|
||||
docker ps -a
|
||||
|
||||
echo "Display services logs..."
|
||||
$DC_SCRIPT logs redis
|
||||
$DC_SCRIPT logs openldap
|
||||
$DC_SCRIPT logs nginx
|
||||
$DC_SCRIPT logs nginx-tests
|
||||
$DC_SCRIPT logs authelia
|
||||
|
||||
echo "Check number of services"
|
||||
./scripts/example/check-services.sh
|
||||
|
||||
echo "Run integration tests..."
|
||||
$DC_SCRIPT run --rm integration-tests
|
||||
|
||||
echo "Shutdown services..."
|
||||
$DC_SCRIPT down
|
||||
|
||||
# Prepare & test example from end user perspective
|
||||
|
||||
echo "Start services..."
|
||||
run_services
|
||||
|
||||
./node_modules/.bin/mocha --compilers ts:ts-node/register --recursive test/system
|
||||
|
||||
$DC_SCRIPT down
|
||||
|
|
@ -1,24 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
echo "Build services images..."
|
||||
./scripts/dc-test.sh build
|
||||
|
||||
echo "Start services..."
|
||||
./scripts/dc-test.sh up -d redis openldap
|
||||
sleep 2
|
||||
./scripts/dc-test.sh up -d authelia nginx
|
||||
sleep 3
|
||||
docker ps -a
|
||||
|
||||
echo "Display services logs..."
|
||||
./scripts/dc-test.sh logs authelia
|
||||
./scripts/dc-test.sh logs nginx
|
||||
./scripts/dc-test.sh logs openldap
|
||||
|
||||
echo "Run integration tests..."
|
||||
./scripts/dc-test.sh run --rm --name int-test int-test
|
||||
|
||||
echo "Shutdown services..."
|
||||
./scripts/dc-test.sh down
|
|
@ -1,15 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
|
||||
# Build production environment and set it up
|
||||
./scripts/dc-example.sh build
|
||||
./scripts/dc-example.sh up -d
|
||||
|
||||
# Wait for services to be running
|
||||
sleep 5
|
||||
|
||||
# Check if services are correctly running
|
||||
./scripts/check-services.sh
|
||||
|
||||
./scripts/dc-example.sh down
|
|
@ -11,11 +11,8 @@ grunt test
|
|||
# Build the app from Typescript and package
|
||||
grunt build-dist
|
||||
|
||||
# Run integration tests
|
||||
./scripts/run-int-test.sh
|
||||
|
||||
# Test staging environment
|
||||
./scripts/run-staging.sh
|
||||
# Run integration/example tests
|
||||
./scripts/integration-tests.sh
|
||||
|
||||
# Test npm deployment before actual deployment
|
||||
./scripts/npm-deployment-test.sh
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
./scripts/dc-example.sh down
|
|
@ -1,164 +0,0 @@
|
|||
|
||||
import Request = require("request");
|
||||
import Assert = require("assert");
|
||||
import Speakeasy = require("speakeasy");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import Util = require("util");
|
||||
import Sinon = require("sinon");
|
||||
import Endpoints = require("../../src/server/endpoints");
|
||||
|
||||
const EXEC_PATH = "./dist/src/server/index.js";
|
||||
const CONFIG_PATH = "./test/integration/config.yml";
|
||||
const j = Request.jar();
|
||||
const request: typeof Request = <typeof Request>BluebirdPromise.promisifyAll(Request.defaults({ jar: j }));
|
||||
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||
|
||||
const DOMAIN = "test.local";
|
||||
const PORT = 8080;
|
||||
|
||||
const HOME_URL = Util.format("https://%s.%s:%d", "home", DOMAIN, PORT);
|
||||
const SECRET_URL = Util.format("https://%s.%s:%d", "secret", DOMAIN, PORT);
|
||||
const SECRET1_URL = Util.format("https://%s.%s:%d", "secret1", DOMAIN, PORT);
|
||||
const SECRET2_URL = Util.format("https://%s.%s:%d", "secret2", DOMAIN, PORT);
|
||||
const MX1_URL = Util.format("https://%s.%s:%d", "mx1.mail", DOMAIN, PORT);
|
||||
const MX2_URL = Util.format("https://%s.%s:%d", "mx2.mail", DOMAIN, PORT);
|
||||
const BASE_AUTH_URL = Util.format("https://%s.%s:%d", "auth", DOMAIN, PORT);
|
||||
|
||||
function waitFor(ms: number): BluebirdPromise<{}> {
|
||||
return new BluebirdPromise(function (resolve, reject) {
|
||||
setTimeout(function () {
|
||||
resolve();
|
||||
}, ms);
|
||||
});
|
||||
}
|
||||
|
||||
describe("test the server", function () {
|
||||
let home_page: string;
|
||||
let login_page: string;
|
||||
|
||||
before(function () {
|
||||
const home_page_promise = getHomePage()
|
||||
.then(function (data) {
|
||||
home_page = data.body;
|
||||
});
|
||||
const login_page_promise = getLoginPage()
|
||||
.then(function (data) {
|
||||
login_page = data.body;
|
||||
});
|
||||
|
||||
return BluebirdPromise.all([home_page_promise,
|
||||
login_page_promise]);
|
||||
});
|
||||
|
||||
after(function () {
|
||||
});
|
||||
|
||||
function str_contains(str: string, pattern: string) {
|
||||
return str.indexOf(pattern) != -1;
|
||||
}
|
||||
|
||||
function home_page_contains(pattern: string) {
|
||||
return str_contains(home_page, pattern);
|
||||
}
|
||||
|
||||
it("should serve a correct home page", function () {
|
||||
Assert(home_page_contains(BASE_AUTH_URL + Endpoints.LOGOUT_GET + "?redirect=" + HOME_URL + "/"));
|
||||
Assert(home_page_contains(HOME_URL + "/secret.html"));
|
||||
Assert(home_page_contains(SECRET_URL + "/secret.html"));
|
||||
Assert(home_page_contains(SECRET1_URL + "/secret.html"));
|
||||
Assert(home_page_contains(SECRET2_URL + "/secret.html"));
|
||||
Assert(home_page_contains(MX1_URL + "/secret.html"));
|
||||
Assert(home_page_contains(MX2_URL + "/secret.html"));
|
||||
});
|
||||
|
||||
it("should serve the login page", function () {
|
||||
return getPromised(BASE_AUTH_URL + Endpoints.FIRST_FACTOR_GET)
|
||||
.then(function (data: Request.RequestResponse) {
|
||||
Assert.equal(data.statusCode, 200);
|
||||
});
|
||||
});
|
||||
|
||||
it("should serve the homepage", function () {
|
||||
return getPromised(HOME_URL + "/")
|
||||
.then(function (data: Request.RequestResponse) {
|
||||
Assert.equal(data.statusCode, 200);
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect when logout", function () {
|
||||
return getPromised(BASE_AUTH_URL + Endpoints.LOGOUT_GET + "?redirect=" + HOME_URL)
|
||||
.then(function (data: Request.RequestResponse) {
|
||||
Assert.equal(data.statusCode, 200);
|
||||
Assert.equal(data.body, home_page);
|
||||
});
|
||||
});
|
||||
|
||||
it("should be redirected to the login page when accessing secret while not authenticated", function () {
|
||||
return getPromised(HOME_URL + "/secret.html")
|
||||
.then(function (data: Request.RequestResponse) {
|
||||
Assert.equal(data.statusCode, 200);
|
||||
Assert.equal(data.body, login_page);
|
||||
});
|
||||
});
|
||||
|
||||
it.skip("should fail the first factor", function () {
|
||||
return postPromised(BASE_AUTH_URL + Endpoints.FIRST_FACTOR_POST, {
|
||||
form: {
|
||||
username: "admin",
|
||||
password: "password",
|
||||
}
|
||||
})
|
||||
.then(function (data: Request.RequestResponse) {
|
||||
Assert.equal(data.body, "Bad credentials");
|
||||
});
|
||||
});
|
||||
|
||||
function login_as(username: string, password: string) {
|
||||
return postPromised(BASE_AUTH_URL + Endpoints.FIRST_FACTOR_POST, {
|
||||
form: {
|
||||
username: "john",
|
||||
password: "password",
|
||||
}
|
||||
})
|
||||
.then(function (data: Request.RequestResponse) {
|
||||
Assert.equal(data.statusCode, 302);
|
||||
return BluebirdPromise.resolve();
|
||||
});
|
||||
}
|
||||
|
||||
it("should succeed the first factor", function () {
|
||||
return login_as("john", "password");
|
||||
});
|
||||
|
||||
describe("test ldap connection", function () {
|
||||
it("should not fail after inactivity", function () {
|
||||
const clock = Sinon.useFakeTimers();
|
||||
return login_as("john", "password")
|
||||
.then(function () {
|
||||
clock.tick(3600000 * 24); // 24 hour
|
||||
return login_as("john", "password");
|
||||
})
|
||||
.then(function () {
|
||||
clock.restore();
|
||||
return BluebirdPromise.resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function getPromised(url: string) {
|
||||
return request.getAsync(url);
|
||||
}
|
||||
|
||||
function postPromised(url: string, body: Object) {
|
||||
return request.postAsync(url, body);
|
||||
}
|
||||
|
||||
function getHomePage(): BluebirdPromise<Request.RequestResponse> {
|
||||
return getPromised(HOME_URL + "/");
|
||||
}
|
||||
|
||||
function getLoginPage(): BluebirdPromise<Request.RequestResponse> {
|
||||
return getPromised(BASE_AUTH_URL + Endpoints.FIRST_FACTOR_GET);
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
|
||||
# The port to listen on
|
||||
port: 80
|
||||
|
||||
# Log level
|
||||
#
|
||||
# Level of verbosity for logs
|
||||
logs_level: debug
|
||||
|
||||
# LDAP configuration
|
||||
#
|
||||
# Example: for user john, the DN will be cn=john,ou=users,dc=example,dc=com
|
||||
ldap:
|
||||
# The url of the ldap server
|
||||
url: ldap://openldap
|
||||
|
||||
# The base dn for every entries
|
||||
base_dn: dc=example,dc=com
|
||||
|
||||
# An additional dn to define the scope to all users
|
||||
additional_user_dn: ou=users
|
||||
|
||||
# The user name attribute of users. Might uid for FreeIPA. 'cn' by default.
|
||||
user_name_attribute: cn
|
||||
|
||||
# An additional dn to define the scope of groups
|
||||
additional_group_dn: ou=groups
|
||||
|
||||
# The group name attribute of group. 'cn' by default.
|
||||
group_name_attribute: cn
|
||||
|
||||
# The username and password of the admin user.
|
||||
user: cn=admin,dc=example,dc=com
|
||||
password: password
|
||||
|
||||
|
||||
# Access Control
|
||||
#
|
||||
# Access control is a set of rules you can use to restrict the user access.
|
||||
# Default (anyone), per-user or per-group rules can be defined.
|
||||
#
|
||||
# If 'access_control' is not defined, ACL rules are disabled and default policy
|
||||
# is applied, i.e., access is allowed to anyone. Otherwise restrictions follow
|
||||
# the rules defined below.
|
||||
# If no rule is provided, all domains are denied.
|
||||
#
|
||||
# '*' means 'any' subdomains and matches any string. It must stand at the
|
||||
# beginning of the pattern.
|
||||
access_control:
|
||||
default:
|
||||
- home.test.local
|
||||
groups:
|
||||
admin:
|
||||
- '*.test.local'
|
||||
dev:
|
||||
- secret.test.local
|
||||
- secret2.test.local
|
||||
users:
|
||||
harry:
|
||||
- secret1.test.local
|
||||
bob:
|
||||
- '*.mail.test.local'
|
||||
|
||||
|
||||
# Configuration of session cookies
|
||||
#
|
||||
# _secret_ the secret to encrypt session cookies
|
||||
# _expiration_ the time before cookies expire
|
||||
# _domain_ the domain to protect.
|
||||
# Note: the authenticator must also be in that domain. If empty, the cookie
|
||||
# is restricted to the subdomain of the issuer.
|
||||
session:
|
||||
secret: unsecure_secret
|
||||
expiration: 3600000
|
||||
domain: test.local
|
||||
redis:
|
||||
host: redis
|
||||
port: 6379
|
||||
|
||||
|
||||
# The directory where the DB files will be saved
|
||||
store_directory: /var/lib/authelia/store
|
||||
|
||||
|
||||
# Notifications are sent to users when they require a password reset, a u2f
|
||||
# registration or a TOTP registration.
|
||||
# Use only one available configuration: filesystem, gmail
|
||||
notifier:
|
||||
# For testing purpose, notifications can be sent in a file
|
||||
filesystem:
|
||||
filename: /var/lib/authelia/notifications/notification.txt
|
||||
|
||||
# Use your gmail account to send the notifications. You can use an app password.
|
||||
# gmail:
|
||||
# username: user
|
||||
# password: password
|
||||
|
|
@ -1,15 +1,6 @@
|
|||
version: '2'
|
||||
services:
|
||||
authelia:
|
||||
image: node:7-alpine
|
||||
command: node /usr/src/dist/src/server/index.js /etc/authelia/config.yml
|
||||
volumes:
|
||||
- ./:/usr/src
|
||||
- ./test/integration/config.yml:/etc/authelia/config.yml:ro
|
||||
networks:
|
||||
- example-network
|
||||
|
||||
int-test:
|
||||
integration-tests:
|
||||
build: ./test/integration
|
||||
command: ./node_modules/.bin/mocha --compilers ts:ts-node/register --recursive test/integration
|
||||
volumes:
|
||||
|
@ -17,8 +8,7 @@ services:
|
|||
networks:
|
||||
- example-network
|
||||
|
||||
|
||||
nginx:
|
||||
nginx-tests:
|
||||
image: nginx:alpine
|
||||
volumes:
|
||||
- ./example/nginx/index.html:/usr/share/nginx/html/index.html
|
||||
|
@ -39,4 +29,3 @@ services:
|
|||
- mx1.mail.test.local
|
||||
- mx2.mail.test.local
|
||||
- auth.test.local
|
||||
|
||||
|
|
|
@ -0,0 +1,112 @@
|
|||
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||
|
||||
import Request = require("request");
|
||||
import Assert = require("assert");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import Util = require("util");
|
||||
import Redis = require("redis");
|
||||
import Endpoints = require("../../src/server/endpoints");
|
||||
|
||||
const RequestAsync = BluebirdPromise.promisifyAll(Request) as typeof Request;
|
||||
|
||||
const DOMAIN = "test.local";
|
||||
const PORT = 8080;
|
||||
|
||||
const HOME_URL = Util.format("https://%s.%s:%d", "home", DOMAIN, PORT);
|
||||
const SECRET_URL = Util.format("https://%s.%s:%d", "secret", DOMAIN, PORT);
|
||||
const SECRET1_URL = Util.format("https://%s.%s:%d", "secret1", DOMAIN, PORT);
|
||||
const SECRET2_URL = Util.format("https://%s.%s:%d", "secret2", DOMAIN, PORT);
|
||||
const MX1_URL = Util.format("https://%s.%s:%d", "mx1.mail", DOMAIN, PORT);
|
||||
const MX2_URL = Util.format("https://%s.%s:%d", "mx2.mail", DOMAIN, PORT);
|
||||
|
||||
const BASE_AUTH_URL = Util.format("https://%s.%s:%d", "auth", DOMAIN, PORT);
|
||||
const FIRST_FACTOR_URL = Util.format("%s/api/firstfactor", BASE_AUTH_URL);
|
||||
const LOGOUT_URL = Util.format("%s/logout", BASE_AUTH_URL);
|
||||
|
||||
|
||||
const redisOptions = {
|
||||
host: "redis",
|
||||
port: 6379
|
||||
};
|
||||
|
||||
|
||||
describe("integration tests", function () {
|
||||
let redisClient: Redis.RedisClient;
|
||||
|
||||
before(function () {
|
||||
redisClient = Redis.createClient(redisOptions);
|
||||
});
|
||||
|
||||
function str_contains(str: string, pattern: string) {
|
||||
return str.indexOf(pattern) != -1;
|
||||
}
|
||||
|
||||
function test_homepage_is_correct(body: string) {
|
||||
Assert(str_contains(body, BASE_AUTH_URL + Endpoints.LOGOUT_GET + "?redirect=" + HOME_URL + "/"));
|
||||
Assert(str_contains(body, HOME_URL + "/secret.html"));
|
||||
Assert(str_contains(body, SECRET_URL + "/secret.html"));
|
||||
Assert(str_contains(body, SECRET1_URL + "/secret.html"));
|
||||
Assert(str_contains(body, SECRET2_URL + "/secret.html"));
|
||||
Assert(str_contains(body, MX1_URL + "/secret.html"));
|
||||
Assert(str_contains(body, MX2_URL + "/secret.html"));
|
||||
Assert(str_contains(body, "Access the secret"));
|
||||
}
|
||||
|
||||
it("should access the home page", function () {
|
||||
return RequestAsync.getAsync(HOME_URL)
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(200, response.statusCode);
|
||||
test_homepage_is_correct(response.body);
|
||||
});
|
||||
});
|
||||
|
||||
it("should access the authentication page", function () {
|
||||
return RequestAsync.getAsync(BASE_AUTH_URL)
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(200, response.statusCode);
|
||||
Assert(response.body.indexOf("Sign in") > -1);
|
||||
});
|
||||
});
|
||||
|
||||
it("should fail first factor when wrong credentials are provided", function () {
|
||||
return RequestAsync.postAsync(FIRST_FACTOR_URL, {
|
||||
json: true,
|
||||
body: {
|
||||
username: "john",
|
||||
password: "wrong password"
|
||||
}
|
||||
})
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(401, response.statusCode);
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect when correct credentials are provided during first factor", function () {
|
||||
return RequestAsync.postAsync(FIRST_FACTOR_URL, {
|
||||
json: true,
|
||||
body: {
|
||||
username: "john",
|
||||
password: "password"
|
||||
}
|
||||
})
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(302, response.statusCode);
|
||||
});
|
||||
});
|
||||
|
||||
it("should have registered four sessions in redis", function (done) {
|
||||
redisClient.dbsize(function (err: Error, count: number) {
|
||||
Assert.equal(3, count);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect to home page when logout is called", function () {
|
||||
return RequestAsync.getAsync(Util.format("%s?redirect=%s", LOGOUT_URL, HOME_URL))
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(200, response.statusCode);
|
||||
Assert(response.body.indexOf("Access the secret") > -1);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,86 +0,0 @@
|
|||
# nginx-sso - example nginx config
|
||||
#
|
||||
# (c) 2015 by Johannes Gilger <heipei@hackvalue.de>
|
||||
#
|
||||
# This is an example config for using nginx with the nginx-sso cookie system.
|
||||
# For simplicity, this config sets up two fictional vhosts that you can use to
|
||||
# test against both components of the nginx-sso system: ssoauth & ssologin.
|
||||
# In a real deployment, these vhosts would be separate hosts.
|
||||
|
||||
#user nobody;
|
||||
worker_processes 1;
|
||||
|
||||
#error_log logs/error.log;
|
||||
#error_log logs/error.log notice;
|
||||
#error_log logs/error.log info;
|
||||
|
||||
#pid logs/nginx.pid;
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
server {
|
||||
listen 8080 ssl;
|
||||
server_name auth.test.local localhost;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/server.crt;
|
||||
ssl_certificate_key /etc/ssl/server.key;
|
||||
|
||||
|
||||
location / {
|
||||
proxy_set_header X-Original-URI $request_uri;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
|
||||
proxy_pass http://authelia/;
|
||||
|
||||
proxy_intercept_errors on;
|
||||
|
||||
error_page 401 = /error/401;
|
||||
error_page 403 = /error/403;
|
||||
error_page 404 = /error/404;
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 8080 ssl;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
server_name secret1.test.local secret2.test.local secret.test.local
|
||||
home.test.local mx1.mail.test.local mx2.mail.test.local;
|
||||
|
||||
ssl on;
|
||||
ssl_certificate /etc/ssl/server.crt;
|
||||
ssl_certificate_key /etc/ssl/server.key;
|
||||
|
||||
error_page 401 = @error401;
|
||||
location @error401 {
|
||||
return 302 https://auth.test.local:8080;
|
||||
}
|
||||
|
||||
location /auth_verify {
|
||||
internal;
|
||||
proxy_set_header X-Original-URI $request_uri;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $http_host;
|
||||
|
||||
proxy_pass http://authelia/verify;
|
||||
}
|
||||
|
||||
location = /secret.html {
|
||||
auth_request /auth_verify;
|
||||
|
||||
auth_request_set $user $upstream_http_x_remote_user;
|
||||
proxy_set_header X-Forwarded-User $user;
|
||||
auth_request_set $groups $upstream_http_remote_groups;
|
||||
proxy_set_header Remote-Groups $groups;
|
||||
auth_request_set $expiry $upstream_http_remote_expiry;
|
||||
proxy_set_header Remote-Expiry $expiry;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
import Redis = require("redis");
|
||||
import Assert = require("assert");
|
||||
|
||||
const redisOptions = {
|
||||
host: "redis",
|
||||
port: 6379
|
||||
};
|
||||
|
||||
describe("test redis is correctly used", function () {
|
||||
let redisClient: Redis.RedisClient;
|
||||
|
||||
before(function () {
|
||||
redisClient = Redis.createClient(redisOptions);
|
||||
});
|
||||
|
||||
it("should have registered at least one session", function (done) {
|
||||
redisClient.dbsize(function (err: Error, count: number) {
|
||||
Assert.equal(1, count);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -0,0 +1,92 @@
|
|||
|
||||
process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0";
|
||||
|
||||
import Request = require("request");
|
||||
import Assert = require("assert");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import Util = require("util");
|
||||
import Endpoints = require("../../src/server/endpoints");
|
||||
|
||||
const RequestAsync = BluebirdPromise.promisifyAll(Request) as typeof Request;
|
||||
|
||||
const DOMAIN = "test.local";
|
||||
const PORT = 8080;
|
||||
|
||||
const HOME_URL = Util.format("https://%s.%s:%d", "home", DOMAIN, PORT);
|
||||
const SECRET_URL = Util.format("https://%s.%s:%d", "secret", DOMAIN, PORT);
|
||||
const SECRET1_URL = Util.format("https://%s.%s:%d", "secret1", DOMAIN, PORT);
|
||||
const SECRET2_URL = Util.format("https://%s.%s:%d", "secret2", DOMAIN, PORT);
|
||||
const MX1_URL = Util.format("https://%s.%s:%d", "mx1.mail", DOMAIN, PORT);
|
||||
const MX2_URL = Util.format("https://%s.%s:%d", "mx2.mail", DOMAIN, PORT);
|
||||
|
||||
const BASE_AUTH_URL = Util.format("https://%s.%s:%d", "auth", DOMAIN, PORT);
|
||||
const FIRST_FACTOR_URL = Util.format("%s/api/firstfactor", BASE_AUTH_URL);
|
||||
const LOGOUT_URL = Util.format("%s/logout", BASE_AUTH_URL);
|
||||
|
||||
|
||||
describe("test example environment", function () {
|
||||
function str_contains(str: string, pattern: string) {
|
||||
return str.indexOf(pattern) != -1;
|
||||
}
|
||||
|
||||
function test_homepage_is_correct(body: string) {
|
||||
Assert(str_contains(body, BASE_AUTH_URL + Endpoints.LOGOUT_GET + "?redirect=" + HOME_URL + "/"));
|
||||
Assert(str_contains(body, HOME_URL + "/secret.html"));
|
||||
Assert(str_contains(body, SECRET_URL + "/secret.html"));
|
||||
Assert(str_contains(body, SECRET1_URL + "/secret.html"));
|
||||
Assert(str_contains(body, SECRET2_URL + "/secret.html"));
|
||||
Assert(str_contains(body, MX1_URL + "/secret.html"));
|
||||
Assert(str_contains(body, MX2_URL + "/secret.html"));
|
||||
Assert(str_contains(body, "Access the secret"));
|
||||
}
|
||||
|
||||
it("should access the home page", function () {
|
||||
return RequestAsync.getAsync(HOME_URL)
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(200, response.statusCode);
|
||||
test_homepage_is_correct(response.body);
|
||||
});
|
||||
});
|
||||
|
||||
it("should access the authentication page", function () {
|
||||
return RequestAsync.getAsync(BASE_AUTH_URL)
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(200, response.statusCode);
|
||||
Assert(response.body.indexOf("Sign in") > -1);
|
||||
});
|
||||
});
|
||||
|
||||
it("should fail first factor when wrong credentials are provided", function () {
|
||||
return RequestAsync.postAsync(FIRST_FACTOR_URL, {
|
||||
json: true,
|
||||
body: {
|
||||
username: "john",
|
||||
password: "wrong password"
|
||||
}
|
||||
})
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(401, response.statusCode);
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect when correct credentials are provided during first factor", function () {
|
||||
return RequestAsync.postAsync(FIRST_FACTOR_URL, {
|
||||
json: true,
|
||||
body: {
|
||||
username: "john",
|
||||
password: "password"
|
||||
}
|
||||
})
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(302, response.statusCode);
|
||||
});
|
||||
});
|
||||
|
||||
it("should redirect to home page when logout is called", function () {
|
||||
return RequestAsync.getAsync(Util.format("%s?redirect=%s", LOGOUT_URL, HOME_URL))
|
||||
.then(function (response: Request.RequestResponse) {
|
||||
Assert.equal(200, response.statusCode);
|
||||
Assert(response.body.indexOf("Access the secret") > -1);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
import FirstFactorValidator = require("../../../src/client/firstfactor/FirstFactorValidator");
|
||||
import FirstFactorValidator = require("../../../../src/client/firstfactor/FirstFactorValidator");
|
||||
import JQueryMock = require("../mocks/jquery");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import Assert = require("assert");
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
import Endpoints = require("../../../src/server/endpoints");
|
||||
import Endpoints = require("../../../../src/server/endpoints");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
|
||||
import UISelectors = require("../../../src/client/firstfactor/UISelectors");
|
||||
import firstfactor from "../../../src/client/firstfactor/index";
|
||||
import UISelectors = require("../../../../src/client/firstfactor/UISelectors");
|
||||
import firstfactor from "../../../../src/client/firstfactor/index";
|
||||
import JQueryMock = require("../mocks/jquery");
|
||||
import Assert = require("assert");
|
||||
import sinon = require("sinon");
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
import TOTPValidator = require("../../../src/client/secondfactor/TOTPValidator");
|
||||
import TOTPValidator = require("../../../../src/client/secondfactor/TOTPValidator");
|
||||
import JQueryMock = require("../mocks/jquery");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import Assert = require("assert");
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
import U2FValidator = require("../../../src/client/secondfactor/U2FValidator");
|
||||
import U2FValidator = require("../../../../src/client/secondfactor/U2FValidator");
|
||||
import JQueryMock = require("../mocks/jquery");
|
||||
import U2FApiMock = require("../mocks/u2f-api");
|
||||
import { SignMessage } from "../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage";
|
||||
import { SignMessage } from "../../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage";
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import Assert = require("assert");
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
import sinon = require("sinon");
|
||||
import assert = require("assert");
|
||||
|
||||
import UISelector = require("../../../src/client/totp-register/ui-selector");
|
||||
import TOTPRegister = require("../../../src/client/totp-register/totp-register");
|
||||
import UISelector = require("../../../../src/client/totp-register/ui-selector");
|
||||
import TOTPRegister = require("../../../../src/client/totp-register/totp-register");
|
||||
|
||||
describe("test totp-register", function() {
|
||||
let jqueryMock: any;
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
import { AuthenticationRegulator } from "../../src/server/lib/AuthenticationRegulator";
|
||||
import UserDataStore from "../../src/server/lib/UserDataStore";
|
||||
import { AuthenticationRegulator } from "../../../src/server/lib/AuthenticationRegulator";
|
||||
import UserDataStore from "../../../src/server/lib/UserDataStore";
|
||||
import MockDate = require("mockdate");
|
||||
import exceptions = require("../../src/server/lib/Exceptions");
|
||||
import exceptions = require("../../../src/server/lib/Exceptions");
|
||||
import nedb = require("nedb");
|
||||
|
||||
describe("test authentication regulator", function() {
|
|
@ -1,6 +1,6 @@
|
|||
import * as Assert from "assert";
|
||||
import { UserConfiguration } from "../../src/types/Configuration";
|
||||
import ConfigurationAdapter from "../../src/server/lib/ConfigurationAdapter";
|
||||
import { UserConfiguration } from "../../../src/types/Configuration";
|
||||
import ConfigurationAdapter from "../../../src/server/lib/ConfigurationAdapter";
|
||||
|
||||
describe("test config adapter", function() {
|
||||
function build_yaml_config(): UserConfiguration {
|
|
@ -2,9 +2,9 @@
|
|||
import * as BluebirdPromise from "bluebird";
|
||||
import * as request from "request";
|
||||
|
||||
import Server from "../../src/server/lib/Server";
|
||||
import { UserConfiguration } from "../../src/types/Configuration";
|
||||
import { GlobalDependencies } from "../../src/types/Dependencies";
|
||||
import Server from "../../../src/server/lib/Server";
|
||||
import { UserConfiguration } from "../../../src/types/Configuration";
|
||||
import { GlobalDependencies } from "../../../src/types/Dependencies";
|
||||
import * as tmp from "tmp";
|
||||
import U2FMock = require("./mocks/u2f");
|
||||
import { LdapjsClientMock } from "./mocks/ldapjs";
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
import sinon = require("sinon");
|
||||
import IdentityValidator = require("../../src/server/lib/IdentityCheckMiddleware");
|
||||
import AuthenticationSession = require("../../src/server/lib/AuthenticationSession");
|
||||
import exceptions = require("../../src/server/lib/Exceptions");
|
||||
import IdentityValidator = require("../../../src/server/lib/IdentityCheckMiddleware");
|
||||
import AuthenticationSession = require("../../../src/server/lib/AuthenticationSession");
|
||||
import exceptions = require("../../../src/server/lib/Exceptions");
|
||||
import assert = require("assert");
|
||||
import winston = require("winston");
|
||||
import Promise = require("bluebird");
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import LdapClient = require("../../src/server/lib/LdapClient");
|
||||
import { LdapConfiguration } from "../../src/types/Configuration";
|
||||
import LdapClient = require("../../../src/server/lib/LdapClient");
|
||||
import { LdapConfiguration } from "../../../src/types/Configuration";
|
||||
|
||||
import sinon = require("sinon");
|
||||
import BluebirdPromise = require("bluebird");
|
|
@ -9,9 +9,9 @@ import u2f = require("u2f");
|
|||
import nodemailer = require("nodemailer");
|
||||
import session = require("express-session");
|
||||
|
||||
import { AppConfiguration, UserConfiguration } from "../../src/types/Configuration";
|
||||
import { GlobalDependencies, Nodemailer } from "../../src/types/Dependencies";
|
||||
import Server from "../../src/server/lib/Server";
|
||||
import { AppConfiguration, UserConfiguration } from "../../../src/types/Configuration";
|
||||
import { GlobalDependencies, Nodemailer } from "../../../src/types/Dependencies";
|
||||
import Server from "../../../src/server/lib/Server";
|
||||
|
||||
|
||||
describe("test server configuration", function () {
|
|
@ -1,6 +1,6 @@
|
|||
import SessionConfigurationBuilder from "../../src/server/lib/SessionConfigurationBuilder";
|
||||
import { AppConfiguration } from "../../src/types/Configuration";
|
||||
import { GlobalDependencies } from "../../src/types/Dependencies";
|
||||
import SessionConfigurationBuilder from "../../../src/server/lib/SessionConfigurationBuilder";
|
||||
import { AppConfiguration } from "../../../src/types/Configuration";
|
||||
import { GlobalDependencies } from "../../../src/types/Dependencies";
|
||||
import ExpressSession = require("express-session");
|
||||
import ConnectRedis = require("connect-redis");
|
||||
import sinon = require("sinon");
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
import { TOTPValidator } from "../../src/server/lib/TOTPValidator";
|
||||
import { TOTPValidator } from "../../../src/server/lib/TOTPValidator";
|
||||
import sinon = require("sinon");
|
||||
import Promise = require("bluebird");
|
||||
import SpeakeasyMock = require("./mocks/speakeasy");
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import UserDataStore from "../../src/server/lib/UserDataStore";
|
||||
import { U2FRegistrationDocument, Options } from "../../src/server/lib/UserDataStore";
|
||||
import UserDataStore from "../../../src/server/lib/UserDataStore";
|
||||
import { U2FRegistrationDocument, Options } from "../../../src/server/lib/UserDataStore";
|
||||
|
||||
import nedb = require("nedb");
|
||||
import assert = require("assert");
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
import assert = require("assert");
|
||||
import winston = require("winston");
|
||||
import { AccessController } from "../../../src/server/lib/access_control/AccessController";
|
||||
import { ACLConfiguration } from "../../../src/types/Configuration";
|
||||
import { AccessController } from "../../../../src/server/lib/access_control/AccessController";
|
||||
import { ACLConfiguration } from "../../../../src/types/Configuration";
|
||||
|
||||
describe("test access control manager", function () {
|
||||
let accessController: AccessController;
|
|
@ -2,8 +2,8 @@
|
|||
import assert = require("assert");
|
||||
import winston = require("winston");
|
||||
|
||||
import PatternBuilder from "../../../src/server/lib/access_control/PatternBuilder";
|
||||
import { ACLConfiguration } from "../../../src/types/Configuration";
|
||||
import PatternBuilder from "../../../../src/server/lib/access_control/PatternBuilder";
|
||||
import { ACLConfiguration } from "../../../../src/types/Configuration";
|
||||
|
||||
describe("test access control manager", function () {
|
||||
describe("test access control pattern builder when no configuration is provided", () => {
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
import sinon = require("sinon");
|
||||
import { IdentityValidable } from "../../../src/server/lib/IdentityCheckMiddleware";
|
||||
import { IdentityValidable } from "../../../../src/server/lib/IdentityCheckMiddleware";
|
||||
import express = require("express");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import { Identity } from "../../../src/types/Identity";
|
||||
import { Identity } from "../../../../src/types/Identity";
|
||||
|
||||
|
||||
export interface IdentityValidableMock {
|
|
@ -1,6 +1,6 @@
|
|||
import sinon = require("sinon");
|
||||
import express = require("express");
|
||||
import { ServerVariables, VARIABLES_KEY } from "../../../src/server/lib/ServerVariables";
|
||||
import { ServerVariables, VARIABLES_KEY } from "../../../../src/server/lib/ServerVariables";
|
||||
|
||||
export interface ServerVariablesMock {
|
||||
logger: any;
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import * as sinon from "sinon";
|
||||
import * as assert from "assert";
|
||||
import { FileSystemNotifier } from "../../../src/server/lib/notifiers/FileSystemNotifier";
|
||||
import { FileSystemNotifier } from "../../../../src/server/lib/notifiers/FileSystemNotifier";
|
||||
import * as tmp from "tmp";
|
||||
import * as fs from "fs";
|
||||
import BluebirdPromise = require("bluebird");
|
|
@ -3,7 +3,7 @@ import * as assert from "assert";
|
|||
import BluebirdPromise = require("bluebird");
|
||||
|
||||
import NodemailerMock = require("../mocks/nodemailer");
|
||||
import GMailNotifier = require("../../../src/server/lib/notifiers/GMailNotifier");
|
||||
import GMailNotifier = require("../../../../src/server/lib/notifiers/GMailNotifier");
|
||||
|
||||
|
||||
describe("test gmail notifier", function () {
|
|
@ -3,9 +3,9 @@ import * as sinon from "sinon";
|
|||
import * as BluebirdPromise from "bluebird";
|
||||
import * as assert from "assert";
|
||||
|
||||
import { NotifierFactory } from "../../../src/server/lib/notifiers/NotifierFactory";
|
||||
import { GMailNotifier } from "../../../src/server/lib/notifiers/GMailNotifier";
|
||||
import { FileSystemNotifier } from "../../../src/server/lib/notifiers/FileSystemNotifier";
|
||||
import { NotifierFactory } from "../../../../src/server/lib/notifiers/NotifierFactory";
|
||||
import { GMailNotifier } from "../../../../src/server/lib/notifiers/GMailNotifier";
|
||||
import { FileSystemNotifier } from "../../../../src/server/lib/notifiers/FileSystemNotifier";
|
||||
|
||||
import NodemailerMock = require("../mocks/nodemailer");
|
||||
|
|
@ -4,7 +4,7 @@ import request = require("request");
|
|||
import assert = require("assert");
|
||||
import express = require("express");
|
||||
import nodemailer = require("nodemailer");
|
||||
import Endpoints = require("../../src/server/endpoints");
|
||||
import Endpoints = require("../../../src/server/endpoints");
|
||||
|
||||
import NodemailerMock = require("./mocks/nodemailer");
|
||||
|
|
@ -4,10 +4,10 @@ import BluebirdPromise = require("bluebird");
|
|||
import assert = require("assert");
|
||||
import winston = require("winston");
|
||||
|
||||
import FirstFactorPost = require("../../../../src/server/lib/routes/firstfactor/post");
|
||||
import exceptions = require("../../../../src/server/lib/Exceptions");
|
||||
import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession");
|
||||
import Endpoints = require("../../../../src/server/endpoints");
|
||||
import FirstFactorPost = require("../../../../../src/server/lib/routes/firstfactor/post");
|
||||
import exceptions = require("../../../../../src/server/lib/Exceptions");
|
||||
import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession");
|
||||
import Endpoints = require("../../../../../src/server/endpoints");
|
||||
|
||||
import AuthenticationRegulatorMock = require("../../mocks/AuthenticationRegulator");
|
||||
import AccessControllerMock = require("../../mocks/AccessController");
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
import PasswordResetHandler from "../../../../../src/server/lib/routes/password-reset/identity/PasswordResetHandler";
|
||||
import LdapClient = require("../../../../../src/server/lib/LdapClient");
|
||||
import PasswordResetHandler from "../../../../../../src/server/lib/routes/password-reset/identity/PasswordResetHandler";
|
||||
import LdapClient = require("../../../../../../src/server/lib/LdapClient");
|
||||
import sinon = require("sinon");
|
||||
import winston = require("winston");
|
||||
import assert = require("assert");
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import PasswordResetFormPost = require("../../../../src/server/lib/routes/password-reset/form/post");
|
||||
import LdapClient = require("../../../../src/server/lib/LdapClient");
|
||||
import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession");
|
||||
import PasswordResetFormPost = require("../../../../../src/server/lib/routes/password-reset/form/post");
|
||||
import LdapClient = require("../../../../../src/server/lib/LdapClient");
|
||||
import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession");
|
||||
import sinon = require("sinon");
|
||||
import winston = require("winston");
|
||||
import assert = require("assert");
|
|
@ -1,8 +1,8 @@
|
|||
import sinon = require("sinon");
|
||||
import winston = require("winston");
|
||||
import RegistrationHandler from "../../../../../../src/server/lib/routes/secondfactor/totp/identity/RegistrationHandler";
|
||||
import { Identity } from "../../../../../../src/types/Identity";
|
||||
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession");
|
||||
import RegistrationHandler from "../../../../../../../src/server/lib/routes/secondfactor/totp/identity/RegistrationHandler";
|
||||
import { Identity } from "../../../../../../../src/types/Identity";
|
||||
import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
|
||||
import assert = require("assert");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
|
|
@ -4,9 +4,9 @@ import sinon = require("sinon");
|
|||
import assert = require("assert");
|
||||
import winston = require("winston");
|
||||
|
||||
import exceptions = require("../../../../../../src/server/lib/Exceptions");
|
||||
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession");
|
||||
import SignPost = require("../../../../../../src/server/lib/routes/secondfactor/totp/sign/post");
|
||||
import exceptions = require("../../../../../../../src/server/lib/Exceptions");
|
||||
import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
|
||||
import SignPost = require("../../../../../../../src/server/lib/routes/secondfactor/totp/sign/post");
|
||||
|
||||
import ExpressMock = require("../../../../mocks/express");
|
||||
import UserDataStoreMock = require("../../../../mocks/UserDataStore");
|
|
@ -3,9 +3,9 @@ import winston = require("winston");
|
|||
import assert = require("assert");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
|
||||
import { Identity } from "../../../../../../src/types/Identity";
|
||||
import RegistrationHandler from "../../../../../../src/server/lib/routes/secondfactor/u2f/identity/RegistrationHandler";
|
||||
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession");
|
||||
import { Identity } from "../../../../../../../src/types/Identity";
|
||||
import RegistrationHandler from "../../../../../../../src/server/lib/routes/secondfactor/u2f/identity/RegistrationHandler";
|
||||
import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
|
||||
|
||||
import ExpressMock = require("../../../../mocks/express");
|
||||
import UserDataStoreMock = require("../../../../mocks/UserDataStore");
|
|
@ -2,8 +2,8 @@
|
|||
import sinon = require("sinon");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import assert = require("assert");
|
||||
import U2FRegisterPost = require("../../../../../../src/server/lib/routes/secondfactor/u2f/register/post");
|
||||
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession");
|
||||
import U2FRegisterPost = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/register/post");
|
||||
import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
|
||||
import winston = require("winston");
|
||||
|
||||
import ExpressMock = require("../../../../mocks/express");
|
|
@ -2,8 +2,8 @@
|
|||
import sinon = require("sinon");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import assert = require("assert");
|
||||
import U2FRegisterRequestGet = require("../../../../../../src/server/lib/routes/secondfactor/u2f/register_request/get");
|
||||
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession");
|
||||
import U2FRegisterRequestGet = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/register_request/get");
|
||||
import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
|
||||
import winston = require("winston");
|
||||
|
||||
import ExpressMock = require("../../../../mocks/express");
|
|
@ -2,8 +2,8 @@
|
|||
import sinon = require("sinon");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import assert = require("assert");
|
||||
import U2FSignPost = require("../../../../../../src/server/lib/routes/secondfactor/u2f/sign/post");
|
||||
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession");
|
||||
import U2FSignPost = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/sign/post");
|
||||
import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
|
||||
import winston = require("winston");
|
||||
|
||||
import ExpressMock = require("../../../../mocks/express");
|
|
@ -2,8 +2,8 @@
|
|||
import sinon = require("sinon");
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import assert = require("assert");
|
||||
import U2FSignRequestGet = require("../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/get");
|
||||
import AuthenticationSession = require("../../../../../../src/server/lib/AuthenticationSession");
|
||||
import U2FSignRequestGet = require("../../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/get");
|
||||
import AuthenticationSession = require("../../../../../../../src/server/lib/AuthenticationSession");
|
||||
import winston = require("winston");
|
||||
|
||||
import ExpressMock = require("../../../../mocks/express");
|
||||
|
@ -12,7 +12,7 @@ import ServerVariablesMock = require("../../../../mocks/ServerVariablesMock");
|
|||
import U2FMock = require("../../../../mocks/u2f");
|
||||
import U2f = require("u2f");
|
||||
|
||||
import { SignMessage } from "../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage";
|
||||
import { SignMessage } from "../../../../../../../src/server/lib/routes/secondfactor/u2f/sign_request/SignMessage";
|
||||
|
||||
describe("test u2f routes: sign_request", function () {
|
||||
let req: ExpressMock.RequestMock;
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
import assert = require("assert");
|
||||
import VerifyGet = require("../../../../src/server/lib/routes/verify/get");
|
||||
import AuthenticationSession = require("../../../../src/server/lib/AuthenticationSession");
|
||||
import VerifyGet = require("../../../../../src/server/lib/routes/verify/get");
|
||||
import AuthenticationSession = require("../../../../../src/server/lib/AuthenticationSession");
|
||||
|
||||
import sinon = require("sinon");
|
||||
import winston = require("winston");
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
import Server from "../../../src/server/lib/Server";
|
||||
import LdapClient = require("../../../src/server/lib/LdapClient");
|
||||
import Server from "../../../../src/server/lib/Server";
|
||||
import LdapClient = require("../../../../src/server/lib/LdapClient");
|
||||
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import speakeasy = require("speakeasy");
|
||||
import request = require("request");
|
||||
import nedb = require("nedb");
|
||||
import { GlobalDependencies } from "../../../src/types/Dependencies";
|
||||
import { TOTPSecret } from "../../../src/types/TOTPSecret";
|
||||
import { GlobalDependencies } from "../../../../src/types/Dependencies";
|
||||
import { TOTPSecret } from "../../../../src/types/TOTPSecret";
|
||||
import U2FMock = require("./../mocks/u2f");
|
||||
import Endpoints = require("../../../src/server/endpoints");
|
||||
import Endpoints = require("../../../../src/server/endpoints");
|
||||
import Requests = require("../requests");
|
||||
import Assert = require("assert");
|
||||
import Sinon = require("sinon");
|
|
@ -1,15 +1,15 @@
|
|||
|
||||
import Server from "../../../src/server/lib/Server";
|
||||
import LdapClient = require("../../../src/server/lib/LdapClient");
|
||||
import Server from "../../../../src/server/lib/Server";
|
||||
import LdapClient = require("../../../../src/server/lib/LdapClient");
|
||||
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import speakeasy = require("speakeasy");
|
||||
import Request = require("request");
|
||||
import nedb = require("nedb");
|
||||
import { GlobalDependencies } from "../../../src/types/Dependencies";
|
||||
import { TOTPSecret } from "../../../src/types/TOTPSecret";
|
||||
import { GlobalDependencies } from "../../../../src/types/Dependencies";
|
||||
import { TOTPSecret } from "../../../../src/types/TOTPSecret";
|
||||
import U2FMock = require("./../mocks/u2f");
|
||||
import Endpoints = require("../../../src/server/endpoints");
|
||||
import Endpoints = require("../../../../src/server/endpoints");
|
||||
import Requests = require("../requests");
|
||||
import Assert = require("assert");
|
||||
import Sinon = require("sinon");
|
|
@ -1,17 +1,17 @@
|
|||
|
||||
|
||||
import Server from "../../../src/server/lib/Server";
|
||||
import LdapClient = require("../../../src/server/lib/LdapClient");
|
||||
import Server from "../../../../src/server/lib/Server";
|
||||
import LdapClient = require("../../../../src/server/lib/LdapClient");
|
||||
import { LdapjsClientMock } from "./../mocks/ldapjs";
|
||||
|
||||
import BluebirdPromise = require("bluebird");
|
||||
import speakeasy = require("speakeasy");
|
||||
import request = require("request");
|
||||
import nedb = require("nedb");
|
||||
import { GlobalDependencies } from "../../../src/types/Dependencies";
|
||||
import { TOTPSecret } from "../../../src/types/TOTPSecret";
|
||||
import { GlobalDependencies } from "../../../../src/types/Dependencies";
|
||||
import { TOTPSecret } from "../../../../src/types/TOTPSecret";
|
||||
import U2FMock = require("./../mocks/u2f");
|
||||
import Endpoints = require("../../../src/server/endpoints");
|
||||
import Endpoints = require("../../../../src/server/endpoints");
|
||||
import Requests = require("../requests");
|
||||
import Assert = require("assert");
|
||||
import Sinon = require("sinon");
|
|
@ -3,7 +3,7 @@ import * as assert from "assert";
|
|||
import * as Promise from "bluebird";
|
||||
import * as sinon from "sinon";
|
||||
import * as MockDate from "mockdate";
|
||||
import UserDataStore from "../../../src/server/lib/UserDataStore";
|
||||
import UserDataStore from "../../../../src/server/lib/UserDataStore";
|
||||
import nedb = require("nedb");
|
||||
|
||||
describe("test user data store", function() {
|
|
@ -3,7 +3,7 @@ import * as assert from "assert";
|
|||
import * as Promise from "bluebird";
|
||||
import * as sinon from "sinon";
|
||||
import * as MockDate from "mockdate";
|
||||
import UserDataStore from "../../../src/server/lib/UserDataStore";
|
||||
import UserDataStore from "../../../../src/server/lib/UserDataStore";
|
||||
import nedb = require("nedb");
|
||||
|
||||
describe("test user data store", function() {
|
Loading…
Reference in New Issue