-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
22203bb
commit 9bb5d3f
Showing
33 changed files
with
1,039 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
apps/server/src/modules/authentication/authentication-api.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
apps/server/src/modules/authentication/controllers/dto/oidc-logout-body.params.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { ApiProperty } from '@nestjs/swagger'; | ||
import { IsString } from 'class-validator'; | ||
|
||
export class OidcLogoutBodyParams { | ||
@IsString() | ||
@ApiProperty() | ||
logout_token!: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...er/src/modules/authentication/loggable/account-system-mismatch.loggable-exception.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { ObjectId } from '@mikro-orm/mongodb'; | ||
import { AccountSystemMismatchLoggableException } from './account-system-mismatch.loggable-exception'; | ||
|
||
describe(AccountSystemMismatchLoggableException.name, () => { | ||
describe('getLogMessage', () => { | ||
const setup = () => { | ||
const expected = new ObjectId().toHexString(); | ||
const received = new ObjectId().toHexString(); | ||
|
||
const exception = new AccountSystemMismatchLoggableException(expected, received); | ||
|
||
return { | ||
exception, | ||
expected, | ||
received, | ||
}; | ||
}; | ||
|
||
it('should return the correct log message', () => { | ||
const { exception, expected, received } = setup(); | ||
|
||
const message = exception.getLogMessage(); | ||
|
||
expect(message).toEqual({ | ||
type: 'LOGIN_SYSTEM_MISMATCH', | ||
stack: expect.any(String), | ||
data: { | ||
expected, | ||
received, | ||
}, | ||
}); | ||
}); | ||
}); | ||
}); |
21 changes: 21 additions & 0 deletions
21
.../server/src/modules/authentication/loggable/account-system-mismatch.loggable-exception.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import { BadRequestException } from '@nestjs/common'; | ||
import { EntityId } from '@shared/domain/types'; | ||
import { Loggable } from '@src/core/logger/interfaces'; | ||
import { ErrorLogMessage } from '@src/core/logger/types'; | ||
|
||
export class AccountSystemMismatchLoggableException extends BadRequestException implements Loggable { | ||
constructor(private readonly expectedSystemId?: EntityId, private readonly receivedSystemId?: EntityId) { | ||
super(); | ||
} | ||
|
||
getLogMessage(): ErrorLogMessage { | ||
return { | ||
type: 'LOGIN_SYSTEM_MISMATCH', | ||
stack: this.stack, | ||
data: { | ||
expected: this.expectedSystemId, | ||
received: this.receivedSystemId, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.