From 96a6c36bb4e118da5a01319146072f18cbe00d55 Mon Sep 17 00:00:00 2001 From: Tyler Davis Date: Sat, 11 Jan 2025 08:06:39 +1100 Subject: [PATCH] simplify to always use email from cfIdentity Signed-off-by: Tyler Davis --- .../src/authenticator.test.ts | 2 +- .../src/authenticator.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.test.ts b/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.test.ts index 69fcb742e5..ea38bd5180 100644 --- a/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.test.ts +++ b/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.test.ts @@ -25,7 +25,7 @@ describe('authenticator', () => { const profile = await auth.defaultProfileTransform( { - cfIdentity: { name: 'Name' } as any, + cfIdentity: { name: 'Name', email: 'hello@example.com' } as any, claims: { email: 'hello@example.com' } as any, token: 'fake', }, diff --git a/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.ts b/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.ts index 632c439d7e..7b311a60f0 100644 --- a/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.ts +++ b/plugins/auth-backend-module-cloudflare-access-provider/src/authenticator.ts @@ -38,7 +38,7 @@ export function createCloudflareAccessAuthenticator(options?: { async defaultProfileTransform(result: CloudflareAccessResult) { return { profile: { - email: result.claims.email ?? result.cfIdentity.email, + email: result.cfIdentity.email, displayName: result.cfIdentity.name, }, };