diff --git a/.npmignore b/.npmignore index 93304db63..9513d38de 100644 --- a/.npmignore +++ b/.npmignore @@ -1,7 +1,6 @@ client/ server/ test/ -shared/ docs/ scripts/ images/ diff --git a/Dockerfile b/Dockerfile index 7abb1699f..0532b69e0 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 63d57df6d..5168e9538 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 8e198666e..2a8f35580 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 b6f38f760..521e093c1 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 4a7f52257..b13943ec0 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 000000000..24391ef23 --- /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 365163254..4f204d8dc 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 346965c75..c6b8a7b09 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 dad5c5d5a..9cf7081fd 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 d15731e97..885abc90d 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 3086aa356..278dd13e2 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 4d5112146..f98ffebfe 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 fccd7471b..5e21b27e1 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 74175ae30..ccbaa42ea 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 a21ab3be4..6ceb75847 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 d74bd7242..6a39d5ed2 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 5abf4825a..a04b24ad8 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 af11fb533..e31f364b5 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 87d55c432..83bb88abe 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 de3c3252f..69bac57d6 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 0f3797405..55ee564f8 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 8cd89eb3c..d6b1cc028 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 0b89aad24..4c08d57d9 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 9f95a0bb5..a1e8f9a30 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 29e8f2f40..b307ab8b6 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 389ef8a85..6715e53e7 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 fff376b29..2ac5267f7 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 b9ccf8a19..a8549f488 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 06ad59ee6..ed09010d4 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 d47eb73e2..269118956 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 f9dd3585d..6eadf88d0 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 167ec88d7..dce59be19 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 3fab1024b..74f2fe9ab 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 2fb8bab8a..54b6b5706 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 6f062bfb3..74a2e32f1 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 8b995ac9f..6c30b441b 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 869136795..882accec8 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 630f76b9a..875620428 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 efb792ec9..01ed41295 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 ebe98c5ed..36e999058 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 d6f1a911c..000000000 --- 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 2a8ad3158..000ae0c84 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 48cf45fc6..b861a45d8 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 e72b82c7f..2f4df3b0e 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';