From 186839d6e56206d6e8f860aa120ba75d8a25838e Mon Sep 17 00:00:00 2001 From: Clement Michaud Date: Wed, 17 Apr 2019 00:26:12 +0200 Subject: [PATCH] Remove the shared directory and move files to server. --- .npmignore | 1 - Dockerfile | 1 - scripts/authelia-scripts-unittest | 1 - {shared => server/src/lib}/AuthenticationLevel.ts | 0 {shared => server/src/lib}/BelongToDomain.ts | 0 {shared => server/src/lib}/DomainExtractor.spec.ts | 2 +- {shared => server/src/lib}/DomainExtractor.ts | 0 {shared => server/src/lib}/ErrorMessage.ts | 0 server/src/lib/IdentityCheckMiddleware.spec.ts | 2 +- server/src/lib/IdentityCheckMiddleware.ts | 4 ++-- server/src/lib/Method2FA.ts | 3 +++ server/src/lib/Server.spec.ts | 3 +-- server/src/lib/Server.ts | 2 +- {shared => server/src/lib}/SignMessage.ts | 0 {shared => server/src/lib}/UserMessages.ts | 0 {shared => server/src/lib}/api.ts | 0 server/src/lib/authentication/Level.ts | 2 +- server/src/lib/connectors/mongo/MongoClient.ts | 1 - {shared => server/src/lib}/constants.ts | 0 server/src/lib/routes/firstfactor/post.ts | 4 ++-- server/src/lib/routes/logout/post.ts | 2 +- server/src/lib/routes/password-reset/form/post.ts | 3 +-- server/src/lib/routes/secondfactor/available/Get.ts | 2 +- server/src/lib/routes/secondfactor/duo-push/Post.ts | 4 ++-- server/src/lib/routes/secondfactor/preferences/Get.ts | 2 +- server/src/lib/routes/secondfactor/preferences/Post.ts | 2 +- server/src/lib/routes/secondfactor/redirect.spec.ts | 2 +- server/src/lib/routes/secondfactor/redirect.ts | 2 +- .../routes/secondfactor/totp/identity/RegistrationHandler.ts | 2 +- server/src/lib/routes/secondfactor/totp/sign/post.ts | 2 +- server/src/lib/routes/secondfactor/u2f/register/post.ts | 4 ++-- .../src/lib/routes/secondfactor/u2f/register_request/get.ts | 4 ++-- server/src/lib/routes/secondfactor/u2f/sign/post.spec.ts | 2 +- server/src/lib/routes/secondfactor/u2f/sign/post.ts | 4 ++-- server/src/lib/routes/secondfactor/u2f/sign_request/get.ts | 4 ++-- server/src/lib/routes/verify/Get.spec.ts | 2 +- server/src/lib/routes/verify/Get.ts | 2 +- server/src/lib/routes/verify/GetBasicAuth.spec.ts | 2 +- server/src/lib/routes/verify/GetBasicAuth.ts | 2 +- server/src/lib/routes/verify/SetUserAndGroupsHeaders.spec.ts | 2 +- server/src/lib/routes/verify/SetUserAndGroupsHeaders.ts | 2 +- server/src/lib/storage/IUserDataStore.d.ts | 2 +- server/src/lib/storage/UserDataStore.ts | 2 +- server/src/lib/storage/UserDataStoreStub.spec.ts | 2 +- server/src/lib/stubs/express.spec.ts | 2 +- server/src/lib/utils/GetHeader.ts | 2 +- server/src/lib/utils/RequestUrlGetter.ts | 2 +- server/src/lib/web_server/RestApi.ts | 2 +- {shared => server/src}/types/u2f.d.ts | 0 server/tsconfig.json | 1 - shared/Method2FA.ts | 3 --- test/helpers/context/AutheliaServerWithHotReload.ts | 2 +- test/suites/basic/scenarii/BadPassword.ts | 2 +- test/suites/basic/scenarii/TOTPValidation.ts | 2 +- 54 files changed, 48 insertions(+), 55 deletions(-) rename {shared => server/src/lib}/AuthenticationLevel.ts (100%) rename {shared => server/src/lib}/BelongToDomain.ts (100%) rename {shared => server/src/lib}/DomainExtractor.spec.ts (96%) rename {shared => server/src/lib}/DomainExtractor.ts (100%) rename {shared => server/src/lib}/ErrorMessage.ts (100%) create mode 100644 server/src/lib/Method2FA.ts rename {shared => server/src/lib}/SignMessage.ts (100%) rename {shared => server/src/lib}/UserMessages.ts (100%) rename {shared => server/src/lib}/api.ts (100%) rename {shared => server/src/lib}/constants.ts (100%) rename {shared => server/src}/types/u2f.d.ts (100%) delete mode 100644 shared/Method2FA.ts diff --git a/.npmignore b/.npmignore index 93304db6..9513d38d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,6 @@ client/ server/ test/ -shared/ docs/ scripts/ images/ diff --git a/Dockerfile b/Dockerfile index 7abb1699..0532b69e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,6 @@ RUN apk --update add --no-cache --virtual \ apk del .build-deps COPY dist/server /usr/src/server -COPY dist/shared /usr/src/shared EXPOSE 9091 diff --git a/scripts/authelia-scripts-unittest b/scripts/authelia-scripts-unittest index 63d57df6..5168e953 100755 --- a/scripts/authelia-scripts-unittest +++ b/scripts/authelia-scripts-unittest @@ -35,7 +35,6 @@ async function runTests(patterns) { async function test() { await runTests([ 'server/src/**/*.spec.ts', - 'shared/**/*.spec.ts' ]); } diff --git a/shared/AuthenticationLevel.ts b/server/src/lib/AuthenticationLevel.ts similarity index 100% rename from shared/AuthenticationLevel.ts rename to server/src/lib/AuthenticationLevel.ts diff --git a/shared/BelongToDomain.ts b/server/src/lib/BelongToDomain.ts similarity index 100% rename from shared/BelongToDomain.ts rename to server/src/lib/BelongToDomain.ts diff --git a/shared/DomainExtractor.spec.ts b/server/src/lib/DomainExtractor.spec.ts similarity index 96% rename from shared/DomainExtractor.spec.ts rename to server/src/lib/DomainExtractor.spec.ts index 8e198666..2a8f3558 100644 --- a/shared/DomainExtractor.spec.ts +++ b/server/src/lib/DomainExtractor.spec.ts @@ -1,7 +1,7 @@ import { DomainExtractor } from "./DomainExtractor"; import Assert = require("assert"); -describe("shared/DomainExtractor", function () { +describe("src/lib/DomainExtractor", function () { describe("test fromUrl", function () { it("should return domain from https url", function () { const domain = DomainExtractor.fromUrl("https://www.example.com/test/abc"); diff --git a/shared/DomainExtractor.ts b/server/src/lib/DomainExtractor.ts similarity index 100% rename from shared/DomainExtractor.ts rename to server/src/lib/DomainExtractor.ts diff --git a/shared/ErrorMessage.ts b/server/src/lib/ErrorMessage.ts similarity index 100% rename from shared/ErrorMessage.ts rename to server/src/lib/ErrorMessage.ts diff --git a/server/src/lib/IdentityCheckMiddleware.spec.ts b/server/src/lib/IdentityCheckMiddleware.spec.ts index b6f38f76..521e093c 100644 --- a/server/src/lib/IdentityCheckMiddleware.spec.ts +++ b/server/src/lib/IdentityCheckMiddleware.spec.ts @@ -9,7 +9,7 @@ import ExpressMock = require("./stubs/express.spec"); import { IdentityValidableStub } from "./IdentityValidableStub.spec"; import { ServerVariablesMock, ServerVariablesMockBuilder } from "./ServerVariablesMockBuilder.spec"; -import { OPERATION_FAILED } from "../../../shared/UserMessages"; +import { OPERATION_FAILED } from "./UserMessages"; describe("IdentityCheckMiddleware", function () { let req: Express.Request; diff --git a/server/src/lib/IdentityCheckMiddleware.ts b/server/src/lib/IdentityCheckMiddleware.ts index 4a7f5225..b13943ec 100644 --- a/server/src/lib/IdentityCheckMiddleware.ts +++ b/server/src/lib/IdentityCheckMiddleware.ts @@ -10,12 +10,12 @@ import { AuthenticationSessionHandler } from "./AuthenticationSessionHandler"; import { AuthenticationSession } from "../../types/AuthenticationSession"; import { ServerVariables } from "./ServerVariables"; import { IdentityValidable } from "./IdentityValidable"; -import * as Constants from "../../../shared/constants"; +import * as Constants from "./constants"; import Identity = require("../../types/Identity"); import { IdentityValidationDocument } from "./storage/IdentityValidationDocument"; -import { OPERATION_FAILED } from "../../../shared/UserMessages"; +import { OPERATION_FAILED } from "./UserMessages"; import GetHeader from "./utils/GetHeader"; function createAndSaveToken(userid: string, challenge: string, diff --git a/server/src/lib/Method2FA.ts b/server/src/lib/Method2FA.ts new file mode 100644 index 00000000..24391ef2 --- /dev/null +++ b/server/src/lib/Method2FA.ts @@ -0,0 +1,3 @@ +import Method2FA from "../../../client/src/types/Method2FA"; + +export default Method2FA; \ No newline at end of file diff --git a/server/src/lib/Server.spec.ts b/server/src/lib/Server.spec.ts index 36516325..4f204d8d 100644 --- a/server/src/lib/Server.spec.ts +++ b/server/src/lib/Server.spec.ts @@ -2,7 +2,6 @@ import Assert = require("assert"); import Sinon = require("sinon"); import nedb = require("nedb"); -import express = require("express"); import winston = require("winston"); import speakeasy = require("speakeasy"); import u2f = require("u2f"); @@ -10,7 +9,7 @@ import session = require("express-session"); import { Configuration } from "./configuration/schema/Configuration"; import { GlobalDependencies } from "../../types/Dependencies"; import Server from "./Server"; -import { LdapjsMock, LdapjsClientMock } from "./stubs/ldapjs.spec"; +import { LdapjsMock } from "./stubs/ldapjs.spec"; describe("Server", function () { diff --git a/server/src/lib/Server.ts b/server/src/lib/Server.ts index 346965c7..c6b8a7b0 100644 --- a/server/src/lib/Server.ts +++ b/server/src/lib/Server.ts @@ -11,7 +11,7 @@ import { ServerVariables } from "./ServerVariables"; import { ServerVariablesInitializer } from "./ServerVariablesInitializer"; import { Configurator } from "./web_server/Configurator"; -import { GET_VARIABLE_KEY } from "../../../shared/constants"; +import { GET_VARIABLE_KEY } from "./constants"; function clone(obj: any) { return JSON.parse(JSON.stringify(obj)); diff --git a/shared/SignMessage.ts b/server/src/lib/SignMessage.ts similarity index 100% rename from shared/SignMessage.ts rename to server/src/lib/SignMessage.ts diff --git a/shared/UserMessages.ts b/server/src/lib/UserMessages.ts similarity index 100% rename from shared/UserMessages.ts rename to server/src/lib/UserMessages.ts diff --git a/shared/api.ts b/server/src/lib/api.ts similarity index 100% rename from shared/api.ts rename to server/src/lib/api.ts diff --git a/server/src/lib/authentication/Level.ts b/server/src/lib/authentication/Level.ts index dad5c5d5..9cf7081f 100644 --- a/server/src/lib/authentication/Level.ts +++ b/server/src/lib/authentication/Level.ts @@ -1,3 +1,3 @@ -import { default as Level } from "../../../../shared/AuthenticationLevel"; +import { default as Level } from "../AuthenticationLevel"; export { Level }; diff --git a/server/src/lib/connectors/mongo/MongoClient.ts b/server/src/lib/connectors/mongo/MongoClient.ts index d15731e9..885abc90 100644 --- a/server/src/lib/connectors/mongo/MongoClient.ts +++ b/server/src/lib/connectors/mongo/MongoClient.ts @@ -2,7 +2,6 @@ import MongoDB = require("mongodb"); import { IMongoClient } from "./IMongoClient"; import Bluebird = require("bluebird"); -import { AUTHENTICATION_FAILED } from "../../../../../shared/UserMessages"; import { IGlobalLogger } from "../../logging/IGlobalLogger"; import { MongoStorageConfiguration } from "../../configuration/schema/StorageConfiguration"; diff --git a/shared/constants.ts b/server/src/lib/constants.ts similarity index 100% rename from shared/constants.ts rename to server/src/lib/constants.ts diff --git a/server/src/lib/routes/firstfactor/post.ts b/server/src/lib/routes/firstfactor/post.ts index 3086aa35..278dd13e 100644 --- a/server/src/lib/routes/firstfactor/post.ts +++ b/server/src/lib/routes/firstfactor/post.ts @@ -2,13 +2,13 @@ import BluebirdPromise = require("bluebird"); import express = require("express"); import ErrorReplies = require("../../ErrorReplies"); import { AuthenticationSessionHandler } from "../../AuthenticationSessionHandler"; -import UserMessages = require("../../../../../shared/UserMessages"); +import UserMessages = require("../../UserMessages"); import { ServerVariables } from "../../ServerVariables"; import { AuthenticationSession } from "../../../../types/AuthenticationSession"; import { GroupsAndEmails } from "../../authentication/backends/GroupsAndEmails"; import { Level } from "../../authentication/Level"; import { Level as AuthorizationLevel } from "../../authorization/Level"; -import { BelongToDomain } from "../../../../../shared/BelongToDomain"; +import { BelongToDomain } from "../../BelongToDomain"; import { URLDecomposer } from "../..//utils/URLDecomposer"; import { Object } from "../../../lib/authorization/Object"; import { Subject } from "../../../lib/authorization/Subject"; diff --git a/server/src/lib/routes/logout/post.ts b/server/src/lib/routes/logout/post.ts index 4d511214..f98ffebf 100644 --- a/server/src/lib/routes/logout/post.ts +++ b/server/src/lib/routes/logout/post.ts @@ -1,7 +1,7 @@ import express = require("express"); import { AuthenticationSessionHandler } from "../../AuthenticationSessionHandler"; -import Constants = require("../../../../../shared/constants"); +import Constants = require("../../constants"); import { ServerVariables } from "../../ServerVariables"; function getRedirectParam(req: express.Request) { diff --git a/server/src/lib/routes/password-reset/form/post.ts b/server/src/lib/routes/password-reset/form/post.ts index fccd7471..5e21b27e 100644 --- a/server/src/lib/routes/password-reset/form/post.ts +++ b/server/src/lib/routes/password-reset/form/post.ts @@ -2,11 +2,10 @@ import express = require("express"); import BluebirdPromise = require("bluebird"); import objectPath = require("object-path"); -import exceptions = require("../../../Exceptions"); import { AuthenticationSessionHandler } from "../../../AuthenticationSessionHandler"; import { AuthenticationSession } from "../../../../../types/AuthenticationSession"; import ErrorReplies = require("../../../ErrorReplies"); -import UserMessages = require("../../../../../../shared/UserMessages"); +import UserMessages = require("../../../UserMessages"); import { ServerVariables } from "../../../ServerVariables"; import Constants = require("./../constants"); diff --git a/server/src/lib/routes/secondfactor/available/Get.ts b/server/src/lib/routes/secondfactor/available/Get.ts index 74175ae3..ccbaa42e 100644 --- a/server/src/lib/routes/secondfactor/available/Get.ts +++ b/server/src/lib/routes/secondfactor/available/Get.ts @@ -1,6 +1,6 @@ import * as Express from "express"; import { ServerVariables } from "../../../ServerVariables"; -import Method2FA from "../../../../../../shared/Method2FA"; +import Method2FA from "../../../Method2FA"; export default function(vars: ServerVariables) { diff --git a/server/src/lib/routes/secondfactor/duo-push/Post.ts b/server/src/lib/routes/secondfactor/duo-push/Post.ts index a21ab3be..6ceb7584 100644 --- a/server/src/lib/routes/secondfactor/duo-push/Post.ts +++ b/server/src/lib/routes/secondfactor/duo-push/Post.ts @@ -2,12 +2,12 @@ import * as Express from "express"; import { ServerVariables } from "../../../ServerVariables"; import { AuthenticationSessionHandler } from "../../../AuthenticationSessionHandler"; import * as ErrorReplies from "../../../ErrorReplies"; -import * as UserMessage from "../../../../../../shared/UserMessages"; +import * as UserMessage from "../../../UserMessages"; import redirect from "../redirect"; import { Level } from "../../../authentication/Level"; import { DuoPushConfiguration } from "../../../configuration/schema/DuoPushConfiguration"; import GetHeader from "../../../utils/GetHeader"; -import { HEADER_X_TARGET_URL } from "../../../../../../shared/constants"; +import { HEADER_X_TARGET_URL } from "../../../constants"; const DuoApi = require("@duosecurity/duo_api"); interface DuoResponse { diff --git a/server/src/lib/routes/secondfactor/preferences/Get.ts b/server/src/lib/routes/secondfactor/preferences/Get.ts index d74bd724..6a39d5ed 100644 --- a/server/src/lib/routes/secondfactor/preferences/Get.ts +++ b/server/src/lib/routes/secondfactor/preferences/Get.ts @@ -2,7 +2,7 @@ import * as Express from "express"; import { ServerVariables } from "../../../ServerVariables"; import { AuthenticationSessionHandler } from "../../../AuthenticationSessionHandler"; import * as ErrorReplies from "../../../ErrorReplies"; -import * as UserMessage from "../../../../../../shared/UserMessages"; +import * as UserMessage from "../../../UserMessages"; export default function(vars: ServerVariables) { diff --git a/server/src/lib/routes/secondfactor/preferences/Post.ts b/server/src/lib/routes/secondfactor/preferences/Post.ts index 5abf4825..a04b24ad 100644 --- a/server/src/lib/routes/secondfactor/preferences/Post.ts +++ b/server/src/lib/routes/secondfactor/preferences/Post.ts @@ -2,7 +2,7 @@ import * as Express from "express"; import { ServerVariables } from "../../../ServerVariables"; import { AuthenticationSessionHandler } from "../../../AuthenticationSessionHandler"; import * as ErrorReplies from "../../../ErrorReplies"; -import * as UserMessage from "../../../../../../shared/UserMessages"; +import * as UserMessage from "../../../UserMessages"; export default function(vars: ServerVariables) { diff --git a/server/src/lib/routes/secondfactor/redirect.spec.ts b/server/src/lib/routes/secondfactor/redirect.spec.ts index af11fb53..e31f364b 100644 --- a/server/src/lib/routes/secondfactor/redirect.spec.ts +++ b/server/src/lib/routes/secondfactor/redirect.spec.ts @@ -5,7 +5,7 @@ import { ServerVariablesMockBuilder } from "../../ServerVariablesMockBuilder.spec"; import { ServerVariables } from "../../ServerVariables"; import Assert = require("assert"); -import { HEADER_X_TARGET_URL } from "../../../../../shared/constants"; +import { HEADER_X_TARGET_URL } from "../../constants"; describe("routes/secondfactor/redirect", function() { let req: Express.Request; diff --git a/server/src/lib/routes/secondfactor/redirect.ts b/server/src/lib/routes/secondfactor/redirect.ts index 87d55c43..83bb88ab 100644 --- a/server/src/lib/routes/secondfactor/redirect.ts +++ b/server/src/lib/routes/secondfactor/redirect.ts @@ -4,7 +4,7 @@ import * as URLParse from "url-parse"; import { ServerVariables } from "../../ServerVariables"; import IsRedirectionSafe from "../../../lib/utils/IsRedirectionSafe"; import GetHeader from "../../utils/GetHeader"; -import { HEADER_X_TARGET_URL } from "../../../../../shared/constants"; +import { HEADER_X_TARGET_URL } from "../../constants"; export default function (vars: ServerVariables) { diff --git a/server/src/lib/routes/secondfactor/totp/identity/RegistrationHandler.ts b/server/src/lib/routes/secondfactor/totp/identity/RegistrationHandler.ts index de3c3252..69bac57d 100644 --- a/server/src/lib/routes/secondfactor/totp/identity/RegistrationHandler.ts +++ b/server/src/lib/routes/secondfactor/totp/identity/RegistrationHandler.ts @@ -7,7 +7,7 @@ import { IdentityValidable } from "../../../../IdentityValidable"; import Constants = require("../constants"); import ErrorReplies = require("../../../../ErrorReplies"); import { AuthenticationSessionHandler } from "../../../../AuthenticationSessionHandler"; -import UserMessages = require("../../../../../../../shared/UserMessages"); +import UserMessages = require("../../../../UserMessages"); import FirstFactorValidator = require("../../../../FirstFactorValidator"); import { IRequestLogger } from "../../../../logging/IRequestLogger"; import { IUserDataStore } from "../../../../storage/IUserDataStore"; diff --git a/server/src/lib/routes/secondfactor/totp/sign/post.ts b/server/src/lib/routes/secondfactor/totp/sign/post.ts index 0f379740..55ee564f 100644 --- a/server/src/lib/routes/secondfactor/totp/sign/post.ts +++ b/server/src/lib/routes/secondfactor/totp/sign/post.ts @@ -6,7 +6,7 @@ import Redirect from "../../redirect"; import ErrorReplies = require("../../../../ErrorReplies"); import { AuthenticationSessionHandler } from "../../../../AuthenticationSessionHandler"; import { AuthenticationSession } from "../../../../../../types/AuthenticationSession"; -import UserMessages = require("../../../../../../../shared/UserMessages"); +import UserMessages = require("../../../../UserMessages"); import { ServerVariables } from "../../../../ServerVariables"; import { Level } from "../../../../authentication/Level"; diff --git a/server/src/lib/routes/secondfactor/u2f/register/post.ts b/server/src/lib/routes/secondfactor/u2f/register/post.ts index 8cd89eb3..d6b1cc02 100644 --- a/server/src/lib/routes/secondfactor/u2f/register/post.ts +++ b/server/src/lib/routes/secondfactor/u2f/register/post.ts @@ -7,10 +7,10 @@ import redirect from "../../redirect"; import ErrorReplies = require("../../../../ErrorReplies"); import { ServerVariables } from "../../../../ServerVariables"; import { AuthenticationSessionHandler } from "../../../../AuthenticationSessionHandler"; -import UserMessages = require("../../../../../../../shared/UserMessages"); +import UserMessages = require("../../../../UserMessages"); import { AuthenticationSession } from "../../../../../../types/AuthenticationSession"; import GetHeader from "../../../../utils/GetHeader"; -import * as Constants from "../../../../../../../shared/constants"; +import * as Constants from "../../../../constants"; export default function (vars: ServerVariables) { diff --git a/server/src/lib/routes/secondfactor/u2f/register_request/get.ts b/server/src/lib/routes/secondfactor/u2f/register_request/get.ts index 0b89aad2..4c08d57d 100644 --- a/server/src/lib/routes/secondfactor/u2f/register_request/get.ts +++ b/server/src/lib/routes/secondfactor/u2f/register_request/get.ts @@ -5,10 +5,10 @@ import U2f = require("u2f"); import ErrorReplies = require("../../../../ErrorReplies"); import { AuthenticationSessionHandler } from "../../../../AuthenticationSessionHandler"; import { AuthenticationSession } from "../../../../../../types/AuthenticationSession"; -import UserMessages = require("../../../../../../../shared/UserMessages"); +import UserMessages = require("../../../../UserMessages"); import { ServerVariables } from "../../../../ServerVariables"; import GetHeader from "../../../../utils/GetHeader"; -import * as Constants from "../../../../../../../shared/constants"; +import * as Constants from "../../../../constants"; export default function (vars: ServerVariables) { function handler(req: express.Request, res: express.Response): BluebirdPromise { diff --git a/server/src/lib/routes/secondfactor/u2f/sign/post.spec.ts b/server/src/lib/routes/secondfactor/u2f/sign/post.spec.ts index 9f95a0bb..a1e8f9a3 100644 --- a/server/src/lib/routes/secondfactor/u2f/sign/post.spec.ts +++ b/server/src/lib/routes/secondfactor/u2f/sign/post.spec.ts @@ -4,7 +4,7 @@ import BluebirdPromise = require("bluebird"); import Assert = require("assert"); import U2FSignPost = require("./post"); import { ServerVariables } from "../../../../ServerVariables"; -import UserMessages = require("../../../../../../../shared/UserMessages"); +import UserMessages = require("../../../../UserMessages"); import { ServerVariablesMockBuilder, ServerVariablesMock } from "../../../../ServerVariablesMockBuilder.spec"; import ExpressMock = require("../../../../stubs/express.spec"); import { Level } from "../../../../authentication/Level"; diff --git a/server/src/lib/routes/secondfactor/u2f/sign/post.ts b/server/src/lib/routes/secondfactor/u2f/sign/post.ts index 29e8f2f4..b307ab8b 100644 --- a/server/src/lib/routes/secondfactor/u2f/sign/post.ts +++ b/server/src/lib/routes/secondfactor/u2f/sign/post.ts @@ -7,11 +7,11 @@ import Redirect from "../../redirect"; import ErrorReplies = require("../../../../ErrorReplies"); import { ServerVariables } from "../../../../ServerVariables"; import { AuthenticationSessionHandler } from "../../../../AuthenticationSessionHandler"; -import UserMessages = require("../../../../../../../shared/UserMessages"); +import UserMessages = require("../../../../UserMessages"); import { AuthenticationSession } from "../../../../../../types/AuthenticationSession"; import { Level } from "../../../../authentication/Level"; import GetHeader from "../../../../utils/GetHeader"; -import * as Constants from "../../../../../../../shared/constants"; +import * as Constants from "../../../../constants"; export default function (vars: ServerVariables) { function handler(req: express.Request, res: express.Response): BluebirdPromise { diff --git a/server/src/lib/routes/secondfactor/u2f/sign_request/get.ts b/server/src/lib/routes/secondfactor/u2f/sign_request/get.ts index 389ef8a8..6715e53e 100644 --- a/server/src/lib/routes/secondfactor/u2f/sign_request/get.ts +++ b/server/src/lib/routes/secondfactor/u2f/sign_request/get.ts @@ -4,11 +4,11 @@ import { U2FRegistrationDocument } from "../../../../storage/U2FRegistrationDocu import exceptions = require("../../../../Exceptions"); import ErrorReplies = require("../../../../ErrorReplies"); import { AuthenticationSessionHandler } from "../../../../AuthenticationSessionHandler"; -import UserMessages = require("../../../../../../../shared/UserMessages"); +import UserMessages = require("../../../../UserMessages"); import { ServerVariables } from "../../../../ServerVariables"; import { AuthenticationSession } from "../../../../../../types/AuthenticationSession"; import GetHeader from "../../../../utils/GetHeader"; -import * as Constants from "../../../../../../../shared/constants"; +import * as Constants from "../../../../constants"; export default function (vars: ServerVariables) { function handler(req: express.Request, res: express.Response): BluebirdPromise { diff --git a/server/src/lib/routes/verify/Get.spec.ts b/server/src/lib/routes/verify/Get.spec.ts index fff376b2..2ac5267f 100644 --- a/server/src/lib/routes/verify/Get.spec.ts +++ b/server/src/lib/routes/verify/Get.spec.ts @@ -6,7 +6,7 @@ import { AuthenticationSession } from "../../../../types/AuthenticationSession"; import ExpressMock = require("../../stubs/express.spec"); import { ServerVariables } from "../../ServerVariables"; import { ServerVariablesMockBuilder, ServerVariablesMock } from "../../ServerVariablesMockBuilder.spec"; -import { HEADER_X_ORIGINAL_URL } from "../../../../../shared/constants"; +import { HEADER_X_ORIGINAL_URL } from "../../constants"; import Get from "./Get"; import { ImportMock } from 'ts-mock-imports'; import * as GetBasicAuth from "./GetBasicAuth"; diff --git a/server/src/lib/routes/verify/Get.ts b/server/src/lib/routes/verify/Get.ts index b9ccf8a1..a8549f48 100644 --- a/server/src/lib/routes/verify/Get.ts +++ b/server/src/lib/routes/verify/Get.ts @@ -4,7 +4,7 @@ import ErrorReplies = require("../../ErrorReplies"); import { ServerVariables } from "../../ServerVariables"; import GetSessionCookie from "./GetSessionCookie"; import GetBasicAuth from "./GetBasicAuth"; -import Constants = require("../../../../../shared/constants"); +import Constants = require("../../constants"); import { AuthenticationSessionHandler } from "../../AuthenticationSessionHandler"; import { AuthenticationSession } diff --git a/server/src/lib/routes/verify/GetBasicAuth.spec.ts b/server/src/lib/routes/verify/GetBasicAuth.spec.ts index 06ad59ee..ed09010d 100644 --- a/server/src/lib/routes/verify/GetBasicAuth.spec.ts +++ b/server/src/lib/routes/verify/GetBasicAuth.spec.ts @@ -2,7 +2,7 @@ import * as Express from "express"; import { ServerVariables } from "../../ServerVariables"; import * as ExpressMock from "../../stubs/express.spec"; import { ServerVariablesMockBuilder, ServerVariablesMock } from "../../ServerVariablesMockBuilder.spec"; -import { HEADER_X_ORIGINAL_URL } from "../../../../../shared/constants"; +import { HEADER_X_ORIGINAL_URL } from "../../constants"; import { Level } from "../../authorization/Level"; import GetBasicAuthModule from "./GetBasicAuth"; import * as CheckAuthorizations from "./CheckAuthorizations"; diff --git a/server/src/lib/routes/verify/GetBasicAuth.ts b/server/src/lib/routes/verify/GetBasicAuth.ts index d47eb73e..26911895 100644 --- a/server/src/lib/routes/verify/GetBasicAuth.ts +++ b/server/src/lib/routes/verify/GetBasicAuth.ts @@ -3,7 +3,7 @@ import { ServerVariables } from "../../ServerVariables"; import { URLDecomposer } from "../../utils/URLDecomposer"; import { Level } from "../../authentication/Level"; import GetHeader from "../../utils/GetHeader"; -import { HEADER_PROXY_AUTHORIZATION } from "../../../../../shared/constants"; +import { HEADER_PROXY_AUTHORIZATION } from "../../constants"; import setUserAndGroupsHeaders from "./SetUserAndGroupsHeaders"; import CheckAuthorizations from "./CheckAuthorizations"; import RequestUrlGetter from "../../utils/RequestUrlGetter"; diff --git a/server/src/lib/routes/verify/SetUserAndGroupsHeaders.spec.ts b/server/src/lib/routes/verify/SetUserAndGroupsHeaders.spec.ts index f9dd3585..6eadf88d 100644 --- a/server/src/lib/routes/verify/SetUserAndGroupsHeaders.spec.ts +++ b/server/src/lib/routes/verify/SetUserAndGroupsHeaders.spec.ts @@ -1,6 +1,6 @@ import * as ExpressMock from "../../stubs/express.spec"; import * as Assert from "assert"; -import { HEADER_REMOTE_USER, HEADER_REMOTE_GROUPS } from "../../../../../shared/constants"; +import { HEADER_REMOTE_USER, HEADER_REMOTE_GROUPS } from "../../constants"; import SetUserAndGroupsHeaders from "./SetUserAndGroupsHeaders"; describe("routes/verify/SetUserAndGroupsHeaders", function() { diff --git a/server/src/lib/routes/verify/SetUserAndGroupsHeaders.ts b/server/src/lib/routes/verify/SetUserAndGroupsHeaders.ts index 167ec88d..dce59be1 100644 --- a/server/src/lib/routes/verify/SetUserAndGroupsHeaders.ts +++ b/server/src/lib/routes/verify/SetUserAndGroupsHeaders.ts @@ -1,5 +1,5 @@ import * as Express from "express"; -import { HEADER_REMOTE_USER, HEADER_REMOTE_GROUPS } from "../../../../../shared/constants"; +import { HEADER_REMOTE_USER, HEADER_REMOTE_GROUPS } from "../../constants"; export default function(res: Express.Response, username: string | undefined, groups: string[] | undefined) { if (username) res.setHeader(HEADER_REMOTE_USER, username); diff --git a/server/src/lib/storage/IUserDataStore.d.ts b/server/src/lib/storage/IUserDataStore.d.ts index 3fab1024..74f2fe9a 100644 --- a/server/src/lib/storage/IUserDataStore.d.ts +++ b/server/src/lib/storage/IUserDataStore.d.ts @@ -5,7 +5,7 @@ import { U2FRegistration } from "../../../types/U2FRegistration"; import { TOTPSecret } from "../../../types/TOTPSecret"; import { AuthenticationTraceDocument } from "./AuthenticationTraceDocument"; import { IdentityValidationDocument } from "./IdentityValidationDocument"; -import Method2FA from "../../../../shared/Method2FA"; +import Method2FA from "../Method2FA"; export interface IUserDataStore { saveU2FRegistration(userId: string, appId: string, registration: U2FRegistration): BluebirdPromise; diff --git a/server/src/lib/storage/UserDataStore.ts b/server/src/lib/storage/UserDataStore.ts index 2fb8bab8..54b6b570 100644 --- a/server/src/lib/storage/UserDataStore.ts +++ b/server/src/lib/storage/UserDataStore.ts @@ -8,7 +8,7 @@ import { U2FRegistration } from "../../../types/U2FRegistration"; import { TOTPSecret } from "../../../types/TOTPSecret"; import { AuthenticationTraceDocument } from "./AuthenticationTraceDocument"; import { IdentityValidationDocument } from "./IdentityValidationDocument"; -import Method2FA from "../../../../shared/Method2FA"; +import Method2FA from "../Method2FA"; // Constants diff --git a/server/src/lib/storage/UserDataStoreStub.spec.ts b/server/src/lib/storage/UserDataStoreStub.spec.ts index 6f062bfb..74a2e32f 100644 --- a/server/src/lib/storage/UserDataStoreStub.spec.ts +++ b/server/src/lib/storage/UserDataStoreStub.spec.ts @@ -8,7 +8,7 @@ import { TOTPSecret } from "../../../types/TOTPSecret"; import { AuthenticationTraceDocument } from "./AuthenticationTraceDocument"; import { IdentityValidationDocument } from "./IdentityValidationDocument"; import { IUserDataStore } from "./IUserDataStore"; -import Method2FA from "../../../../shared/Method2FA"; +import Method2FA from "../Method2FA"; export class UserDataStoreStub implements IUserDataStore { saveU2FRegistrationStub: Sinon.SinonStub; diff --git a/server/src/lib/stubs/express.spec.ts b/server/src/lib/stubs/express.spec.ts index 8b995ac9..6c30b441 100644 --- a/server/src/lib/stubs/express.spec.ts +++ b/server/src/lib/stubs/express.spec.ts @@ -1,7 +1,7 @@ import * as Sinon from "sinon"; import * as Express from "express"; -import { GET_VARIABLE_KEY } from "../../../../shared/constants"; +import { GET_VARIABLE_KEY } from "../constants"; import { RequestLoggerStub } from "../logging/RequestLoggerStub.spec"; export interface ResponseMock { diff --git a/server/src/lib/utils/GetHeader.ts b/server/src/lib/utils/GetHeader.ts index 86913679..882accec 100644 --- a/server/src/lib/utils/GetHeader.ts +++ b/server/src/lib/utils/GetHeader.ts @@ -1,7 +1,7 @@ import * as Express from "express"; import * as ObjectPath from "object-path"; import { ServerVariables } from "../ServerVariables"; -import { GET_VARIABLE_KEY } from "../../../../shared/constants"; +import { GET_VARIABLE_KEY } from "../constants"; /** * diff --git a/server/src/lib/utils/RequestUrlGetter.ts b/server/src/lib/utils/RequestUrlGetter.ts index 630f76b9..87562042 100644 --- a/server/src/lib/utils/RequestUrlGetter.ts +++ b/server/src/lib/utils/RequestUrlGetter.ts @@ -1,4 +1,4 @@ -import Constants = require("../../../../shared/constants"); +import Constants = require("../constants"); import Express = require("express"); import GetHeader from "./GetHeader"; import HasHeader from "./HasHeader"; diff --git a/server/src/lib/web_server/RestApi.ts b/server/src/lib/web_server/RestApi.ts index efb792ec..01ed4129 100644 --- a/server/src/lib/web_server/RestApi.ts +++ b/server/src/lib/web_server/RestApi.ts @@ -25,7 +25,7 @@ import U2FRegisterRequestGet = require("../routes/secondfactor/u2f/register_requ import ResetPasswordFormPost = require("../routes/password-reset/form/post"); import { ServerVariables } from "../ServerVariables"; -import Endpoints = require("../../../../shared/api"); +import Endpoints = require("../api"); import { RequireValidatedFirstFactor } from "./middlewares/RequireValidatedFirstFactor"; function setupTotp(app: Express.Application, vars: ServerVariables) { diff --git a/shared/types/u2f.d.ts b/server/src/types/u2f.d.ts similarity index 100% rename from shared/types/u2f.d.ts rename to server/src/types/u2f.d.ts diff --git a/server/tsconfig.json b/server/tsconfig.json index ebe98c5e..36e99905 100644 --- a/server/tsconfig.json +++ b/server/tsconfig.json @@ -11,7 +11,6 @@ "paths": { "*": [ "./types/*", - "../shared/types/*" ] } }, diff --git a/shared/Method2FA.ts b/shared/Method2FA.ts deleted file mode 100644 index d6f1a911..00000000 --- a/shared/Method2FA.ts +++ /dev/null @@ -1,3 +0,0 @@ -import Method2FA from "../client/src/types/Method2FA"; - -export default Method2FA; \ No newline at end of file diff --git a/test/helpers/context/AutheliaServerWithHotReload.ts b/test/helpers/context/AutheliaServerWithHotReload.ts index 2a8ad315..000ae0c8 100644 --- a/test/helpers/context/AutheliaServerWithHotReload.ts +++ b/test/helpers/context/AutheliaServerWithHotReload.ts @@ -17,7 +17,7 @@ class AutheliaServerWithHotReload implements AutheliaServerInterface { constructor(configPath: string, watchedPaths: string[]) { this.configPath = configPath; - const pathsToReload = ['server', 'shared/**/*.ts', 'node_modules', + const pathsToReload = ['server', 'node_modules', this.AUTHELIA_INTERRUPT_FILENAME, configPath].concat(watchedPaths); console.log("Authelia will reload on changes of files or directories in " + pathsToReload.join(', ')); this.watcher = Chokidar.watch(pathsToReload, { diff --git a/test/suites/basic/scenarii/BadPassword.ts b/test/suites/basic/scenarii/BadPassword.ts index 48cf45fc..b861a45d 100644 --- a/test/suites/basic/scenarii/BadPassword.ts +++ b/test/suites/basic/scenarii/BadPassword.ts @@ -1,5 +1,5 @@ import FillLoginPageWithUserAndPasswordAndClick from '../../../helpers/FillLoginPageAndClick'; -import {AUTHENTICATION_FAILED} from '../../../../shared/UserMessages'; +import {AUTHENTICATION_FAILED} from '../../../../server/src/lib/UserMessages'; import VisitPageAndWaitUrlIs from '../../../helpers/behaviors/VisitPageAndWaitUrlIs'; import VerifyNotificationDisplayed from '../../../helpers/assertions/VerifyNotificationDisplayed'; import { StartDriver, StopDriver } from '../../../helpers/context/WithDriver'; diff --git a/test/suites/basic/scenarii/TOTPValidation.ts b/test/suites/basic/scenarii/TOTPValidation.ts index e72b82c7..2f4df3b0 100644 --- a/test/suites/basic/scenarii/TOTPValidation.ts +++ b/test/suites/basic/scenarii/TOTPValidation.ts @@ -2,7 +2,7 @@ import FillLoginPageWithUserAndPasswordAndClick from '../../../helpers/FillLogin import ValidateTotp from '../../../helpers/ValidateTotp'; import VerifySecretObserved from "../../../helpers/assertions/VerifySecretObserved"; import LoginAndRegisterTotp from '../../../helpers/LoginAndRegisterTotp'; -import { AUTHENTICATION_TOTP_FAILED } from '../../../../shared/UserMessages'; +import { AUTHENTICATION_TOTP_FAILED } from '../../../../server/src/lib/UserMessages'; import VisitPageAndWaitUrlIs from '../../../helpers/behaviors/VisitPageAndWaitUrlIs'; import VerifyNotificationDisplayed from '../../../helpers/assertions/VerifyNotificationDisplayed'; import VerifyUrlIs from '../../../helpers/assertions/VerifyUrlIs';