From 8443332f72f5c90bf53724433bcef44ec755bba7 Mon Sep 17 00:00:00 2001 From: Ryan Hanchett Date: Wed, 8 May 2024 09:18:06 -0700 Subject: [PATCH] fix: default to undefined for algo, iss and aud fields if not set in config Signed-off-by: Ryan Hanchett --- .../services/implementations/auth/external/jwks.ts | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/backend-app-api/src/services/implementations/auth/external/jwks.ts b/packages/backend-app-api/src/services/implementations/auth/external/jwks.ts index 070f33ed53..dd3df07435 100644 --- a/packages/backend-app-api/src/services/implementations/auth/external/jwks.ts +++ b/packages/backend-app-api/src/services/implementations/auth/external/jwks.ts @@ -25,20 +25,20 @@ import { TokenHandler } from './types'; */ export class JWKSHandler implements TokenHandler { #entries: Array<{ - algorithms: string[]; - audiences: string[] | string; - issuers: string[]; + algorithms: string[] | undefined; + audiences: string[] | undefined; + issuers: string[] | undefined; url: string; }> = []; add(options: Config) { - const algorithms = options.getOptionalStringArray('algorithms') ?? []; - const issuers = options.getOptionalStringArray('issuers') ?? []; - const audiences = options.getOptionalStringArray('audiences') ?? ''; + const algorithms = options.getOptionalStringArray('algorithms'); + const issuers = options.getOptionalStringArray('issuers'); + const audiences = options.getOptionalStringArray('audiences'); const url = options.getString('url'); if (!url.match(/^\S+$/)) { - throw new Error('Illegal URI, must be a set of non-space characters'); + throw new Error('Illegal URL, must be a set of non-space characters'); } this.#entries.push({ algorithms, audiences, issuers, url });