From 9aeb31aaba8676a3e2c411ae14c2a0511f32a8e3 Mon Sep 17 00:00:00 2001 From: "(skovati) Luke" Date: Wed, 27 Dec 2023 11:38:41 -0800 Subject: [PATCH] remove FakeAuthAdapter --- src/main.ts | 5 ++--- src/packages/auth/adapters/FakeAuthAdapter.ts | 14 -------------- 2 files changed, 2 insertions(+), 17 deletions(-) delete mode 100644 src/packages/auth/adapters/FakeAuthAdapter.ts diff --git a/src/main.ts b/src/main.ts index 7751515..59f6dab 100644 --- a/src/main.ts +++ b/src/main.ts @@ -13,7 +13,6 @@ import cookieParser from 'cookie-parser'; import { AuthAdapter } from './packages/auth/types.js'; import { NoAuthAdapter } from './packages/auth/adapters/NoAuthAdapter.js'; import { CAMAuthAdapter } from './packages/auth/adapters/CAMAuthAdapter.js'; -import { FakeAuthAdapter } from './packages/auth/adapters/FakeAuthAdapter.js'; async function main(): Promise { const logger = getLogger('main'); @@ -27,7 +26,7 @@ async function main(): Promise { await DbMerlin.init(); - let authHandler: AuthAdapter = FakeAuthAdapter; + let authHandler: AuthAdapter; switch (AUTH_TYPE) { case 'none': authHandler = NoAuthAdapter; @@ -36,7 +35,7 @@ async function main(): Promise { authHandler = CAMAuthAdapter; break; default: - authHandler = FakeAuthAdapter; + throw new Error(`invalid auth type env var: ${AUTH_TYPE}`); } initApiPlaygroundRoutes(app); diff --git a/src/packages/auth/adapters/FakeAuthAdapter.ts b/src/packages/auth/adapters/FakeAuthAdapter.ts deleted file mode 100644 index 9dc56c0..0000000 --- a/src/packages/auth/adapters/FakeAuthAdapter.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { getEnv } from '../../../env.js'; -import type { AuthAdapter, ValidateResponse } from '../types.js'; - -export const FakeAuthAdapter: AuthAdapter = { - logout: async (): Promise => true, - validate: async (): Promise => { - const { AUTH_UI_URL } = getEnv(); - return { - message: 'SSO token auth is disabled', - redirectURL: AUTH_UI_URL, - success: false, - }; - }, -};