1 | import { Handler } from "../../handler";
|
2 | import { BaseTriggerEvent, StringMap } from "./_common";
|
3 |
|
4 | export interface GroupOverrideDetails {
|
5 | groupsToOverride?: string[] | undefined;
|
6 | iamRolesToOverride?: string[] | undefined;
|
7 | preferredRole?: string | undefined;
|
8 | }
|
9 |
|
10 | export interface BasePreTokenGenerationTriggerEvent<T extends string> extends BaseTriggerEvent<T> {
|
11 | request: {
|
12 | userAttributes: StringMap;
|
13 | groupConfiguration: GroupOverrideDetails;
|
14 | clientMetadata?: StringMap | undefined;
|
15 | };
|
16 | response: {
|
17 | claimsOverrideDetails: {
|
18 | claimsToAddOrOverride?: StringMap | undefined;
|
19 | claimsToSuppress?: string[] | undefined;
|
20 | groupOverrideDetails?: GroupOverrideDetails | undefined;
|
21 | };
|
22 | };
|
23 | }
|
24 |
|
25 | export type PreTokenGenerationHostedAuthTriggerEvent = BasePreTokenGenerationTriggerEvent<"TokenGeneration_HostedAuth">;
|
26 |
|
27 | export type PreTokenGenerationAuthenticationTriggerEvent = BasePreTokenGenerationTriggerEvent<
|
28 | "TokenGeneration_Authentication"
|
29 | >;
|
30 |
|
31 | export type PreTokenGenerationNewPasswordChallengeTriggerEvent = BasePreTokenGenerationTriggerEvent<
|
32 | "TokenGeneration_NewPasswordChallenge"
|
33 | >;
|
34 |
|
35 | export type PreTokenGenerationAuthenticateDeviceTriggerEvent = BasePreTokenGenerationTriggerEvent<
|
36 | "TokenGeneration_AuthenticateDevice"
|
37 | >;
|
38 |
|
39 | export type PreTokenGenerationRefreshTokensTriggerEvent = BasePreTokenGenerationTriggerEvent<
|
40 | "TokenGeneration_RefreshTokens"
|
41 | >;
|
42 |
|
43 |
|
44 |
|
45 |
|
46 | export type PreTokenGenerationTriggerEvent =
|
47 | | PreTokenGenerationHostedAuthTriggerEvent
|
48 | | PreTokenGenerationAuthenticationTriggerEvent
|
49 | | PreTokenGenerationNewPasswordChallengeTriggerEvent
|
50 | | PreTokenGenerationAuthenticateDeviceTriggerEvent
|
51 | | PreTokenGenerationRefreshTokensTriggerEvent;
|
52 |
|
53 | export type PreTokenGenerationTriggerHandler = Handler<PreTokenGenerationTriggerEvent>;
|