Skip to content

Commit

Permalink
Merge pull request #24 from bcgov/fix/auth-header-name
Browse files Browse the repository at this point in the history
fix auth header name
  • Loading branch information
hannah-macdonald1 authored Nov 5, 2024
2 parents 6101104 + 407e2f9 commit c9757b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/common/guards/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}),
Expand All @@ -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) => {
Expand Down
2 changes: 1 addition & 1 deletion src/common/guards/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class AuthService {
async getRecordAndValidate(req: Request): Promise<boolean> {
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 });
Expand Down

0 comments on commit c9757b4

Please sign in to comment.