@azure/msal-browser 3.0.0-alpha.2 → 3.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/app/IPublicClientApplication.js +1 -1
- package/dist/app/PublicClientApplication.js +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +1 -2
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +2 -3
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/CryptoKeyStore.d.ts +5 -4
- package/dist/cache/CryptoKeyStore.d.ts.map +1 -1
- package/dist/cache/CryptoKeyStore.js +5 -6
- package/dist/cache/CryptoKeyStore.js.map +1 -1
- package/dist/cache/DatabaseStorage.js +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.js +1 -1
- package/dist/config/Configuration.d.ts +0 -16
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +2 -6
- package/dist/config/Configuration.js.map +1 -1
- package/dist/controllers/ControllerFactory.js +1 -1
- package/dist/controllers/IController.d.ts +1 -1
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/StandardController.d.ts +2 -2
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.js +13 -8
- package/dist/controllers/StandardController.js.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +1 -13
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.js +4 -45
- package/dist/crypto/BrowserCrypto.js.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -2
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +3 -3
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.js +1 -1
- package/dist/crypto/ModernBrowserCrypto.js +1 -1
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.js +1 -1
- package/dist/encode/Base64Encode.js +1 -1
- package/dist/error/BrowserAuthError.js +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/error/NativeAuthError.d.ts +14 -13
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.js +16 -11
- package/dist/error/NativeAuthError.js.map +1 -1
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.d.ts.map +1 -1
- package/dist/event/EventMessage.js +2 -1
- package/dist/event/EventMessage.js.map +1 -1
- package/dist/event/EventType.d.ts +28 -26
- package/dist/event/EventType.d.ts.map +1 -1
- package/dist/event/EventType.js +28 -28
- package/dist/event/EventType.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +15 -2
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +14 -10
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
- package/dist/interaction_client/PopupClient.js +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +3 -2
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
- package/dist/interaction_client/SilentCacheClient.js +2 -2
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +2 -2
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/internals.js +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.js +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/operatingcontext/BaseOperatingContext.js +1 -1
- package/dist/operatingcontext/StandardOperatingContext.js +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/telemetry/BrowserPerformanceClient.d.ts +1 -2
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +3 -3
- package/dist/telemetry/BrowserPerformanceClient.js.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
- package/dist/utils/BrowserConstants.d.ts +82 -72
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +73 -83
- package/dist/utils/BrowserConstants.js.map +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.cjs.js +817 -973
- package/lib/msal-browser.cjs.js.map +1 -1
- package/lib/msal-browser.js +817 -973
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +62 -73
- package/package.json +8 -4
- package/dist/crypto/MsBrowserCrypto.d.ts +0 -10
- package/dist/crypto/MsBrowserCrypto.d.ts.map +0 -1
- package/dist/crypto/MsBrowserCrypto.js +0 -88
- package/dist/crypto/MsBrowserCrypto.js.map +0 -1
- package/dist/crypto/MsrBrowserCrypto.d.ts +0 -18
- package/dist/crypto/MsrBrowserCrypto.d.ts.map +0 -1
- package/dist/crypto/MsrBrowserCrypto.js +0 -35
- package/dist/crypto/MsrBrowserCrypto.js.map +0 -1
package/lib/msal-browser.cjs.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0.0-
|
|
1
|
+
/*! @azure/msal-browser v3.0.0-beta.0 2023-06-19 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v14.0.0-
|
|
5
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -75,100 +75,95 @@ const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, Constants.EMAIL_SCOPE];
|
|
|
75
75
|
/**
|
|
76
76
|
* Request header names
|
|
77
77
|
*/
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
})(HeaderNames || (HeaderNames = {}));
|
|
78
|
+
const HeaderNames = {
|
|
79
|
+
CONTENT_TYPE: "Content-Type",
|
|
80
|
+
RETRY_AFTER: "Retry-After",
|
|
81
|
+
CCS_HEADER: "X-AnchorMailbox",
|
|
82
|
+
WWWAuthenticate: "WWW-Authenticate",
|
|
83
|
+
AuthenticationInfo: "Authentication-Info",
|
|
84
|
+
X_MS_REQUEST_ID: "x-ms-request-id",
|
|
85
|
+
X_MS_HTTP_VERSION: "x-ms-httpver",
|
|
86
|
+
};
|
|
88
87
|
/**
|
|
89
88
|
* Persistent cache keys MSAL which stay while user is logged in.
|
|
90
89
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
})(PersistentCacheKeys || (PersistentCacheKeys = {}));
|
|
90
|
+
const PersistentCacheKeys = {
|
|
91
|
+
ID_TOKEN: "idtoken",
|
|
92
|
+
CLIENT_INFO: "client.info",
|
|
93
|
+
ADAL_ID_TOKEN: "adal.idtoken",
|
|
94
|
+
ERROR: "error",
|
|
95
|
+
ERROR_DESC: "error.description",
|
|
96
|
+
ACTIVE_ACCOUNT: "active-account",
|
|
97
|
+
ACTIVE_ACCOUNT_FILTERS: "active-account-filters", // new cache entry for active_account for a more robust version for browser
|
|
98
|
+
};
|
|
101
99
|
/**
|
|
102
100
|
* String constants related to AAD Authority
|
|
103
101
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
})(AADAuthorityConstants || (AADAuthorityConstants = {}));
|
|
102
|
+
const AADAuthorityConstants = {
|
|
103
|
+
COMMON: "common",
|
|
104
|
+
ORGANIZATIONS: "organizations",
|
|
105
|
+
CONSUMERS: "consumers",
|
|
106
|
+
};
|
|
110
107
|
/**
|
|
111
108
|
* Keys in the hashParams sent by AAD Server
|
|
112
109
|
*/
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
110
|
+
const AADServerParamKeys = {
|
|
111
|
+
CLIENT_ID: "client_id",
|
|
112
|
+
REDIRECT_URI: "redirect_uri",
|
|
113
|
+
RESPONSE_TYPE: "response_type",
|
|
114
|
+
RESPONSE_MODE: "response_mode",
|
|
115
|
+
GRANT_TYPE: "grant_type",
|
|
116
|
+
CLAIMS: "claims",
|
|
117
|
+
SCOPE: "scope",
|
|
118
|
+
ERROR: "error",
|
|
119
|
+
ERROR_DESCRIPTION: "error_description",
|
|
120
|
+
ACCESS_TOKEN: "access_token",
|
|
121
|
+
ID_TOKEN: "id_token",
|
|
122
|
+
REFRESH_TOKEN: "refresh_token",
|
|
123
|
+
EXPIRES_IN: "expires_in",
|
|
124
|
+
STATE: "state",
|
|
125
|
+
NONCE: "nonce",
|
|
126
|
+
PROMPT: "prompt",
|
|
127
|
+
SESSION_STATE: "session_state",
|
|
128
|
+
CLIENT_INFO: "client_info",
|
|
129
|
+
CODE: "code",
|
|
130
|
+
CODE_CHALLENGE: "code_challenge",
|
|
131
|
+
CODE_CHALLENGE_METHOD: "code_challenge_method",
|
|
132
|
+
CODE_VERIFIER: "code_verifier",
|
|
133
|
+
CLIENT_REQUEST_ID: "client-request-id",
|
|
134
|
+
X_CLIENT_SKU: "x-client-SKU",
|
|
135
|
+
X_CLIENT_VER: "x-client-VER",
|
|
136
|
+
X_CLIENT_OS: "x-client-OS",
|
|
137
|
+
X_CLIENT_CPU: "x-client-CPU",
|
|
138
|
+
X_CLIENT_CURR_TELEM: "x-client-current-telemetry",
|
|
139
|
+
X_CLIENT_LAST_TELEM: "x-client-last-telemetry",
|
|
140
|
+
X_MS_LIB_CAPABILITY: "x-ms-lib-capability",
|
|
141
|
+
X_APP_NAME: "x-app-name",
|
|
142
|
+
X_APP_VER: "x-app-ver",
|
|
143
|
+
POST_LOGOUT_URI: "post_logout_redirect_uri",
|
|
144
|
+
ID_TOKEN_HINT: "id_token_hint",
|
|
145
|
+
DEVICE_CODE: "device_code",
|
|
146
|
+
CLIENT_SECRET: "client_secret",
|
|
147
|
+
CLIENT_ASSERTION: "client_assertion",
|
|
148
|
+
CLIENT_ASSERTION_TYPE: "client_assertion_type",
|
|
149
|
+
TOKEN_TYPE: "token_type",
|
|
150
|
+
REQ_CNF: "req_cnf",
|
|
151
|
+
OBO_ASSERTION: "assertion",
|
|
152
|
+
REQUESTED_TOKEN_USE: "requested_token_use",
|
|
153
|
+
ON_BEHALF_OF: "on_behalf_of",
|
|
154
|
+
FOCI: "foci",
|
|
155
|
+
CCS_HEADER: "X-AnchorMailbox",
|
|
156
|
+
RETURN_SPA_CODE: "return_spa_code",
|
|
157
|
+
NATIVE_BROKER: "nativebroker",
|
|
158
|
+
LOGOUT_HINT: "logout_hint",
|
|
159
|
+
};
|
|
164
160
|
/**
|
|
165
161
|
* Claims request keys
|
|
166
162
|
*/
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
})(ClaimsRequestKeys || (ClaimsRequestKeys = {}));
|
|
163
|
+
const ClaimsRequestKeys = {
|
|
164
|
+
ACCESS_TOKEN: "access_token",
|
|
165
|
+
XMS_CC: "xms_cc",
|
|
166
|
+
};
|
|
172
167
|
/**
|
|
173
168
|
* we considered making this "enum" in the request instead of string, however it looks like the allowed list of
|
|
174
169
|
* prompt values kept changing over past couple of years. There are some undocumented prompt values for some
|
|
@@ -185,18 +180,17 @@ const PromptValue = {
|
|
|
185
180
|
/**
|
|
186
181
|
* SSO Types - generated to populate hints
|
|
187
182
|
*/
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
})(SSOTypes || (SSOTypes = {}));
|
|
183
|
+
const SSOTypes = {
|
|
184
|
+
ACCOUNT: "account",
|
|
185
|
+
SID: "sid",
|
|
186
|
+
LOGIN_HINT: "login_hint",
|
|
187
|
+
ID_TOKEN: "id_token",
|
|
188
|
+
DOMAIN_HINT: "domain_hint",
|
|
189
|
+
ORGANIZATIONS: "organizations",
|
|
190
|
+
CONSUMERS: "consumers",
|
|
191
|
+
ACCOUNT_ID: "accountIdentifier",
|
|
192
|
+
HOMEACCOUNT_ID: "homeAccountIdentifier",
|
|
193
|
+
};
|
|
200
194
|
/**
|
|
201
195
|
* allowed values for codeVerifier
|
|
202
196
|
*/
|
|
@@ -207,68 +201,62 @@ const CodeChallengeMethodValues = {
|
|
|
207
201
|
/**
|
|
208
202
|
* allowed values for response_mode
|
|
209
203
|
*/
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
})(ResponseMode || (ResponseMode = {}));
|
|
204
|
+
const ResponseMode = {
|
|
205
|
+
QUERY: "query",
|
|
206
|
+
FRAGMENT: "fragment",
|
|
207
|
+
FORM_POST: "form_post",
|
|
208
|
+
};
|
|
216
209
|
/**
|
|
217
210
|
* allowed grant_type
|
|
218
211
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
})(GrantType || (GrantType = {}));
|
|
212
|
+
const GrantType = {
|
|
213
|
+
IMPLICIT_GRANT: "implicit",
|
|
214
|
+
AUTHORIZATION_CODE_GRANT: "authorization_code",
|
|
215
|
+
CLIENT_CREDENTIALS_GRANT: "client_credentials",
|
|
216
|
+
RESOURCE_OWNER_PASSWORD_GRANT: "password",
|
|
217
|
+
REFRESH_TOKEN_GRANT: "refresh_token",
|
|
218
|
+
DEVICE_CODE_GRANT: "device_code",
|
|
219
|
+
JWT_BEARER: "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
220
|
+
};
|
|
229
221
|
/**
|
|
230
222
|
* Account types in Cache
|
|
231
223
|
*/
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
})(CacheAccountType || (CacheAccountType = {}));
|
|
224
|
+
const CacheAccountType = {
|
|
225
|
+
MSSTS_ACCOUNT_TYPE: "MSSTS",
|
|
226
|
+
ADFS_ACCOUNT_TYPE: "ADFS",
|
|
227
|
+
MSAV1_ACCOUNT_TYPE: "MSA",
|
|
228
|
+
GENERIC_ACCOUNT_TYPE: "Generic", // NTLM, Kerberos, FBA, Basic etc
|
|
229
|
+
};
|
|
239
230
|
/**
|
|
240
231
|
* Separators used in cache
|
|
241
232
|
*/
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
})(Separators || (Separators = {}));
|
|
233
|
+
const Separators = {
|
|
234
|
+
CACHE_KEY_SEPARATOR: "-",
|
|
235
|
+
CLIENT_INFO_SEPARATOR: ".",
|
|
236
|
+
};
|
|
247
237
|
/**
|
|
248
238
|
* Credential Type stored in the cache
|
|
249
239
|
*/
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
})(CredentialType || (CredentialType = {}));
|
|
240
|
+
const CredentialType = {
|
|
241
|
+
ID_TOKEN: "IdToken",
|
|
242
|
+
ACCESS_TOKEN: "AccessToken",
|
|
243
|
+
ACCESS_TOKEN_WITH_AUTH_SCHEME: "AccessToken_With_AuthScheme",
|
|
244
|
+
REFRESH_TOKEN: "RefreshToken",
|
|
245
|
+
};
|
|
257
246
|
/**
|
|
258
247
|
* Combine all cache types
|
|
259
248
|
*/
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
})(CacheType || (CacheType = {}));
|
|
249
|
+
const CacheType = {
|
|
250
|
+
ADFS: 1001,
|
|
251
|
+
MSA: 1002,
|
|
252
|
+
MSSTS: 1003,
|
|
253
|
+
GENERIC: 1004,
|
|
254
|
+
ACCESS_TOKEN: 2001,
|
|
255
|
+
REFRESH_TOKEN: 2002,
|
|
256
|
+
ID_TOKEN: 2003,
|
|
257
|
+
APP_METADATA: 3001,
|
|
258
|
+
UNDEFINED: 9999,
|
|
259
|
+
};
|
|
272
260
|
/**
|
|
273
261
|
* More Cache related constants
|
|
274
262
|
*/
|
|
@@ -279,13 +267,12 @@ const AUTHORITY_METADATA_CONSTANTS = {
|
|
|
279
267
|
CACHE_KEY: "authority-metadata",
|
|
280
268
|
REFRESH_TIME_SECONDS: 3600 * 24, // 24 Hours
|
|
281
269
|
};
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
})(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
|
|
270
|
+
const AuthorityMetadataSource = {
|
|
271
|
+
CONFIG: "config",
|
|
272
|
+
CACHE: "cache",
|
|
273
|
+
NETWORK: "network",
|
|
274
|
+
HARDCODED_VALUES: "hardcoded_values",
|
|
275
|
+
};
|
|
289
276
|
const SERVER_TELEM_CONSTANTS = {
|
|
290
277
|
SCHEMA_VERSION: 5,
|
|
291
278
|
MAX_CUR_HEADER_BYTES: 80,
|
|
@@ -301,12 +288,11 @@ const SERVER_TELEM_CONSTANTS = {
|
|
|
301
288
|
/**
|
|
302
289
|
* Type of the authentication request
|
|
303
290
|
*/
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
})(exports.AuthenticationScheme || (exports.AuthenticationScheme = {}));
|
|
291
|
+
const AuthenticationScheme = {
|
|
292
|
+
BEARER: "Bearer",
|
|
293
|
+
POP: "pop",
|
|
294
|
+
SSH: "ssh-cert",
|
|
295
|
+
};
|
|
310
296
|
/**
|
|
311
297
|
* Constants related to throttling
|
|
312
298
|
*/
|
|
@@ -327,56 +313,50 @@ const Errors = {
|
|
|
327
313
|
/**
|
|
328
314
|
* Password grant parameters
|
|
329
315
|
*/
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
})(PasswordGrantConstants || (PasswordGrantConstants = {}));
|
|
316
|
+
const PasswordGrantConstants = {
|
|
317
|
+
username: "username",
|
|
318
|
+
password: "password",
|
|
319
|
+
};
|
|
335
320
|
/**
|
|
336
321
|
* Response codes
|
|
337
322
|
*/
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
})(ResponseCodes || (ResponseCodes = {}));
|
|
323
|
+
const ResponseCodes = {
|
|
324
|
+
httpSuccess: 200,
|
|
325
|
+
httpBadRequest: 400,
|
|
326
|
+
};
|
|
343
327
|
/**
|
|
344
328
|
* Region Discovery Sources
|
|
345
329
|
*/
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
})(RegionDiscoverySources || (RegionDiscoverySources = {}));
|
|
330
|
+
const RegionDiscoverySources = {
|
|
331
|
+
FAILED_AUTO_DETECTION: "1",
|
|
332
|
+
INTERNAL_CACHE: "2",
|
|
333
|
+
ENVIRONMENT_VARIABLE: "3",
|
|
334
|
+
IMDS: "4",
|
|
335
|
+
};
|
|
353
336
|
/**
|
|
354
337
|
* Region Discovery Outcomes
|
|
355
338
|
*/
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
JsonTypes["Jwk"] = "JWK";
|
|
376
|
-
JsonTypes["Pop"] = "pop";
|
|
377
|
-
})(JsonTypes || (JsonTypes = {}));
|
|
339
|
+
const RegionDiscoveryOutcomes = {
|
|
340
|
+
CONFIGURED_MATCHES_DETECTED: "1",
|
|
341
|
+
CONFIGURED_NO_AUTO_DETECTION: "2",
|
|
342
|
+
CONFIGURED_NOT_DETECTED: "3",
|
|
343
|
+
AUTO_DETECTION_REQUESTED_SUCCESSFUL: "4",
|
|
344
|
+
AUTO_DETECTION_REQUESTED_FAILED: "5",
|
|
345
|
+
};
|
|
346
|
+
const CacheOutcome = {
|
|
347
|
+
NO_CACHE_HIT: "0",
|
|
348
|
+
FORCE_REFRESH: "1",
|
|
349
|
+
NO_CACHED_ACCESS_TOKEN: "2",
|
|
350
|
+
CACHED_ACCESS_TOKEN_EXPIRED: "3",
|
|
351
|
+
REFRESH_CACHED_ACCESS_TOKEN: "4",
|
|
352
|
+
};
|
|
353
|
+
const JsonTypes = {
|
|
354
|
+
Jwt: "JWT",
|
|
355
|
+
Jwk: "JWK",
|
|
356
|
+
Pop: "pop",
|
|
357
|
+
};
|
|
378
358
|
|
|
379
|
-
/*! @azure/msal-common v14.0.0-
|
|
359
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
380
360
|
|
|
381
361
|
/*
|
|
382
362
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -430,7 +410,7 @@ class AuthError extends Error {
|
|
|
430
410
|
}
|
|
431
411
|
}
|
|
432
412
|
|
|
433
|
-
/*! @azure/msal-common v14.0.0-
|
|
413
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
434
414
|
|
|
435
415
|
/*
|
|
436
416
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -475,7 +455,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
475
455
|
},
|
|
476
456
|
};
|
|
477
457
|
|
|
478
|
-
/*! @azure/msal-common v14.0.0-
|
|
458
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
479
459
|
|
|
480
460
|
/*
|
|
481
461
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -997,7 +977,7 @@ class ClientAuthError extends AuthError {
|
|
|
997
977
|
}
|
|
998
978
|
}
|
|
999
979
|
|
|
1000
|
-
/*! @azure/msal-common v14.0.0-
|
|
980
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1001
981
|
|
|
1002
982
|
/*
|
|
1003
983
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1124,7 +1104,7 @@ class StringUtils {
|
|
|
1124
1104
|
}
|
|
1125
1105
|
}
|
|
1126
1106
|
|
|
1127
|
-
/*! @azure/msal-common v14.0.0-
|
|
1107
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1128
1108
|
|
|
1129
1109
|
/*
|
|
1130
1110
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1324,33 +1304,32 @@ class Logger {
|
|
|
1324
1304
|
}
|
|
1325
1305
|
}
|
|
1326
1306
|
|
|
1327
|
-
/*! @azure/msal-common v14.0.0-
|
|
1307
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1328
1308
|
/* eslint-disable header/header */
|
|
1329
1309
|
const name$1 = "@azure/msal-common";
|
|
1330
|
-
const version$1 = "14.0.0-
|
|
1310
|
+
const version$1 = "14.0.0-beta.0";
|
|
1331
1311
|
|
|
1332
|
-
/*! @azure/msal-common v14.0.0-
|
|
1312
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1333
1313
|
/*
|
|
1334
1314
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1335
1315
|
* Licensed under the MIT License.
|
|
1336
1316
|
*/
|
|
1337
|
-
|
|
1338
|
-
(function (AzureCloudInstance) {
|
|
1317
|
+
const AzureCloudInstance = {
|
|
1339
1318
|
// AzureCloudInstance is not specified.
|
|
1340
|
-
|
|
1319
|
+
None: "none",
|
|
1341
1320
|
// Microsoft Azure public cloud
|
|
1342
|
-
|
|
1321
|
+
AzurePublic: "https://login.microsoftonline.com",
|
|
1343
1322
|
// Microsoft PPE
|
|
1344
|
-
|
|
1323
|
+
AzurePpe: "https://login.windows-ppe.net",
|
|
1345
1324
|
// Microsoft Chinese national cloud
|
|
1346
|
-
|
|
1325
|
+
AzureChina: "https://login.chinacloudapi.cn",
|
|
1347
1326
|
// Microsoft German national cloud ("Black Forest")
|
|
1348
|
-
|
|
1327
|
+
AzureGermany: "https://login.microsoftonline.de",
|
|
1349
1328
|
// US Government cloud
|
|
1350
|
-
|
|
1351
|
-
}
|
|
1329
|
+
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1330
|
+
};
|
|
1352
1331
|
|
|
1353
|
-
/*! @azure/msal-common v14.0.0-
|
|
1332
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1354
1333
|
|
|
1355
1334
|
/*
|
|
1356
1335
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1450,8 +1429,12 @@ const ClientConfigurationErrorMessage = {
|
|
|
1450
1429
|
},
|
|
1451
1430
|
invalidAuthenticationHeader: {
|
|
1452
1431
|
code: "invalid_authentication_header",
|
|
1453
|
-
desc: "Invalid authentication header provided"
|
|
1432
|
+
desc: "Invalid authentication header provided"
|
|
1454
1433
|
},
|
|
1434
|
+
authorityMismatch: {
|
|
1435
|
+
code: "authority_mismatch",
|
|
1436
|
+
desc: "Authority mismatch error. Authority provided in login request or PublicClientApplication config does not match the environment of the provided account. Please use a matching account or make an interactive request to login to this authority."
|
|
1437
|
+
}
|
|
1455
1438
|
};
|
|
1456
1439
|
/**
|
|
1457
1440
|
* Error thrown when there is an error in configuration of the MSAL.js library.
|
|
@@ -1600,9 +1583,15 @@ class ClientConfigurationError extends ClientAuthError {
|
|
|
1600
1583
|
static createInvalidAuthenticationHeaderError(invalidHeaderName, details) {
|
|
1601
1584
|
return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, `${ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc}. Invalid header: ${invalidHeaderName}. Details: ${details}`);
|
|
1602
1585
|
}
|
|
1586
|
+
/**
|
|
1587
|
+
* Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
|
|
1588
|
+
*/
|
|
1589
|
+
static createAuthorityMismatchError() {
|
|
1590
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);
|
|
1591
|
+
}
|
|
1603
1592
|
}
|
|
1604
1593
|
|
|
1605
|
-
/*! @azure/msal-common v14.0.0-
|
|
1594
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1606
1595
|
|
|
1607
1596
|
/*
|
|
1608
1597
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1802,7 +1791,7 @@ class ScopeSet {
|
|
|
1802
1791
|
}
|
|
1803
1792
|
}
|
|
1804
1793
|
|
|
1805
|
-
/*! @azure/msal-common v14.0.0-
|
|
1794
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1806
1795
|
|
|
1807
1796
|
/*
|
|
1808
1797
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1842,7 +1831,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
1842
1831
|
};
|
|
1843
1832
|
}
|
|
1844
1833
|
|
|
1845
|
-
/*! @azure/msal-common v14.0.0-
|
|
1834
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1846
1835
|
/*
|
|
1847
1836
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1848
1837
|
* Licensed under the MIT License.
|
|
@@ -1850,15 +1839,14 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
1850
1839
|
/**
|
|
1851
1840
|
* Authority types supported by MSAL.
|
|
1852
1841
|
*/
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
})(AuthorityType || (AuthorityType = {}));
|
|
1842
|
+
const AuthorityType = {
|
|
1843
|
+
Default: 0,
|
|
1844
|
+
Adfs: 1,
|
|
1845
|
+
Dsts: 2,
|
|
1846
|
+
Ciam: 3
|
|
1847
|
+
};
|
|
1860
1848
|
|
|
1861
|
-
/*! @azure/msal-common v14.0.0-
|
|
1849
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
1862
1850
|
|
|
1863
1851
|
/*
|
|
1864
1852
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2109,7 +2097,7 @@ class AccountEntity {
|
|
|
2109
2097
|
}
|
|
2110
2098
|
}
|
|
2111
2099
|
|
|
2112
|
-
/*! @azure/msal-common v14.0.0-
|
|
2100
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
2113
2101
|
|
|
2114
2102
|
/*
|
|
2115
2103
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2160,7 +2148,7 @@ class AuthToken {
|
|
|
2160
2148
|
}
|
|
2161
2149
|
}
|
|
2162
2150
|
|
|
2163
|
-
/*! @azure/msal-common v14.0.0-
|
|
2151
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
2164
2152
|
|
|
2165
2153
|
/*
|
|
2166
2154
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2442,7 +2430,7 @@ class CacheManager {
|
|
|
2442
2430
|
return false;
|
|
2443
2431
|
}
|
|
2444
2432
|
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
|
|
2445
|
-
if (filter.tokenType ===
|
|
2433
|
+
if (filter.tokenType === AuthenticationScheme.SSH) {
|
|
2446
2434
|
if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
|
|
2447
2435
|
return false;
|
|
2448
2436
|
}
|
|
@@ -2570,7 +2558,7 @@ class CacheManager {
|
|
|
2570
2558
|
// Remove Token Binding Key from key store for PoP Tokens Credentials
|
|
2571
2559
|
if (credential.credentialType.toLowerCase() ===
|
|
2572
2560
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
|
|
2573
|
-
if (credential.tokenType ===
|
|
2561
|
+
if (credential.tokenType === AuthenticationScheme.POP) {
|
|
2574
2562
|
const accessTokenWithAuthSchemeEntity = credential;
|
|
2575
2563
|
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
2576
2564
|
if (kid) {
|
|
@@ -2722,14 +2710,14 @@ class CacheManager {
|
|
|
2722
2710
|
getAccessToken(account, request, tokenKeys) {
|
|
2723
2711
|
this.commonLogger.trace("CacheManager - getAccessToken called");
|
|
2724
2712
|
const scopes = ScopeSet.createSearchScopes(request.scopes);
|
|
2725
|
-
const authScheme = request.authenticationScheme ||
|
|
2713
|
+
const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
|
|
2726
2714
|
/*
|
|
2727
2715
|
* Distinguish between Bearer and PoP/SSH token cache types
|
|
2728
2716
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
2729
2717
|
*/
|
|
2730
2718
|
const credentialType = authScheme &&
|
|
2731
2719
|
authScheme.toLowerCase() !==
|
|
2732
|
-
|
|
2720
|
+
AuthenticationScheme.BEARER.toLowerCase()
|
|
2733
2721
|
? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
|
|
2734
2722
|
: CredentialType.ACCESS_TOKEN;
|
|
2735
2723
|
const accessTokenFilter = {
|
|
@@ -3174,7 +3162,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
3174
3162
|
}
|
|
3175
3163
|
}
|
|
3176
3164
|
|
|
3177
|
-
/*! @azure/msal-common v14.0.0-
|
|
3165
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3178
3166
|
|
|
3179
3167
|
/*
|
|
3180
3168
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3215,7 +3203,7 @@ const DEFAULT_CLIENT_CREDENTIALS = {
|
|
|
3215
3203
|
clientAssertion: undefined,
|
|
3216
3204
|
};
|
|
3217
3205
|
const DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
3218
|
-
azureCloudInstance:
|
|
3206
|
+
azureCloudInstance: AzureCloudInstance.None,
|
|
3219
3207
|
tenant: `${Constants.DEFAULT_COMMON_TENANT}`,
|
|
3220
3208
|
};
|
|
3221
3209
|
const DEFAULT_TELEMETRY_OPTIONS = {
|
|
@@ -3265,7 +3253,7 @@ function buildAuthOptions(authOptions) {
|
|
|
3265
3253
|
};
|
|
3266
3254
|
}
|
|
3267
3255
|
|
|
3268
|
-
/*! @azure/msal-common v14.0.0-
|
|
3256
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3269
3257
|
|
|
3270
3258
|
/*
|
|
3271
3259
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3282,7 +3270,7 @@ class ServerError extends AuthError {
|
|
|
3282
3270
|
}
|
|
3283
3271
|
}
|
|
3284
3272
|
|
|
3285
|
-
/*! @azure/msal-common v14.0.0-
|
|
3273
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3286
3274
|
|
|
3287
3275
|
/*
|
|
3288
3276
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3379,7 +3367,7 @@ class ThrottlingUtils {
|
|
|
3379
3367
|
}
|
|
3380
3368
|
}
|
|
3381
3369
|
|
|
3382
|
-
/*! @azure/msal-common v14.0.0-
|
|
3370
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3383
3371
|
|
|
3384
3372
|
/*
|
|
3385
3373
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3415,18 +3403,17 @@ class NetworkManager {
|
|
|
3415
3403
|
}
|
|
3416
3404
|
}
|
|
3417
3405
|
|
|
3418
|
-
/*! @azure/msal-common v14.0.0-
|
|
3406
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3419
3407
|
/*
|
|
3420
3408
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3421
3409
|
* Licensed under the MIT License.
|
|
3422
3410
|
*/
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3411
|
+
const CcsCredentialType = {
|
|
3412
|
+
HOME_ACCOUNT_ID: "home_account_id",
|
|
3413
|
+
UPN: "UPN",
|
|
3414
|
+
};
|
|
3428
3415
|
|
|
3429
|
-
/*! @azure/msal-common v14.0.0-
|
|
3416
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3430
3417
|
|
|
3431
3418
|
/*
|
|
3432
3419
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3507,12 +3494,11 @@ class RequestValidator {
|
|
|
3507
3494
|
}
|
|
3508
3495
|
});
|
|
3509
3496
|
// remove empty string parameters
|
|
3510
|
-
return Object.fromEntries(Object.entries(eQParams).filter(
|
|
3511
|
-
);
|
|
3497
|
+
return Object.fromEntries(Object.entries(eQParams).filter(kv => kv[1] !== ""));
|
|
3512
3498
|
}
|
|
3513
3499
|
}
|
|
3514
3500
|
|
|
3515
|
-
/*! @azure/msal-common v14.0.0-
|
|
3501
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3516
3502
|
|
|
3517
3503
|
/*
|
|
3518
3504
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3844,7 +3830,7 @@ class RequestParameterBuilder {
|
|
|
3844
3830
|
*/
|
|
3845
3831
|
addPopToken(cnfString) {
|
|
3846
3832
|
if (!StringUtils.isEmpty(cnfString)) {
|
|
3847
|
-
this.parameters.set(AADServerParamKeys.TOKEN_TYPE,
|
|
3833
|
+
this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.POP);
|
|
3848
3834
|
this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));
|
|
3849
3835
|
}
|
|
3850
3836
|
}
|
|
@@ -3853,7 +3839,7 @@ class RequestParameterBuilder {
|
|
|
3853
3839
|
*/
|
|
3854
3840
|
addSshJwk(sshJwkString) {
|
|
3855
3841
|
if (!StringUtils.isEmpty(sshJwkString)) {
|
|
3856
|
-
this.parameters.set(AADServerParamKeys.TOKEN_TYPE,
|
|
3842
|
+
this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.SSH);
|
|
3857
3843
|
this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));
|
|
3858
3844
|
}
|
|
3859
3845
|
}
|
|
@@ -3889,7 +3875,7 @@ class RequestParameterBuilder {
|
|
|
3889
3875
|
}
|
|
3890
3876
|
}
|
|
3891
3877
|
|
|
3892
|
-
/*! @azure/msal-common v14.0.0-
|
|
3878
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3893
3879
|
|
|
3894
3880
|
/*
|
|
3895
3881
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3984,7 +3970,7 @@ class BaseClient {
|
|
|
3984
3970
|
}
|
|
3985
3971
|
}
|
|
3986
3972
|
|
|
3987
|
-
/*! @azure/msal-common v14.0.0-
|
|
3973
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
3988
3974
|
|
|
3989
3975
|
/*
|
|
3990
3976
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4117,13 +4103,13 @@ class CredentialEntity {
|
|
|
4117
4103
|
*/
|
|
4118
4104
|
return tokenType &&
|
|
4119
4105
|
tokenType.toLowerCase() !==
|
|
4120
|
-
|
|
4106
|
+
AuthenticationScheme.BEARER.toLowerCase()
|
|
4121
4107
|
? tokenType.toLowerCase()
|
|
4122
4108
|
: Constants.EMPTY_STRING;
|
|
4123
4109
|
}
|
|
4124
4110
|
}
|
|
4125
4111
|
|
|
4126
|
-
/*! @azure/msal-common v14.0.0-
|
|
4112
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4127
4113
|
|
|
4128
4114
|
/*
|
|
4129
4115
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4182,7 +4168,7 @@ class IdTokenEntity extends CredentialEntity {
|
|
|
4182
4168
|
}
|
|
4183
4169
|
}
|
|
4184
4170
|
|
|
4185
|
-
/*! @azure/msal-common v14.0.0-
|
|
4171
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4186
4172
|
/*
|
|
4187
4173
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4188
4174
|
* Licensed under the MIT License.
|
|
@@ -4229,7 +4215,7 @@ class TimeUtils {
|
|
|
4229
4215
|
}
|
|
4230
4216
|
}
|
|
4231
4217
|
|
|
4232
|
-
/*! @azure/msal-common v14.0.0-
|
|
4218
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4233
4219
|
|
|
4234
4220
|
/*
|
|
4235
4221
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4293,7 +4279,7 @@ class AccessTokenEntity extends CredentialEntity {
|
|
|
4293
4279
|
atEntity.target = scopes;
|
|
4294
4280
|
atEntity.userAssertionHash = userAssertionHash;
|
|
4295
4281
|
atEntity.tokenType = StringUtils.isEmpty(tokenType)
|
|
4296
|
-
?
|
|
4282
|
+
? AuthenticationScheme.BEARER
|
|
4297
4283
|
: tokenType;
|
|
4298
4284
|
if (requestedClaims) {
|
|
4299
4285
|
atEntity.requestedClaims = requestedClaims;
|
|
@@ -4304,11 +4290,11 @@ class AccessTokenEntity extends CredentialEntity {
|
|
|
4304
4290
|
* Cast to lower to handle "bearer" from ADFS
|
|
4305
4291
|
*/
|
|
4306
4292
|
if (atEntity.tokenType?.toLowerCase() !==
|
|
4307
|
-
|
|
4293
|
+
AuthenticationScheme.BEARER.toLowerCase()) {
|
|
4308
4294
|
atEntity.credentialType =
|
|
4309
4295
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
4310
4296
|
switch (atEntity.tokenType) {
|
|
4311
|
-
case
|
|
4297
|
+
case AuthenticationScheme.POP:
|
|
4312
4298
|
// Make sure keyId is present and add it to credential
|
|
4313
4299
|
const tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
|
|
4314
4300
|
if (!tokenClaims?.cnf?.kid) {
|
|
@@ -4316,7 +4302,7 @@ class AccessTokenEntity extends CredentialEntity {
|
|
|
4316
4302
|
}
|
|
4317
4303
|
atEntity.keyId = tokenClaims.cnf.kid;
|
|
4318
4304
|
break;
|
|
4319
|
-
case
|
|
4305
|
+
case AuthenticationScheme.SSH:
|
|
4320
4306
|
atEntity.keyId = keyId;
|
|
4321
4307
|
}
|
|
4322
4308
|
}
|
|
@@ -4343,7 +4329,7 @@ class AccessTokenEntity extends CredentialEntity {
|
|
|
4343
4329
|
}
|
|
4344
4330
|
}
|
|
4345
4331
|
|
|
4346
|
-
/*! @azure/msal-common v14.0.0-
|
|
4332
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4347
4333
|
|
|
4348
4334
|
/*
|
|
4349
4335
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4405,7 +4391,7 @@ class RefreshTokenEntity extends CredentialEntity {
|
|
|
4405
4391
|
}
|
|
4406
4392
|
}
|
|
4407
4393
|
|
|
4408
|
-
/*! @azure/msal-common v14.0.0-
|
|
4394
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4409
4395
|
|
|
4410
4396
|
/*
|
|
4411
4397
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4486,7 +4472,7 @@ class InteractionRequiredAuthError extends AuthError {
|
|
|
4486
4472
|
}
|
|
4487
4473
|
}
|
|
4488
4474
|
|
|
4489
|
-
/*! @azure/msal-common v14.0.0-
|
|
4475
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4490
4476
|
/*
|
|
4491
4477
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4492
4478
|
* Licensed under the MIT License.
|
|
@@ -4501,7 +4487,7 @@ class CacheRecord {
|
|
|
4501
4487
|
}
|
|
4502
4488
|
}
|
|
4503
4489
|
|
|
4504
|
-
/*! @azure/msal-common v14.0.0-
|
|
4490
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4505
4491
|
|
|
4506
4492
|
/*
|
|
4507
4493
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4575,7 +4561,7 @@ class ProtocolUtils {
|
|
|
4575
4561
|
}
|
|
4576
4562
|
}
|
|
4577
4563
|
|
|
4578
|
-
/*! @azure/msal-common v14.0.0-
|
|
4564
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4579
4565
|
|
|
4580
4566
|
/*
|
|
4581
4567
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4820,7 +4806,7 @@ class UrlString {
|
|
|
4820
4806
|
}
|
|
4821
4807
|
}
|
|
4822
4808
|
|
|
4823
|
-
/*! @azure/msal-common v14.0.0-
|
|
4809
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
4824
4810
|
/*
|
|
4825
4811
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4826
4812
|
* Licensed under the MIT License.
|
|
@@ -4831,212 +4817,210 @@ class UrlString {
|
|
|
4831
4817
|
* @export
|
|
4832
4818
|
* @enum {number}
|
|
4833
4819
|
*/
|
|
4834
|
-
|
|
4835
|
-
(function (PerformanceEvents) {
|
|
4820
|
+
const PerformanceEvents = {
|
|
4836
4821
|
/**
|
|
4837
4822
|
* acquireTokenByCode API (msal-browser and msal-node).
|
|
4838
4823
|
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
4839
4824
|
*/
|
|
4840
|
-
|
|
4825
|
+
AcquireTokenByCode: "acquireTokenByCode",
|
|
4841
4826
|
/**
|
|
4842
4827
|
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
4843
4828
|
* Used to renew an access token using a refresh token against the token endpoint.
|
|
4844
4829
|
*/
|
|
4845
|
-
|
|
4830
|
+
AcquireTokenByRefreshToken: "acquireTokenByRefreshToken",
|
|
4846
4831
|
/**
|
|
4847
4832
|
* acquireTokenSilent API (msal-browser and msal-node).
|
|
4848
4833
|
* Used to silently acquire a new access token (from the cache or the network).
|
|
4849
4834
|
*/
|
|
4850
|
-
|
|
4835
|
+
AcquireTokenSilent: "acquireTokenSilent",
|
|
4851
4836
|
/**
|
|
4852
4837
|
* acquireTokenSilentAsync (msal-browser).
|
|
4853
4838
|
* Internal API for acquireTokenSilent.
|
|
4854
4839
|
*/
|
|
4855
|
-
|
|
4840
|
+
AcquireTokenSilentAsync: "acquireTokenSilentAsync",
|
|
4856
4841
|
/**
|
|
4857
4842
|
* acquireTokenPopup (msal-browser).
|
|
4858
4843
|
* Used to acquire a new access token interactively through pop ups
|
|
4859
4844
|
*/
|
|
4860
|
-
|
|
4845
|
+
AcquireTokenPopup: "acquireTokenPopup",
|
|
4861
4846
|
/**
|
|
4862
4847
|
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
4863
4848
|
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
4864
4849
|
*/
|
|
4865
|
-
|
|
4850
|
+
CryptoOptsGetPublicKeyThumbprint: "cryptoOptsGetPublicKeyThumbprint",
|
|
4866
4851
|
/**
|
|
4867
4852
|
* signJwt API in CryptoOpts class (msal-browser).
|
|
4868
4853
|
* Used to signed a pop token.
|
|
4869
4854
|
*/
|
|
4870
|
-
|
|
4855
|
+
CryptoOptsSignJwt: "cryptoOptsSignJwt",
|
|
4871
4856
|
/**
|
|
4872
4857
|
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
4873
4858
|
* Used to read access tokens from the cache.
|
|
4874
4859
|
*/
|
|
4875
|
-
|
|
4860
|
+
SilentCacheClientAcquireToken: "silentCacheClientAcquireToken",
|
|
4876
4861
|
/**
|
|
4877
4862
|
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
4878
4863
|
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4879
4864
|
*/
|
|
4880
|
-
|
|
4865
|
+
SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
|
|
4881
4866
|
/**
|
|
4882
4867
|
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4883
4868
|
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
4884
4869
|
*/
|
|
4885
|
-
|
|
4870
|
+
SilentRefreshClientAcquireToken: "silentRefreshClientAcquireToken",
|
|
4886
4871
|
/**
|
|
4887
4872
|
* ssoSilent API (msal-browser).
|
|
4888
4873
|
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
4889
4874
|
*/
|
|
4890
|
-
|
|
4875
|
+
SsoSilent: "ssoSilent",
|
|
4891
4876
|
/**
|
|
4892
4877
|
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
4893
4878
|
* Used to load authority metadata for a request.
|
|
4894
4879
|
*/
|
|
4895
|
-
|
|
4880
|
+
StandardInteractionClientGetDiscoveredAuthority: "standardInteractionClientGetDiscoveredAuthority",
|
|
4896
4881
|
/**
|
|
4897
4882
|
* acquireToken APIs in msal-browser.
|
|
4898
4883
|
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
4899
4884
|
*/
|
|
4900
|
-
|
|
4885
|
+
FetchAccountIdWithNativeBroker: "fetchAccountIdWithNativeBroker",
|
|
4901
4886
|
/**
|
|
4902
4887
|
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
4903
4888
|
* Used to acquire a token from Native component when native brokering is enabled.
|
|
4904
4889
|
*/
|
|
4905
|
-
|
|
4890
|
+
NativeInteractionClientAcquireToken: "nativeInteractionClientAcquireToken",
|
|
4906
4891
|
/**
|
|
4907
4892
|
* Time spent creating default headers for requests to token endpoint
|
|
4908
4893
|
*/
|
|
4909
|
-
|
|
4894
|
+
BaseClientCreateTokenRequestHeaders: "baseClientCreateTokenRequestHeaders",
|
|
4910
4895
|
/**
|
|
4911
4896
|
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
4912
4897
|
*/
|
|
4913
|
-
|
|
4898
|
+
BrokerHandhshake: "brokerHandshake",
|
|
4914
4899
|
/**
|
|
4915
4900
|
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
4916
4901
|
*/
|
|
4917
|
-
|
|
4902
|
+
AcquireTokenByRefreshTokenInBroker: "acquireTokenByRefreshTokenInBroker",
|
|
4918
4903
|
/**
|
|
4919
4904
|
* Time taken for token acquisition by broker
|
|
4920
4905
|
*/
|
|
4921
|
-
|
|
4906
|
+
AcquireTokenByBroker: "acquireTokenByBroker",
|
|
4922
4907
|
/**
|
|
4923
4908
|
* Time spent on the network for refresh token acquisition
|
|
4924
4909
|
*/
|
|
4925
|
-
|
|
4910
|
+
RefreshTokenClientExecuteTokenRequest: "refreshTokenClientExecuteTokenRequest",
|
|
4926
4911
|
/**
|
|
4927
4912
|
* Time taken for acquiring refresh token , records RT size
|
|
4928
4913
|
*/
|
|
4929
|
-
|
|
4914
|
+
RefreshTokenClientAcquireToken: "refreshTokenClientAcquireToken",
|
|
4930
4915
|
/**
|
|
4931
4916
|
* Time taken for acquiring cached refresh token
|
|
4932
4917
|
*/
|
|
4933
|
-
|
|
4918
|
+
RefreshTokenClientAcquireTokenWithCachedRefreshToken: "refreshTokenClientAcquireTokenWithCachedRefreshToken",
|
|
4934
4919
|
/**
|
|
4935
4920
|
* acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).
|
|
4936
4921
|
*/
|
|
4937
|
-
|
|
4922
|
+
RefreshTokenClientAcquireTokenByRefreshToken: "refreshTokenClientAcquireTokenByRefreshToken",
|
|
4938
4923
|
/**
|
|
4939
4924
|
* Helper function to create token request body in RefreshTokenClient (msal-common).
|
|
4940
4925
|
*/
|
|
4941
|
-
|
|
4926
|
+
RefreshTokenClientCreateTokenRequestBody: "refreshTokenClientCreateTokenRequestBody",
|
|
4942
4927
|
/**
|
|
4943
4928
|
* acquireTokenFromCache (msal-browser).
|
|
4944
4929
|
* Internal API for acquiring token from cache
|
|
4945
4930
|
*/
|
|
4946
|
-
|
|
4931
|
+
AcquireTokenFromCache: "acquireTokenFromCache",
|
|
4947
4932
|
/**
|
|
4948
4933
|
* acquireTokenBySilentIframe (msal-browser).
|
|
4949
4934
|
* Internal API for acquiring token by silent Iframe
|
|
4950
4935
|
*/
|
|
4951
|
-
|
|
4936
|
+
AcquireTokenBySilentIframe: "acquireTokenBySilentIframe",
|
|
4952
4937
|
/**
|
|
4953
4938
|
* Internal API for initializing base request in BaseInteractionClient (msal-browser)
|
|
4954
4939
|
*/
|
|
4955
|
-
|
|
4940
|
+
InitializeBaseRequest: "initializeBaseRequest",
|
|
4956
4941
|
/**
|
|
4957
4942
|
* Internal API for initializing silent request in SilentCacheClient (msal-browser)
|
|
4958
4943
|
*/
|
|
4959
|
-
|
|
4960
|
-
|
|
4944
|
+
InitializeSilentRequest: "initializeSilentRequest",
|
|
4945
|
+
InitializeClientApplication: "initializeClientApplication",
|
|
4961
4946
|
/**
|
|
4962
4947
|
* Helper function in SilentIframeClient class (msal-browser).
|
|
4963
4948
|
*/
|
|
4964
|
-
|
|
4949
|
+
SilentIframeClientTokenHelper: "silentIframeClientTokenHelper",
|
|
4965
4950
|
/**
|
|
4966
4951
|
* SilentHandler
|
|
4967
4952
|
*/
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4953
|
+
SilentHandlerInitiateAuthRequest: "silentHandlerInitiateAuthRequest",
|
|
4954
|
+
SilentHandlerMonitorIframeForHash: "silentHandlerMonitorIframeForHash",
|
|
4955
|
+
SilentHandlerLoadFrame: "silentHandlerLoadFrame",
|
|
4971
4956
|
/**
|
|
4972
4957
|
* Helper functions in StandardInteractionClient class (msal-browser)
|
|
4973
4958
|
*/
|
|
4974
|
-
|
|
4975
|
-
|
|
4976
|
-
|
|
4977
|
-
|
|
4959
|
+
StandardInteractionClientCreateAuthCodeClient: "standardInteractionClientCreateAuthCodeClient",
|
|
4960
|
+
StandardInteractionClientGetClientConfiguration: "standardInteractionClientGetClientConfiguration",
|
|
4961
|
+
StandardInteractionClientInitializeAuthorizationRequest: "standardInteractionClientInitializeAuthorizationRequest",
|
|
4962
|
+
StandardInteractionClientInitializeAuthorizationCodeRequest: "standardInteractionClientInitializeAuthorizationCodeRequest",
|
|
4978
4963
|
/**
|
|
4979
4964
|
* getAuthCodeUrl API (msal-browser and msal-node).
|
|
4980
4965
|
*/
|
|
4981
|
-
|
|
4966
|
+
GetAuthCodeUrl: "getAuthCodeUrl",
|
|
4982
4967
|
/**
|
|
4983
4968
|
* Functions from InteractionHandler (msal-browser)
|
|
4984
4969
|
*/
|
|
4985
|
-
|
|
4986
|
-
|
|
4987
|
-
|
|
4970
|
+
HandleCodeResponseFromServer: "handleCodeResponseFromServer",
|
|
4971
|
+
HandleCodeResponseFromHash: "handleCodeResponseFromHash",
|
|
4972
|
+
UpdateTokenEndpointAuthority: "updateTokenEndpointAuthority",
|
|
4988
4973
|
/**
|
|
4989
4974
|
* APIs in Authorization Code Client (msal-common)
|
|
4990
4975
|
*/
|
|
4991
|
-
|
|
4992
|
-
|
|
4993
|
-
|
|
4994
|
-
|
|
4976
|
+
AuthClientAcquireToken: "authClientAcquireToken",
|
|
4977
|
+
AuthClientExecuteTokenRequest: "authClientExecuteTokenRequest",
|
|
4978
|
+
AuthClientCreateTokenRequestBody: "authClientCreateTokenRequestBody",
|
|
4979
|
+
AuthClientCreateQueryString: "authClientCreateQueryString",
|
|
4995
4980
|
/**
|
|
4996
4981
|
* Generate functions in PopTokenGenerator (msal-common)
|
|
4997
4982
|
*/
|
|
4998
|
-
|
|
4999
|
-
|
|
4983
|
+
PopTokenGenerateCnf: "popTokenGenerateCnf",
|
|
4984
|
+
PopTokenGenerateKid: "popTokenGenerateKid",
|
|
5000
4985
|
/**
|
|
5001
4986
|
* handleServerTokenResponse API in ResponseHandler (msal-common)
|
|
5002
4987
|
*/
|
|
5003
|
-
|
|
4988
|
+
HandleServerTokenResponse: "handleServerTokenResponse",
|
|
5004
4989
|
/**
|
|
5005
4990
|
* Authority functions
|
|
5006
4991
|
*/
|
|
5007
|
-
|
|
5008
|
-
|
|
5009
|
-
|
|
5010
|
-
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
4992
|
+
AuthorityFactoryCreateDiscoveredInstance: "authorityFactoryCreateDiscoveredInstance",
|
|
4993
|
+
AuthorityResolveEndpointsAsync: "authorityResolveEndpointsAsync",
|
|
4994
|
+
AuthorityGetCloudDiscoveryMetadataFromNetwork: "authorityGetCloudDiscoveryMetadataFromNetwork",
|
|
4995
|
+
AuthorityUpdateCloudDiscoveryMetadata: "authorityUpdateCloudDiscoveryMetadata",
|
|
4996
|
+
AuthorityGetEndpointMetadataFromNetwork: "authorityGetEndpointMetadataFromNetwork",
|
|
4997
|
+
AuthorityUpdateEndpointMetadata: "authorityUpdateEndpointMetadata",
|
|
4998
|
+
AuthorityUpdateMetadataWithRegionalInformation: "authorityUpdateMetadataWithRegionalInformation",
|
|
5014
4999
|
/**
|
|
5015
5000
|
* Region Discovery functions
|
|
5016
5001
|
*/
|
|
5017
|
-
|
|
5018
|
-
|
|
5019
|
-
|
|
5020
|
-
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
}
|
|
5002
|
+
RegionDiscoveryDetectRegion: "regionDiscoveryDetectRegion",
|
|
5003
|
+
RegionDiscoveryGetRegionFromIMDS: "regionDiscoveryGetRegionFromIMDS",
|
|
5004
|
+
RegionDiscoveryGetCurrentVersion: "regionDiscoveryGetCurrentVersion",
|
|
5005
|
+
AcquireTokenByCodeAsync: "acquireTokenByCodeAsync",
|
|
5006
|
+
GetEndpointMetadataFromNetwork: "getEndpointMetadataFromNetwork",
|
|
5007
|
+
GetCloudDiscoveryMetadataFromNetworkMeasurement: "getCloudDiscoveryMetadataFromNetworkMeasurement",
|
|
5008
|
+
HandleRedirectPromiseMeasurement: "handleRedirectPromiseMeasurement",
|
|
5009
|
+
UpdateCloudDiscoveryMetadataMeasurement: "updateCloudDiscoveryMetadataMeasurement",
|
|
5010
|
+
UsernamePasswordClientAcquireToken: "usernamePasswordClientAcquireToken",
|
|
5011
|
+
NativeMessageHandlerHandshake: "nativeMessageHandlerHandshake",
|
|
5012
|
+
};
|
|
5028
5013
|
/**
|
|
5029
5014
|
* State of the performance event.
|
|
5030
5015
|
*
|
|
5031
5016
|
* @export
|
|
5032
5017
|
* @enum {number}
|
|
5033
5018
|
*/
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
|
|
5038
|
-
|
|
5039
|
-
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
5019
|
+
const PerformanceEventStatus = {
|
|
5020
|
+
NotStarted: 0,
|
|
5021
|
+
InProgress: 1,
|
|
5022
|
+
Completed: 2,
|
|
5023
|
+
};
|
|
5040
5024
|
const IntFields = new Set([
|
|
5041
5025
|
"accessTokenSize",
|
|
5042
5026
|
"durationMs",
|
|
@@ -5049,17 +5033,16 @@ const IntFields = new Set([
|
|
|
5049
5033
|
"status",
|
|
5050
5034
|
]);
|
|
5051
5035
|
|
|
5052
|
-
/*! @azure/msal-common v14.0.0-
|
|
5036
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
5053
5037
|
|
|
5054
5038
|
/*
|
|
5055
5039
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5056
5040
|
* Licensed under the MIT License.
|
|
5057
5041
|
*/
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
})(KeyLocation || (KeyLocation = {}));
|
|
5042
|
+
const KeyLocation = {
|
|
5043
|
+
SW: "sw",
|
|
5044
|
+
UHW: "uhw",
|
|
5045
|
+
};
|
|
5063
5046
|
class PopTokenGenerator {
|
|
5064
5047
|
constructor(cryptoUtils, performanceClient) {
|
|
5065
5048
|
this.cryptoUtils = cryptoUtils;
|
|
@@ -5072,8 +5055,8 @@ class PopTokenGenerator {
|
|
|
5072
5055
|
* @returns
|
|
5073
5056
|
*/
|
|
5074
5057
|
async generateCnf(request) {
|
|
5075
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5076
|
-
this.performanceClient?.setPreQueueTime(
|
|
5058
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5059
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5077
5060
|
const reqCnf = await this.generateKid(request);
|
|
5078
5061
|
const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
5079
5062
|
return {
|
|
@@ -5088,7 +5071,7 @@ class PopTokenGenerator {
|
|
|
5088
5071
|
* @returns
|
|
5089
5072
|
*/
|
|
5090
5073
|
async generateKid(request) {
|
|
5091
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5074
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5092
5075
|
const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
|
|
5093
5076
|
return {
|
|
5094
5077
|
kid: kidThumbprint,
|
|
@@ -5135,7 +5118,7 @@ class PopTokenGenerator {
|
|
|
5135
5118
|
}
|
|
5136
5119
|
}
|
|
5137
5120
|
|
|
5138
|
-
/*! @azure/msal-common v14.0.0-
|
|
5121
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
5139
5122
|
|
|
5140
5123
|
/*
|
|
5141
5124
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5204,7 +5187,7 @@ class AppMetadataEntity {
|
|
|
5204
5187
|
}
|
|
5205
5188
|
}
|
|
5206
5189
|
|
|
5207
|
-
/*! @azure/msal-common v14.0.0-
|
|
5190
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
5208
5191
|
/*
|
|
5209
5192
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5210
5193
|
* Licensed under the MIT License.
|
|
@@ -5231,7 +5214,7 @@ class AppMetadataEntity {
|
|
|
5231
5214
|
}
|
|
5232
5215
|
}
|
|
5233
5216
|
|
|
5234
|
-
/*! @azure/msal-common v14.0.0-
|
|
5217
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
5235
5218
|
|
|
5236
5219
|
/*
|
|
5237
5220
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5301,7 +5284,7 @@ class ResponseHandler {
|
|
|
5301
5284
|
* @param authority
|
|
5302
5285
|
*/
|
|
5303
5286
|
async handleServerTokenResponse(serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
|
|
5304
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5287
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.HandleServerTokenResponse, serverTokenResponse.correlation_id);
|
|
5305
5288
|
// create an idToken object (not entity)
|
|
5306
5289
|
let idTokenObj;
|
|
5307
5290
|
if (serverTokenResponse.id_token) {
|
|
@@ -5474,7 +5457,7 @@ class ResponseHandler {
|
|
|
5474
5457
|
let extExpiresOn;
|
|
5475
5458
|
let familyId = Constants.EMPTY_STRING;
|
|
5476
5459
|
if (cacheRecord.accessToken) {
|
|
5477
|
-
if (cacheRecord.accessToken.tokenType ===
|
|
5460
|
+
if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {
|
|
5478
5461
|
const popTokenGenerator = new PopTokenGenerator(cryptoObj);
|
|
5479
5462
|
const { secret, keyId } = cacheRecord.accessToken;
|
|
5480
5463
|
if (!keyId) {
|
|
@@ -5534,7 +5517,7 @@ class ResponseHandler {
|
|
|
5534
5517
|
}
|
|
5535
5518
|
}
|
|
5536
5519
|
|
|
5537
|
-
/*! @azure/msal-common v14.0.0-
|
|
5520
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
5538
5521
|
|
|
5539
5522
|
/*
|
|
5540
5523
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5560,8 +5543,8 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5560
5543
|
* @param request
|
|
5561
5544
|
*/
|
|
5562
5545
|
async getAuthCodeUrl(request) {
|
|
5563
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5564
|
-
this.performanceClient?.setPreQueueTime(
|
|
5546
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.GetAuthCodeUrl, request.correlationId);
|
|
5547
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5565
5548
|
const queryString = await this.createAuthCodeUrlQueryString(request);
|
|
5566
5549
|
return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);
|
|
5567
5550
|
}
|
|
@@ -5574,13 +5557,13 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5574
5557
|
if (!request || !request.code) {
|
|
5575
5558
|
throw ClientAuthError.createTokenRequestCannotBeMadeError();
|
|
5576
5559
|
}
|
|
5577
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5560
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientAcquireToken, request.correlationId);
|
|
5578
5561
|
const atsMeasurement = this.performanceClient?.startMeasurement(
|
|
5579
5562
|
// @ts-ignore
|
|
5580
5563
|
"AuthCodeClientAcquireToken", request.correlationId);
|
|
5581
5564
|
this.logger.info("in acquireToken call in auth-code client");
|
|
5582
5565
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
5583
|
-
this.performanceClient?.setPreQueueTime(
|
|
5566
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5584
5567
|
const response = await this.executeTokenRequest(this.authority, request);
|
|
5585
5568
|
// Retrieve requestId from response headers
|
|
5586
5569
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
@@ -5593,7 +5576,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5593
5576
|
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin, this.performanceClient);
|
|
5594
5577
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
5595
5578
|
responseHandler.validateTokenResponse(response.body);
|
|
5596
|
-
this.performanceClient?.setPreQueueTime(
|
|
5579
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
5597
5580
|
return responseHandler
|
|
5598
5581
|
.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId)
|
|
5599
5582
|
.then((result) => {
|
|
@@ -5656,8 +5639,8 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5656
5639
|
* @param request
|
|
5657
5640
|
*/
|
|
5658
5641
|
async executeTokenRequest(authority, request) {
|
|
5659
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5660
|
-
this.performanceClient?.setPreQueueTime(
|
|
5642
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5643
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5661
5644
|
const queryParametersString = this.createTokenQueryParameters(request);
|
|
5662
5645
|
const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
5663
5646
|
const requestBody = await this.createTokenRequestBody(request);
|
|
@@ -5693,7 +5676,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5693
5676
|
* @param request
|
|
5694
5677
|
*/
|
|
5695
5678
|
async createTokenRequestBody(request) {
|
|
5696
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5679
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5697
5680
|
const parameterBuilder = new RequestParameterBuilder();
|
|
5698
5681
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5699
5682
|
/*
|
|
@@ -5733,14 +5716,14 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5733
5716
|
}
|
|
5734
5717
|
parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);
|
|
5735
5718
|
parameterBuilder.addClientInfo();
|
|
5736
|
-
if (request.authenticationScheme ===
|
|
5719
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
5737
5720
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
5738
|
-
this.performanceClient?.setPreQueueTime(
|
|
5721
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5739
5722
|
const reqCnfData = await popTokenGenerator.generateCnf(request);
|
|
5740
5723
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5741
5724
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5742
5725
|
}
|
|
5743
|
-
else if (request.authenticationScheme ===
|
|
5726
|
+
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
5744
5727
|
if (request.sshJwk) {
|
|
5745
5728
|
parameterBuilder.addSshJwk(request.sshJwk);
|
|
5746
5729
|
}
|
|
@@ -5808,7 +5791,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5808
5791
|
* @param request
|
|
5809
5792
|
*/
|
|
5810
5793
|
async createAuthCodeUrlQueryString(request) {
|
|
5811
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5794
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5812
5795
|
const parameterBuilder = new RequestParameterBuilder();
|
|
5813
5796
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5814
5797
|
const requestScopes = [
|
|
@@ -5923,7 +5906,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5923
5906
|
// signal ests that this is a WAM call
|
|
5924
5907
|
parameterBuilder.addNativeBroker();
|
|
5925
5908
|
// pass the req_cnf for POP
|
|
5926
|
-
if (request.authenticationScheme ===
|
|
5909
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
5927
5910
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5928
5911
|
// to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
|
|
5929
5912
|
const reqCnfData = await popTokenGenerator.generateCnf(request);
|
|
@@ -5970,7 +5953,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
5970
5953
|
}
|
|
5971
5954
|
}
|
|
5972
5955
|
|
|
5973
|
-
/*! @azure/msal-common v14.0.0-
|
|
5956
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
5974
5957
|
|
|
5975
5958
|
/*
|
|
5976
5959
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5984,11 +5967,11 @@ class RefreshTokenClient extends BaseClient {
|
|
|
5984
5967
|
super(configuration, performanceClient);
|
|
5985
5968
|
}
|
|
5986
5969
|
async acquireToken(request) {
|
|
5987
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5988
|
-
const atsMeasurement = this.performanceClient?.startMeasurement(
|
|
5970
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
5971
|
+
const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
5989
5972
|
this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
|
|
5990
5973
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
5991
|
-
this.performanceClient?.setPreQueueTime(
|
|
5974
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
5992
5975
|
const response = await this.executeTokenRequest(request, this.authority);
|
|
5993
5976
|
const httpVerToken = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];
|
|
5994
5977
|
atsMeasurement?.addStaticFields({
|
|
@@ -6003,7 +5986,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6003
5986
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
6004
5987
|
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
6005
5988
|
responseHandler.validateTokenResponse(response.body);
|
|
6006
|
-
this.performanceClient?.setPreQueueTime(
|
|
5989
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
6007
5990
|
return responseHandler
|
|
6008
5991
|
.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId)
|
|
6009
5992
|
.then((result) => {
|
|
@@ -6031,7 +6014,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6031
6014
|
if (!request) {
|
|
6032
6015
|
throw ClientConfigurationError.createEmptyTokenRequestError();
|
|
6033
6016
|
}
|
|
6034
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6017
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
6035
6018
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
6036
6019
|
if (!request.account) {
|
|
6037
6020
|
throw ClientAuthError.createNoAccountInSilentRequestError();
|
|
@@ -6041,7 +6024,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6041
6024
|
// if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest
|
|
6042
6025
|
if (isFOCI) {
|
|
6043
6026
|
try {
|
|
6044
|
-
this.performanceClient?.setPreQueueTime(
|
|
6027
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6045
6028
|
return this.acquireTokenWithCachedRefreshToken(request, true);
|
|
6046
6029
|
}
|
|
6047
6030
|
catch (e) {
|
|
@@ -6054,7 +6037,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6054
6037
|
e.subError === Errors.CLIENT_MISMATCH_ERROR;
|
|
6055
6038
|
// if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)
|
|
6056
6039
|
if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {
|
|
6057
|
-
this.performanceClient?.setPreQueueTime(
|
|
6040
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6058
6041
|
return this.acquireTokenWithCachedRefreshToken(request, false);
|
|
6059
6042
|
// throw in all other cases
|
|
6060
6043
|
}
|
|
@@ -6064,7 +6047,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6064
6047
|
}
|
|
6065
6048
|
}
|
|
6066
6049
|
// fall back to application refresh token acquisition
|
|
6067
|
-
this.performanceClient?.setPreQueueTime(
|
|
6050
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6068
6051
|
return this.acquireTokenWithCachedRefreshToken(request, false);
|
|
6069
6052
|
}
|
|
6070
6053
|
/**
|
|
@@ -6072,9 +6055,9 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6072
6055
|
* @param request
|
|
6073
6056
|
*/
|
|
6074
6057
|
async acquireTokenWithCachedRefreshToken(request, foci) {
|
|
6075
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6058
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6076
6059
|
// fetches family RT or application RT based on FOCI value
|
|
6077
|
-
const atsMeasurement = this.performanceClient?.startMeasurement(
|
|
6060
|
+
const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6078
6061
|
this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
|
|
6079
6062
|
const refreshToken = this.cacheManager.getRefreshToken(request.account, foci);
|
|
6080
6063
|
if (!refreshToken) {
|
|
@@ -6088,13 +6071,13 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6088
6071
|
const refreshTokenRequest = {
|
|
6089
6072
|
...request,
|
|
6090
6073
|
refreshToken: refreshToken.secret,
|
|
6091
|
-
authenticationScheme: request.authenticationScheme ||
|
|
6074
|
+
authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER,
|
|
6092
6075
|
ccsCredential: {
|
|
6093
6076
|
credential: request.account.homeAccountId,
|
|
6094
6077
|
type: CcsCredentialType.HOME_ACCOUNT_ID,
|
|
6095
6078
|
},
|
|
6096
6079
|
};
|
|
6097
|
-
this.performanceClient?.setPreQueueTime(
|
|
6080
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6098
6081
|
return this.acquireToken(refreshTokenRequest);
|
|
6099
6082
|
}
|
|
6100
6083
|
/**
|
|
@@ -6103,9 +6086,9 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6103
6086
|
* @param authority
|
|
6104
6087
|
*/
|
|
6105
6088
|
async executeTokenRequest(request, authority) {
|
|
6106
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6107
|
-
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(
|
|
6108
|
-
this.performanceClient?.setPreQueueTime(
|
|
6089
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6090
|
+
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6091
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6109
6092
|
const queryParametersString = this.createTokenQueryParameters(request);
|
|
6110
6093
|
const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
6111
6094
|
const requestBody = await this.createTokenRequestBody(request);
|
|
@@ -6140,9 +6123,9 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6140
6123
|
* @param request
|
|
6141
6124
|
*/
|
|
6142
6125
|
async createTokenRequestBody(request) {
|
|
6143
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6126
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6144
6127
|
const correlationId = request.correlationId;
|
|
6145
|
-
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(
|
|
6128
|
+
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
|
|
6146
6129
|
const parameterBuilder = new RequestParameterBuilder();
|
|
6147
6130
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
6148
6131
|
parameterBuilder.addScopes(request.scopes);
|
|
@@ -6164,14 +6147,14 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6164
6147
|
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
6165
6148
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
6166
6149
|
}
|
|
6167
|
-
if (request.authenticationScheme ===
|
|
6150
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
6168
6151
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
6169
|
-
this.performanceClient?.setPreQueueTime(
|
|
6152
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
6170
6153
|
const reqCnfData = await popTokenGenerator.generateCnf(request);
|
|
6171
6154
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
6172
6155
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
6173
6156
|
}
|
|
6174
|
-
else if (request.authenticationScheme ===
|
|
6157
|
+
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
6175
6158
|
if (request.sshJwk) {
|
|
6176
6159
|
parameterBuilder.addSshJwk(request.sshJwk);
|
|
6177
6160
|
}
|
|
@@ -6212,7 +6195,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
6212
6195
|
}
|
|
6213
6196
|
}
|
|
6214
6197
|
|
|
6215
|
-
/*! @azure/msal-common v14.0.0-
|
|
6198
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
6216
6199
|
|
|
6217
6200
|
/*
|
|
6218
6201
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6309,7 +6292,7 @@ class SilentFlowClient extends BaseClient {
|
|
|
6309
6292
|
}
|
|
6310
6293
|
}
|
|
6311
6294
|
|
|
6312
|
-
/*! @azure/msal-common v14.0.0-
|
|
6295
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
6313
6296
|
/*
|
|
6314
6297
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6315
6298
|
* Licensed under the MIT License.
|
|
@@ -6321,7 +6304,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
6321
6304
|
response.hasOwnProperty("jwks_uri"));
|
|
6322
6305
|
}
|
|
6323
6306
|
|
|
6324
|
-
/*! @azure/msal-common v14.0.0-
|
|
6307
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
6325
6308
|
/*
|
|
6326
6309
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6327
6310
|
* Licensed under the MIT License.
|
|
@@ -7199,7 +7182,7 @@ const rawMetdataJSON = {
|
|
|
7199
7182
|
const EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
7200
7183
|
const InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
7201
7184
|
|
|
7202
|
-
/*! @azure/msal-common v14.0.0-
|
|
7185
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
7203
7186
|
/*
|
|
7204
7187
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7205
7188
|
* Licensed under the MIT License.
|
|
@@ -7207,13 +7190,12 @@ const InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
|
7207
7190
|
/**
|
|
7208
7191
|
* Protocol modes supported by MSAL.
|
|
7209
7192
|
*/
|
|
7210
|
-
|
|
7211
|
-
|
|
7212
|
-
|
|
7213
|
-
|
|
7214
|
-
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
7193
|
+
const ProtocolMode = {
|
|
7194
|
+
AAD: "AAD",
|
|
7195
|
+
OIDC: "OIDC",
|
|
7196
|
+
};
|
|
7215
7197
|
|
|
7216
|
-
/*! @azure/msal-common v14.0.0-
|
|
7198
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
7217
7199
|
|
|
7218
7200
|
/*
|
|
7219
7201
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7293,7 +7275,7 @@ class AuthorityMetadataEntity {
|
|
|
7293
7275
|
}
|
|
7294
7276
|
}
|
|
7295
7277
|
|
|
7296
|
-
/*! @azure/msal-common v14.0.0-
|
|
7278
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
7297
7279
|
/*
|
|
7298
7280
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7299
7281
|
* Licensed under the MIT License.
|
|
@@ -7303,7 +7285,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
7303
7285
|
response.hasOwnProperty("metadata"));
|
|
7304
7286
|
}
|
|
7305
7287
|
|
|
7306
|
-
/*! @azure/msal-common v14.0.0-
|
|
7288
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
7307
7289
|
/*
|
|
7308
7290
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7309
7291
|
* Licensed under the MIT License.
|
|
@@ -7313,7 +7295,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
7313
7295
|
response.hasOwnProperty("error_description"));
|
|
7314
7296
|
}
|
|
7315
7297
|
|
|
7316
|
-
/*! @azure/msal-common v14.0.0-
|
|
7298
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
7317
7299
|
|
|
7318
7300
|
/*
|
|
7319
7301
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7331,14 +7313,14 @@ class RegionDiscovery {
|
|
|
7331
7313
|
* @returns Promise<string | null>
|
|
7332
7314
|
*/
|
|
7333
7315
|
async detectRegion(environmentRegion, regionDiscoveryMetadata) {
|
|
7334
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7316
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
7335
7317
|
// Initialize auto detected region with the region from the envrionment
|
|
7336
7318
|
let autodetectedRegionName = environmentRegion;
|
|
7337
7319
|
// Check if a region was detected from the environment, if not, attempt to get the region from IMDS
|
|
7338
7320
|
if (!autodetectedRegionName) {
|
|
7339
7321
|
const options = RegionDiscovery.IMDS_OPTIONS;
|
|
7340
7322
|
try {
|
|
7341
|
-
this.performanceClient?.setPreQueueTime(
|
|
7323
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
7342
7324
|
const localIMDSVersionResponse = await this.getRegionFromIMDS(Constants.IMDS_VERSION, options);
|
|
7343
7325
|
if (localIMDSVersionResponse.status ===
|
|
7344
7326
|
ResponseCodes.httpSuccess) {
|
|
@@ -7349,14 +7331,14 @@ class RegionDiscovery {
|
|
|
7349
7331
|
// If the response using the local IMDS version failed, try to fetch the current version of IMDS and retry.
|
|
7350
7332
|
if (localIMDSVersionResponse.status ===
|
|
7351
7333
|
ResponseCodes.httpBadRequest) {
|
|
7352
|
-
this.performanceClient?.setPreQueueTime(
|
|
7334
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
7353
7335
|
const currentIMDSVersion = await this.getCurrentVersion(options);
|
|
7354
7336
|
if (!currentIMDSVersion) {
|
|
7355
7337
|
regionDiscoveryMetadata.region_source =
|
|
7356
7338
|
RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
7357
7339
|
return null;
|
|
7358
7340
|
}
|
|
7359
|
-
this.performanceClient?.setPreQueueTime(
|
|
7341
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
7360
7342
|
const currentIMDSVersionResponse = await this.getRegionFromIMDS(currentIMDSVersion, options);
|
|
7361
7343
|
if (currentIMDSVersionResponse.status ===
|
|
7362
7344
|
ResponseCodes.httpSuccess) {
|
|
@@ -7391,7 +7373,7 @@ class RegionDiscovery {
|
|
|
7391
7373
|
* @returns Promise<NetworkResponse<string>>
|
|
7392
7374
|
*/
|
|
7393
7375
|
async getRegionFromIMDS(version, options) {
|
|
7394
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7376
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
7395
7377
|
return this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?api-version=${version}&format=text`, options, Constants.IMDS_TIMEOUT);
|
|
7396
7378
|
}
|
|
7397
7379
|
/**
|
|
@@ -7400,7 +7382,7 @@ class RegionDiscovery {
|
|
|
7400
7382
|
* @returns Promise<string | null>
|
|
7401
7383
|
*/
|
|
7402
7384
|
async getCurrentVersion(options) {
|
|
7403
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7385
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
7404
7386
|
try {
|
|
7405
7387
|
const response = await this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?format=json`, options);
|
|
7406
7388
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
@@ -7424,7 +7406,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
7424
7406
|
},
|
|
7425
7407
|
};
|
|
7426
7408
|
|
|
7427
|
-
/*! @azure/msal-common v14.0.0-
|
|
7409
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
7428
7410
|
|
|
7429
7411
|
/*
|
|
7430
7412
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7600,7 +7582,7 @@ class Authority {
|
|
|
7600
7582
|
return authorityUri.PathSegments.length === 1
|
|
7601
7583
|
&& !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])
|
|
7602
7584
|
&& this.getAuthorityType(authorityUri) === AuthorityType.Default
|
|
7603
|
-
&& this.protocolMode ===
|
|
7585
|
+
&& this.protocolMode === ProtocolMode.AAD;
|
|
7604
7586
|
}
|
|
7605
7587
|
/**
|
|
7606
7588
|
* Replaces tenant in url path with current tenant. Defaults to common.
|
|
@@ -7644,7 +7626,7 @@ class Authority {
|
|
|
7644
7626
|
*/
|
|
7645
7627
|
get defaultOpenIdConfigurationEndpoint() {
|
|
7646
7628
|
if (this.authorityType === AuthorityType.Adfs ||
|
|
7647
|
-
this.protocolMode ===
|
|
7629
|
+
this.protocolMode === ProtocolMode.OIDC) {
|
|
7648
7630
|
return `${this.canonicalAuthority}.well-known/openid-configuration`;
|
|
7649
7631
|
}
|
|
7650
7632
|
return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;
|
|
@@ -7660,16 +7642,16 @@ class Authority {
|
|
|
7660
7642
|
* and the /authorize, /token and logout endpoints.
|
|
7661
7643
|
*/
|
|
7662
7644
|
async resolveEndpointsAsync() {
|
|
7663
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7645
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityResolveEndpointsAsync, this.correlationId);
|
|
7664
7646
|
let metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);
|
|
7665
7647
|
if (!metadataEntity) {
|
|
7666
7648
|
metadataEntity = new AuthorityMetadataEntity();
|
|
7667
7649
|
metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);
|
|
7668
7650
|
}
|
|
7669
|
-
this.performanceClient?.setPreQueueTime(
|
|
7651
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
7670
7652
|
const cloudDiscoverySource = await this.updateCloudDiscoveryMetadata(metadataEntity);
|
|
7671
7653
|
this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);
|
|
7672
|
-
this.performanceClient?.setPreQueueTime(
|
|
7654
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
7673
7655
|
const endpointSource = await this.updateEndpointMetadata(metadataEntity);
|
|
7674
7656
|
if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE &&
|
|
7675
7657
|
endpointSource !== AuthorityMetadataSource.CACHE) {
|
|
@@ -7686,7 +7668,7 @@ class Authority {
|
|
|
7686
7668
|
* @param metadataEntity
|
|
7687
7669
|
*/
|
|
7688
7670
|
async updateEndpointMetadata(metadataEntity) {
|
|
7689
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7671
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
7690
7672
|
let metadata = this.getEndpointMetadataFromConfig();
|
|
7691
7673
|
if (metadata) {
|
|
7692
7674
|
metadataEntity.updateEndpointMetadata(metadata, false);
|
|
@@ -7698,12 +7680,12 @@ class Authority {
|
|
|
7698
7680
|
// No need to update
|
|
7699
7681
|
return AuthorityMetadataSource.CACHE;
|
|
7700
7682
|
}
|
|
7701
|
-
this.performanceClient?.setPreQueueTime(
|
|
7683
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7702
7684
|
metadata = await this.getEndpointMetadataFromNetwork();
|
|
7703
7685
|
if (metadata) {
|
|
7704
7686
|
// If the user prefers to use an azure region replace the global endpoints with regional information.
|
|
7705
7687
|
if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
|
|
7706
|
-
this.performanceClient?.setPreQueueTime(
|
|
7688
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7707
7689
|
metadata = await this.updateMetadataWithRegionalInformation(metadata);
|
|
7708
7690
|
}
|
|
7709
7691
|
metadataEntity.updateEndpointMetadata(metadata, true);
|
|
@@ -7714,7 +7696,7 @@ class Authority {
|
|
|
7714
7696
|
!this.authorityOptions.skipAuthorityMetadataCache) {
|
|
7715
7697
|
// If the user prefers to use an azure region replace the global endpoints with regional information.
|
|
7716
7698
|
if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
|
|
7717
|
-
this.performanceClient?.setPreQueueTime(
|
|
7699
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7718
7700
|
harcodedMetadata =
|
|
7719
7701
|
await this.updateMetadataWithRegionalInformation(harcodedMetadata);
|
|
7720
7702
|
}
|
|
@@ -7757,8 +7739,8 @@ class Authority {
|
|
|
7757
7739
|
* @param hasHardcodedMetadata boolean
|
|
7758
7740
|
*/
|
|
7759
7741
|
async getEndpointMetadataFromNetwork() {
|
|
7760
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7761
|
-
const perfEvent = this.performanceClient?.startMeasurement(
|
|
7742
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7743
|
+
const perfEvent = this.performanceClient?.startMeasurement(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7762
7744
|
const options = {};
|
|
7763
7745
|
/*
|
|
7764
7746
|
* TODO: Add a timeout if the authority exists in our library's
|
|
@@ -7798,8 +7780,8 @@ class Authority {
|
|
|
7798
7780
|
* Update the retrieved metadata with regional information.
|
|
7799
7781
|
*/
|
|
7800
7782
|
async updateMetadataWithRegionalInformation(metadata) {
|
|
7801
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7802
|
-
this.performanceClient?.setPreQueueTime(
|
|
7783
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7784
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
7803
7785
|
const autodetectedRegionName = await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration?.environmentRegion, this.regionDiscoveryMetadata);
|
|
7804
7786
|
const azureRegion = this.authorityOptions.azureRegionConfiguration?.azureRegion ===
|
|
7805
7787
|
Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
|
|
@@ -7837,7 +7819,7 @@ class Authority {
|
|
|
7837
7819
|
* @returns AuthorityMetadataSource
|
|
7838
7820
|
*/
|
|
7839
7821
|
async updateCloudDiscoveryMetadata(metadataEntity) {
|
|
7840
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7822
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
7841
7823
|
this.logger.verbose("Attempting to get cloud discovery metadata in the config");
|
|
7842
7824
|
this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities ||
|
|
7843
7825
|
Constants.NOT_APPLICABLE}`);
|
|
@@ -7864,7 +7846,7 @@ class Authority {
|
|
|
7864
7846
|
this.logger.verbose("The metadata entity is expired.");
|
|
7865
7847
|
}
|
|
7866
7848
|
this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
|
|
7867
|
-
this.performanceClient?.setPreQueueTime(
|
|
7849
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7868
7850
|
metadata = await this.getCloudDiscoveryMetadataFromNetwork();
|
|
7869
7851
|
if (metadata) {
|
|
7870
7852
|
this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
|
|
@@ -7925,7 +7907,7 @@ class Authority {
|
|
|
7925
7907
|
* @param hasHardcodedMetadata boolean
|
|
7926
7908
|
*/
|
|
7927
7909
|
async getCloudDiscoveryMetadataFromNetwork() {
|
|
7928
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7910
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7929
7911
|
const instanceDiscoveryEndpoint = `${Constants.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`;
|
|
7930
7912
|
const options = {};
|
|
7931
7913
|
/*
|
|
@@ -8008,7 +7990,7 @@ class Authority {
|
|
|
8008
7990
|
static generateAuthority(authorityString, azureCloudOptions) {
|
|
8009
7991
|
let authorityAzureCloudInstance;
|
|
8010
7992
|
if (azureCloudOptions &&
|
|
8011
|
-
azureCloudOptions.azureCloudInstance !==
|
|
7993
|
+
azureCloudOptions.azureCloudInstance !== AzureCloudInstance.None) {
|
|
8012
7994
|
const tenant = azureCloudOptions.tenant
|
|
8013
7995
|
? azureCloudOptions.tenant
|
|
8014
7996
|
: Constants.DEFAULT_COMMON_TENANT;
|
|
@@ -8142,7 +8124,7 @@ Authority.reservedTenantDomains = (new Set([
|
|
|
8142
8124
|
AADAuthorityConstants.ORGANIZATIONS
|
|
8143
8125
|
]));
|
|
8144
8126
|
|
|
8145
|
-
/*! @azure/msal-common v14.0.0-
|
|
8127
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8146
8128
|
|
|
8147
8129
|
/*
|
|
8148
8130
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8160,12 +8142,12 @@ class AuthorityFactory {
|
|
|
8160
8142
|
* @param protocolMode
|
|
8161
8143
|
*/
|
|
8162
8144
|
static async createDiscoveredInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
8163
|
-
performanceClient?.addQueueMeasurement(
|
|
8145
|
+
performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
|
|
8164
8146
|
const authorityUriFinal = Authority.transformCIAMAuthority(authorityUri);
|
|
8165
8147
|
// Initialize authority and perform discovery endpoint check.
|
|
8166
8148
|
const acquireTokenAuthority = AuthorityFactory.createInstance(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);
|
|
8167
8149
|
try {
|
|
8168
|
-
performanceClient?.setPreQueueTime(
|
|
8150
|
+
performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityResolveEndpointsAsync, correlationId);
|
|
8169
8151
|
await acquireTokenAuthority.resolveEndpointsAsync();
|
|
8170
8152
|
return acquireTokenAuthority;
|
|
8171
8153
|
}
|
|
@@ -8192,7 +8174,7 @@ class AuthorityFactory {
|
|
|
8192
8174
|
}
|
|
8193
8175
|
}
|
|
8194
8176
|
|
|
8195
|
-
/*! @azure/msal-common v14.0.0-
|
|
8177
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8196
8178
|
|
|
8197
8179
|
/*
|
|
8198
8180
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8222,7 +8204,7 @@ class ServerTelemetryEntity {
|
|
|
8222
8204
|
}
|
|
8223
8205
|
}
|
|
8224
8206
|
|
|
8225
|
-
/*! @azure/msal-common v14.0.0-
|
|
8207
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8226
8208
|
|
|
8227
8209
|
/*
|
|
8228
8210
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8248,7 +8230,7 @@ class ThrottlingEntity {
|
|
|
8248
8230
|
}
|
|
8249
8231
|
}
|
|
8250
8232
|
|
|
8251
|
-
/*! @azure/msal-common v14.0.0-
|
|
8233
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8252
8234
|
|
|
8253
8235
|
/*
|
|
8254
8236
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8265,7 +8247,7 @@ const StubbedNetworkModule = {
|
|
|
8265
8247
|
},
|
|
8266
8248
|
};
|
|
8267
8249
|
|
|
8268
|
-
/*! @azure/msal-common v14.0.0-
|
|
8250
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8269
8251
|
|
|
8270
8252
|
/*
|
|
8271
8253
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8307,7 +8289,7 @@ class JoseHeaderError extends AuthError {
|
|
|
8307
8289
|
}
|
|
8308
8290
|
}
|
|
8309
8291
|
|
|
8310
|
-
/*! @azure/msal-common v14.0.0-
|
|
8292
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8311
8293
|
|
|
8312
8294
|
/*
|
|
8313
8295
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8346,7 +8328,7 @@ class JoseHeader {
|
|
|
8346
8328
|
}
|
|
8347
8329
|
}
|
|
8348
8330
|
|
|
8349
|
-
/*! @azure/msal-common v14.0.0-
|
|
8331
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8350
8332
|
|
|
8351
8333
|
/*
|
|
8352
8334
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8404,7 +8386,7 @@ class AuthenticationHeaderParser {
|
|
|
8404
8386
|
}
|
|
8405
8387
|
}
|
|
8406
8388
|
|
|
8407
|
-
/*! @azure/msal-common v14.0.0-
|
|
8389
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8408
8390
|
|
|
8409
8391
|
/*
|
|
8410
8392
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8603,7 +8585,7 @@ class ServerTelemetryManager {
|
|
|
8603
8585
|
}
|
|
8604
8586
|
}
|
|
8605
8587
|
|
|
8606
|
-
/*! @azure/msal-common v14.0.0-
|
|
8588
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
8607
8589
|
|
|
8608
8590
|
/*
|
|
8609
8591
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9012,20 +8994,16 @@ class PerformanceClient {
|
|
|
9012
8994
|
}
|
|
9013
8995
|
}
|
|
9014
8996
|
|
|
9015
|
-
/*! @azure/msal-common v14.0.0-
|
|
8997
|
+
/*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
|
|
9016
8998
|
|
|
9017
8999
|
/*
|
|
9018
9000
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9019
9001
|
* Licensed under the MIT License.
|
|
9020
9002
|
*/
|
|
9021
9003
|
class StubPerformanceMeasurement {
|
|
9022
|
-
|
|
9023
|
-
|
|
9024
|
-
|
|
9025
|
-
endMeasurement() { }
|
|
9026
|
-
flushMeasurement() {
|
|
9027
|
-
return null;
|
|
9028
|
-
}
|
|
9004
|
+
startMeasurement() { return; }
|
|
9005
|
+
endMeasurement() { return; }
|
|
9006
|
+
flushMeasurement() { return null; }
|
|
9029
9007
|
}
|
|
9030
9008
|
class StubPerformanceClient extends PerformanceClient {
|
|
9031
9009
|
generateId() {
|
|
@@ -9034,21 +9012,11 @@ class StubPerformanceClient extends PerformanceClient {
|
|
|
9034
9012
|
startPerformanceMeasurement() {
|
|
9035
9013
|
return new StubPerformanceMeasurement();
|
|
9036
9014
|
}
|
|
9037
|
-
|
|
9038
|
-
calculateQueuedTime(preQueueTime, currentTime) {
|
|
9015
|
+
calculateQueuedTime() {
|
|
9039
9016
|
return 0;
|
|
9040
9017
|
}
|
|
9041
|
-
addQueueMeasurement(
|
|
9042
|
-
|
|
9043
|
-
queueTime // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9044
|
-
) {
|
|
9045
|
-
return;
|
|
9046
|
-
}
|
|
9047
|
-
setPreQueueTime(eventName, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9048
|
-
correlationId // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9049
|
-
) {
|
|
9050
|
-
return;
|
|
9051
|
-
}
|
|
9018
|
+
addQueueMeasurement() { return; }
|
|
9019
|
+
setPreQueueTime() { return; }
|
|
9052
9020
|
}
|
|
9053
9021
|
|
|
9054
9022
|
/*
|
|
@@ -9577,79 +9545,72 @@ const NativeConstants = {
|
|
|
9577
9545
|
PREFERRED_EXTENSION_ID: "ppnbnpeolgkicgegkbkbjmhlideopiji",
|
|
9578
9546
|
MATS_TELEMETRY: "MATS",
|
|
9579
9547
|
};
|
|
9580
|
-
|
|
9581
|
-
|
|
9582
|
-
|
|
9583
|
-
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
BrowserCacheLocation["MemoryStorage"] = "memoryStorage";
|
|
9592
|
-
})(exports.BrowserCacheLocation || (exports.BrowserCacheLocation = {}));
|
|
9548
|
+
const NativeExtensionMethod = {
|
|
9549
|
+
HandshakeRequest: "Handshake",
|
|
9550
|
+
HandshakeResponse: "HandshakeResponse",
|
|
9551
|
+
GetToken: "GetToken",
|
|
9552
|
+
Response: "Response",
|
|
9553
|
+
};
|
|
9554
|
+
const BrowserCacheLocation = {
|
|
9555
|
+
LocalStorage: "localStorage",
|
|
9556
|
+
SessionStorage: "sessionStorage",
|
|
9557
|
+
MemoryStorage: "memoryStorage",
|
|
9558
|
+
};
|
|
9593
9559
|
/**
|
|
9594
9560
|
* HTTP Request types supported by MSAL.
|
|
9595
9561
|
*/
|
|
9596
|
-
|
|
9597
|
-
|
|
9598
|
-
|
|
9599
|
-
|
|
9600
|
-
})(HTTP_REQUEST_TYPE || (HTTP_REQUEST_TYPE = {}));
|
|
9562
|
+
const HTTP_REQUEST_TYPE = {
|
|
9563
|
+
GET: "GET",
|
|
9564
|
+
POST: "POST",
|
|
9565
|
+
};
|
|
9601
9566
|
/**
|
|
9602
9567
|
* Temporary cache keys for MSAL, deleted after any request.
|
|
9603
9568
|
*/
|
|
9604
|
-
|
|
9605
|
-
|
|
9606
|
-
|
|
9607
|
-
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
StaticCacheKeys["TOKEN_KEYS"] = "msal.token.keys";
|
|
9626
|
-
})(StaticCacheKeys || (StaticCacheKeys = {}));
|
|
9569
|
+
const TemporaryCacheKeys = {
|
|
9570
|
+
AUTHORITY: "authority",
|
|
9571
|
+
ACQUIRE_TOKEN_ACCOUNT: "acquireToken.account",
|
|
9572
|
+
SESSION_STATE: "session.state",
|
|
9573
|
+
REQUEST_STATE: "request.state",
|
|
9574
|
+
NONCE_IDTOKEN: "nonce.id_token",
|
|
9575
|
+
ORIGIN_URI: "request.origin",
|
|
9576
|
+
RENEW_STATUS: "token.renew.status",
|
|
9577
|
+
URL_HASH: "urlHash",
|
|
9578
|
+
REQUEST_PARAMS: "request.params",
|
|
9579
|
+
SCOPES: "scopes",
|
|
9580
|
+
INTERACTION_STATUS_KEY: "interaction.status",
|
|
9581
|
+
CCS_CREDENTIAL: "ccs.credential",
|
|
9582
|
+
CORRELATION_ID: "request.correlationId",
|
|
9583
|
+
NATIVE_REQUEST: "request.native",
|
|
9584
|
+
REDIRECT_CONTEXT: "request.redirect.context",
|
|
9585
|
+
};
|
|
9586
|
+
const StaticCacheKeys = {
|
|
9587
|
+
ACCOUNT_KEYS: "msal.account.keys",
|
|
9588
|
+
TOKEN_KEYS: "msal.token.keys",
|
|
9589
|
+
};
|
|
9627
9590
|
/**
|
|
9628
9591
|
* Cache keys stored in-memory
|
|
9629
9592
|
*/
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
-
})(InMemoryCacheKeys || (InMemoryCacheKeys = {}));
|
|
9593
|
+
const InMemoryCacheKeys = {
|
|
9594
|
+
WRAPPER_SKU: "wrapper.sku",
|
|
9595
|
+
WRAPPER_VER: "wrapper.version",
|
|
9596
|
+
};
|
|
9635
9597
|
/**
|
|
9636
9598
|
* API Codes for Telemetry purposes.
|
|
9637
9599
|
* Before adding a new code you must claim it in the MSAL Telemetry tracker as these number spaces are shared across all MSALs
|
|
9638
9600
|
* 0-99 Silent Flow
|
|
9639
9601
|
* 800-899 Auth Code Flow
|
|
9640
9602
|
*/
|
|
9641
|
-
|
|
9642
|
-
|
|
9643
|
-
|
|
9644
|
-
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
})(exports.ApiId || (exports.ApiId = {}));
|
|
9603
|
+
const ApiId = {
|
|
9604
|
+
acquireTokenRedirect: 861,
|
|
9605
|
+
acquireTokenPopup: 862,
|
|
9606
|
+
ssoSilent: 863,
|
|
9607
|
+
acquireTokenSilent_authCode: 864,
|
|
9608
|
+
handleRedirectPromise: 865,
|
|
9609
|
+
acquireTokenByCode: 866,
|
|
9610
|
+
acquireTokenSilent_silentFlow: 61,
|
|
9611
|
+
logout: 961,
|
|
9612
|
+
logoutPopup: 962,
|
|
9613
|
+
};
|
|
9653
9614
|
/*
|
|
9654
9615
|
* Interaction type of the API - used for state and telemetry
|
|
9655
9616
|
*/
|
|
@@ -9664,37 +9625,36 @@ exports.InteractionType = void 0;
|
|
|
9664
9625
|
* Types of interaction currently in progress.
|
|
9665
9626
|
* Used in events in wrapper libraries to invoke functions when certain interaction is in progress or all interactions are complete.
|
|
9666
9627
|
*/
|
|
9667
|
-
|
|
9668
|
-
(function (InteractionStatus) {
|
|
9628
|
+
const InteractionStatus = {
|
|
9669
9629
|
/**
|
|
9670
9630
|
* Initial status before interaction occurs
|
|
9671
9631
|
*/
|
|
9672
|
-
|
|
9632
|
+
Startup: "startup",
|
|
9673
9633
|
/**
|
|
9674
9634
|
* Status set when all login calls occuring
|
|
9675
9635
|
*/
|
|
9676
|
-
|
|
9636
|
+
Login: "login",
|
|
9677
9637
|
/**
|
|
9678
9638
|
* Status set when logout call occuring
|
|
9679
9639
|
*/
|
|
9680
|
-
|
|
9640
|
+
Logout: "logout",
|
|
9681
9641
|
/**
|
|
9682
9642
|
* Status set for acquireToken calls
|
|
9683
9643
|
*/
|
|
9684
|
-
|
|
9644
|
+
AcquireToken: "acquireToken",
|
|
9685
9645
|
/**
|
|
9686
9646
|
* Status set for ssoSilent calls
|
|
9687
9647
|
*/
|
|
9688
|
-
|
|
9648
|
+
SsoSilent: "ssoSilent",
|
|
9689
9649
|
/**
|
|
9690
9650
|
* Status set when handleRedirect in progress
|
|
9691
9651
|
*/
|
|
9692
|
-
|
|
9652
|
+
HandleRedirect: "handleRedirect",
|
|
9693
9653
|
/**
|
|
9694
9654
|
* Status set when interaction is complete
|
|
9695
9655
|
*/
|
|
9696
|
-
|
|
9697
|
-
}
|
|
9656
|
+
None: "none",
|
|
9657
|
+
};
|
|
9698
9658
|
const DEFAULT_REQUEST = {
|
|
9699
9659
|
scopes: OIDC_DEFAULT_SCOPES,
|
|
9700
9660
|
};
|
|
@@ -9703,52 +9663,50 @@ const DEFAULT_REQUEST = {
|
|
|
9703
9663
|
*/
|
|
9704
9664
|
const KEY_FORMAT_JWK = "jwk";
|
|
9705
9665
|
// Supported wrapper SKUs
|
|
9706
|
-
|
|
9707
|
-
|
|
9708
|
-
|
|
9709
|
-
|
|
9710
|
-
})(exports.WrapperSKU || (exports.WrapperSKU = {}));
|
|
9666
|
+
const WrapperSKU = {
|
|
9667
|
+
React: "@azure/msal-react",
|
|
9668
|
+
Angular: "@azure/msal-angular",
|
|
9669
|
+
};
|
|
9711
9670
|
// DatabaseStorage Constants
|
|
9712
9671
|
const DB_NAME = "msal.db";
|
|
9713
9672
|
const DB_VERSION = 1;
|
|
9714
9673
|
const DB_TABLE_NAME = `${DB_NAME}.keys`;
|
|
9715
|
-
|
|
9716
|
-
(function (CacheLookupPolicy) {
|
|
9674
|
+
const CacheLookupPolicy = {
|
|
9717
9675
|
/*
|
|
9718
9676
|
* acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired
|
|
9719
9677
|
* or cannot be found the refresh token will be used to acquire a new one. Finally, if the refresh token
|
|
9720
9678
|
* is expired acquireTokenSilent will attempt to acquire new access and refresh tokens.
|
|
9721
9679
|
*/
|
|
9722
|
-
|
|
9680
|
+
Default: 0,
|
|
9723
9681
|
/*
|
|
9724
9682
|
* acquireTokenSilent will only look for access tokens in the cache. It will not attempt to renew access or
|
|
9725
9683
|
* refresh tokens.
|
|
9726
9684
|
*/
|
|
9727
|
-
|
|
9685
|
+
AccessToken: 1,
|
|
9728
9686
|
/*
|
|
9729
9687
|
* acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired or
|
|
9730
9688
|
* cannot be found, the refresh token will be used to acquire a new one. If the refresh token is expired, it
|
|
9731
9689
|
* will not be renewed and acquireTokenSilent will fail.
|
|
9732
9690
|
*/
|
|
9733
|
-
|
|
9691
|
+
AccessTokenAndRefreshToken: 2,
|
|
9734
9692
|
/*
|
|
9735
9693
|
* acquireTokenSilent will not attempt to retrieve access tokens from the cache and will instead attempt to
|
|
9736
9694
|
* exchange the cached refresh token for a new access token. If the refresh token is expired, it will not be
|
|
9737
9695
|
* renewed and acquireTokenSilent will fail.
|
|
9738
9696
|
*/
|
|
9739
|
-
|
|
9697
|
+
RefreshToken: 3,
|
|
9740
9698
|
/*
|
|
9741
9699
|
* acquireTokenSilent will not look in the cache for the access token. It will go directly to network with the
|
|
9742
9700
|
* cached refresh token. If the refresh token is expired an attempt will be made to renew it. This is equivalent to
|
|
9743
9701
|
* setting "forceRefresh: true".
|
|
9744
9702
|
*/
|
|
9745
|
-
|
|
9703
|
+
RefreshTokenAndNetwork: 4,
|
|
9746
9704
|
/*
|
|
9747
9705
|
* acquireTokenSilent will attempt to renew both access and refresh tokens. It will not look in the cache. This will
|
|
9748
9706
|
* always fail if 3rd party cookies are blocked by the browser.
|
|
9749
9707
|
*/
|
|
9750
|
-
|
|
9751
|
-
}
|
|
9708
|
+
Skip: 5,
|
|
9709
|
+
};
|
|
9752
9710
|
|
|
9753
9711
|
/*
|
|
9754
9712
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9857,8 +9815,8 @@ class BrowserStorage {
|
|
|
9857
9815
|
this.windowStorage = window[cacheLocation];
|
|
9858
9816
|
}
|
|
9859
9817
|
validateWindowStorage(cacheLocation) {
|
|
9860
|
-
if (cacheLocation !==
|
|
9861
|
-
cacheLocation !==
|
|
9818
|
+
if (cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
9819
|
+
cacheLocation !== BrowserCacheLocation.SessionStorage) {
|
|
9862
9820
|
throw BrowserConfigurationAuthError.createStorageNotSupportedError(cacheLocation);
|
|
9863
9821
|
}
|
|
9864
9822
|
const storageSupported = !!window[cacheLocation];
|
|
@@ -9981,8 +9939,8 @@ class BrowserCacheManager extends CacheManager {
|
|
|
9981
9939
|
*/
|
|
9982
9940
|
setupBrowserStorage(cacheLocation) {
|
|
9983
9941
|
switch (cacheLocation) {
|
|
9984
|
-
case
|
|
9985
|
-
case
|
|
9942
|
+
case BrowserCacheLocation.LocalStorage:
|
|
9943
|
+
case BrowserCacheLocation.SessionStorage:
|
|
9986
9944
|
try {
|
|
9987
9945
|
return new BrowserStorage(cacheLocation);
|
|
9988
9946
|
}
|
|
@@ -9990,9 +9948,9 @@ class BrowserCacheManager extends CacheManager {
|
|
|
9990
9948
|
this.logger.verbose(e);
|
|
9991
9949
|
break;
|
|
9992
9950
|
}
|
|
9993
|
-
case
|
|
9951
|
+
case BrowserCacheLocation.MemoryStorage:
|
|
9994
9952
|
}
|
|
9995
|
-
this.cacheConfig.cacheLocation =
|
|
9953
|
+
this.cacheConfig.cacheLocation = BrowserCacheLocation.MemoryStorage;
|
|
9996
9954
|
return new MemoryStorage();
|
|
9997
9955
|
}
|
|
9998
9956
|
/**
|
|
@@ -10002,18 +9960,18 @@ class BrowserCacheManager extends CacheManager {
|
|
|
10002
9960
|
*/
|
|
10003
9961
|
setupTemporaryCacheStorage(temporaryCacheLocation, cacheLocation) {
|
|
10004
9962
|
switch (cacheLocation) {
|
|
10005
|
-
case
|
|
10006
|
-
case
|
|
9963
|
+
case BrowserCacheLocation.LocalStorage:
|
|
9964
|
+
case BrowserCacheLocation.SessionStorage:
|
|
10007
9965
|
try {
|
|
10008
9966
|
// Temporary cache items will always be stored in session storage to mitigate problems caused by multiple tabs
|
|
10009
9967
|
return new BrowserStorage(temporaryCacheLocation ||
|
|
10010
|
-
|
|
9968
|
+
BrowserCacheLocation.SessionStorage);
|
|
10011
9969
|
}
|
|
10012
9970
|
catch (e) {
|
|
10013
9971
|
this.logger.verbose(e);
|
|
10014
9972
|
return this.internalStorage;
|
|
10015
9973
|
}
|
|
10016
|
-
case
|
|
9974
|
+
case BrowserCacheLocation.MemoryStorage:
|
|
10017
9975
|
default:
|
|
10018
9976
|
return this.internalStorage;
|
|
10019
9977
|
}
|
|
@@ -10197,8 +10155,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
10197
10155
|
}
|
|
10198
10156
|
/**
|
|
10199
10157
|
* set account entity in the platform cache
|
|
10200
|
-
* @param
|
|
10201
|
-
* @param value
|
|
10158
|
+
* @param account
|
|
10202
10159
|
*/
|
|
10203
10160
|
setAccount(account) {
|
|
10204
10161
|
this.logger.trace("BrowserCacheManager.setAccount called");
|
|
@@ -10759,7 +10716,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
10759
10716
|
if (!value) {
|
|
10760
10717
|
// If temp cache item not found in session/memory, check local storage for items set by old versions
|
|
10761
10718
|
if (this.cacheConfig.cacheLocation ===
|
|
10762
|
-
|
|
10719
|
+
BrowserCacheLocation.LocalStorage) {
|
|
10763
10720
|
const item = this.browserStorage.getItem(key);
|
|
10764
10721
|
if (item) {
|
|
10765
10722
|
this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage");
|
|
@@ -11219,8 +11176,8 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11219
11176
|
}
|
|
11220
11177
|
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
11221
11178
|
const cacheOptions = {
|
|
11222
|
-
cacheLocation:
|
|
11223
|
-
temporaryCacheLocation:
|
|
11179
|
+
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
11180
|
+
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
11224
11181
|
storeAuthStateInCookie: false,
|
|
11225
11182
|
secureCookies: false,
|
|
11226
11183
|
cacheMigrationEnabled: false,
|
|
@@ -11230,7 +11187,7 @@ const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
|
11230
11187
|
|
|
11231
11188
|
/* eslint-disable header/header */
|
|
11232
11189
|
const name = "@azure/msal-browser";
|
|
11233
|
-
const version = "3.0.0-
|
|
11190
|
+
const version = "3.0.0-beta.0";
|
|
11234
11191
|
|
|
11235
11192
|
/*
|
|
11236
11193
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11639,10 +11596,13 @@ class BaseInteractionClient {
|
|
|
11639
11596
|
* Initializer function for all request APIs
|
|
11640
11597
|
* @param request
|
|
11641
11598
|
*/
|
|
11642
|
-
async initializeBaseRequest(request) {
|
|
11643
|
-
this.performanceClient.addQueueMeasurement(
|
|
11599
|
+
async initializeBaseRequest(request, account) {
|
|
11600
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
11644
11601
|
this.logger.verbose("Initializing BaseAuthRequest");
|
|
11645
11602
|
const authority = request.authority || this.config.auth.authority;
|
|
11603
|
+
if (account) {
|
|
11604
|
+
await this.validateRequestAuthority(authority, account);
|
|
11605
|
+
}
|
|
11646
11606
|
const scopes = [...((request && request.scopes) || [])];
|
|
11647
11607
|
const validatedRequest = {
|
|
11648
11608
|
...request,
|
|
@@ -11652,12 +11612,12 @@ class BaseInteractionClient {
|
|
|
11652
11612
|
};
|
|
11653
11613
|
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
11654
11614
|
if (!validatedRequest.authenticationScheme) {
|
|
11655
|
-
validatedRequest.authenticationScheme =
|
|
11615
|
+
validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;
|
|
11656
11616
|
this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');
|
|
11657
11617
|
}
|
|
11658
11618
|
else {
|
|
11659
11619
|
if (validatedRequest.authenticationScheme ===
|
|
11660
|
-
|
|
11620
|
+
AuthenticationScheme.SSH) {
|
|
11661
11621
|
if (!request.sshJwk) {
|
|
11662
11622
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
11663
11623
|
}
|
|
@@ -11688,6 +11648,16 @@ class BaseInteractionClient {
|
|
|
11688
11648
|
BrowserUtils.getCurrentUri();
|
|
11689
11649
|
return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());
|
|
11690
11650
|
}
|
|
11651
|
+
/*
|
|
11652
|
+
* If authority provided in the request does not match environment/authority specified
|
|
11653
|
+
* in the account or MSAL config, we throw an error.
|
|
11654
|
+
*/
|
|
11655
|
+
async validateRequestAuthority(authority, account) {
|
|
11656
|
+
const discoveredAuthority = await this.getDiscoveredAuthority(authority);
|
|
11657
|
+
if (!discoveredAuthority.isAlias(account.environment)) {
|
|
11658
|
+
throw ClientConfigurationError.createAuthorityMismatchError();
|
|
11659
|
+
}
|
|
11660
|
+
}
|
|
11691
11661
|
/**
|
|
11692
11662
|
*
|
|
11693
11663
|
* @param apiId
|
|
@@ -11741,7 +11711,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
11741
11711
|
* @param request
|
|
11742
11712
|
*/
|
|
11743
11713
|
async initializeAuthorizationCodeRequest(request) {
|
|
11744
|
-
this.performanceClient.addQueueMeasurement(
|
|
11714
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
11745
11715
|
this.logger.verbose("initializeAuthorizationRequest called", request.correlationId);
|
|
11746
11716
|
const generatedPkceParams = await this.browserCrypto.generatePkceCodes();
|
|
11747
11717
|
const authCodeRequest = {
|
|
@@ -11844,9 +11814,9 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
11844
11814
|
* @param authorityUrl
|
|
11845
11815
|
*/
|
|
11846
11816
|
async createAuthCodeClient(serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
|
|
11847
|
-
this.performanceClient.addQueueMeasurement(
|
|
11817
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);
|
|
11848
11818
|
// Create auth module.
|
|
11849
|
-
this.performanceClient.setPreQueueTime(
|
|
11819
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11850
11820
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions);
|
|
11851
11821
|
return new AuthorizationCodeClient(clientConfig, this.performanceClient);
|
|
11852
11822
|
}
|
|
@@ -11857,9 +11827,9 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
11857
11827
|
* @param requestCorrelationId
|
|
11858
11828
|
*/
|
|
11859
11829
|
async getClientConfiguration(serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
|
|
11860
|
-
this.performanceClient.addQueueMeasurement(
|
|
11830
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11861
11831
|
this.logger.verbose("getClientConfiguration called", this.correlationId);
|
|
11862
|
-
this.performanceClient.setPreQueueTime(
|
|
11832
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11863
11833
|
const discoveredAuthority = await this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions);
|
|
11864
11834
|
const logger = this.config.system.loggerOptions;
|
|
11865
11835
|
return {
|
|
@@ -11916,9 +11886,9 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
11916
11886
|
* @param requestCorrelationId
|
|
11917
11887
|
*/
|
|
11918
11888
|
async getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions) {
|
|
11919
|
-
this.performanceClient.addQueueMeasurement(
|
|
11889
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11920
11890
|
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
|
|
11921
|
-
const getAuthorityMeasurement = this.performanceClient?.startMeasurement(
|
|
11891
|
+
const getAuthorityMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11922
11892
|
const authorityOptions = {
|
|
11923
11893
|
protocolMode: this.config.auth.protocolMode,
|
|
11924
11894
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
@@ -11933,7 +11903,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
11933
11903
|
// fall back to the authority from config
|
|
11934
11904
|
const builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
11935
11905
|
this.logger.verbose("Creating discovered authority with configured authority", this.correlationId);
|
|
11936
|
-
this.performanceClient.setPreQueueTime(
|
|
11906
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.correlationId);
|
|
11937
11907
|
return await AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId)
|
|
11938
11908
|
.then((result) => {
|
|
11939
11909
|
getAuthorityMeasurement.endMeasurement({
|
|
@@ -11956,14 +11926,14 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
11956
11926
|
* @param interactionType
|
|
11957
11927
|
*/
|
|
11958
11928
|
async initializeAuthorizationRequest(request, interactionType) {
|
|
11959
|
-
this.performanceClient.addQueueMeasurement(
|
|
11929
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.correlationId);
|
|
11960
11930
|
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
|
|
11961
11931
|
const redirectUri = this.getRedirectUri(request.redirectUri);
|
|
11962
11932
|
const browserState = {
|
|
11963
11933
|
interactionType: interactionType,
|
|
11964
11934
|
};
|
|
11965
11935
|
const state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
11966
|
-
this.performanceClient.setPreQueueTime(
|
|
11936
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
11967
11937
|
const validatedRequest = {
|
|
11968
11938
|
...(await this.initializeBaseRequest(request)),
|
|
11969
11939
|
redirectUri: redirectUri,
|
|
@@ -12008,7 +11978,7 @@ class InteractionHandler {
|
|
|
12008
11978
|
* @param locationHash
|
|
12009
11979
|
*/
|
|
12010
11980
|
async handleCodeResponseFromHash(locationHash, state, authority, networkModule) {
|
|
12011
|
-
this.performanceClient.addQueueMeasurement(
|
|
11981
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromHash, this.authCodeRequest.correlationId);
|
|
12012
11982
|
this.logger.verbose("InteractionHandler.handleCodeResponse called");
|
|
12013
11983
|
// Check that location hash isn't empty.
|
|
12014
11984
|
if (StringUtils.isEmpty(locationHash)) {
|
|
@@ -12034,7 +12004,7 @@ class InteractionHandler {
|
|
|
12034
12004
|
throw e;
|
|
12035
12005
|
}
|
|
12036
12006
|
}
|
|
12037
|
-
this.performanceClient.setPreQueueTime(
|
|
12007
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
12038
12008
|
return this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule);
|
|
12039
12009
|
}
|
|
12040
12010
|
/**
|
|
@@ -12046,7 +12016,7 @@ class InteractionHandler {
|
|
|
12046
12016
|
* @returns
|
|
12047
12017
|
*/
|
|
12048
12018
|
async handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule, validateNonce = true) {
|
|
12049
|
-
this.performanceClient.addQueueMeasurement(
|
|
12019
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
12050
12020
|
this.logger.trace("InteractionHandler.handleCodeResponseFromServer called");
|
|
12051
12021
|
// Handle code response.
|
|
12052
12022
|
const stateKey = this.browserStorage.generateStateKey(state);
|
|
@@ -12061,7 +12031,7 @@ class InteractionHandler {
|
|
|
12061
12031
|
this.authCodeRequest.code = authCodeResponse.code;
|
|
12062
12032
|
// Check for new cloud instance
|
|
12063
12033
|
if (authCodeResponse.cloud_instance_host_name) {
|
|
12064
|
-
this.performanceClient.setPreQueueTime(
|
|
12034
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
12065
12035
|
await this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule);
|
|
12066
12036
|
}
|
|
12067
12037
|
// Nonce validation not needed when redirect not involved (e.g. hybrid spa, renewing token via rt)
|
|
@@ -12080,7 +12050,7 @@ class InteractionHandler {
|
|
|
12080
12050
|
}
|
|
12081
12051
|
}
|
|
12082
12052
|
// Acquire token with retrieved code.
|
|
12083
|
-
this.performanceClient.setPreQueueTime(
|
|
12053
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AuthClientAcquireToken, this.authCodeRequest.correlationId);
|
|
12084
12054
|
const tokenResponse = await this.authModule.acquireToken(this.authCodeRequest, authCodeResponse);
|
|
12085
12055
|
this.browserStorage.cleanRequestByState(state);
|
|
12086
12056
|
return tokenResponse;
|
|
@@ -12092,7 +12062,7 @@ class InteractionHandler {
|
|
|
12092
12062
|
* @param networkModule
|
|
12093
12063
|
*/
|
|
12094
12064
|
async updateTokenEndpointAuthority(cloudInstanceHostname, authority, networkModule) {
|
|
12095
|
-
this.performanceClient.addQueueMeasurement(
|
|
12065
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
12096
12066
|
const cloudInstanceAuthorityUri = `https://${cloudInstanceHostname}/${authority.tenant}/`;
|
|
12097
12067
|
const cloudInstanceAuthority = await AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, this.browserStorage, authority.options, this.logger, this.performanceClient, this.authCodeRequest.correlationId);
|
|
12098
12068
|
this.authModule.updateAuthority(cloudInstanceAuthority);
|
|
@@ -12143,7 +12113,7 @@ class RedirectHandler extends InteractionHandler {
|
|
|
12143
12113
|
this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);
|
|
12144
12114
|
this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${requestUrl}`);
|
|
12145
12115
|
const navigationOptions = {
|
|
12146
|
-
apiId:
|
|
12116
|
+
apiId: ApiId.acquireTokenRedirect,
|
|
12147
12117
|
timeout: params.redirectTimeout,
|
|
12148
12118
|
noHistory: false,
|
|
12149
12119
|
};
|
|
@@ -12239,48 +12209,48 @@ class RedirectHandler extends InteractionHandler {
|
|
|
12239
12209
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12240
12210
|
* Licensed under the MIT License.
|
|
12241
12211
|
*/
|
|
12242
|
-
|
|
12243
|
-
|
|
12244
|
-
|
|
12245
|
-
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
}
|
|
12212
|
+
const EventType = {
|
|
12213
|
+
INITIALIZE_START: "msal:initializeStart",
|
|
12214
|
+
INITIALIZE_END: "msal:initializeEnd",
|
|
12215
|
+
ACCOUNT_ADDED: "msal:accountAdded",
|
|
12216
|
+
ACCOUNT_REMOVED: "msal:accountRemoved",
|
|
12217
|
+
LOGIN_START: "msal:loginStart",
|
|
12218
|
+
LOGIN_SUCCESS: "msal:loginSuccess",
|
|
12219
|
+
LOGIN_FAILURE: "msal:loginFailure",
|
|
12220
|
+
ACQUIRE_TOKEN_START: "msal:acquireTokenStart",
|
|
12221
|
+
ACQUIRE_TOKEN_SUCCESS: "msal:acquireTokenSuccess",
|
|
12222
|
+
ACQUIRE_TOKEN_FAILURE: "msal:acquireTokenFailure",
|
|
12223
|
+
ACQUIRE_TOKEN_NETWORK_START: "msal:acquireTokenFromNetworkStart",
|
|
12224
|
+
SSO_SILENT_START: "msal:ssoSilentStart",
|
|
12225
|
+
SSO_SILENT_SUCCESS: "msal:ssoSilentSuccess",
|
|
12226
|
+
SSO_SILENT_FAILURE: "msal:ssoSilentFailure",
|
|
12227
|
+
ACQUIRE_TOKEN_BY_CODE_START: "msal:acquireTokenByCodeStart",
|
|
12228
|
+
ACQUIRE_TOKEN_BY_CODE_SUCCESS: "msal:acquireTokenByCodeSuccess",
|
|
12229
|
+
ACQUIRE_TOKEN_BY_CODE_FAILURE: "msal:acquireTokenByCodeFailure",
|
|
12230
|
+
HANDLE_REDIRECT_START: "msal:handleRedirectStart",
|
|
12231
|
+
HANDLE_REDIRECT_END: "msal:handleRedirectEnd",
|
|
12232
|
+
POPUP_OPENED: "msal:popupOpened",
|
|
12233
|
+
LOGOUT_START: "msal:logoutStart",
|
|
12234
|
+
LOGOUT_SUCCESS: "msal:logoutSuccess",
|
|
12235
|
+
LOGOUT_FAILURE: "msal:logoutFailure",
|
|
12236
|
+
LOGOUT_END: "msal:logoutEnd",
|
|
12237
|
+
RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache"
|
|
12238
|
+
};
|
|
12269
12239
|
|
|
12270
12240
|
/*
|
|
12271
12241
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12272
12242
|
* Licensed under the MIT License.
|
|
12273
12243
|
*/
|
|
12274
|
-
|
|
12275
|
-
|
|
12276
|
-
|
|
12277
|
-
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
}
|
|
12244
|
+
const INVALID_METHOD_ERROR = -2147186943;
|
|
12245
|
+
const NativeStatusCode = {
|
|
12246
|
+
USER_INTERACTION_REQUIRED: "USER_INTERACTION_REQUIRED",
|
|
12247
|
+
USER_CANCEL: "USER_CANCEL",
|
|
12248
|
+
NO_NETWORK: "NO_NETWORK",
|
|
12249
|
+
TRANSIENT_ERROR: "TRANSIENT_ERROR",
|
|
12250
|
+
PERSISTENT_ERROR: "PERSISTENT_ERROR",
|
|
12251
|
+
DISABLED: "DISABLED",
|
|
12252
|
+
ACCOUNT_UNAVAILABLE: "ACCOUNT_UNAVAILABLE",
|
|
12253
|
+
};
|
|
12284
12254
|
const NativeAuthErrorMessage = {
|
|
12285
12255
|
extensionError: {
|
|
12286
12256
|
code: "ContentError",
|
|
@@ -12311,6 +12281,11 @@ class NativeAuthError extends AuthError {
|
|
|
12311
12281
|
this.ext.status === NativeStatusCode.DISABLED)) {
|
|
12312
12282
|
return true;
|
|
12313
12283
|
}
|
|
12284
|
+
if (this.ext &&
|
|
12285
|
+
this.ext.error &&
|
|
12286
|
+
this.ext.error === INVALID_METHOD_ERROR) {
|
|
12287
|
+
return true;
|
|
12288
|
+
}
|
|
12314
12289
|
switch (this.errorCode) {
|
|
12315
12290
|
case NativeAuthErrorMessage.extensionError.code:
|
|
12316
12291
|
return true;
|
|
@@ -12366,9 +12341,9 @@ class SilentCacheClient extends StandardInteractionClient {
|
|
|
12366
12341
|
* @param silentRequest
|
|
12367
12342
|
*/
|
|
12368
12343
|
async acquireToken(silentRequest) {
|
|
12369
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(
|
|
12344
|
+
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
|
|
12370
12345
|
// Telemetry manager only used to increment cacheHits here
|
|
12371
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
12346
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
12372
12347
|
const silentAuthClient = await this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
12373
12348
|
this.logger.verbose("Silent auth client created");
|
|
12374
12349
|
try {
|
|
@@ -12408,16 +12383,16 @@ class SilentCacheClient extends StandardInteractionClient {
|
|
|
12408
12383
|
*/
|
|
12409
12384
|
async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
12410
12385
|
// Create auth module.
|
|
12411
|
-
this.performanceClient.setPreQueueTime(
|
|
12386
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
12412
12387
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
12413
12388
|
return new SilentFlowClient(clientConfig, this.performanceClient);
|
|
12414
12389
|
}
|
|
12415
12390
|
async initializeSilentRequest(request, account) {
|
|
12416
|
-
this.performanceClient.addQueueMeasurement(
|
|
12417
|
-
this.performanceClient.setPreQueueTime(
|
|
12391
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);
|
|
12392
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
12418
12393
|
return {
|
|
12419
12394
|
...request,
|
|
12420
|
-
...
|
|
12395
|
+
...await this.initializeBaseRequest(request, account),
|
|
12421
12396
|
account: account,
|
|
12422
12397
|
forceRefresh: request.forceRefresh || false,
|
|
12423
12398
|
};
|
|
@@ -12444,7 +12419,7 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12444
12419
|
async acquireToken(request) {
|
|
12445
12420
|
this.logger.trace("NativeInteractionClient - acquireToken called.");
|
|
12446
12421
|
// start the perf measurement
|
|
12447
|
-
const nativeATMeasurement = this.performanceClient.startMeasurement(
|
|
12422
|
+
const nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
|
|
12448
12423
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
12449
12424
|
// initialize native request
|
|
12450
12425
|
const nativeRequest = await this.initializeNativeRequest(request);
|
|
@@ -12514,7 +12489,7 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12514
12489
|
this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided");
|
|
12515
12490
|
throw ClientAuthError.createNoAccountFoundError();
|
|
12516
12491
|
}
|
|
12517
|
-
// fetch the account from
|
|
12492
|
+
// fetch the account from browser cache
|
|
12518
12493
|
const account = this.browserStorage.getAccountInfoFilteredBy({
|
|
12519
12494
|
nativeAccountId,
|
|
12520
12495
|
});
|
|
@@ -12554,7 +12529,7 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12554
12529
|
}
|
|
12555
12530
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify(nativeRequest), true);
|
|
12556
12531
|
const navigationOptions = {
|
|
12557
|
-
apiId:
|
|
12532
|
+
apiId: ApiId.acquireTokenRedirect,
|
|
12558
12533
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
12559
12534
|
noHistory: false,
|
|
12560
12535
|
};
|
|
@@ -12632,7 +12607,7 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12632
12607
|
const result = await this.generateAuthenticationResult(response, request, idTokenObj, accountEntity, authority.canonicalAuthority, reqTimestamp);
|
|
12633
12608
|
// cache accounts and tokens in the appropriate storage
|
|
12634
12609
|
this.cacheAccount(accountEntity);
|
|
12635
|
-
this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
12610
|
+
this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
12636
12611
|
return result;
|
|
12637
12612
|
}
|
|
12638
12613
|
/**
|
|
@@ -12682,7 +12657,7 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12682
12657
|
* @param response
|
|
12683
12658
|
*/
|
|
12684
12659
|
async generatePopAccessToken(response, request) {
|
|
12685
|
-
if (request.tokenType ===
|
|
12660
|
+
if (request.tokenType === AuthenticationScheme.POP) {
|
|
12686
12661
|
/**
|
|
12687
12662
|
* This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
|
|
12688
12663
|
* is still received, SHR is calculated locally
|
|
@@ -12740,9 +12715,9 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12740
12715
|
Constants.EMPTY_STRING;
|
|
12741
12716
|
// generate PoP token as needed
|
|
12742
12717
|
const responseAccessToken = await this.generatePopAccessToken(response, request);
|
|
12743
|
-
const tokenType = request.tokenType ===
|
|
12744
|
-
?
|
|
12745
|
-
:
|
|
12718
|
+
const tokenType = request.tokenType === AuthenticationScheme.POP
|
|
12719
|
+
? AuthenticationScheme.POP
|
|
12720
|
+
: AuthenticationScheme.BEARER;
|
|
12746
12721
|
const result = {
|
|
12747
12722
|
authority: authority,
|
|
12748
12723
|
uniqueId: uid,
|
|
@@ -12783,20 +12758,21 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12783
12758
|
* @param tenantId
|
|
12784
12759
|
* @param reqTimestamp
|
|
12785
12760
|
*/
|
|
12786
|
-
cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
12787
|
-
|
|
12788
|
-
const idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
12789
|
-
this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
|
|
12761
|
+
cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
12762
|
+
const cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
12790
12763
|
// cache accessToken in inmemory storage
|
|
12791
|
-
const expiresIn = request.tokenType ===
|
|
12764
|
+
const expiresIn = request.tokenType === AuthenticationScheme.POP
|
|
12792
12765
|
? Constants.SHR_NONCE_VALIDITY
|
|
12793
12766
|
: (typeof response.expires_in === "string"
|
|
12794
12767
|
? parseInt(response.expires_in, 10)
|
|
12795
12768
|
: response.expires_in) || 0;
|
|
12796
12769
|
const tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
12797
12770
|
const responseScopes = this.generateScopes(response, request);
|
|
12798
|
-
const
|
|
12799
|
-
|
|
12771
|
+
const cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj
|
|
12772
|
+
? idTokenObj.claims.tid || Constants.EMPTY_STRING
|
|
12773
|
+
: tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
|
|
12774
|
+
const nativeCacheRecord = new CacheRecord(accountEntity, cachedIdToken, cachedAccessToken);
|
|
12775
|
+
this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);
|
|
12800
12776
|
}
|
|
12801
12777
|
addTelemetryFromNativeResponse(response) {
|
|
12802
12778
|
const mats = this.getMATSFromResponse(response);
|
|
@@ -12874,6 +12850,9 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12874
12850
|
async initializeNativeRequest(request) {
|
|
12875
12851
|
this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
|
|
12876
12852
|
const authority = request.authority || this.config.auth.authority;
|
|
12853
|
+
if (request.account) {
|
|
12854
|
+
await this.validateRequestAuthority(authority, request.account);
|
|
12855
|
+
}
|
|
12877
12856
|
const canonicalAuthority = new UrlString(authority);
|
|
12878
12857
|
canonicalAuthority.validateAsUri();
|
|
12879
12858
|
// scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
|
|
@@ -12883,8 +12862,8 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12883
12862
|
const getPrompt = () => {
|
|
12884
12863
|
// If request is silent, prompt is always none
|
|
12885
12864
|
switch (this.apiId) {
|
|
12886
|
-
case
|
|
12887
|
-
case
|
|
12865
|
+
case ApiId.ssoSilent:
|
|
12866
|
+
case ApiId.acquireTokenSilent_silentFlow:
|
|
12888
12867
|
this.logger.trace("initializeNativeRequest: silent request sets prompt to none");
|
|
12889
12868
|
return PromptValue.NONE;
|
|
12890
12869
|
}
|
|
@@ -12923,7 +12902,7 @@ class NativeInteractionClient extends BaseInteractionClient {
|
|
|
12923
12902
|
},
|
|
12924
12903
|
extendedExpiryToken: false, // Make this configurable?
|
|
12925
12904
|
};
|
|
12926
|
-
if (request.authenticationScheme ===
|
|
12905
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
12927
12906
|
// add POP request type
|
|
12928
12907
|
const shrParameters = {
|
|
12929
12908
|
resourceRequestUri: request.resourceRequestUri,
|
|
@@ -12955,7 +12934,7 @@ class NativeMessageHandler {
|
|
|
12955
12934
|
this.messageChannel = new MessageChannel();
|
|
12956
12935
|
this.windowListener = this.onWindowMessage.bind(this); // Window event callback doesn't have access to 'this' unless it's bound
|
|
12957
12936
|
this.performanceClient = performanceClient;
|
|
12958
|
-
this.handshakeEvent = performanceClient.startMeasurement(
|
|
12937
|
+
this.handshakeEvent = performanceClient.startMeasurement(PerformanceEvents.NativeMessageHandlerHandshake);
|
|
12959
12938
|
this.crypto = crypto;
|
|
12960
12939
|
}
|
|
12961
12940
|
/**
|
|
@@ -13184,8 +13163,8 @@ class NativeMessageHandler {
|
|
|
13184
13163
|
}
|
|
13185
13164
|
if (authenticationScheme) {
|
|
13186
13165
|
switch (authenticationScheme) {
|
|
13187
|
-
case
|
|
13188
|
-
case
|
|
13166
|
+
case AuthenticationScheme.BEARER:
|
|
13167
|
+
case AuthenticationScheme.POP:
|
|
13189
13168
|
logger.trace("isNativeAvailable: authenticationScheme is supported, returning true");
|
|
13190
13169
|
return true;
|
|
13191
13170
|
default:
|
|
@@ -13211,23 +13190,24 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
13211
13190
|
* @param request
|
|
13212
13191
|
*/
|
|
13213
13192
|
async acquireToken(request) {
|
|
13214
|
-
this.performanceClient.setPreQueueTime(
|
|
13193
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
13215
13194
|
const validRequest = await this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect);
|
|
13216
13195
|
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
13217
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13196
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenRedirect);
|
|
13218
13197
|
const handleBackButton = (event) => {
|
|
13219
13198
|
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
13220
13199
|
if (event.persisted) {
|
|
13221
13200
|
this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
|
|
13222
13201
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
13202
|
+
this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, exports.InteractionType.Redirect);
|
|
13223
13203
|
}
|
|
13224
13204
|
};
|
|
13225
13205
|
try {
|
|
13226
13206
|
// Create auth code request and generate PKCE params
|
|
13227
|
-
this.performanceClient.setPreQueueTime(
|
|
13207
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
13228
13208
|
const authCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);
|
|
13229
13209
|
// Initialize the client
|
|
13230
|
-
this.performanceClient.setPreQueueTime(
|
|
13210
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
13231
13211
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);
|
|
13232
13212
|
this.logger.verbose("Auth code client created");
|
|
13233
13213
|
// Create redirect interaction handler.
|
|
@@ -13266,7 +13246,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
13266
13246
|
* @param hash
|
|
13267
13247
|
*/
|
|
13268
13248
|
async handleRedirectPromise(hash) {
|
|
13269
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13249
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.handleRedirectPromise);
|
|
13270
13250
|
try {
|
|
13271
13251
|
if (!this.browserStorage.isInteractionInProgress(true)) {
|
|
13272
13252
|
this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null.");
|
|
@@ -13318,7 +13298,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
13318
13298
|
*/
|
|
13319
13299
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);
|
|
13320
13300
|
const navigationOptions = {
|
|
13321
|
-
apiId:
|
|
13301
|
+
apiId: ApiId.handleRedirectPromise,
|
|
13322
13302
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
13323
13303
|
noHistory: true,
|
|
13324
13304
|
};
|
|
@@ -13391,7 +13371,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
13391
13371
|
if (!this.nativeMessageHandler) {
|
|
13392
13372
|
throw BrowserAuthError.createNativeConnectionNotEstablishedError();
|
|
13393
13373
|
}
|
|
13394
|
-
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
13374
|
+
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, cachedRequest.correlationId);
|
|
13395
13375
|
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);
|
|
13396
13376
|
return nativeInteractionClient
|
|
13397
13377
|
.acquireToken({
|
|
@@ -13408,7 +13388,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
13408
13388
|
if (!currentAuthority) {
|
|
13409
13389
|
throw BrowserAuthError.createNoCachedAuthorityError();
|
|
13410
13390
|
}
|
|
13411
|
-
this.performanceClient.setPreQueueTime(
|
|
13391
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, cachedRequest.correlationId);
|
|
13412
13392
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, currentAuthority);
|
|
13413
13393
|
this.logger.verbose("Auth code client created");
|
|
13414
13394
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);
|
|
@@ -13423,22 +13403,22 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
13423
13403
|
async logout(logoutRequest) {
|
|
13424
13404
|
this.logger.verbose("logoutRedirect called");
|
|
13425
13405
|
const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
|
13426
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13406
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logout);
|
|
13427
13407
|
try {
|
|
13428
|
-
this.eventHandler.emitEvent(
|
|
13408
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_START, exports.InteractionType.Redirect, logoutRequest);
|
|
13429
13409
|
// Clear cache on logout
|
|
13430
13410
|
await this.clearCacheOnLogout(validLogoutRequest.account);
|
|
13431
13411
|
const navigationOptions = {
|
|
13432
|
-
apiId:
|
|
13412
|
+
apiId: ApiId.logout,
|
|
13433
13413
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
13434
13414
|
noHistory: false,
|
|
13435
13415
|
};
|
|
13436
|
-
this.performanceClient.setPreQueueTime(
|
|
13416
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validLogoutRequest.correlationId);
|
|
13437
13417
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, logoutRequest && logoutRequest.authority);
|
|
13438
13418
|
this.logger.verbose("Auth code client created");
|
|
13439
13419
|
// Create logout string and navigate user window to logout.
|
|
13440
13420
|
const logoutUri = authClient.getLogoutUri(validLogoutRequest);
|
|
13441
|
-
this.eventHandler.emitEvent(
|
|
13421
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Redirect, validLogoutRequest);
|
|
13442
13422
|
// Check if onRedirectNavigate is implemented, and invoke it if so
|
|
13443
13423
|
if (logoutRequest &&
|
|
13444
13424
|
typeof logoutRequest.onRedirectNavigate === "function") {
|
|
@@ -13472,11 +13452,11 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
13472
13452
|
e.setCorrelationId(this.correlationId);
|
|
13473
13453
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
13474
13454
|
}
|
|
13475
|
-
this.eventHandler.emitEvent(
|
|
13476
|
-
this.eventHandler.emitEvent(
|
|
13455
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
13456
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Redirect);
|
|
13477
13457
|
throw e;
|
|
13478
13458
|
}
|
|
13479
|
-
this.eventHandler.emitEvent(
|
|
13459
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Redirect);
|
|
13480
13460
|
}
|
|
13481
13461
|
/**
|
|
13482
13462
|
* Use to get the redirectStartPage either from request or use current window
|
|
@@ -13565,16 +13545,16 @@ class PopupClient extends StandardInteractionClient {
|
|
|
13565
13545
|
*/
|
|
13566
13546
|
async acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup) {
|
|
13567
13547
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
13568
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13569
|
-
this.performanceClient.setPreQueueTime(
|
|
13548
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);
|
|
13549
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
13570
13550
|
const validRequest = await this.initializeAuthorizationRequest(request, exports.InteractionType.Popup);
|
|
13571
13551
|
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
13572
13552
|
try {
|
|
13573
13553
|
// Create auth code request and generate PKCE params
|
|
13574
|
-
this.performanceClient.setPreQueueTime(
|
|
13554
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
13575
13555
|
const authCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);
|
|
13576
13556
|
// Initialize the client
|
|
13577
|
-
this.performanceClient.setPreQueueTime(
|
|
13557
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
13578
13558
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);
|
|
13579
13559
|
this.logger.verbose("Auth code client created");
|
|
13580
13560
|
const isNativeBroker = NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);
|
|
@@ -13582,7 +13562,7 @@ class PopupClient extends StandardInteractionClient {
|
|
|
13582
13562
|
let fetchNativeAccountIdMeasurement;
|
|
13583
13563
|
if (isNativeBroker) {
|
|
13584
13564
|
fetchNativeAccountIdMeasurement =
|
|
13585
|
-
this.performanceClient.startMeasurement(
|
|
13565
|
+
this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);
|
|
13586
13566
|
}
|
|
13587
13567
|
// Create acquire token url.
|
|
13588
13568
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
@@ -13598,7 +13578,7 @@ class PopupClient extends StandardInteractionClient {
|
|
|
13598
13578
|
popupWindowAttributes,
|
|
13599
13579
|
};
|
|
13600
13580
|
const popupWindow = this.initiateAuthRequest(navigateUrl, popupParameters);
|
|
13601
|
-
this.eventHandler.emitEvent(
|
|
13581
|
+
this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
|
|
13602
13582
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
13603
13583
|
const hash = await this.monitorPopupForHash(popupWindow);
|
|
13604
13584
|
// Deserialize hash fragment response parameters.
|
|
@@ -13618,7 +13598,7 @@ class PopupClient extends StandardInteractionClient {
|
|
|
13618
13598
|
if (!this.nativeMessageHandler) {
|
|
13619
13599
|
throw BrowserAuthError.createNativeConnectionNotEstablishedError();
|
|
13620
13600
|
}
|
|
13621
|
-
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
13601
|
+
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, validRequest.correlationId);
|
|
13622
13602
|
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);
|
|
13623
13603
|
return nativeInteractionClient
|
|
13624
13604
|
.acquireToken({
|
|
@@ -13658,29 +13638,29 @@ class PopupClient extends StandardInteractionClient {
|
|
|
13658
13638
|
*/
|
|
13659
13639
|
async logoutPopupAsync(validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
|
|
13660
13640
|
this.logger.verbose("logoutPopupAsync called");
|
|
13661
|
-
this.eventHandler.emitEvent(
|
|
13662
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13641
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_START, exports.InteractionType.Popup, validRequest);
|
|
13642
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);
|
|
13663
13643
|
try {
|
|
13664
13644
|
// Clear cache on logout
|
|
13665
13645
|
await this.clearCacheOnLogout(validRequest.account);
|
|
13666
13646
|
// Initialize the client
|
|
13667
|
-
this.performanceClient.setPreQueueTime(
|
|
13647
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validRequest.correlationId);
|
|
13668
13648
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, requestAuthority);
|
|
13669
13649
|
this.logger.verbose("Auth code client created");
|
|
13670
13650
|
// Create logout string and navigate user window to logout.
|
|
13671
13651
|
const logoutUri = authClient.getLogoutUri(validRequest);
|
|
13672
|
-
this.eventHandler.emitEvent(
|
|
13652
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Popup, validRequest);
|
|
13673
13653
|
// Open the popup window to requestUrl.
|
|
13674
13654
|
const popupWindow = this.openPopup(logoutUri, {
|
|
13675
13655
|
popupName,
|
|
13676
13656
|
popupWindowAttributes,
|
|
13677
13657
|
popup,
|
|
13678
13658
|
});
|
|
13679
|
-
this.eventHandler.emitEvent(
|
|
13659
|
+
this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
|
|
13680
13660
|
await this.waitForLogoutPopup(popupWindow);
|
|
13681
13661
|
if (mainWindowRedirectUri) {
|
|
13682
13662
|
const navigationOptions = {
|
|
13683
|
-
apiId:
|
|
13663
|
+
apiId: ApiId.logoutPopup,
|
|
13684
13664
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
13685
13665
|
noHistory: false,
|
|
13686
13666
|
};
|
|
@@ -13703,11 +13683,11 @@ class PopupClient extends StandardInteractionClient {
|
|
|
13703
13683
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
13704
13684
|
}
|
|
13705
13685
|
this.browserStorage.setInteractionInProgress(false);
|
|
13706
|
-
this.eventHandler.emitEvent(
|
|
13707
|
-
this.eventHandler.emitEvent(
|
|
13686
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null, e);
|
|
13687
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
13708
13688
|
throw e;
|
|
13709
13689
|
}
|
|
13710
|
-
this.eventHandler.emitEvent(
|
|
13690
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
13711
13691
|
}
|
|
13712
13692
|
/**
|
|
13713
13693
|
* Opens a popup window with given request Url.
|
|
@@ -14036,22 +14016,22 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
14036
14016
|
postLogoutRedirectUri: Constants.EMPTY_STRING,
|
|
14037
14017
|
navigateToLoginRequestUrl: true,
|
|
14038
14018
|
clientCapabilities: [],
|
|
14039
|
-
protocolMode:
|
|
14019
|
+
protocolMode: ProtocolMode.AAD,
|
|
14040
14020
|
azureCloudOptions: {
|
|
14041
|
-
azureCloudInstance:
|
|
14021
|
+
azureCloudInstance: AzureCloudInstance.None,
|
|
14042
14022
|
tenant: Constants.EMPTY_STRING,
|
|
14043
14023
|
},
|
|
14044
14024
|
skipAuthorityMetadataCache: false,
|
|
14045
14025
|
};
|
|
14046
14026
|
// Default cache options for browser
|
|
14047
14027
|
const DEFAULT_CACHE_OPTIONS = {
|
|
14048
|
-
cacheLocation:
|
|
14049
|
-
temporaryCacheLocation:
|
|
14028
|
+
cacheLocation: BrowserCacheLocation.SessionStorage,
|
|
14029
|
+
temporaryCacheLocation: BrowserCacheLocation.SessionStorage,
|
|
14050
14030
|
storeAuthStateInCookie: false,
|
|
14051
14031
|
secureCookies: false,
|
|
14052
14032
|
// Default cache migration to true if cache location is localStorage since entries are preserved across tabs/windows. Migration has little to no benefit in sessionStorage and memoryStorage
|
|
14053
14033
|
cacheMigrationEnabled: userInputCache &&
|
|
14054
|
-
userInputCache.cacheLocation ===
|
|
14034
|
+
userInputCache.cacheLocation === BrowserCacheLocation.LocalStorage
|
|
14055
14035
|
? true
|
|
14056
14036
|
: false,
|
|
14057
14037
|
};
|
|
@@ -14083,11 +14063,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
14083
14063
|
allowNativeBroker: true,
|
|
14084
14064
|
nativeBrokerHandshakeTimeout: userInputSystem?.nativeBrokerHandshakeTimeout ||
|
|
14085
14065
|
DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
|
|
14086
|
-
pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS
|
|
14087
|
-
cryptoOptions: {
|
|
14088
|
-
useMsrCrypto: false,
|
|
14089
|
-
entropy: undefined,
|
|
14090
|
-
},
|
|
14066
|
+
pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS
|
|
14091
14067
|
};
|
|
14092
14068
|
const providedSystemOptions = {
|
|
14093
14069
|
...userInputSystem,
|
|
@@ -14124,14 +14100,14 @@ class SilentHandler extends InteractionHandler {
|
|
|
14124
14100
|
* @param userRequestScopes
|
|
14125
14101
|
*/
|
|
14126
14102
|
async initiateAuthRequest(requestUrl) {
|
|
14127
|
-
this.performanceClient.addQueueMeasurement(
|
|
14103
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerInitiateAuthRequest, this.authCodeRequest.correlationId);
|
|
14128
14104
|
if (StringUtils.isEmpty(requestUrl)) {
|
|
14129
14105
|
// Throw error if request URL is empty.
|
|
14130
14106
|
this.logger.info("Navigate url is empty");
|
|
14131
14107
|
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
14132
14108
|
}
|
|
14133
14109
|
if (this.navigateFrameWait) {
|
|
14134
|
-
this.performanceClient.setPreQueueTime(
|
|
14110
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
14135
14111
|
return await this.loadFrame(requestUrl);
|
|
14136
14112
|
}
|
|
14137
14113
|
return this.loadFrameSync(requestUrl);
|
|
@@ -14142,7 +14118,7 @@ class SilentHandler extends InteractionHandler {
|
|
|
14142
14118
|
* @param timeout
|
|
14143
14119
|
*/
|
|
14144
14120
|
monitorIframeForHash(iframe, timeout) {
|
|
14145
|
-
this.performanceClient.addQueueMeasurement(
|
|
14121
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerMonitorIframeForHash, this.authCodeRequest.correlationId);
|
|
14146
14122
|
return new Promise((resolve, reject) => {
|
|
14147
14123
|
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
14148
14124
|
this.logger.warning(`system.loadFrameTimeout or system.iframeHashTimeout set to lower (${timeout}ms) than the default (${DEFAULT_IFRAME_TIMEOUT_MS}ms). This may result in timeouts.`);
|
|
@@ -14215,7 +14191,7 @@ class SilentHandler extends InteractionHandler {
|
|
|
14215
14191
|
* @ignore
|
|
14216
14192
|
*/
|
|
14217
14193
|
loadFrame(urlNavigate) {
|
|
14218
|
-
this.performanceClient.addQueueMeasurement(
|
|
14194
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
14219
14195
|
/*
|
|
14220
14196
|
* This trick overcomes iframe navigation in IE
|
|
14221
14197
|
* IE does not load the page consistently in iframe
|
|
@@ -14286,9 +14262,9 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
14286
14262
|
* @param request
|
|
14287
14263
|
*/
|
|
14288
14264
|
async acquireToken(request) {
|
|
14289
|
-
this.performanceClient.addQueueMeasurement(
|
|
14265
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
14290
14266
|
this.logger.verbose("acquireTokenByIframe called");
|
|
14291
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(
|
|
14267
|
+
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
14292
14268
|
// Check that we have some SSO data
|
|
14293
14269
|
if (StringUtils.isEmpty(request.loginHint) &&
|
|
14294
14270
|
StringUtils.isEmpty(request.sid) &&
|
|
@@ -14305,7 +14281,7 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
14305
14281
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
14306
14282
|
}
|
|
14307
14283
|
// Create silent request
|
|
14308
|
-
this.performanceClient.setPreQueueTime(
|
|
14284
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
14309
14285
|
const silentRequest = await this.initializeAuthorizationRequest({
|
|
14310
14286
|
...request,
|
|
14311
14287
|
prompt: request.prompt || PromptValue.NONE,
|
|
@@ -14314,10 +14290,10 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
14314
14290
|
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
14315
14291
|
try {
|
|
14316
14292
|
// Initialize the client
|
|
14317
|
-
this.performanceClient.setPreQueueTime(
|
|
14293
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
14318
14294
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
14319
14295
|
this.logger.verbose("Auth code client created");
|
|
14320
|
-
this.performanceClient.setPreQueueTime(
|
|
14296
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientTokenHelper, request.correlationId);
|
|
14321
14297
|
return await this.silentTokenHelper(authClient, silentRequest).then((result) => {
|
|
14322
14298
|
acquireTokenMeasurement.endMeasurement({
|
|
14323
14299
|
success: true,
|
|
@@ -14355,12 +14331,12 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
14355
14331
|
* @param userRequestScopes
|
|
14356
14332
|
*/
|
|
14357
14333
|
async silentTokenHelper(authClient, silentRequest) {
|
|
14358
|
-
this.performanceClient.addQueueMeasurement(
|
|
14334
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, silentRequest.correlationId);
|
|
14359
14335
|
// Create auth code request and generate PKCE params
|
|
14360
|
-
this.performanceClient.setPreQueueTime(
|
|
14336
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, silentRequest.correlationId);
|
|
14361
14337
|
const authCodeRequest = await this.initializeAuthorizationCodeRequest(silentRequest);
|
|
14362
14338
|
// Create authorize request url
|
|
14363
|
-
this.performanceClient.setPreQueueTime(
|
|
14339
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.GetAuthCodeUrl, silentRequest.correlationId);
|
|
14364
14340
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
14365
14341
|
...silentRequest,
|
|
14366
14342
|
nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
|
|
@@ -14368,10 +14344,10 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
14368
14344
|
// Create silent handler
|
|
14369
14345
|
const silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);
|
|
14370
14346
|
// Get the frame handle for the silent request
|
|
14371
|
-
this.performanceClient.setPreQueueTime(
|
|
14347
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerInitiateAuthRequest, silentRequest.correlationId);
|
|
14372
14348
|
const msalFrame = await silentHandler.initiateAuthRequest(navigateUrl);
|
|
14373
14349
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
14374
|
-
this.performanceClient.setPreQueueTime(
|
|
14350
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerMonitorIframeForHash, silentRequest.correlationId);
|
|
14375
14351
|
const hash = await silentHandler.monitorIframeForHash(msalFrame, this.config.system.iframeHashTimeout);
|
|
14376
14352
|
// Deserialize hash fragment response parameters.
|
|
14377
14353
|
const serverParams = UrlString.getDeserializedHash(hash);
|
|
@@ -14394,7 +14370,7 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
14394
14370
|
});
|
|
14395
14371
|
}
|
|
14396
14372
|
// Handle response from hash string
|
|
14397
|
-
this.performanceClient.setPreQueueTime(
|
|
14373
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.HandleCodeResponseFromHash, silentRequest.correlationId);
|
|
14398
14374
|
return silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient);
|
|
14399
14375
|
}
|
|
14400
14376
|
}
|
|
@@ -14409,18 +14385,18 @@ class SilentRefreshClient extends StandardInteractionClient {
|
|
|
14409
14385
|
* @param request
|
|
14410
14386
|
*/
|
|
14411
14387
|
async acquireToken(request) {
|
|
14412
|
-
this.performanceClient.addQueueMeasurement(
|
|
14413
|
-
this.performanceClient.setPreQueueTime(
|
|
14388
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
|
14389
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
14414
14390
|
const silentRequest = {
|
|
14415
14391
|
...request,
|
|
14416
|
-
...
|
|
14392
|
+
...await this.initializeBaseRequest(request, request.account)
|
|
14417
14393
|
};
|
|
14418
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(
|
|
14419
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
14394
|
+
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
|
|
14395
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
14420
14396
|
const refreshTokenClient = await this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
14421
14397
|
this.logger.verbose("Refresh token client created");
|
|
14422
14398
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
14423
|
-
this.performanceClient.setPreQueueTime(
|
|
14399
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
14424
14400
|
return refreshTokenClient
|
|
14425
14401
|
.acquireTokenByRefreshToken(silentRequest)
|
|
14426
14402
|
.then((result) => {
|
|
@@ -14456,7 +14432,7 @@ class SilentRefreshClient extends StandardInteractionClient {
|
|
|
14456
14432
|
*/
|
|
14457
14433
|
async createRefreshTokenClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
14458
14434
|
// Create auth module.
|
|
14459
|
-
this.performanceClient.setPreQueueTime(
|
|
14435
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
14460
14436
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
14461
14437
|
return new RefreshTokenClient(clientConfig, this.performanceClient);
|
|
14462
14438
|
}
|
|
@@ -14569,11 +14545,11 @@ class EventHandler {
|
|
|
14569
14545
|
const accountInfo = accountEntity.getAccountInfo();
|
|
14570
14546
|
if (!e.oldValue && e.newValue) {
|
|
14571
14547
|
this.logger.info("Account was added to cache in a different window");
|
|
14572
|
-
this.emitEvent(
|
|
14548
|
+
this.emitEvent(EventType.ACCOUNT_ADDED, undefined, accountInfo);
|
|
14573
14549
|
}
|
|
14574
14550
|
else if (!e.newValue && e.oldValue) {
|
|
14575
14551
|
this.logger.info("Account was removed from cache in a different window");
|
|
14576
|
-
this.emitEvent(
|
|
14552
|
+
this.emitEvent(EventType.ACCOUNT_REMOVED, undefined, accountInfo);
|
|
14577
14553
|
}
|
|
14578
14554
|
}
|
|
14579
14555
|
catch (e) {
|
|
@@ -15089,115 +15065,6 @@ class ModernBrowserCrypto {
|
|
|
15089
15065
|
}
|
|
15090
15066
|
}
|
|
15091
15067
|
|
|
15092
|
-
/*
|
|
15093
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15094
|
-
* Licensed under the MIT License.
|
|
15095
|
-
*/
|
|
15096
|
-
class MsrBrowserCrypto {
|
|
15097
|
-
initPrng(entropy) {
|
|
15098
|
-
// Turn into array, as initPrng seems to not always like Uint8Array (even though it should support both)
|
|
15099
|
-
return window.msrCrypto.initPrng([...entropy]);
|
|
15100
|
-
}
|
|
15101
|
-
getRandomValues(dataBuffer) {
|
|
15102
|
-
return window.msrCrypto.getRandomValues(dataBuffer);
|
|
15103
|
-
}
|
|
15104
|
-
async generateKey(algorithm, extractable, keyUsages) {
|
|
15105
|
-
return window.msrCrypto.subtle.generateKey(algorithm, extractable, keyUsages);
|
|
15106
|
-
}
|
|
15107
|
-
async exportKey(key) {
|
|
15108
|
-
return window.msrCrypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
15109
|
-
}
|
|
15110
|
-
async importKey(keyData, algorithm, extractable, keyUsages) {
|
|
15111
|
-
return window.msrCrypto.subtle.importKey(KEY_FORMAT_JWK, keyData, algorithm, extractable, keyUsages);
|
|
15112
|
-
}
|
|
15113
|
-
async sign(algorithm, key, data) {
|
|
15114
|
-
return window.msrCrypto.subtle.sign(algorithm, key, data);
|
|
15115
|
-
}
|
|
15116
|
-
async digest(algorithm, data) {
|
|
15117
|
-
return window.msrCrypto.subtle.digest(algorithm, data);
|
|
15118
|
-
}
|
|
15119
|
-
}
|
|
15120
|
-
|
|
15121
|
-
/*
|
|
15122
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15123
|
-
* Licensed under the MIT License.
|
|
15124
|
-
*/
|
|
15125
|
-
class MsBrowserCrypto {
|
|
15126
|
-
getRandomValues(dataBuffer) {
|
|
15127
|
-
return window["msCrypto"].getRandomValues(dataBuffer);
|
|
15128
|
-
}
|
|
15129
|
-
async generateKey(algorithm, extractable, keyUsages) {
|
|
15130
|
-
return new Promise((resolve, reject) => {
|
|
15131
|
-
const msGenerateKey = window["msCrypto"].subtle.generateKey(algorithm, extractable, keyUsages);
|
|
15132
|
-
msGenerateKey.addEventListener("complete", (e) => {
|
|
15133
|
-
resolve(e.target.result);
|
|
15134
|
-
});
|
|
15135
|
-
msGenerateKey.addEventListener("error", (error) => {
|
|
15136
|
-
reject(error);
|
|
15137
|
-
});
|
|
15138
|
-
});
|
|
15139
|
-
}
|
|
15140
|
-
async exportKey(key) {
|
|
15141
|
-
return new Promise((resolve, reject) => {
|
|
15142
|
-
const msExportKey = window["msCrypto"].subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
15143
|
-
msExportKey.addEventListener("complete", (e) => {
|
|
15144
|
-
const resultBuffer = e.target.result;
|
|
15145
|
-
const resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))
|
|
15146
|
-
.replace(/\r/g, Constants.EMPTY_STRING)
|
|
15147
|
-
.replace(/\n/g, Constants.EMPTY_STRING)
|
|
15148
|
-
.replace(/\t/g, Constants.EMPTY_STRING)
|
|
15149
|
-
.split(" ")
|
|
15150
|
-
.join(Constants.EMPTY_STRING)
|
|
15151
|
-
.replace("\u0000", Constants.EMPTY_STRING);
|
|
15152
|
-
try {
|
|
15153
|
-
resolve(JSON.parse(resultString));
|
|
15154
|
-
}
|
|
15155
|
-
catch (e) {
|
|
15156
|
-
reject(e);
|
|
15157
|
-
}
|
|
15158
|
-
});
|
|
15159
|
-
msExportKey.addEventListener("error", (error) => {
|
|
15160
|
-
reject(error);
|
|
15161
|
-
});
|
|
15162
|
-
});
|
|
15163
|
-
}
|
|
15164
|
-
async importKey(keyData, algorithm, extractable, keyUsages) {
|
|
15165
|
-
const keyString = BrowserStringUtils.getSortedObjectString(keyData);
|
|
15166
|
-
const keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);
|
|
15167
|
-
return new Promise((resolve, reject) => {
|
|
15168
|
-
const msImportKey = window["msCrypto"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer, algorithm, extractable, keyUsages);
|
|
15169
|
-
msImportKey.addEventListener("complete", (e) => {
|
|
15170
|
-
resolve(e.target.result);
|
|
15171
|
-
});
|
|
15172
|
-
msImportKey.addEventListener("error", (error) => {
|
|
15173
|
-
reject(error);
|
|
15174
|
-
});
|
|
15175
|
-
});
|
|
15176
|
-
}
|
|
15177
|
-
async sign(algorithm, key, data) {
|
|
15178
|
-
return new Promise((resolve, reject) => {
|
|
15179
|
-
const msSign = window["msCrypto"].subtle.sign(algorithm, key, data);
|
|
15180
|
-
msSign.addEventListener("complete", (e) => {
|
|
15181
|
-
resolve(e.target.result);
|
|
15182
|
-
});
|
|
15183
|
-
msSign.addEventListener("error", (error) => {
|
|
15184
|
-
reject(error);
|
|
15185
|
-
});
|
|
15186
|
-
});
|
|
15187
|
-
}
|
|
15188
|
-
async digest(algorithm, data) {
|
|
15189
|
-
return new Promise((resolve, reject) => {
|
|
15190
|
-
const digestOperation = window["msCrypto"].subtle.digest(algorithm, data.buffer);
|
|
15191
|
-
digestOperation.addEventListener("complete", (e) => {
|
|
15192
|
-
resolve(e.target.result);
|
|
15193
|
-
});
|
|
15194
|
-
digestOperation.addEventListener("error", (error) => {
|
|
15195
|
-
reject(error);
|
|
15196
|
-
});
|
|
15197
|
-
});
|
|
15198
|
-
}
|
|
15199
|
-
}
|
|
15200
|
-
|
|
15201
15068
|
/*
|
|
15202
15069
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15203
15070
|
* Licensed under the MIT License.
|
|
@@ -15218,40 +15085,16 @@ const PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
|
15218
15085
|
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
15219
15086
|
*/
|
|
15220
15087
|
class BrowserCrypto {
|
|
15221
|
-
constructor(logger
|
|
15088
|
+
constructor(logger) {
|
|
15222
15089
|
this.logger = logger;
|
|
15223
|
-
this.cryptoOptions = cryptoOptions;
|
|
15224
15090
|
if (this.hasBrowserCrypto()) {
|
|
15225
15091
|
// Use standard modern web crypto if available
|
|
15226
15092
|
this.logger.verbose("BrowserCrypto: modern crypto interface available");
|
|
15227
15093
|
this.subtleCrypto = new ModernBrowserCrypto();
|
|
15228
15094
|
}
|
|
15229
|
-
else if (this.hasIECrypto()) {
|
|
15230
|
-
// For IE11, use msCrypto interface
|
|
15231
|
-
this.logger.verbose("BrowserCrypto: MS crypto interface available");
|
|
15232
|
-
this.subtleCrypto = new MsBrowserCrypto();
|
|
15233
|
-
}
|
|
15234
|
-
else if (this.hasMsrCrypto() && this.cryptoOptions?.useMsrCrypto) {
|
|
15235
|
-
// For other browsers, use MSR Crypto if found
|
|
15236
|
-
this.logger.verbose("BrowserCrypto: MSR crypto interface available");
|
|
15237
|
-
this.subtleCrypto = new MsrBrowserCrypto();
|
|
15238
|
-
}
|
|
15239
15095
|
else {
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
}
|
|
15243
|
-
this.logger.error("BrowserCrypto: No crypto interfaces available.");
|
|
15244
|
-
throw BrowserAuthError.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");
|
|
15245
|
-
}
|
|
15246
|
-
// Mainly needed for MSR Crypto: https://github.com/microsoft/MSR-JavaScript-Crypto#random-number-generator-prng
|
|
15247
|
-
if (this.subtleCrypto.initPrng) {
|
|
15248
|
-
this.logger.verbose("BrowserCrypto: Interface requires entropy");
|
|
15249
|
-
if (!this.cryptoOptions?.entropy) {
|
|
15250
|
-
this.logger.error("BrowserCrypto: Interface requires entropy but none provided.");
|
|
15251
|
-
throw BrowserConfigurationAuthError.createEntropyNotProvided();
|
|
15252
|
-
}
|
|
15253
|
-
this.logger.verbose("BrowserCrypto: Entropy provided");
|
|
15254
|
-
this.subtleCrypto.initPrng(this.cryptoOptions.entropy);
|
|
15096
|
+
this.logger.error("BrowserCrypto: crypto interface is unavailable");
|
|
15097
|
+
throw BrowserAuthError.createCryptoNotAvailableError("Browser crypto interface is not available.");
|
|
15255
15098
|
}
|
|
15256
15099
|
this.keygenAlgorithmOptions = {
|
|
15257
15100
|
name: PKCS1_V15_KEYGEN_ALG,
|
|
@@ -15260,24 +15103,12 @@ class BrowserCrypto {
|
|
|
15260
15103
|
publicExponent: PUBLIC_EXPONENT,
|
|
15261
15104
|
};
|
|
15262
15105
|
}
|
|
15263
|
-
/**
|
|
15264
|
-
* Check whether IE crypto or other browser cryptography is available.
|
|
15265
|
-
*/
|
|
15266
|
-
hasIECrypto() {
|
|
15267
|
-
return "msCrypto" in window;
|
|
15268
|
-
}
|
|
15269
15106
|
/**
|
|
15270
15107
|
* Check whether browser crypto is available.
|
|
15271
15108
|
*/
|
|
15272
15109
|
hasBrowserCrypto() {
|
|
15273
15110
|
return "crypto" in window;
|
|
15274
15111
|
}
|
|
15275
|
-
/**
|
|
15276
|
-
* Check whether MSR crypto polyfill is available
|
|
15277
|
-
*/
|
|
15278
|
-
hasMsrCrypto() {
|
|
15279
|
-
return "msrCrypto" in window;
|
|
15280
|
-
}
|
|
15281
15112
|
/**
|
|
15282
15113
|
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
15283
15114
|
* @param dataString
|
|
@@ -15305,7 +15136,6 @@ class BrowserCrypto {
|
|
|
15305
15136
|
/**
|
|
15306
15137
|
* Export key as Json Web Key (JWK)
|
|
15307
15138
|
* @param key
|
|
15308
|
-
* @param format
|
|
15309
15139
|
*/
|
|
15310
15140
|
async exportJwk(key) {
|
|
15311
15141
|
return this.subtleCrypto.exportKey(key);
|
|
@@ -15313,7 +15143,6 @@ class BrowserCrypto {
|
|
|
15313
15143
|
/**
|
|
15314
15144
|
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
15315
15145
|
* @param key
|
|
15316
|
-
* @param format
|
|
15317
15146
|
* @param extractable
|
|
15318
15147
|
* @param usages
|
|
15319
15148
|
*/
|
|
@@ -15658,11 +15487,10 @@ class AsyncMemoryStorage {
|
|
|
15658
15487
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15659
15488
|
* Licensed under the MIT License.
|
|
15660
15489
|
*/
|
|
15661
|
-
|
|
15662
|
-
|
|
15663
|
-
|
|
15664
|
-
|
|
15665
|
-
})(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));
|
|
15490
|
+
const CryptoKeyStoreNames = {
|
|
15491
|
+
asymmetricKeys: "asymmetricKeys",
|
|
15492
|
+
symmetricKeys: "symmetricKeys",
|
|
15493
|
+
};
|
|
15666
15494
|
/**
|
|
15667
15495
|
* MSAL CryptoKeyStore DB Version 2
|
|
15668
15496
|
*/
|
|
@@ -15705,10 +15533,10 @@ class CryptoKeyStore {
|
|
|
15705
15533
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
15706
15534
|
*/
|
|
15707
15535
|
class CryptoOps {
|
|
15708
|
-
constructor(logger, performanceClient
|
|
15536
|
+
constructor(logger, performanceClient) {
|
|
15709
15537
|
this.logger = logger;
|
|
15710
15538
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
15711
|
-
this.browserCrypto = new BrowserCrypto(this.logger
|
|
15539
|
+
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
15712
15540
|
this.b64Encode = new Base64Encode();
|
|
15713
15541
|
this.b64Decode = new Base64Decode();
|
|
15714
15542
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
@@ -15748,7 +15576,7 @@ class CryptoOps {
|
|
|
15748
15576
|
* @param request
|
|
15749
15577
|
*/
|
|
15750
15578
|
async getPublicKeyThumbprint(request) {
|
|
15751
|
-
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(
|
|
15579
|
+
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);
|
|
15752
15580
|
// Generate Keypair
|
|
15753
15581
|
const keyPair = await this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);
|
|
15754
15582
|
// Generate Thumbprint for Public Key
|
|
@@ -15799,7 +15627,7 @@ class CryptoOps {
|
|
|
15799
15627
|
* @param kid
|
|
15800
15628
|
*/
|
|
15801
15629
|
async signJwt(payload, kid, correlationId) {
|
|
15802
|
-
const signJwtMeasurement = this.performanceClient?.startMeasurement(
|
|
15630
|
+
const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
15803
15631
|
const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);
|
|
15804
15632
|
if (!cachedKeyPair) {
|
|
15805
15633
|
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);
|
|
@@ -15945,9 +15773,9 @@ class BrowserPerformanceMeasurement {
|
|
|
15945
15773
|
* Licensed under the MIT License.
|
|
15946
15774
|
*/
|
|
15947
15775
|
class BrowserPerformanceClient extends PerformanceClient {
|
|
15948
|
-
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry
|
|
15776
|
+
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
|
|
15949
15777
|
super(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry);
|
|
15950
|
-
this.browserCrypto = new BrowserCrypto(this.logger
|
|
15778
|
+
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
15951
15779
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
15952
15780
|
}
|
|
15953
15781
|
startPerformanceMeasurement(measureName, correlationId) {
|
|
@@ -16088,7 +15916,7 @@ var internals = /*#__PURE__*/Object.freeze({
|
|
|
16088
15916
|
SilentIframeClient: SilentIframeClient,
|
|
16089
15917
|
SilentRefreshClient: SilentRefreshClient,
|
|
16090
15918
|
StandardInteractionClient: StandardInteractionClient,
|
|
16091
|
-
|
|
15919
|
+
TemporaryCacheKeys: TemporaryCacheKeys
|
|
16092
15920
|
});
|
|
16093
15921
|
|
|
16094
15922
|
/*
|
|
@@ -16518,7 +16346,7 @@ class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
16518
16346
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
16519
16347
|
}
|
|
16520
16348
|
// Create silent request
|
|
16521
|
-
this.performanceClient.setPreQueueTime(
|
|
16349
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
16522
16350
|
const silentRequest = await this.initializeAuthorizationRequest(request, exports.InteractionType.Silent);
|
|
16523
16351
|
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
|
|
16524
16352
|
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
@@ -16529,7 +16357,7 @@ class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
16529
16357
|
code: request.code,
|
|
16530
16358
|
};
|
|
16531
16359
|
// Initialize the client
|
|
16532
|
-
this.performanceClient.setPreQueueTime(
|
|
16360
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, request.correlationId);
|
|
16533
16361
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, silentRequest.authority);
|
|
16534
16362
|
const authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
|
|
16535
16363
|
this.logger.verbose("Auth code client created");
|
|
@@ -16607,11 +16435,11 @@ class StandardController {
|
|
|
16607
16435
|
this.hybridAuthCodeResponses = new Map();
|
|
16608
16436
|
// Initialize performance client
|
|
16609
16437
|
this.performanceClient = this.isBrowserEnvironment
|
|
16610
|
-
? new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application
|
|
16438
|
+
? new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application)
|
|
16611
16439
|
: new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);
|
|
16612
16440
|
// Initialize the crypto class.
|
|
16613
16441
|
this.browserCrypto = this.isBrowserEnvironment
|
|
16614
|
-
? new CryptoOps(this.logger, this.performanceClient
|
|
16442
|
+
? new CryptoOps(this.logger, this.performanceClient)
|
|
16615
16443
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
16616
16444
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
16617
16445
|
// Initialize the browser storage class.
|
|
@@ -16620,8 +16448,8 @@ class StandardController {
|
|
|
16620
16448
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
16621
16449
|
// initialize in memory storage for native flows
|
|
16622
16450
|
const nativeCacheOptions = {
|
|
16623
|
-
cacheLocation:
|
|
16624
|
-
temporaryCacheLocation:
|
|
16451
|
+
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
16452
|
+
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
16625
16453
|
storeAuthStateInCookie: false,
|
|
16626
16454
|
secureCookies: false,
|
|
16627
16455
|
cacheMigrationEnabled: false,
|
|
@@ -16660,8 +16488,8 @@ class StandardController {
|
|
|
16660
16488
|
return;
|
|
16661
16489
|
}
|
|
16662
16490
|
const allowNativeBroker = this.config.system.allowNativeBroker;
|
|
16663
|
-
const initMeasurement = this.performanceClient.startMeasurement(
|
|
16664
|
-
this.eventHandler.emitEvent(
|
|
16491
|
+
const initMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.InitializeClientApplication);
|
|
16492
|
+
this.eventHandler.emitEvent(EventType.INITIALIZE_START);
|
|
16665
16493
|
if (allowNativeBroker) {
|
|
16666
16494
|
try {
|
|
16667
16495
|
this.nativeExtensionProvider =
|
|
@@ -16672,7 +16500,7 @@ class StandardController {
|
|
|
16672
16500
|
}
|
|
16673
16501
|
}
|
|
16674
16502
|
this.initialized = true;
|
|
16675
|
-
this.eventHandler.emitEvent(
|
|
16503
|
+
this.eventHandler.emitEvent(EventType.INITIALIZE_END);
|
|
16676
16504
|
initMeasurement.endMeasurement({ allowNativeBroker, success: true });
|
|
16677
16505
|
}
|
|
16678
16506
|
// #region Redirect Flow
|
|
@@ -16697,7 +16525,7 @@ class StandardController {
|
|
|
16697
16525
|
const redirectResponseKey = hash || Constants.EMPTY_STRING;
|
|
16698
16526
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
16699
16527
|
if (typeof response === "undefined") {
|
|
16700
|
-
this.eventHandler.emitEvent(
|
|
16528
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
16701
16529
|
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
16702
16530
|
const request = this.browserStorage.getCachedNativeRequest();
|
|
16703
16531
|
let redirectResponse;
|
|
@@ -16706,7 +16534,7 @@ class StandardController {
|
|
|
16706
16534
|
this.nativeExtensionProvider &&
|
|
16707
16535
|
!hash) {
|
|
16708
16536
|
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
16709
|
-
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
16537
|
+
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
|
|
16710
16538
|
redirectResponse = nativeClient.handleRedirectPromise();
|
|
16711
16539
|
}
|
|
16712
16540
|
else {
|
|
@@ -16723,26 +16551,26 @@ class StandardController {
|
|
|
16723
16551
|
const isLoggingIn = loggedInAccounts.length <
|
|
16724
16552
|
this.getAllAccounts().length;
|
|
16725
16553
|
if (isLoggingIn) {
|
|
16726
|
-
this.eventHandler.emitEvent(
|
|
16554
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
16727
16555
|
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
16728
16556
|
}
|
|
16729
16557
|
else {
|
|
16730
|
-
this.eventHandler.emitEvent(
|
|
16558
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
16731
16559
|
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
16732
16560
|
}
|
|
16733
16561
|
}
|
|
16734
|
-
this.eventHandler.emitEvent(
|
|
16562
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
16735
16563
|
return result;
|
|
16736
16564
|
})
|
|
16737
16565
|
.catch((e) => {
|
|
16738
16566
|
// Emit login event if there is an account
|
|
16739
16567
|
if (loggedInAccounts.length > 0) {
|
|
16740
|
-
this.eventHandler.emitEvent(
|
|
16568
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16741
16569
|
}
|
|
16742
16570
|
else {
|
|
16743
|
-
this.eventHandler.emitEvent(
|
|
16571
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16744
16572
|
}
|
|
16745
|
-
this.eventHandler.emitEvent(
|
|
16573
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
16746
16574
|
throw e;
|
|
16747
16575
|
});
|
|
16748
16576
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
@@ -16772,14 +16600,14 @@ class StandardController {
|
|
|
16772
16600
|
// If logged in, emit acquire token events
|
|
16773
16601
|
const isLoggedIn = this.getAllAccounts().length > 0;
|
|
16774
16602
|
if (isLoggedIn) {
|
|
16775
|
-
this.eventHandler.emitEvent(
|
|
16603
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
|
|
16776
16604
|
}
|
|
16777
16605
|
else {
|
|
16778
|
-
this.eventHandler.emitEvent(
|
|
16606
|
+
this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Redirect, request);
|
|
16779
16607
|
}
|
|
16780
16608
|
let result;
|
|
16781
16609
|
if (this.nativeExtensionProvider && this.canUseNative(request)) {
|
|
16782
|
-
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
16610
|
+
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
|
|
16783
16611
|
result = nativeClient
|
|
16784
16612
|
.acquireTokenRedirect(request)
|
|
16785
16613
|
.catch((e) => {
|
|
@@ -16804,10 +16632,10 @@ class StandardController {
|
|
|
16804
16632
|
return result.catch((e) => {
|
|
16805
16633
|
// If logged in, emit acquire token events
|
|
16806
16634
|
if (isLoggedIn) {
|
|
16807
|
-
this.eventHandler.emitEvent(
|
|
16635
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16808
16636
|
}
|
|
16809
16637
|
else {
|
|
16810
|
-
this.eventHandler.emitEvent(
|
|
16638
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16811
16639
|
}
|
|
16812
16640
|
throw e;
|
|
16813
16641
|
});
|
|
@@ -16823,7 +16651,7 @@ class StandardController {
|
|
|
16823
16651
|
*/
|
|
16824
16652
|
acquireTokenPopup(request) {
|
|
16825
16653
|
const correlationId = this.getRequestCorrelationId(request);
|
|
16826
|
-
const atPopupMeasurement = this.performanceClient.startMeasurement(
|
|
16654
|
+
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);
|
|
16827
16655
|
try {
|
|
16828
16656
|
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
16829
16657
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
@@ -16835,14 +16663,14 @@ class StandardController {
|
|
|
16835
16663
|
// If logged in, emit acquire token events
|
|
16836
16664
|
const loggedInAccounts = this.getAllAccounts();
|
|
16837
16665
|
if (loggedInAccounts.length > 0) {
|
|
16838
|
-
this.eventHandler.emitEvent(
|
|
16666
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Popup, request);
|
|
16839
16667
|
}
|
|
16840
16668
|
else {
|
|
16841
|
-
this.eventHandler.emitEvent(
|
|
16669
|
+
this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Popup, request);
|
|
16842
16670
|
}
|
|
16843
16671
|
let result;
|
|
16844
16672
|
if (this.canUseNative(request)) {
|
|
16845
|
-
result = this.acquireTokenNative(request,
|
|
16673
|
+
result = this.acquireTokenNative(request, ApiId.acquireTokenPopup)
|
|
16846
16674
|
.then((response) => {
|
|
16847
16675
|
this.browserStorage.setInteractionInProgress(false);
|
|
16848
16676
|
atPopupMeasurement.endMeasurement({
|
|
@@ -16878,10 +16706,10 @@ class StandardController {
|
|
|
16878
16706
|
*/
|
|
16879
16707
|
const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;
|
|
16880
16708
|
if (isLoggingIn) {
|
|
16881
|
-
this.eventHandler.emitEvent(
|
|
16709
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Popup, result);
|
|
16882
16710
|
}
|
|
16883
16711
|
else {
|
|
16884
|
-
this.eventHandler.emitEvent(
|
|
16712
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
|
|
16885
16713
|
}
|
|
16886
16714
|
atPopupMeasurement.addStaticFields({
|
|
16887
16715
|
accessTokenSize: result.accessToken.length,
|
|
@@ -16895,10 +16723,10 @@ class StandardController {
|
|
|
16895
16723
|
})
|
|
16896
16724
|
.catch((e) => {
|
|
16897
16725
|
if (loggedInAccounts.length > 0) {
|
|
16898
|
-
this.eventHandler.emitEvent(
|
|
16726
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
16899
16727
|
}
|
|
16900
16728
|
else {
|
|
16901
|
-
this.eventHandler.emitEvent(
|
|
16729
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
16902
16730
|
}
|
|
16903
16731
|
atPopupMeasurement.endMeasurement({
|
|
16904
16732
|
errorCode: e.errorCode,
|
|
@@ -16946,16 +16774,16 @@ class StandardController {
|
|
|
16946
16774
|
correlationId: correlationId,
|
|
16947
16775
|
};
|
|
16948
16776
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
16949
|
-
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(
|
|
16777
|
+
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);
|
|
16950
16778
|
this.ssoSilentMeasurement?.increment({
|
|
16951
16779
|
visibilityChangeCount: 0,
|
|
16952
16780
|
});
|
|
16953
16781
|
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
16954
16782
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
16955
|
-
this.eventHandler.emitEvent(
|
|
16783
|
+
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, exports.InteractionType.Silent, validRequest);
|
|
16956
16784
|
let result;
|
|
16957
16785
|
if (this.canUseNative(validRequest)) {
|
|
16958
|
-
result = this.acquireTokenNative(validRequest,
|
|
16786
|
+
result = this.acquireTokenNative(validRequest, ApiId.ssoSilent).catch((e) => {
|
|
16959
16787
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
16960
16788
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
16961
16789
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
@@ -16971,7 +16799,7 @@ class StandardController {
|
|
|
16971
16799
|
}
|
|
16972
16800
|
return result
|
|
16973
16801
|
.then((response) => {
|
|
16974
|
-
this.eventHandler.emitEvent(
|
|
16802
|
+
this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
16975
16803
|
this.ssoSilentMeasurement?.addStaticFields({
|
|
16976
16804
|
accessTokenSize: response.accessToken.length,
|
|
16977
16805
|
idTokenSize: response.idToken.length,
|
|
@@ -16984,7 +16812,7 @@ class StandardController {
|
|
|
16984
16812
|
return response;
|
|
16985
16813
|
})
|
|
16986
16814
|
.catch((e) => {
|
|
16987
|
-
this.eventHandler.emitEvent(
|
|
16815
|
+
this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
16988
16816
|
this.ssoSilentMeasurement?.endMeasurement({
|
|
16989
16817
|
errorCode: e.errorCode,
|
|
16990
16818
|
subErrorCode: e.subError,
|
|
@@ -17010,8 +16838,8 @@ class StandardController {
|
|
|
17010
16838
|
const correlationId = this.getRequestCorrelationId(request);
|
|
17011
16839
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
17012
16840
|
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
17013
|
-
this.eventHandler.emitEvent(
|
|
17014
|
-
const atbcMeasurement = this.performanceClient.startMeasurement(
|
|
16841
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
16842
|
+
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, request.correlationId);
|
|
17015
16843
|
try {
|
|
17016
16844
|
if (request.code && request.nativeAccountId) {
|
|
17017
16845
|
// Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.
|
|
@@ -17027,7 +16855,7 @@ class StandardController {
|
|
|
17027
16855
|
correlationId,
|
|
17028
16856
|
})
|
|
17029
16857
|
.then((result) => {
|
|
17030
|
-
this.eventHandler.emitEvent(
|
|
16858
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
|
|
17031
16859
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
17032
16860
|
atbcMeasurement.addStaticFields({
|
|
17033
16861
|
accessTokenSize: result.accessToken.length,
|
|
@@ -17042,7 +16870,7 @@ class StandardController {
|
|
|
17042
16870
|
})
|
|
17043
16871
|
.catch((error) => {
|
|
17044
16872
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
17045
|
-
this.eventHandler.emitEvent(
|
|
16873
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, error);
|
|
17046
16874
|
atbcMeasurement.endMeasurement({
|
|
17047
16875
|
errorCode: error.errorCode,
|
|
17048
16876
|
subErrorCode: error.subError,
|
|
@@ -17060,7 +16888,7 @@ class StandardController {
|
|
|
17060
16888
|
}
|
|
17061
16889
|
else if (request.nativeAccountId) {
|
|
17062
16890
|
if (this.canUseNative(request, request.nativeAccountId)) {
|
|
17063
|
-
return this.acquireTokenNative(request,
|
|
16891
|
+
return this.acquireTokenNative(request, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e) => {
|
|
17064
16892
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
17065
16893
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
17066
16894
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
@@ -17077,7 +16905,7 @@ class StandardController {
|
|
|
17077
16905
|
}
|
|
17078
16906
|
}
|
|
17079
16907
|
catch (e) {
|
|
17080
|
-
this.eventHandler.emitEvent(
|
|
16908
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
17081
16909
|
atbcMeasurement.endMeasurement({
|
|
17082
16910
|
errorCode: (e instanceof AuthError && e.errorCode) || undefined,
|
|
17083
16911
|
subErrorCode: (e instanceof AuthError && e.subError) || undefined,
|
|
@@ -17094,7 +16922,7 @@ class StandardController {
|
|
|
17094
16922
|
async acquireTokenByCodeAsync(request) {
|
|
17095
16923
|
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
|
|
17096
16924
|
this.acquireTokenByCodeAsyncMeasurement =
|
|
17097
|
-
this.performanceClient.startMeasurement(
|
|
16925
|
+
this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCodeAsync, request.correlationId);
|
|
17098
16926
|
this.acquireTokenByCodeAsyncMeasurement?.increment({
|
|
17099
16927
|
visibilityChangeCount: 0,
|
|
17100
16928
|
});
|
|
@@ -17132,11 +16960,11 @@ class StandardController {
|
|
|
17132
16960
|
* @returns A promise that, when resolved, returns the access token
|
|
17133
16961
|
*/
|
|
17134
16962
|
async acquireTokenFromCache(silentCacheClient, commonRequest, silentRequest) {
|
|
17135
|
-
this.performanceClient.addQueueMeasurement(
|
|
16963
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenFromCache, commonRequest.correlationId);
|
|
17136
16964
|
switch (silentRequest.cacheLookupPolicy) {
|
|
17137
|
-
case
|
|
17138
|
-
case
|
|
17139
|
-
case
|
|
16965
|
+
case CacheLookupPolicy.Default:
|
|
16966
|
+
case CacheLookupPolicy.AccessToken:
|
|
16967
|
+
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
17140
16968
|
return silentCacheClient.acquireToken(commonRequest);
|
|
17141
16969
|
default:
|
|
17142
16970
|
throw ClientAuthError.createRefreshRequiredError();
|
|
@@ -17149,14 +16977,14 @@ class StandardController {
|
|
|
17149
16977
|
* @returns A promise that, when resolved, returns the access token
|
|
17150
16978
|
*/
|
|
17151
16979
|
async acquireTokenByRefreshToken(commonRequest, silentRequest) {
|
|
17152
|
-
this.performanceClient.addQueueMeasurement(
|
|
16980
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenByRefreshToken, commonRequest.correlationId);
|
|
17153
16981
|
switch (silentRequest.cacheLookupPolicy) {
|
|
17154
|
-
case
|
|
17155
|
-
case
|
|
17156
|
-
case
|
|
17157
|
-
case
|
|
16982
|
+
case CacheLookupPolicy.Default:
|
|
16983
|
+
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
16984
|
+
case CacheLookupPolicy.RefreshToken:
|
|
16985
|
+
case CacheLookupPolicy.RefreshTokenAndNetwork:
|
|
17158
16986
|
const silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);
|
|
17159
|
-
this.performanceClient.setPreQueueTime(
|
|
16987
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentRefreshClientAcquireToken, commonRequest.correlationId);
|
|
17160
16988
|
return silentRefreshClient.acquireToken(commonRequest);
|
|
17161
16989
|
default:
|
|
17162
16990
|
throw ClientAuthError.createRefreshRequiredError();
|
|
@@ -17168,9 +16996,9 @@ class StandardController {
|
|
|
17168
16996
|
* @returns A promise that, when resolved, returns the access token
|
|
17169
16997
|
*/
|
|
17170
16998
|
async acquireTokenBySilentIframe(request) {
|
|
17171
|
-
this.performanceClient.addQueueMeasurement(
|
|
16999
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenBySilentIframe, request.correlationId);
|
|
17172
17000
|
const silentIframeClient = this.createSilentIframeClient(request.correlationId);
|
|
17173
|
-
this.performanceClient.setPreQueueTime(
|
|
17001
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
17174
17002
|
return silentIframeClient.acquireToken(request);
|
|
17175
17003
|
}
|
|
17176
17004
|
// #endregion
|
|
@@ -17328,9 +17156,9 @@ class StandardController {
|
|
|
17328
17156
|
*
|
|
17329
17157
|
* @protected
|
|
17330
17158
|
* @param {InteractionType} interactionType What kind of interaction is being used
|
|
17331
|
-
* @param {boolean} [
|
|
17159
|
+
* @param {boolean} [isAppEmbedded=false] Whether to set interaction in progress temp cache flag
|
|
17332
17160
|
*/
|
|
17333
|
-
preflightBrowserEnvironmentCheck(interactionType,
|
|
17161
|
+
preflightBrowserEnvironmentCheck(interactionType, isAppEmbedded = false) {
|
|
17334
17162
|
this.logger.verbose("preflightBrowserEnvironmentCheck started");
|
|
17335
17163
|
// Block request if not in browser environment
|
|
17336
17164
|
BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
@@ -17340,18 +17168,23 @@ class StandardController {
|
|
|
17340
17168
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
17341
17169
|
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
17342
17170
|
BrowserUtils.blockAcquireTokenInPopups();
|
|
17343
|
-
|
|
17344
|
-
|
|
17171
|
+
/*
|
|
17172
|
+
* Block token acquisition before initialize has been called if native brokering is enabled in top-frame.
|
|
17173
|
+
* Skip check if application is embedded.
|
|
17174
|
+
*/
|
|
17175
|
+
if (!isAppEmbedded) {
|
|
17176
|
+
BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);
|
|
17177
|
+
}
|
|
17345
17178
|
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
17346
17179
|
if (interactionType === exports.InteractionType.Redirect &&
|
|
17347
17180
|
this.config.cache.cacheLocation ===
|
|
17348
|
-
|
|
17181
|
+
BrowserCacheLocation.MemoryStorage &&
|
|
17349
17182
|
!this.config.cache.storeAuthStateInCookie) {
|
|
17350
17183
|
throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
|
|
17351
17184
|
}
|
|
17352
17185
|
if (interactionType === exports.InteractionType.Redirect ||
|
|
17353
17186
|
interactionType === exports.InteractionType.Popup) {
|
|
17354
|
-
this.preflightInteractiveRequest(
|
|
17187
|
+
this.preflightInteractiveRequest(!isAppEmbedded);
|
|
17355
17188
|
}
|
|
17356
17189
|
}
|
|
17357
17190
|
/**
|
|
@@ -17439,7 +17272,7 @@ class StandardController {
|
|
|
17439
17272
|
* @param correlationId
|
|
17440
17273
|
*/
|
|
17441
17274
|
createSilentIframeClient(correlationId) {
|
|
17442
|
-
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
17275
|
+
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
|
|
17443
17276
|
}
|
|
17444
17277
|
/**
|
|
17445
17278
|
* Returns new instance of the Silent Cache Interaction Client
|
|
@@ -17457,7 +17290,7 @@ class StandardController {
|
|
|
17457
17290
|
* Returns new instance of the Silent AuthCode Interaction Client
|
|
17458
17291
|
*/
|
|
17459
17292
|
createSilentAuthCodeClient(correlationId) {
|
|
17460
|
-
return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
17293
|
+
return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, this.nativeExtensionProvider, correlationId);
|
|
17461
17294
|
}
|
|
17462
17295
|
/**
|
|
17463
17296
|
* Adds event callbacks to array
|
|
@@ -17666,7 +17499,7 @@ class StandardController {
|
|
|
17666
17499
|
*/
|
|
17667
17500
|
async acquireTokenSilent(request) {
|
|
17668
17501
|
const correlationId = this.getRequestCorrelationId(request);
|
|
17669
|
-
const atsMeasurement = this.performanceClient.startMeasurement(
|
|
17502
|
+
const atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);
|
|
17670
17503
|
atsMeasurement.addStaticFields({
|
|
17671
17504
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
17672
17505
|
});
|
|
@@ -17692,7 +17525,7 @@ class StandardController {
|
|
|
17692
17525
|
const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
|
|
17693
17526
|
if (typeof cachedResponse === "undefined") {
|
|
17694
17527
|
this.logger.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
|
|
17695
|
-
this.performanceClient.setPreQueueTime(
|
|
17528
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenSilentAsync, correlationId);
|
|
17696
17529
|
const response = this.acquireTokenSilentAsync({
|
|
17697
17530
|
...request,
|
|
17698
17531
|
correlationId,
|
|
@@ -17738,9 +17571,9 @@ class StandardController {
|
|
|
17738
17571
|
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
|
|
17739
17572
|
*/
|
|
17740
17573
|
async acquireTokenSilentAsync(request, account) {
|
|
17741
|
-
this.performanceClient.addQueueMeasurement(
|
|
17742
|
-
this.eventHandler.emitEvent(
|
|
17743
|
-
this.atsAsyncMeasurement = this.performanceClient.startMeasurement(
|
|
17574
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
17575
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
17576
|
+
this.atsAsyncMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
17744
17577
|
this.atsAsyncMeasurement?.increment({
|
|
17745
17578
|
visibilityChangeCount: 0,
|
|
17746
17579
|
});
|
|
@@ -17753,7 +17586,7 @@ class StandardController {
|
|
|
17753
17586
|
...request,
|
|
17754
17587
|
account,
|
|
17755
17588
|
};
|
|
17756
|
-
result = this.acquireTokenNative(silentRequest,
|
|
17589
|
+
result = this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e) => {
|
|
17757
17590
|
// If native token acquisition fails for availability reasons fallback to web flow
|
|
17758
17591
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
17759
17592
|
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
@@ -17768,23 +17601,23 @@ class StandardController {
|
|
|
17768
17601
|
else {
|
|
17769
17602
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
17770
17603
|
const silentCacheClient = this.createSilentCacheClient(request.correlationId);
|
|
17771
|
-
this.performanceClient.setPreQueueTime(
|
|
17604
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeSilentRequest, request.correlationId);
|
|
17772
17605
|
const silentRequest = await silentCacheClient.initializeSilentRequest(request, account);
|
|
17773
17606
|
const requestWithCLP = {
|
|
17774
17607
|
...request,
|
|
17775
17608
|
// set the request's CacheLookupPolicy to Default if it was not optionally passed in
|
|
17776
|
-
cacheLookupPolicy: request.cacheLookupPolicy ||
|
|
17609
|
+
cacheLookupPolicy: request.cacheLookupPolicy || CacheLookupPolicy.Default,
|
|
17777
17610
|
};
|
|
17778
|
-
this.performanceClient.setPreQueueTime(
|
|
17611
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenFromCache, silentRequest.correlationId);
|
|
17779
17612
|
result = this.acquireTokenFromCache(silentCacheClient, silentRequest, requestWithCLP).catch((cacheError) => {
|
|
17780
17613
|
if (requestWithCLP.cacheLookupPolicy ===
|
|
17781
|
-
|
|
17614
|
+
CacheLookupPolicy.AccessToken) {
|
|
17782
17615
|
throw cacheError;
|
|
17783
17616
|
}
|
|
17784
17617
|
// block the reload if it occurred inside a hidden iframe
|
|
17785
17618
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
17786
|
-
this.eventHandler.emitEvent(
|
|
17787
|
-
this.performanceClient.setPreQueueTime(
|
|
17619
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest);
|
|
17620
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenByRefreshToken, silentRequest.correlationId);
|
|
17788
17621
|
return this.acquireTokenByRefreshToken(silentRequest, requestWithCLP).catch((refreshTokenError) => {
|
|
17789
17622
|
const isServerError = refreshTokenError instanceof ServerError;
|
|
17790
17623
|
const isInteractionRequiredError = refreshTokenError instanceof
|
|
@@ -17795,22 +17628,22 @@ class StandardController {
|
|
|
17795
17628
|
!isInvalidGrantError ||
|
|
17796
17629
|
isInteractionRequiredError ||
|
|
17797
17630
|
requestWithCLP.cacheLookupPolicy ===
|
|
17798
|
-
|
|
17631
|
+
CacheLookupPolicy.AccessTokenAndRefreshToken ||
|
|
17799
17632
|
requestWithCLP.cacheLookupPolicy ===
|
|
17800
|
-
|
|
17633
|
+
CacheLookupPolicy.RefreshToken) &&
|
|
17801
17634
|
requestWithCLP.cacheLookupPolicy !==
|
|
17802
|
-
|
|
17635
|
+
CacheLookupPolicy.Skip) {
|
|
17803
17636
|
throw refreshTokenError;
|
|
17804
17637
|
}
|
|
17805
17638
|
this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", request.correlationId);
|
|
17806
|
-
this.performanceClient.setPreQueueTime(
|
|
17639
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenBySilentIframe, silentRequest.correlationId);
|
|
17807
17640
|
return this.acquireTokenBySilentIframe(silentRequest);
|
|
17808
17641
|
});
|
|
17809
17642
|
});
|
|
17810
17643
|
}
|
|
17811
17644
|
return result
|
|
17812
17645
|
.then((response) => {
|
|
17813
|
-
this.eventHandler.emitEvent(
|
|
17646
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
17814
17647
|
this.atsAsyncMeasurement?.endMeasurement({
|
|
17815
17648
|
success: true,
|
|
17816
17649
|
fromCache: response.fromCache,
|
|
@@ -17820,7 +17653,7 @@ class StandardController {
|
|
|
17820
17653
|
return response;
|
|
17821
17654
|
})
|
|
17822
17655
|
.catch((tokenRenewalError) => {
|
|
17823
|
-
this.eventHandler.emitEvent(
|
|
17656
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
17824
17657
|
this.atsAsyncMeasurement?.endMeasurement({
|
|
17825
17658
|
errorCode: tokenRenewalError.errorCode,
|
|
17826
17659
|
subErrorCode: tokenRenewalError.subError,
|
|
@@ -18256,55 +18089,56 @@ class EventMessageUtils {
|
|
|
18256
18089
|
*/
|
|
18257
18090
|
static getInteractionStatusFromEvent(message, currentStatus) {
|
|
18258
18091
|
switch (message.eventType) {
|
|
18259
|
-
case
|
|
18260
|
-
return
|
|
18261
|
-
case
|
|
18262
|
-
return
|
|
18263
|
-
case
|
|
18092
|
+
case EventType.LOGIN_START:
|
|
18093
|
+
return InteractionStatus.Login;
|
|
18094
|
+
case EventType.SSO_SILENT_START:
|
|
18095
|
+
return InteractionStatus.SsoSilent;
|
|
18096
|
+
case EventType.ACQUIRE_TOKEN_START:
|
|
18264
18097
|
if (message.interactionType === exports.InteractionType.Redirect ||
|
|
18265
18098
|
message.interactionType === exports.InteractionType.Popup) {
|
|
18266
|
-
return
|
|
18099
|
+
return InteractionStatus.AcquireToken;
|
|
18267
18100
|
}
|
|
18268
18101
|
break;
|
|
18269
|
-
case
|
|
18270
|
-
return
|
|
18271
|
-
case
|
|
18272
|
-
return
|
|
18273
|
-
case
|
|
18274
|
-
case
|
|
18102
|
+
case EventType.HANDLE_REDIRECT_START:
|
|
18103
|
+
return InteractionStatus.HandleRedirect;
|
|
18104
|
+
case EventType.LOGOUT_START:
|
|
18105
|
+
return InteractionStatus.Logout;
|
|
18106
|
+
case EventType.SSO_SILENT_SUCCESS:
|
|
18107
|
+
case EventType.SSO_SILENT_FAILURE:
|
|
18275
18108
|
if (currentStatus &&
|
|
18276
|
-
currentStatus !==
|
|
18109
|
+
currentStatus !== InteractionStatus.SsoSilent) {
|
|
18277
18110
|
// Prevent this event from clearing any status other than ssoSilent
|
|
18278
18111
|
break;
|
|
18279
18112
|
}
|
|
18280
|
-
return
|
|
18281
|
-
case
|
|
18113
|
+
return InteractionStatus.None;
|
|
18114
|
+
case EventType.LOGOUT_END:
|
|
18282
18115
|
if (currentStatus &&
|
|
18283
|
-
currentStatus !==
|
|
18116
|
+
currentStatus !== InteractionStatus.Logout) {
|
|
18284
18117
|
// Prevent this event from clearing any status other than logout
|
|
18285
18118
|
break;
|
|
18286
18119
|
}
|
|
18287
|
-
return
|
|
18288
|
-
case
|
|
18120
|
+
return InteractionStatus.None;
|
|
18121
|
+
case EventType.HANDLE_REDIRECT_END:
|
|
18289
18122
|
if (currentStatus &&
|
|
18290
|
-
currentStatus !==
|
|
18123
|
+
currentStatus !== InteractionStatus.HandleRedirect) {
|
|
18291
18124
|
// Prevent this event from clearing any status other than handleRedirect
|
|
18292
18125
|
break;
|
|
18293
18126
|
}
|
|
18294
|
-
return
|
|
18295
|
-
case
|
|
18296
|
-
case
|
|
18297
|
-
case
|
|
18298
|
-
case
|
|
18127
|
+
return InteractionStatus.None;
|
|
18128
|
+
case EventType.LOGIN_SUCCESS:
|
|
18129
|
+
case EventType.LOGIN_FAILURE:
|
|
18130
|
+
case EventType.ACQUIRE_TOKEN_SUCCESS:
|
|
18131
|
+
case EventType.ACQUIRE_TOKEN_FAILURE:
|
|
18132
|
+
case EventType.RESTORE_FROM_BFCACHE:
|
|
18299
18133
|
if (message.interactionType === exports.InteractionType.Redirect ||
|
|
18300
18134
|
message.interactionType === exports.InteractionType.Popup) {
|
|
18301
18135
|
if (currentStatus &&
|
|
18302
|
-
currentStatus !==
|
|
18303
|
-
currentStatus !==
|
|
18136
|
+
currentStatus !== InteractionStatus.Login &&
|
|
18137
|
+
currentStatus !== InteractionStatus.AcquireToken) {
|
|
18304
18138
|
// Prevent this event from clearing any status other than login or acquireToken
|
|
18305
18139
|
break;
|
|
18306
18140
|
}
|
|
18307
|
-
return
|
|
18141
|
+
return InteractionStatus.None;
|
|
18308
18142
|
}
|
|
18309
18143
|
break;
|
|
18310
18144
|
}
|
|
@@ -18353,30 +18187,40 @@ class SignedHttpRequest {
|
|
|
18353
18187
|
}
|
|
18354
18188
|
|
|
18355
18189
|
exports.AccountEntity = AccountEntity;
|
|
18190
|
+
exports.ApiId = ApiId;
|
|
18356
18191
|
exports.AuthError = AuthError;
|
|
18357
18192
|
exports.AuthErrorMessage = AuthErrorMessage;
|
|
18358
18193
|
exports.AuthenticationHeaderParser = AuthenticationHeaderParser;
|
|
18194
|
+
exports.AuthenticationScheme = AuthenticationScheme;
|
|
18195
|
+
exports.AzureCloudInstance = AzureCloudInstance;
|
|
18359
18196
|
exports.BrowserAuthError = BrowserAuthError;
|
|
18360
18197
|
exports.BrowserAuthErrorMessage = BrowserAuthErrorMessage;
|
|
18198
|
+
exports.BrowserCacheLocation = BrowserCacheLocation;
|
|
18361
18199
|
exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
|
|
18362
18200
|
exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
|
|
18363
18201
|
exports.BrowserUtils = BrowserUtils;
|
|
18202
|
+
exports.CacheLookupPolicy = CacheLookupPolicy;
|
|
18364
18203
|
exports.ClientAuthError = ClientAuthError;
|
|
18365
18204
|
exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
|
|
18366
18205
|
exports.ClientConfigurationError = ClientConfigurationError;
|
|
18367
18206
|
exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
|
|
18368
18207
|
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
|
|
18369
18208
|
exports.EventMessageUtils = EventMessageUtils;
|
|
18209
|
+
exports.EventType = EventType;
|
|
18370
18210
|
exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
|
|
18371
18211
|
exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
|
|
18212
|
+
exports.InteractionStatus = InteractionStatus;
|
|
18372
18213
|
exports.Logger = Logger;
|
|
18373
18214
|
exports.NavigationClient = NavigationClient;
|
|
18374
18215
|
exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
|
|
18216
|
+
exports.PerformanceEvents = PerformanceEvents;
|
|
18217
|
+
exports.ProtocolMode = ProtocolMode;
|
|
18375
18218
|
exports.PublicClientApplication = PublicClientApplication;
|
|
18376
18219
|
exports.ServerError = ServerError;
|
|
18377
18220
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
18378
18221
|
exports.StringUtils = StringUtils;
|
|
18379
18222
|
exports.UrlString = UrlString;
|
|
18223
|
+
exports.WrapperSKU = WrapperSKU;
|
|
18380
18224
|
exports.internals = internals;
|
|
18381
18225
|
exports.stubbedPublicClientApplication = stubbedPublicClientApplication;
|
|
18382
18226
|
exports.version = version;
|