From 407e2f97cb27c1e3dad16c5a9b3cae94b2d0f032 Mon Sep 17 00:00:00 2001 From: hannah-macdonald1 Date: Tue, 5 Nov 2024 16:24:35 -0700 Subject: [PATCH] fix auth header name --- src/common/guards/auth/auth.service.spec.ts | 4 ++-- src/common/guards/auth/auth.service.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/common/guards/auth/auth.service.spec.ts b/src/common/guards/auth/auth.service.spec.ts index 8226d0a..f620d23 100644 --- a/src/common/guards/auth/auth.service.spec.ts +++ b/src/common/guards/auth/auth.service.spec.ts @@ -96,7 +96,7 @@ describe('AuthService', () => { path: validPath, header: jest.fn((key: string): string => { const headerVal: { [key: string]: string } = { - idir_username: testIdir, + 'x-idir-username': testIdir, }; return headerVal[key]; }), @@ -109,7 +109,7 @@ describe('AuthService', () => { it.each([ [{}, undefined, 0], - [{ idir_username: testIdir }, null, 1], + [{ 'x-idir-username': testIdir }, null, 1], ])( 'should return false with invalid record', async (headers, cacheReturn, cacheSpyCallTimes) => { diff --git a/src/common/guards/auth/auth.service.ts b/src/common/guards/auth/auth.service.ts index 103bf67..182ec42 100644 --- a/src/common/guards/auth/auth.service.ts +++ b/src/common/guards/auth/auth.service.ts @@ -36,7 +36,7 @@ export class AuthService { async getRecordAndValidate(req: Request): Promise { let idir: string, id: string, recordType: RecordType; try { - idir = req.header('idir_username').trim(); + idir = req.header('x-idir-username').trim(); [id, recordType] = this.grabRecordInfoFromPath(req.path); } catch (error: any) { this.logger.error({ error });