-
Notifications
You must be signed in to change notification settings - Fork 66
/
index.d.ts
148 lines (128 loc) · 3.53 KB
/
index.d.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
// example response
// resp = {
// token: 'eyJ0eXAiOiJKV1QiLCJub...',
// account: {
// id: 'abc-someguid-123',
// username: 'wrobins@myemailaddr.com',
// claims: [
// {key: "name", value: "Robins, Walter"},
// {key: "ver", value: "2.0"},
// { ... }
// ]
// }
// }
/**
* Azure AD Authory listings
*
* As per https://docs.microsoft.com/en-us/azure/active-directory/develop/msal-configuration
*/
interface JwtClaim {
key: string;
value: string | string[];
}
interface JwtAccount {
id: string;
username: string;
claims: JwtClaim[];
}
interface JwtToken {
token: string;
idToken: string;
account: JwtAccount;
}
interface AzureADB2CAccount {
id: string;
username: string;
claims: JwtClaim[];
}
type AzureADAuthority =
| {
type: "AAD";
audience:
| "AzureADandPersonalMicrosoftAccount"
| "AzureADMyOrg"
| "AzureADMultipleOrgs"
| "PersonalMicrosoftAccount";
/** default value: MSALAzurePublicCloudInstance */
cloudInstance?: string;
default?: boolean;
}
| {
type: "B2C";
authorityUrl: string;
/** default value: MSALAzurePublicCloudInstance */
cloudInstance?: string;
default: boolean;
};
interface InitOptions {
authorities: Array<AzureADAuthority>;
authorizationUserAgent?: "DEFAULT" | "WEBVIEW" | "BROWSER";
/** Default value is false */
multipleCloudsSupported?: boolean;
/** Default value is false */
brokerRedirectUri?: boolean;
/** Sets app account mode
*
* https://docs.microsoft.com/en-us/azure/active-directory/develop/single-multi-account
*
* Default value is "MULTIPLE"
*/
accountMode?: "SINGLE" | "MULTIPLE";
/**
* Scopes to request
*
* A common list of these can be found at
* https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-permissions-and-consent#openid-connect-scopes
*/
scopes: Array<string>;
/** Optional clientId and tenantId to support changing B2C tenants on the fly.
*
* These values, if provided, will override the ones provided in your package.json file.
* If you do not wish to support multiple tenants, you can leave these out and the ones
* provided in your package.json will be used as they always were. No change required.
*/
clientId?: string;
tenantId?: string;
/** ANDROID ONLY: Optional zoom controls for defining web view behavior */
webViewZoomControlsEnabled?: boolean;
webViewZoomEnabled?: boolean;
/** ANDROID ONLY: Check power optimization setting before attempting network in doze mode (default: true) */
powerOptCheckForNetworkReqEnabled?: boolean;
}
interface InteractiveSignInOptions {
loginHint: string;
/** Default value is "WHEN_REQUIRED" */
prompt:
| "SELECT_ACCOUNT"
| "LOGIN"
| "CONSENT"
| "WHEN_REQUIRED";
authorizationQueryStringParameters: string;
otherScopesToAuthorize: string;
webViewType: string;
}
interface MSALPlugin {
msalInit(success: () => any, error: (err: any) => any, options: InitOptions);
signInSilent(
success: (resp: JwtToken) => any,
error: (err: any) => any,
accountId?: string
);
signInInteractive(
success: (resp: JwtToken) => any,
error: (err: any) => any,
signInOptions?: Partial<InteractiveSignInOptions>
);
signOut(
success: (resp: JwtToken) => any,
error: (err: any) => any,
accountId?: any
);
getAccounts(
success: (resp: AzureADB2CAccount[]) => any,
error: (err: any) => any
);
}
interface CordovaPlugins {
msalPlugin: MSALPlugin;
}