This repository has been archived by the owner on Jun 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathTypes.ts
65 lines (57 loc) · 1.59 KB
/
Types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { AccountInfo, AuthorizationUrlRequest, AuthorizationCodeRequest, SilentFlowRequest } from '@azure/msal-node';
import { TokenClaims } from '@azure/msal-common';
import { Resource } from '../config/AppSettings';
import { AppStages } from './Constants';
// extending express session
declare module 'express-session' {
interface SessionData {
id: string;
key: string;
csrfToken: string;
isAuthenticated: boolean;
hasAccess: boolean;
account: AccountInfo;
authorizationUrlRequest: AuthorizationUrlRequest;
authorizationCodeRequest: AuthorizationCodeRequest;
silentFlowRequest: SilentFlowRequest;
protectedResources?: Record<string, Resource>
}
}
// extending express request
declare module 'express' {
export interface Request {
authInfo?: object;
oboToken?: string;
oboAssertion?: string;
}
}
export type AppState = {
appStage: AppStages;
csrfToken: string;
redirectTo: string;
};
// prepare IdToken payload
export type IdTokenClaims = TokenClaims & {
aud?: string;
roles?: string[];
groups?: string[];
_claim_names?: string[];
_claim_sources?: string[];
xms_cc?: string;
acrs?: string[];
};
// prepare AccessToken payload
export type AccessTokenClaims = TokenClaims & {
scp: string;
aud?: string;
roles?: string[];
groups?: string[];
_claim_names?: string[];
_claim_sources?: string[];
xms_cc?: string;
acrs?: string[];
};