From 8e36104637fc57b8c864376275e9d69bae97c68f Mon Sep 17 00:00:00 2001 From: cogentapps <127109874+cogentapps@users.noreply.github.com> Date: Tue, 4 Jul 2023 20:12:32 +0000 Subject: [PATCH] simplify auth check --- server/src/endpoints/session.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/server/src/endpoints/session.ts b/server/src/endpoints/session.ts index a6bf445f..e56d95cf 100644 --- a/server/src/endpoints/session.ts +++ b/server/src/endpoints/session.ts @@ -6,14 +6,12 @@ export default class SessionRequestHandler extends RequestHandler { async handler(req: express.Request, res: express.Response) { const request = req as any; - const authenticated = !!(request.oidc?.user?.sub || request.session?.passport?.user?.id); - const availableServiceNames = Object.keys(config.services || {}) .filter(key => { const serviceConfig = (config.services as any)?.[key]; const apiKey = serviceConfig?.apiKey; const loginRequired = serviceConfig?.loginRequired ?? true; - return apiKey && (!loginRequired || authenticated); + return apiKey && (!loginRequired || this.userID); }); if (request.oidc) {