From 96e30c54ab9dd8c966b9495fdcd8e13a7f6d7545 Mon Sep 17 00:00:00 2001 From: Ryan Hanchett Date: Wed, 8 May 2024 09:12:28 -0700 Subject: [PATCH] fix: rename uri to url Signed-off-by: Ryan Hanchett --- docs/auth/service-to-service-auth.md | 6 +++--- .../src/services/implementations/auth/external/jwks.ts | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/auth/service-to-service-auth.md b/docs/auth/service-to-service-auth.md index 9ecd39ba8f..e678c82477 100644 --- a/docs/auth/service-to-service-auth.md +++ b/docs/auth/service-to-service-auth.md @@ -96,7 +96,7 @@ backend: externalAccess: - type: jwks options: - uri: https://example.com/.well-known/jwks.json + url: https://example.com/.well-known/jwks.json issuers: - https://example.com algorithms: @@ -105,12 +105,12 @@ backend: - example - type: jwks options: - uri: https://another-example.com/.well-known/jwks.json + url: https://another-example.com/.well-known/jwks.json issuers: - https://example.com ``` -The URI should point at an unauthenticated endpoint that returns the JWKS. +The URL should point at an unauthenticated endpoint that returns the JWKS. Issuers specifies the issuer(s) of the JWT that the authenticating app will accept. Passed JWTs must have an `iss` claim which matches one of the specified issuers. 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 5c3738504d..070f33ed53 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 @@ -28,26 +28,26 @@ export class JWKSHandler implements TokenHandler { algorithms: string[]; audiences: string[] | string; issuers: string[]; - uri: string; + url: string; }> = []; add(options: Config) { const algorithms = options.getOptionalStringArray('algorithms') ?? []; const issuers = options.getOptionalStringArray('issuers') ?? []; const audiences = options.getOptionalStringArray('audiences') ?? ''; - const uri = options.getString('uri'); + const url = options.getString('url'); - if (!uri.match(/^\S+$/)) { + if (!url.match(/^\S+$/)) { throw new Error('Illegal URI, must be a set of non-space characters'); } - this.#entries.push({ algorithms, audiences, issuers, uri }); + this.#entries.push({ algorithms, audiences, issuers, url }); } async verifyToken(token: string) { for (const entry of this.#entries) { try { - const jwks = createRemoteJWKSet(new URL(entry.uri)); + const jwks = createRemoteJWKSet(new URL(entry.url)); const { payload: { sub }, } = await jwtVerify(token, jwks, {