From 6ddfdca12364838218ce8b7a1e479ca63af95a04 Mon Sep 17 00:00:00 2001 From: Jonah Back Date: Tue, 26 Jan 2021 16:54:52 -0800 Subject: [PATCH] fix aws alb auth provider key caching --- plugins/auth-backend/src/providers/aws-alb/provider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/auth-backend/src/providers/aws-alb/provider.ts b/plugins/auth-backend/src/providers/aws-alb/provider.ts index a5db2869b5..61ea10947e 100644 --- a/plugins/auth-backend/src/providers/aws-alb/provider.ts +++ b/plugins/auth-backend/src/providers/aws-alb/provider.ts @@ -95,13 +95,13 @@ export class AwsAlbAuthProvider implements AuthProviderRouteHandlers { async getKey(keyId: string): Promise { const optionalCacheKey = this.keyCache.get(keyId); if (optionalCacheKey) { - return optionalCacheKey; + return crypto.createPublicKey(optionalCacheKey); } const keyText: string = await fetch( `https://public-keys.auth.elb.${this.options.region}.amazonaws.com/${keyId}`, ).then(response => response.text()); const keyValue = crypto.createPublicKey(keyText); - this.keyCache.set(keyId, keyValue); + this.keyCache.set(keyId, keyValue.export({ format: 'pem', type: 'spki' })); return keyValue; } }