From 2effaf13ebe5afd309a2eda7509330fd875ab098 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Wed, 23 Sep 2020 08:46:37 +0200 Subject: [PATCH] Add AuthComponent.getAuthGuard() --- src/auth/AuthComponent.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/auth/AuthComponent.ts b/src/auth/AuthComponent.ts index 097fef8..ce92b7a 100644 --- a/src/auth/AuthComponent.ts +++ b/src/auth/AuthComponent.ts @@ -4,10 +4,10 @@ import AuthGuard from "./AuthGuard"; import Controller from "../Controller"; import {ForbiddenHttpError} from "../HttpError"; -export default class AuthComponent extends ApplicationComponent { - private readonly authGuard: AuthGuard; +export default class AuthComponent> extends ApplicationComponent { + private readonly authGuard: T; - public constructor(authGuard: AuthGuard) { + public constructor(authGuard: T) { super(); this.authGuard = authGuard; } @@ -19,6 +19,10 @@ export default class AuthComponent extends ApplicationComponent { next(); }); } + + public getAuthGuard(): T { + return this.authGuard; + } } export const REQUIRE_REQUEST_AUTH_MIDDLEWARE = async (req: Request, res: Response, next: NextFunction): Promise => {