@azure/msal-browser 3.0.0-alpha.2 → 3.0.0-beta.1
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.d.ts +2 -1
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.js +1 -1
- package/dist/app/PublicClientApplication.d.ts +2 -1
- package/dist/app/PublicClientApplication.d.ts.map +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 +3 -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/ITokenCache.d.ts +2 -1
- package/dist/cache/ITokenCache.d.ts.map +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.d.ts +2 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.js +4 -5
- package/dist/cache/TokenCache.js.map +1 -1
- package/dist/cache/entities/CacheRecord.d.ts +6 -0
- package/dist/cache/entities/CacheRecord.d.ts.map +1 -0
- package/dist/cache/entities/CacheRecord.js +17 -0
- package/dist/cache/entities/CacheRecord.js.map +1 -0
- package/dist/config/Configuration.d.ts +4 -16
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +2 -5
- package/dist/config/Configuration.js.map +1 -1
- package/dist/controllers/ControllerFactory.js +1 -1
- package/dist/controllers/IController.d.ts +3 -2
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/StandardController.d.ts +4 -3
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.js +14 -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 +4 -4
- 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 +2 -2
- 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.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts +4 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +20 -4
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +3 -2
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +14 -9
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +2 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +2 -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.d.ts +2 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +2 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +2 -2
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +2 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts +2 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +3 -2
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +4 -1
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +2 -1
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/InteractionHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +2 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -1
- package/dist/interaction_handler/RedirectHandler.js.map +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/internals.d.ts +1 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +2 -1
- package/dist/internals.js.map +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/response/AuthenticationResult.d.ts +5 -0
- package/dist/response/AuthenticationResult.d.ts.map +1 -0
- 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.d.ts +0 -5
- package/dist/utils/BrowserStringUtils.d.ts.map +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -13
- package/dist/utils/BrowserStringUtils.js.map +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.cjs.js +870 -1019
- package/lib/msal-browser.cjs.js.map +1 -1
- package/lib/msal-browser.js +870 -1019
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +62 -73
- package/package.json +12 -11
- 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.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0.0-
|
|
1
|
+
/*! @azure/msal-browser v3.0.0-beta.1 2023-07-06 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v14.0.0-
|
|
9
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -79,100 +79,95 @@
|
|
|
79
79
|
/**
|
|
80
80
|
* Request header names
|
|
81
81
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})(HeaderNames || (HeaderNames = {}));
|
|
82
|
+
const HeaderNames = {
|
|
83
|
+
CONTENT_TYPE: "Content-Type",
|
|
84
|
+
RETRY_AFTER: "Retry-After",
|
|
85
|
+
CCS_HEADER: "X-AnchorMailbox",
|
|
86
|
+
WWWAuthenticate: "WWW-Authenticate",
|
|
87
|
+
AuthenticationInfo: "Authentication-Info",
|
|
88
|
+
X_MS_REQUEST_ID: "x-ms-request-id",
|
|
89
|
+
X_MS_HTTP_VERSION: "x-ms-httpver",
|
|
90
|
+
};
|
|
92
91
|
/**
|
|
93
92
|
* Persistent cache keys MSAL which stay while user is logged in.
|
|
94
93
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
})(PersistentCacheKeys || (PersistentCacheKeys = {}));
|
|
94
|
+
const PersistentCacheKeys = {
|
|
95
|
+
ID_TOKEN: "idtoken",
|
|
96
|
+
CLIENT_INFO: "client.info",
|
|
97
|
+
ADAL_ID_TOKEN: "adal.idtoken",
|
|
98
|
+
ERROR: "error",
|
|
99
|
+
ERROR_DESC: "error.description",
|
|
100
|
+
ACTIVE_ACCOUNT: "active-account",
|
|
101
|
+
ACTIVE_ACCOUNT_FILTERS: "active-account-filters", // new cache entry for active_account for a more robust version for browser
|
|
102
|
+
};
|
|
105
103
|
/**
|
|
106
104
|
* String constants related to AAD Authority
|
|
107
105
|
*/
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
})(AADAuthorityConstants || (AADAuthorityConstants = {}));
|
|
106
|
+
const AADAuthorityConstants = {
|
|
107
|
+
COMMON: "common",
|
|
108
|
+
ORGANIZATIONS: "organizations",
|
|
109
|
+
CONSUMERS: "consumers",
|
|
110
|
+
};
|
|
114
111
|
/**
|
|
115
112
|
* Keys in the hashParams sent by AAD Server
|
|
116
113
|
*/
|
|
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
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
114
|
+
const AADServerParamKeys = {
|
|
115
|
+
CLIENT_ID: "client_id",
|
|
116
|
+
REDIRECT_URI: "redirect_uri",
|
|
117
|
+
RESPONSE_TYPE: "response_type",
|
|
118
|
+
RESPONSE_MODE: "response_mode",
|
|
119
|
+
GRANT_TYPE: "grant_type",
|
|
120
|
+
CLAIMS: "claims",
|
|
121
|
+
SCOPE: "scope",
|
|
122
|
+
ERROR: "error",
|
|
123
|
+
ERROR_DESCRIPTION: "error_description",
|
|
124
|
+
ACCESS_TOKEN: "access_token",
|
|
125
|
+
ID_TOKEN: "id_token",
|
|
126
|
+
REFRESH_TOKEN: "refresh_token",
|
|
127
|
+
EXPIRES_IN: "expires_in",
|
|
128
|
+
STATE: "state",
|
|
129
|
+
NONCE: "nonce",
|
|
130
|
+
PROMPT: "prompt",
|
|
131
|
+
SESSION_STATE: "session_state",
|
|
132
|
+
CLIENT_INFO: "client_info",
|
|
133
|
+
CODE: "code",
|
|
134
|
+
CODE_CHALLENGE: "code_challenge",
|
|
135
|
+
CODE_CHALLENGE_METHOD: "code_challenge_method",
|
|
136
|
+
CODE_VERIFIER: "code_verifier",
|
|
137
|
+
CLIENT_REQUEST_ID: "client-request-id",
|
|
138
|
+
X_CLIENT_SKU: "x-client-SKU",
|
|
139
|
+
X_CLIENT_VER: "x-client-VER",
|
|
140
|
+
X_CLIENT_OS: "x-client-OS",
|
|
141
|
+
X_CLIENT_CPU: "x-client-CPU",
|
|
142
|
+
X_CLIENT_CURR_TELEM: "x-client-current-telemetry",
|
|
143
|
+
X_CLIENT_LAST_TELEM: "x-client-last-telemetry",
|
|
144
|
+
X_MS_LIB_CAPABILITY: "x-ms-lib-capability",
|
|
145
|
+
X_APP_NAME: "x-app-name",
|
|
146
|
+
X_APP_VER: "x-app-ver",
|
|
147
|
+
POST_LOGOUT_URI: "post_logout_redirect_uri",
|
|
148
|
+
ID_TOKEN_HINT: "id_token_hint",
|
|
149
|
+
DEVICE_CODE: "device_code",
|
|
150
|
+
CLIENT_SECRET: "client_secret",
|
|
151
|
+
CLIENT_ASSERTION: "client_assertion",
|
|
152
|
+
CLIENT_ASSERTION_TYPE: "client_assertion_type",
|
|
153
|
+
TOKEN_TYPE: "token_type",
|
|
154
|
+
REQ_CNF: "req_cnf",
|
|
155
|
+
OBO_ASSERTION: "assertion",
|
|
156
|
+
REQUESTED_TOKEN_USE: "requested_token_use",
|
|
157
|
+
ON_BEHALF_OF: "on_behalf_of",
|
|
158
|
+
FOCI: "foci",
|
|
159
|
+
CCS_HEADER: "X-AnchorMailbox",
|
|
160
|
+
RETURN_SPA_CODE: "return_spa_code",
|
|
161
|
+
NATIVE_BROKER: "nativebroker",
|
|
162
|
+
LOGOUT_HINT: "logout_hint",
|
|
163
|
+
};
|
|
168
164
|
/**
|
|
169
165
|
* Claims request keys
|
|
170
166
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
})(ClaimsRequestKeys || (ClaimsRequestKeys = {}));
|
|
167
|
+
const ClaimsRequestKeys = {
|
|
168
|
+
ACCESS_TOKEN: "access_token",
|
|
169
|
+
XMS_CC: "xms_cc",
|
|
170
|
+
};
|
|
176
171
|
/**
|
|
177
172
|
* we considered making this "enum" in the request instead of string, however it looks like the allowed list of
|
|
178
173
|
* prompt values kept changing over past couple of years. There are some undocumented prompt values for some
|
|
@@ -189,18 +184,17 @@
|
|
|
189
184
|
/**
|
|
190
185
|
* SSO Types - generated to populate hints
|
|
191
186
|
*/
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
})(SSOTypes || (SSOTypes = {}));
|
|
187
|
+
const SSOTypes = {
|
|
188
|
+
ACCOUNT: "account",
|
|
189
|
+
SID: "sid",
|
|
190
|
+
LOGIN_HINT: "login_hint",
|
|
191
|
+
ID_TOKEN: "id_token",
|
|
192
|
+
DOMAIN_HINT: "domain_hint",
|
|
193
|
+
ORGANIZATIONS: "organizations",
|
|
194
|
+
CONSUMERS: "consumers",
|
|
195
|
+
ACCOUNT_ID: "accountIdentifier",
|
|
196
|
+
HOMEACCOUNT_ID: "homeAccountIdentifier",
|
|
197
|
+
};
|
|
204
198
|
/**
|
|
205
199
|
* allowed values for codeVerifier
|
|
206
200
|
*/
|
|
@@ -211,68 +205,62 @@
|
|
|
211
205
|
/**
|
|
212
206
|
* allowed values for response_mode
|
|
213
207
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
})(ResponseMode || (ResponseMode = {}));
|
|
208
|
+
const ResponseMode = {
|
|
209
|
+
QUERY: "query",
|
|
210
|
+
FRAGMENT: "fragment",
|
|
211
|
+
FORM_POST: "form_post",
|
|
212
|
+
};
|
|
220
213
|
/**
|
|
221
214
|
* allowed grant_type
|
|
222
215
|
*/
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
})(GrantType || (GrantType = {}));
|
|
216
|
+
const GrantType = {
|
|
217
|
+
IMPLICIT_GRANT: "implicit",
|
|
218
|
+
AUTHORIZATION_CODE_GRANT: "authorization_code",
|
|
219
|
+
CLIENT_CREDENTIALS_GRANT: "client_credentials",
|
|
220
|
+
RESOURCE_OWNER_PASSWORD_GRANT: "password",
|
|
221
|
+
REFRESH_TOKEN_GRANT: "refresh_token",
|
|
222
|
+
DEVICE_CODE_GRANT: "device_code",
|
|
223
|
+
JWT_BEARER: "urn:ietf:params:oauth:grant-type:jwt-bearer",
|
|
224
|
+
};
|
|
233
225
|
/**
|
|
234
226
|
* Account types in Cache
|
|
235
227
|
*/
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
})(CacheAccountType || (CacheAccountType = {}));
|
|
228
|
+
const CacheAccountType = {
|
|
229
|
+
MSSTS_ACCOUNT_TYPE: "MSSTS",
|
|
230
|
+
ADFS_ACCOUNT_TYPE: "ADFS",
|
|
231
|
+
MSAV1_ACCOUNT_TYPE: "MSA",
|
|
232
|
+
GENERIC_ACCOUNT_TYPE: "Generic", // NTLM, Kerberos, FBA, Basic etc
|
|
233
|
+
};
|
|
243
234
|
/**
|
|
244
235
|
* Separators used in cache
|
|
245
236
|
*/
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
})(Separators || (Separators = {}));
|
|
237
|
+
const Separators = {
|
|
238
|
+
CACHE_KEY_SEPARATOR: "-",
|
|
239
|
+
CLIENT_INFO_SEPARATOR: ".",
|
|
240
|
+
};
|
|
251
241
|
/**
|
|
252
242
|
* Credential Type stored in the cache
|
|
253
243
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
})(CredentialType || (CredentialType = {}));
|
|
244
|
+
const CredentialType = {
|
|
245
|
+
ID_TOKEN: "IdToken",
|
|
246
|
+
ACCESS_TOKEN: "AccessToken",
|
|
247
|
+
ACCESS_TOKEN_WITH_AUTH_SCHEME: "AccessToken_With_AuthScheme",
|
|
248
|
+
REFRESH_TOKEN: "RefreshToken",
|
|
249
|
+
};
|
|
261
250
|
/**
|
|
262
251
|
* Combine all cache types
|
|
263
252
|
*/
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
})(CacheType || (CacheType = {}));
|
|
253
|
+
const CacheType = {
|
|
254
|
+
ADFS: 1001,
|
|
255
|
+
MSA: 1002,
|
|
256
|
+
MSSTS: 1003,
|
|
257
|
+
GENERIC: 1004,
|
|
258
|
+
ACCESS_TOKEN: 2001,
|
|
259
|
+
REFRESH_TOKEN: 2002,
|
|
260
|
+
ID_TOKEN: 2003,
|
|
261
|
+
APP_METADATA: 3001,
|
|
262
|
+
UNDEFINED: 9999,
|
|
263
|
+
};
|
|
276
264
|
/**
|
|
277
265
|
* More Cache related constants
|
|
278
266
|
*/
|
|
@@ -283,13 +271,12 @@
|
|
|
283
271
|
CACHE_KEY: "authority-metadata",
|
|
284
272
|
REFRESH_TIME_SECONDS: 3600 * 24, // 24 Hours
|
|
285
273
|
};
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
})(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
|
|
274
|
+
const AuthorityMetadataSource = {
|
|
275
|
+
CONFIG: "config",
|
|
276
|
+
CACHE: "cache",
|
|
277
|
+
NETWORK: "network",
|
|
278
|
+
HARDCODED_VALUES: "hardcoded_values",
|
|
279
|
+
};
|
|
293
280
|
const SERVER_TELEM_CONSTANTS = {
|
|
294
281
|
SCHEMA_VERSION: 5,
|
|
295
282
|
MAX_CUR_HEADER_BYTES: 80,
|
|
@@ -305,12 +292,11 @@
|
|
|
305
292
|
/**
|
|
306
293
|
* Type of the authentication request
|
|
307
294
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
})(exports.AuthenticationScheme || (exports.AuthenticationScheme = {}));
|
|
295
|
+
const AuthenticationScheme = {
|
|
296
|
+
BEARER: "Bearer",
|
|
297
|
+
POP: "pop",
|
|
298
|
+
SSH: "ssh-cert",
|
|
299
|
+
};
|
|
314
300
|
/**
|
|
315
301
|
* Constants related to throttling
|
|
316
302
|
*/
|
|
@@ -331,56 +317,50 @@
|
|
|
331
317
|
/**
|
|
332
318
|
* Password grant parameters
|
|
333
319
|
*/
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
})(PasswordGrantConstants || (PasswordGrantConstants = {}));
|
|
320
|
+
const PasswordGrantConstants = {
|
|
321
|
+
username: "username",
|
|
322
|
+
password: "password",
|
|
323
|
+
};
|
|
339
324
|
/**
|
|
340
325
|
* Response codes
|
|
341
326
|
*/
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
})(ResponseCodes || (ResponseCodes = {}));
|
|
327
|
+
const ResponseCodes = {
|
|
328
|
+
httpSuccess: 200,
|
|
329
|
+
httpBadRequest: 400,
|
|
330
|
+
};
|
|
347
331
|
/**
|
|
348
332
|
* Region Discovery Sources
|
|
349
333
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
})(RegionDiscoverySources || (RegionDiscoverySources = {}));
|
|
334
|
+
const RegionDiscoverySources = {
|
|
335
|
+
FAILED_AUTO_DETECTION: "1",
|
|
336
|
+
INTERNAL_CACHE: "2",
|
|
337
|
+
ENVIRONMENT_VARIABLE: "3",
|
|
338
|
+
IMDS: "4",
|
|
339
|
+
};
|
|
357
340
|
/**
|
|
358
341
|
* Region Discovery Outcomes
|
|
359
342
|
*/
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
JsonTypes["Jwk"] = "JWK";
|
|
380
|
-
JsonTypes["Pop"] = "pop";
|
|
381
|
-
})(JsonTypes || (JsonTypes = {}));
|
|
343
|
+
const RegionDiscoveryOutcomes = {
|
|
344
|
+
CONFIGURED_MATCHES_DETECTED: "1",
|
|
345
|
+
CONFIGURED_NO_AUTO_DETECTION: "2",
|
|
346
|
+
CONFIGURED_NOT_DETECTED: "3",
|
|
347
|
+
AUTO_DETECTION_REQUESTED_SUCCESSFUL: "4",
|
|
348
|
+
AUTO_DETECTION_REQUESTED_FAILED: "5",
|
|
349
|
+
};
|
|
350
|
+
const CacheOutcome = {
|
|
351
|
+
NO_CACHE_HIT: "0",
|
|
352
|
+
FORCE_REFRESH: "1",
|
|
353
|
+
NO_CACHED_ACCESS_TOKEN: "2",
|
|
354
|
+
CACHED_ACCESS_TOKEN_EXPIRED: "3",
|
|
355
|
+
REFRESH_CACHED_ACCESS_TOKEN: "4",
|
|
356
|
+
};
|
|
357
|
+
const JsonTypes = {
|
|
358
|
+
Jwt: "JWT",
|
|
359
|
+
Jwk: "JWK",
|
|
360
|
+
Pop: "pop",
|
|
361
|
+
};
|
|
382
362
|
|
|
383
|
-
/*! @azure/msal-common v14.0.0-
|
|
363
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
384
364
|
|
|
385
365
|
/*
|
|
386
366
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -434,7 +414,7 @@
|
|
|
434
414
|
}
|
|
435
415
|
}
|
|
436
416
|
|
|
437
|
-
/*! @azure/msal-common v14.0.0-
|
|
417
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
438
418
|
|
|
439
419
|
/*
|
|
440
420
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -479,7 +459,7 @@
|
|
|
479
459
|
},
|
|
480
460
|
};
|
|
481
461
|
|
|
482
|
-
/*! @azure/msal-common v14.0.0-
|
|
462
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
483
463
|
|
|
484
464
|
/*
|
|
485
465
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1001,7 +981,7 @@
|
|
|
1001
981
|
}
|
|
1002
982
|
}
|
|
1003
983
|
|
|
1004
|
-
/*! @azure/msal-common v14.0.0-
|
|
984
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1005
985
|
|
|
1006
986
|
/*
|
|
1007
987
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1128,7 +1108,7 @@
|
|
|
1128
1108
|
}
|
|
1129
1109
|
}
|
|
1130
1110
|
|
|
1131
|
-
/*! @azure/msal-common v14.0.0-
|
|
1111
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1132
1112
|
|
|
1133
1113
|
/*
|
|
1134
1114
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1328,33 +1308,32 @@
|
|
|
1328
1308
|
}
|
|
1329
1309
|
}
|
|
1330
1310
|
|
|
1331
|
-
/*! @azure/msal-common v14.0.0-
|
|
1311
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1332
1312
|
/* eslint-disable header/header */
|
|
1333
1313
|
const name$1 = "@azure/msal-common";
|
|
1334
|
-
const version$1 = "14.0.0-
|
|
1314
|
+
const version$1 = "14.0.0-beta.1";
|
|
1335
1315
|
|
|
1336
|
-
/*! @azure/msal-common v14.0.0-
|
|
1316
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1337
1317
|
/*
|
|
1338
1318
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1339
1319
|
* Licensed under the MIT License.
|
|
1340
1320
|
*/
|
|
1341
|
-
|
|
1342
|
-
(function (AzureCloudInstance) {
|
|
1321
|
+
const AzureCloudInstance = {
|
|
1343
1322
|
// AzureCloudInstance is not specified.
|
|
1344
|
-
|
|
1323
|
+
None: "none",
|
|
1345
1324
|
// Microsoft Azure public cloud
|
|
1346
|
-
|
|
1325
|
+
AzurePublic: "https://login.microsoftonline.com",
|
|
1347
1326
|
// Microsoft PPE
|
|
1348
|
-
|
|
1327
|
+
AzurePpe: "https://login.windows-ppe.net",
|
|
1349
1328
|
// Microsoft Chinese national cloud
|
|
1350
|
-
|
|
1329
|
+
AzureChina: "https://login.chinacloudapi.cn",
|
|
1351
1330
|
// Microsoft German national cloud ("Black Forest")
|
|
1352
|
-
|
|
1331
|
+
AzureGermany: "https://login.microsoftonline.de",
|
|
1353
1332
|
// US Government cloud
|
|
1354
|
-
|
|
1355
|
-
}
|
|
1333
|
+
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1334
|
+
};
|
|
1356
1335
|
|
|
1357
|
-
/*! @azure/msal-common v14.0.0-
|
|
1336
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1358
1337
|
|
|
1359
1338
|
/*
|
|
1360
1339
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1454,8 +1433,12 @@
|
|
|
1454
1433
|
},
|
|
1455
1434
|
invalidAuthenticationHeader: {
|
|
1456
1435
|
code: "invalid_authentication_header",
|
|
1457
|
-
desc: "Invalid authentication header provided"
|
|
1436
|
+
desc: "Invalid authentication header provided"
|
|
1458
1437
|
},
|
|
1438
|
+
authorityMismatch: {
|
|
1439
|
+
code: "authority_mismatch",
|
|
1440
|
+
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."
|
|
1441
|
+
}
|
|
1459
1442
|
};
|
|
1460
1443
|
/**
|
|
1461
1444
|
* Error thrown when there is an error in configuration of the MSAL.js library.
|
|
@@ -1604,9 +1587,15 @@
|
|
|
1604
1587
|
static createInvalidAuthenticationHeaderError(invalidHeaderName, details) {
|
|
1605
1588
|
return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, `${ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc}. Invalid header: ${invalidHeaderName}. Details: ${details}`);
|
|
1606
1589
|
}
|
|
1590
|
+
/**
|
|
1591
|
+
* Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
|
|
1592
|
+
*/
|
|
1593
|
+
static createAuthorityMismatchError() {
|
|
1594
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);
|
|
1595
|
+
}
|
|
1607
1596
|
}
|
|
1608
1597
|
|
|
1609
|
-
/*! @azure/msal-common v14.0.0-
|
|
1598
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1610
1599
|
|
|
1611
1600
|
/*
|
|
1612
1601
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1806,7 +1795,7 @@
|
|
|
1806
1795
|
}
|
|
1807
1796
|
}
|
|
1808
1797
|
|
|
1809
|
-
/*! @azure/msal-common v14.0.0-
|
|
1798
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1810
1799
|
|
|
1811
1800
|
/*
|
|
1812
1801
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1846,7 +1835,7 @@
|
|
|
1846
1835
|
};
|
|
1847
1836
|
}
|
|
1848
1837
|
|
|
1849
|
-
/*! @azure/msal-common v14.0.0-
|
|
1838
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1850
1839
|
/*
|
|
1851
1840
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1852
1841
|
* Licensed under the MIT License.
|
|
@@ -1854,15 +1843,14 @@
|
|
|
1854
1843
|
/**
|
|
1855
1844
|
* Authority types supported by MSAL.
|
|
1856
1845
|
*/
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1862
|
-
|
|
1863
|
-
})(AuthorityType || (AuthorityType = {}));
|
|
1846
|
+
const AuthorityType = {
|
|
1847
|
+
Default: 0,
|
|
1848
|
+
Adfs: 1,
|
|
1849
|
+
Dsts: 2,
|
|
1850
|
+
Ciam: 3
|
|
1851
|
+
};
|
|
1864
1852
|
|
|
1865
|
-
/*! @azure/msal-common v14.0.0-
|
|
1853
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
1866
1854
|
|
|
1867
1855
|
/*
|
|
1868
1856
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2113,7 +2101,7 @@
|
|
|
2113
2101
|
}
|
|
2114
2102
|
}
|
|
2115
2103
|
|
|
2116
|
-
/*! @azure/msal-common v14.0.0-
|
|
2104
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
2117
2105
|
|
|
2118
2106
|
/*
|
|
2119
2107
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2164,7 +2152,7 @@
|
|
|
2164
2152
|
}
|
|
2165
2153
|
}
|
|
2166
2154
|
|
|
2167
|
-
/*! @azure/msal-common v14.0.0-
|
|
2155
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
2168
2156
|
|
|
2169
2157
|
/*
|
|
2170
2158
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2446,7 +2434,7 @@
|
|
|
2446
2434
|
return false;
|
|
2447
2435
|
}
|
|
2448
2436
|
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
|
|
2449
|
-
if (filter.tokenType ===
|
|
2437
|
+
if (filter.tokenType === AuthenticationScheme.SSH) {
|
|
2450
2438
|
if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
|
|
2451
2439
|
return false;
|
|
2452
2440
|
}
|
|
@@ -2574,7 +2562,7 @@
|
|
|
2574
2562
|
// Remove Token Binding Key from key store for PoP Tokens Credentials
|
|
2575
2563
|
if (credential.credentialType.toLowerCase() ===
|
|
2576
2564
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
|
|
2577
|
-
if (credential.tokenType ===
|
|
2565
|
+
if (credential.tokenType === AuthenticationScheme.POP) {
|
|
2578
2566
|
const accessTokenWithAuthSchemeEntity = credential;
|
|
2579
2567
|
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
2580
2568
|
if (kid) {
|
|
@@ -2726,14 +2714,14 @@
|
|
|
2726
2714
|
getAccessToken(account, request, tokenKeys) {
|
|
2727
2715
|
this.commonLogger.trace("CacheManager - getAccessToken called");
|
|
2728
2716
|
const scopes = ScopeSet.createSearchScopes(request.scopes);
|
|
2729
|
-
const authScheme = request.authenticationScheme ||
|
|
2717
|
+
const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
|
|
2730
2718
|
/*
|
|
2731
2719
|
* Distinguish between Bearer and PoP/SSH token cache types
|
|
2732
2720
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
2733
2721
|
*/
|
|
2734
2722
|
const credentialType = authScheme &&
|
|
2735
2723
|
authScheme.toLowerCase() !==
|
|
2736
|
-
|
|
2724
|
+
AuthenticationScheme.BEARER.toLowerCase()
|
|
2737
2725
|
? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
|
|
2738
2726
|
: CredentialType.ACCESS_TOKEN;
|
|
2739
2727
|
const accessTokenFilter = {
|
|
@@ -3178,7 +3166,7 @@
|
|
|
3178
3166
|
}
|
|
3179
3167
|
}
|
|
3180
3168
|
|
|
3181
|
-
/*! @azure/msal-common v14.0.0-
|
|
3169
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3182
3170
|
|
|
3183
3171
|
/*
|
|
3184
3172
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3198,6 +3186,9 @@
|
|
|
3198
3186
|
logLevel: exports.LogLevel.Info,
|
|
3199
3187
|
correlationId: Constants.EMPTY_STRING,
|
|
3200
3188
|
};
|
|
3189
|
+
const DEFAULT_CACHE_OPTIONS = {
|
|
3190
|
+
claimsBasedCachingEnabled: false,
|
|
3191
|
+
};
|
|
3201
3192
|
const DEFAULT_NETWORK_IMPLEMENTATION = {
|
|
3202
3193
|
async sendGetRequestAsync() {
|
|
3203
3194
|
const notImplErr = "Network interface - sendGetRequestAsync() has not been implemented";
|
|
@@ -3219,7 +3210,7 @@
|
|
|
3219
3210
|
clientAssertion: undefined,
|
|
3220
3211
|
};
|
|
3221
3212
|
const DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
3222
|
-
azureCloudInstance:
|
|
3213
|
+
azureCloudInstance: AzureCloudInstance.None,
|
|
3223
3214
|
tenant: `${Constants.DEFAULT_COMMON_TENANT}`,
|
|
3224
3215
|
};
|
|
3225
3216
|
const DEFAULT_TELEMETRY_OPTIONS = {
|
|
@@ -3235,7 +3226,7 @@
|
|
|
3235
3226
|
*
|
|
3236
3227
|
* @returns Configuration
|
|
3237
3228
|
*/
|
|
3238
|
-
function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
|
|
3229
|
+
function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, cacheOptions: userCacheOptions, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
|
|
3239
3230
|
const loggerOptions = {
|
|
3240
3231
|
...DEFAULT_LOGGER_IMPLEMENTATION,
|
|
3241
3232
|
...userLoggerOption,
|
|
@@ -3244,6 +3235,7 @@
|
|
|
3244
3235
|
authOptions: buildAuthOptions(userAuthOptions),
|
|
3245
3236
|
systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },
|
|
3246
3237
|
loggerOptions: loggerOptions,
|
|
3238
|
+
cacheOptions: { ...DEFAULT_CACHE_OPTIONS, ...userCacheOptions },
|
|
3247
3239
|
storageInterface: storageImplementation ||
|
|
3248
3240
|
new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions)),
|
|
3249
3241
|
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
|
|
@@ -3269,7 +3261,7 @@
|
|
|
3269
3261
|
};
|
|
3270
3262
|
}
|
|
3271
3263
|
|
|
3272
|
-
/*! @azure/msal-common v14.0.0-
|
|
3264
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3273
3265
|
|
|
3274
3266
|
/*
|
|
3275
3267
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3286,7 +3278,7 @@
|
|
|
3286
3278
|
}
|
|
3287
3279
|
}
|
|
3288
3280
|
|
|
3289
|
-
/*! @azure/msal-common v14.0.0-
|
|
3281
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3290
3282
|
|
|
3291
3283
|
/*
|
|
3292
3284
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3383,7 +3375,7 @@
|
|
|
3383
3375
|
}
|
|
3384
3376
|
}
|
|
3385
3377
|
|
|
3386
|
-
/*! @azure/msal-common v14.0.0-
|
|
3378
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3387
3379
|
|
|
3388
3380
|
/*
|
|
3389
3381
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3419,18 +3411,17 @@
|
|
|
3419
3411
|
}
|
|
3420
3412
|
}
|
|
3421
3413
|
|
|
3422
|
-
/*! @azure/msal-common v14.0.0-
|
|
3414
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3423
3415
|
/*
|
|
3424
3416
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3425
3417
|
* Licensed under the MIT License.
|
|
3426
3418
|
*/
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3419
|
+
const CcsCredentialType = {
|
|
3420
|
+
HOME_ACCOUNT_ID: "home_account_id",
|
|
3421
|
+
UPN: "UPN",
|
|
3422
|
+
};
|
|
3432
3423
|
|
|
3433
|
-
/*! @azure/msal-common v14.0.0-
|
|
3424
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3434
3425
|
|
|
3435
3426
|
/*
|
|
3436
3427
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3511,12 +3502,11 @@
|
|
|
3511
3502
|
}
|
|
3512
3503
|
});
|
|
3513
3504
|
// remove empty string parameters
|
|
3514
|
-
return Object.fromEntries(Object.entries(eQParams).filter(
|
|
3515
|
-
);
|
|
3505
|
+
return Object.fromEntries(Object.entries(eQParams).filter(kv => kv[1] !== ""));
|
|
3516
3506
|
}
|
|
3517
3507
|
}
|
|
3518
3508
|
|
|
3519
|
-
/*! @azure/msal-common v14.0.0-
|
|
3509
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3520
3510
|
|
|
3521
3511
|
/*
|
|
3522
3512
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3848,7 +3838,7 @@
|
|
|
3848
3838
|
*/
|
|
3849
3839
|
addPopToken(cnfString) {
|
|
3850
3840
|
if (!StringUtils.isEmpty(cnfString)) {
|
|
3851
|
-
this.parameters.set(AADServerParamKeys.TOKEN_TYPE,
|
|
3841
|
+
this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.POP);
|
|
3852
3842
|
this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));
|
|
3853
3843
|
}
|
|
3854
3844
|
}
|
|
@@ -3857,7 +3847,7 @@
|
|
|
3857
3847
|
*/
|
|
3858
3848
|
addSshJwk(sshJwkString) {
|
|
3859
3849
|
if (!StringUtils.isEmpty(sshJwkString)) {
|
|
3860
|
-
this.parameters.set(AADServerParamKeys.TOKEN_TYPE,
|
|
3850
|
+
this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.SSH);
|
|
3861
3851
|
this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));
|
|
3862
3852
|
}
|
|
3863
3853
|
}
|
|
@@ -3893,7 +3883,7 @@
|
|
|
3893
3883
|
}
|
|
3894
3884
|
}
|
|
3895
3885
|
|
|
3896
|
-
/*! @azure/msal-common v14.0.0-
|
|
3886
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3897
3887
|
|
|
3898
3888
|
/*
|
|
3899
3889
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3988,7 +3978,7 @@
|
|
|
3988
3978
|
}
|
|
3989
3979
|
}
|
|
3990
3980
|
|
|
3991
|
-
/*! @azure/msal-common v14.0.0-
|
|
3981
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
3992
3982
|
|
|
3993
3983
|
/*
|
|
3994
3984
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4121,13 +4111,13 @@
|
|
|
4121
4111
|
*/
|
|
4122
4112
|
return tokenType &&
|
|
4123
4113
|
tokenType.toLowerCase() !==
|
|
4124
|
-
|
|
4114
|
+
AuthenticationScheme.BEARER.toLowerCase()
|
|
4125
4115
|
? tokenType.toLowerCase()
|
|
4126
4116
|
: Constants.EMPTY_STRING;
|
|
4127
4117
|
}
|
|
4128
4118
|
}
|
|
4129
4119
|
|
|
4130
|
-
/*! @azure/msal-common v14.0.0-
|
|
4120
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4131
4121
|
|
|
4132
4122
|
/*
|
|
4133
4123
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4186,7 +4176,7 @@
|
|
|
4186
4176
|
}
|
|
4187
4177
|
}
|
|
4188
4178
|
|
|
4189
|
-
/*! @azure/msal-common v14.0.0-
|
|
4179
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4190
4180
|
/*
|
|
4191
4181
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4192
4182
|
* Licensed under the MIT License.
|
|
@@ -4233,7 +4223,7 @@
|
|
|
4233
4223
|
}
|
|
4234
4224
|
}
|
|
4235
4225
|
|
|
4236
|
-
/*! @azure/msal-common v14.0.0-
|
|
4226
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4237
4227
|
|
|
4238
4228
|
/*
|
|
4239
4229
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4297,7 +4287,7 @@
|
|
|
4297
4287
|
atEntity.target = scopes;
|
|
4298
4288
|
atEntity.userAssertionHash = userAssertionHash;
|
|
4299
4289
|
atEntity.tokenType = StringUtils.isEmpty(tokenType)
|
|
4300
|
-
?
|
|
4290
|
+
? AuthenticationScheme.BEARER
|
|
4301
4291
|
: tokenType;
|
|
4302
4292
|
if (requestedClaims) {
|
|
4303
4293
|
atEntity.requestedClaims = requestedClaims;
|
|
@@ -4308,11 +4298,11 @@
|
|
|
4308
4298
|
* Cast to lower to handle "bearer" from ADFS
|
|
4309
4299
|
*/
|
|
4310
4300
|
if (atEntity.tokenType?.toLowerCase() !==
|
|
4311
|
-
|
|
4301
|
+
AuthenticationScheme.BEARER.toLowerCase()) {
|
|
4312
4302
|
atEntity.credentialType =
|
|
4313
4303
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
4314
4304
|
switch (atEntity.tokenType) {
|
|
4315
|
-
case
|
|
4305
|
+
case AuthenticationScheme.POP:
|
|
4316
4306
|
// Make sure keyId is present and add it to credential
|
|
4317
4307
|
const tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
|
|
4318
4308
|
if (!tokenClaims?.cnf?.kid) {
|
|
@@ -4320,7 +4310,7 @@
|
|
|
4320
4310
|
}
|
|
4321
4311
|
atEntity.keyId = tokenClaims.cnf.kid;
|
|
4322
4312
|
break;
|
|
4323
|
-
case
|
|
4313
|
+
case AuthenticationScheme.SSH:
|
|
4324
4314
|
atEntity.keyId = keyId;
|
|
4325
4315
|
}
|
|
4326
4316
|
}
|
|
@@ -4347,7 +4337,7 @@
|
|
|
4347
4337
|
}
|
|
4348
4338
|
}
|
|
4349
4339
|
|
|
4350
|
-
/*! @azure/msal-common v14.0.0-
|
|
4340
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4351
4341
|
|
|
4352
4342
|
/*
|
|
4353
4343
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4409,7 +4399,7 @@
|
|
|
4409
4399
|
}
|
|
4410
4400
|
}
|
|
4411
4401
|
|
|
4412
|
-
/*! @azure/msal-common v14.0.0-
|
|
4402
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4413
4403
|
|
|
4414
4404
|
/*
|
|
4415
4405
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4490,12 +4480,12 @@
|
|
|
4490
4480
|
}
|
|
4491
4481
|
}
|
|
4492
4482
|
|
|
4493
|
-
/*! @azure/msal-common v14.0.0-
|
|
4483
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4494
4484
|
/*
|
|
4495
4485
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4496
4486
|
* Licensed under the MIT License.
|
|
4497
4487
|
*/
|
|
4498
|
-
class CacheRecord {
|
|
4488
|
+
let CacheRecord$1 = class CacheRecord {
|
|
4499
4489
|
constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
|
|
4500
4490
|
this.account = accountEntity || null;
|
|
4501
4491
|
this.idToken = idTokenEntity || null;
|
|
@@ -4503,9 +4493,9 @@
|
|
|
4503
4493
|
this.refreshToken = refreshTokenEntity || null;
|
|
4504
4494
|
this.appMetadata = appMetadataEntity || null;
|
|
4505
4495
|
}
|
|
4506
|
-
}
|
|
4496
|
+
};
|
|
4507
4497
|
|
|
4508
|
-
/*! @azure/msal-common v14.0.0-
|
|
4498
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4509
4499
|
|
|
4510
4500
|
/*
|
|
4511
4501
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4579,7 +4569,7 @@
|
|
|
4579
4569
|
}
|
|
4580
4570
|
}
|
|
4581
4571
|
|
|
4582
|
-
/*! @azure/msal-common v14.0.0-
|
|
4572
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4583
4573
|
|
|
4584
4574
|
/*
|
|
4585
4575
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4824,7 +4814,7 @@
|
|
|
4824
4814
|
}
|
|
4825
4815
|
}
|
|
4826
4816
|
|
|
4827
|
-
/*! @azure/msal-common v14.0.0-
|
|
4817
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
4828
4818
|
/*
|
|
4829
4819
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4830
4820
|
* Licensed under the MIT License.
|
|
@@ -4835,212 +4825,210 @@
|
|
|
4835
4825
|
* @export
|
|
4836
4826
|
* @enum {number}
|
|
4837
4827
|
*/
|
|
4838
|
-
|
|
4839
|
-
(function (PerformanceEvents) {
|
|
4828
|
+
const PerformanceEvents = {
|
|
4840
4829
|
/**
|
|
4841
4830
|
* acquireTokenByCode API (msal-browser and msal-node).
|
|
4842
4831
|
* Used to acquire tokens by trading an authorization code against the token endpoint.
|
|
4843
4832
|
*/
|
|
4844
|
-
|
|
4833
|
+
AcquireTokenByCode: "acquireTokenByCode",
|
|
4845
4834
|
/**
|
|
4846
4835
|
* acquireTokenByRefreshToken API (msal-browser and msal-node).
|
|
4847
4836
|
* Used to renew an access token using a refresh token against the token endpoint.
|
|
4848
4837
|
*/
|
|
4849
|
-
|
|
4838
|
+
AcquireTokenByRefreshToken: "acquireTokenByRefreshToken",
|
|
4850
4839
|
/**
|
|
4851
4840
|
* acquireTokenSilent API (msal-browser and msal-node).
|
|
4852
4841
|
* Used to silently acquire a new access token (from the cache or the network).
|
|
4853
4842
|
*/
|
|
4854
|
-
|
|
4843
|
+
AcquireTokenSilent: "acquireTokenSilent",
|
|
4855
4844
|
/**
|
|
4856
4845
|
* acquireTokenSilentAsync (msal-browser).
|
|
4857
4846
|
* Internal API for acquireTokenSilent.
|
|
4858
4847
|
*/
|
|
4859
|
-
|
|
4848
|
+
AcquireTokenSilentAsync: "acquireTokenSilentAsync",
|
|
4860
4849
|
/**
|
|
4861
4850
|
* acquireTokenPopup (msal-browser).
|
|
4862
4851
|
* Used to acquire a new access token interactively through pop ups
|
|
4863
4852
|
*/
|
|
4864
|
-
|
|
4853
|
+
AcquireTokenPopup: "acquireTokenPopup",
|
|
4865
4854
|
/**
|
|
4866
4855
|
* getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
|
|
4867
4856
|
* Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
|
|
4868
4857
|
*/
|
|
4869
|
-
|
|
4858
|
+
CryptoOptsGetPublicKeyThumbprint: "cryptoOptsGetPublicKeyThumbprint",
|
|
4870
4859
|
/**
|
|
4871
4860
|
* signJwt API in CryptoOpts class (msal-browser).
|
|
4872
4861
|
* Used to signed a pop token.
|
|
4873
4862
|
*/
|
|
4874
|
-
|
|
4863
|
+
CryptoOptsSignJwt: "cryptoOptsSignJwt",
|
|
4875
4864
|
/**
|
|
4876
4865
|
* acquireToken API in the SilentCacheClient class (msal-browser).
|
|
4877
4866
|
* Used to read access tokens from the cache.
|
|
4878
4867
|
*/
|
|
4879
|
-
|
|
4868
|
+
SilentCacheClientAcquireToken: "silentCacheClientAcquireToken",
|
|
4880
4869
|
/**
|
|
4881
4870
|
* acquireToken API in the SilentIframeClient class (msal-browser).
|
|
4882
4871
|
* Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
|
|
4883
4872
|
*/
|
|
4884
|
-
|
|
4873
|
+
SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
|
|
4885
4874
|
/**
|
|
4886
4875
|
* acquireToken API in SilentRereshClient (msal-browser).
|
|
4887
4876
|
* Used to acquire a new set of tokens from the token endpoint using a refresh token.
|
|
4888
4877
|
*/
|
|
4889
|
-
|
|
4878
|
+
SilentRefreshClientAcquireToken: "silentRefreshClientAcquireToken",
|
|
4890
4879
|
/**
|
|
4891
4880
|
* ssoSilent API (msal-browser).
|
|
4892
4881
|
* Used to silently acquire an authorization code and set of tokens using a hidden iframe.
|
|
4893
4882
|
*/
|
|
4894
|
-
|
|
4883
|
+
SsoSilent: "ssoSilent",
|
|
4895
4884
|
/**
|
|
4896
4885
|
* getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
|
|
4897
4886
|
* Used to load authority metadata for a request.
|
|
4898
4887
|
*/
|
|
4899
|
-
|
|
4888
|
+
StandardInteractionClientGetDiscoveredAuthority: "standardInteractionClientGetDiscoveredAuthority",
|
|
4900
4889
|
/**
|
|
4901
4890
|
* acquireToken APIs in msal-browser.
|
|
4902
4891
|
* Used to make an /authorize endpoint call with native brokering enabled.
|
|
4903
4892
|
*/
|
|
4904
|
-
|
|
4893
|
+
FetchAccountIdWithNativeBroker: "fetchAccountIdWithNativeBroker",
|
|
4905
4894
|
/**
|
|
4906
4895
|
* acquireToken API in NativeInteractionClient class (msal-browser).
|
|
4907
4896
|
* Used to acquire a token from Native component when native brokering is enabled.
|
|
4908
4897
|
*/
|
|
4909
|
-
|
|
4898
|
+
NativeInteractionClientAcquireToken: "nativeInteractionClientAcquireToken",
|
|
4910
4899
|
/**
|
|
4911
4900
|
* Time spent creating default headers for requests to token endpoint
|
|
4912
4901
|
*/
|
|
4913
|
-
|
|
4902
|
+
BaseClientCreateTokenRequestHeaders: "baseClientCreateTokenRequestHeaders",
|
|
4914
4903
|
/**
|
|
4915
4904
|
* Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
|
|
4916
4905
|
*/
|
|
4917
|
-
|
|
4906
|
+
BrokerHandhshake: "brokerHandshake",
|
|
4918
4907
|
/**
|
|
4919
4908
|
* acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
|
|
4920
4909
|
*/
|
|
4921
|
-
|
|
4910
|
+
AcquireTokenByRefreshTokenInBroker: "acquireTokenByRefreshTokenInBroker",
|
|
4922
4911
|
/**
|
|
4923
4912
|
* Time taken for token acquisition by broker
|
|
4924
4913
|
*/
|
|
4925
|
-
|
|
4914
|
+
AcquireTokenByBroker: "acquireTokenByBroker",
|
|
4926
4915
|
/**
|
|
4927
4916
|
* Time spent on the network for refresh token acquisition
|
|
4928
4917
|
*/
|
|
4929
|
-
|
|
4918
|
+
RefreshTokenClientExecuteTokenRequest: "refreshTokenClientExecuteTokenRequest",
|
|
4930
4919
|
/**
|
|
4931
4920
|
* Time taken for acquiring refresh token , records RT size
|
|
4932
4921
|
*/
|
|
4933
|
-
|
|
4922
|
+
RefreshTokenClientAcquireToken: "refreshTokenClientAcquireToken",
|
|
4934
4923
|
/**
|
|
4935
4924
|
* Time taken for acquiring cached refresh token
|
|
4936
4925
|
*/
|
|
4937
|
-
|
|
4926
|
+
RefreshTokenClientAcquireTokenWithCachedRefreshToken: "refreshTokenClientAcquireTokenWithCachedRefreshToken",
|
|
4938
4927
|
/**
|
|
4939
4928
|
* acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).
|
|
4940
4929
|
*/
|
|
4941
|
-
|
|
4930
|
+
RefreshTokenClientAcquireTokenByRefreshToken: "refreshTokenClientAcquireTokenByRefreshToken",
|
|
4942
4931
|
/**
|
|
4943
4932
|
* Helper function to create token request body in RefreshTokenClient (msal-common).
|
|
4944
4933
|
*/
|
|
4945
|
-
|
|
4934
|
+
RefreshTokenClientCreateTokenRequestBody: "refreshTokenClientCreateTokenRequestBody",
|
|
4946
4935
|
/**
|
|
4947
4936
|
* acquireTokenFromCache (msal-browser).
|
|
4948
4937
|
* Internal API for acquiring token from cache
|
|
4949
4938
|
*/
|
|
4950
|
-
|
|
4939
|
+
AcquireTokenFromCache: "acquireTokenFromCache",
|
|
4951
4940
|
/**
|
|
4952
4941
|
* acquireTokenBySilentIframe (msal-browser).
|
|
4953
4942
|
* Internal API for acquiring token by silent Iframe
|
|
4954
4943
|
*/
|
|
4955
|
-
|
|
4944
|
+
AcquireTokenBySilentIframe: "acquireTokenBySilentIframe",
|
|
4956
4945
|
/**
|
|
4957
4946
|
* Internal API for initializing base request in BaseInteractionClient (msal-browser)
|
|
4958
4947
|
*/
|
|
4959
|
-
|
|
4948
|
+
InitializeBaseRequest: "initializeBaseRequest",
|
|
4960
4949
|
/**
|
|
4961
4950
|
* Internal API for initializing silent request in SilentCacheClient (msal-browser)
|
|
4962
4951
|
*/
|
|
4963
|
-
|
|
4964
|
-
|
|
4952
|
+
InitializeSilentRequest: "initializeSilentRequest",
|
|
4953
|
+
InitializeClientApplication: "initializeClientApplication",
|
|
4965
4954
|
/**
|
|
4966
4955
|
* Helper function in SilentIframeClient class (msal-browser).
|
|
4967
4956
|
*/
|
|
4968
|
-
|
|
4957
|
+
SilentIframeClientTokenHelper: "silentIframeClientTokenHelper",
|
|
4969
4958
|
/**
|
|
4970
4959
|
* SilentHandler
|
|
4971
4960
|
*/
|
|
4972
|
-
|
|
4973
|
-
|
|
4974
|
-
|
|
4961
|
+
SilentHandlerInitiateAuthRequest: "silentHandlerInitiateAuthRequest",
|
|
4962
|
+
SilentHandlerMonitorIframeForHash: "silentHandlerMonitorIframeForHash",
|
|
4963
|
+
SilentHandlerLoadFrame: "silentHandlerLoadFrame",
|
|
4975
4964
|
/**
|
|
4976
4965
|
* Helper functions in StandardInteractionClient class (msal-browser)
|
|
4977
4966
|
*/
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
|
|
4967
|
+
StandardInteractionClientCreateAuthCodeClient: "standardInteractionClientCreateAuthCodeClient",
|
|
4968
|
+
StandardInteractionClientGetClientConfiguration: "standardInteractionClientGetClientConfiguration",
|
|
4969
|
+
StandardInteractionClientInitializeAuthorizationRequest: "standardInteractionClientInitializeAuthorizationRequest",
|
|
4970
|
+
StandardInteractionClientInitializeAuthorizationCodeRequest: "standardInteractionClientInitializeAuthorizationCodeRequest",
|
|
4982
4971
|
/**
|
|
4983
4972
|
* getAuthCodeUrl API (msal-browser and msal-node).
|
|
4984
4973
|
*/
|
|
4985
|
-
|
|
4974
|
+
GetAuthCodeUrl: "getAuthCodeUrl",
|
|
4986
4975
|
/**
|
|
4987
4976
|
* Functions from InteractionHandler (msal-browser)
|
|
4988
4977
|
*/
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4978
|
+
HandleCodeResponseFromServer: "handleCodeResponseFromServer",
|
|
4979
|
+
HandleCodeResponseFromHash: "handleCodeResponseFromHash",
|
|
4980
|
+
UpdateTokenEndpointAuthority: "updateTokenEndpointAuthority",
|
|
4992
4981
|
/**
|
|
4993
4982
|
* APIs in Authorization Code Client (msal-common)
|
|
4994
4983
|
*/
|
|
4995
|
-
|
|
4996
|
-
|
|
4997
|
-
|
|
4998
|
-
|
|
4984
|
+
AuthClientAcquireToken: "authClientAcquireToken",
|
|
4985
|
+
AuthClientExecuteTokenRequest: "authClientExecuteTokenRequest",
|
|
4986
|
+
AuthClientCreateTokenRequestBody: "authClientCreateTokenRequestBody",
|
|
4987
|
+
AuthClientCreateQueryString: "authClientCreateQueryString",
|
|
4999
4988
|
/**
|
|
5000
4989
|
* Generate functions in PopTokenGenerator (msal-common)
|
|
5001
4990
|
*/
|
|
5002
|
-
|
|
5003
|
-
|
|
4991
|
+
PopTokenGenerateCnf: "popTokenGenerateCnf",
|
|
4992
|
+
PopTokenGenerateKid: "popTokenGenerateKid",
|
|
5004
4993
|
/**
|
|
5005
4994
|
* handleServerTokenResponse API in ResponseHandler (msal-common)
|
|
5006
4995
|
*/
|
|
5007
|
-
|
|
4996
|
+
HandleServerTokenResponse: "handleServerTokenResponse",
|
|
5008
4997
|
/**
|
|
5009
4998
|
* Authority functions
|
|
5010
4999
|
*/
|
|
5011
|
-
|
|
5012
|
-
|
|
5013
|
-
|
|
5014
|
-
|
|
5015
|
-
|
|
5016
|
-
|
|
5017
|
-
|
|
5000
|
+
AuthorityFactoryCreateDiscoveredInstance: "authorityFactoryCreateDiscoveredInstance",
|
|
5001
|
+
AuthorityResolveEndpointsAsync: "authorityResolveEndpointsAsync",
|
|
5002
|
+
AuthorityGetCloudDiscoveryMetadataFromNetwork: "authorityGetCloudDiscoveryMetadataFromNetwork",
|
|
5003
|
+
AuthorityUpdateCloudDiscoveryMetadata: "authorityUpdateCloudDiscoveryMetadata",
|
|
5004
|
+
AuthorityGetEndpointMetadataFromNetwork: "authorityGetEndpointMetadataFromNetwork",
|
|
5005
|
+
AuthorityUpdateEndpointMetadata: "authorityUpdateEndpointMetadata",
|
|
5006
|
+
AuthorityUpdateMetadataWithRegionalInformation: "authorityUpdateMetadataWithRegionalInformation",
|
|
5018
5007
|
/**
|
|
5019
5008
|
* Region Discovery functions
|
|
5020
5009
|
*/
|
|
5021
|
-
|
|
5022
|
-
|
|
5023
|
-
|
|
5024
|
-
|
|
5025
|
-
|
|
5026
|
-
|
|
5027
|
-
|
|
5028
|
-
|
|
5029
|
-
|
|
5030
|
-
|
|
5031
|
-
}
|
|
5010
|
+
RegionDiscoveryDetectRegion: "regionDiscoveryDetectRegion",
|
|
5011
|
+
RegionDiscoveryGetRegionFromIMDS: "regionDiscoveryGetRegionFromIMDS",
|
|
5012
|
+
RegionDiscoveryGetCurrentVersion: "regionDiscoveryGetCurrentVersion",
|
|
5013
|
+
AcquireTokenByCodeAsync: "acquireTokenByCodeAsync",
|
|
5014
|
+
GetEndpointMetadataFromNetwork: "getEndpointMetadataFromNetwork",
|
|
5015
|
+
GetCloudDiscoveryMetadataFromNetworkMeasurement: "getCloudDiscoveryMetadataFromNetworkMeasurement",
|
|
5016
|
+
HandleRedirectPromiseMeasurement: "handleRedirectPromiseMeasurement",
|
|
5017
|
+
UpdateCloudDiscoveryMetadataMeasurement: "updateCloudDiscoveryMetadataMeasurement",
|
|
5018
|
+
UsernamePasswordClientAcquireToken: "usernamePasswordClientAcquireToken",
|
|
5019
|
+
NativeMessageHandlerHandshake: "nativeMessageHandlerHandshake",
|
|
5020
|
+
};
|
|
5032
5021
|
/**
|
|
5033
5022
|
* State of the performance event.
|
|
5034
5023
|
*
|
|
5035
5024
|
* @export
|
|
5036
5025
|
* @enum {number}
|
|
5037
5026
|
*/
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
|
|
5041
|
-
|
|
5042
|
-
|
|
5043
|
-
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
5027
|
+
const PerformanceEventStatus = {
|
|
5028
|
+
NotStarted: 0,
|
|
5029
|
+
InProgress: 1,
|
|
5030
|
+
Completed: 2,
|
|
5031
|
+
};
|
|
5044
5032
|
const IntFields = new Set([
|
|
5045
5033
|
"accessTokenSize",
|
|
5046
5034
|
"durationMs",
|
|
@@ -5053,17 +5041,16 @@
|
|
|
5053
5041
|
"status",
|
|
5054
5042
|
]);
|
|
5055
5043
|
|
|
5056
|
-
/*! @azure/msal-common v14.0.0-
|
|
5044
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
5057
5045
|
|
|
5058
5046
|
/*
|
|
5059
5047
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5060
5048
|
* Licensed under the MIT License.
|
|
5061
5049
|
*/
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
})(KeyLocation || (KeyLocation = {}));
|
|
5050
|
+
const KeyLocation = {
|
|
5051
|
+
SW: "sw",
|
|
5052
|
+
UHW: "uhw",
|
|
5053
|
+
};
|
|
5067
5054
|
class PopTokenGenerator {
|
|
5068
5055
|
constructor(cryptoUtils, performanceClient) {
|
|
5069
5056
|
this.cryptoUtils = cryptoUtils;
|
|
@@ -5076,8 +5063,8 @@
|
|
|
5076
5063
|
* @returns
|
|
5077
5064
|
*/
|
|
5078
5065
|
async generateCnf(request) {
|
|
5079
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5080
|
-
this.performanceClient?.setPreQueueTime(
|
|
5066
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5067
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5081
5068
|
const reqCnf = await this.generateKid(request);
|
|
5082
5069
|
const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
5083
5070
|
return {
|
|
@@ -5092,7 +5079,7 @@
|
|
|
5092
5079
|
* @returns
|
|
5093
5080
|
*/
|
|
5094
5081
|
async generateKid(request) {
|
|
5095
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5082
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateKid, request.correlationId);
|
|
5096
5083
|
const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
|
|
5097
5084
|
return {
|
|
5098
5085
|
kid: kidThumbprint,
|
|
@@ -5139,7 +5126,7 @@
|
|
|
5139
5126
|
}
|
|
5140
5127
|
}
|
|
5141
5128
|
|
|
5142
|
-
/*! @azure/msal-common v14.0.0-
|
|
5129
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
5143
5130
|
|
|
5144
5131
|
/*
|
|
5145
5132
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5208,7 +5195,7 @@
|
|
|
5208
5195
|
}
|
|
5209
5196
|
}
|
|
5210
5197
|
|
|
5211
|
-
/*! @azure/msal-common v14.0.0-
|
|
5198
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
5212
5199
|
/*
|
|
5213
5200
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5214
5201
|
* Licensed under the MIT License.
|
|
@@ -5235,7 +5222,7 @@
|
|
|
5235
5222
|
}
|
|
5236
5223
|
}
|
|
5237
5224
|
|
|
5238
|
-
/*! @azure/msal-common v14.0.0-
|
|
5225
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
5239
5226
|
|
|
5240
5227
|
/*
|
|
5241
5228
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5305,7 +5292,7 @@
|
|
|
5305
5292
|
* @param authority
|
|
5306
5293
|
*/
|
|
5307
5294
|
async handleServerTokenResponse(serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
|
|
5308
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5295
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.HandleServerTokenResponse, serverTokenResponse.correlation_id);
|
|
5309
5296
|
// create an idToken object (not entity)
|
|
5310
5297
|
let idTokenObj;
|
|
5311
5298
|
if (serverTokenResponse.id_token) {
|
|
@@ -5431,7 +5418,7 @@
|
|
|
5431
5418
|
if (!StringUtils.isEmpty(serverTokenResponse.foci)) {
|
|
5432
5419
|
cachedAppMetadata = AppMetadataEntity.createAppMetadataEntity(this.clientId, env, serverTokenResponse.foci);
|
|
5433
5420
|
}
|
|
5434
|
-
return new CacheRecord(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
|
|
5421
|
+
return new CacheRecord$1(cachedAccount, cachedIdToken, cachedAccessToken, cachedRefreshToken, cachedAppMetadata);
|
|
5435
5422
|
}
|
|
5436
5423
|
/**
|
|
5437
5424
|
* Generate Account
|
|
@@ -5478,7 +5465,7 @@
|
|
|
5478
5465
|
let extExpiresOn;
|
|
5479
5466
|
let familyId = Constants.EMPTY_STRING;
|
|
5480
5467
|
if (cacheRecord.accessToken) {
|
|
5481
|
-
if (cacheRecord.accessToken.tokenType ===
|
|
5468
|
+
if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {
|
|
5482
5469
|
const popTokenGenerator = new PopTokenGenerator(cryptoObj);
|
|
5483
5470
|
const { secret, keyId } = cacheRecord.accessToken;
|
|
5484
5471
|
if (!keyId) {
|
|
@@ -5538,7 +5525,7 @@
|
|
|
5538
5525
|
}
|
|
5539
5526
|
}
|
|
5540
5527
|
|
|
5541
|
-
/*! @azure/msal-common v14.0.0-
|
|
5528
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
5542
5529
|
|
|
5543
5530
|
/*
|
|
5544
5531
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5564,8 +5551,8 @@
|
|
|
5564
5551
|
* @param request
|
|
5565
5552
|
*/
|
|
5566
5553
|
async getAuthCodeUrl(request) {
|
|
5567
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5568
|
-
this.performanceClient?.setPreQueueTime(
|
|
5554
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.GetAuthCodeUrl, request.correlationId);
|
|
5555
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5569
5556
|
const queryString = await this.createAuthCodeUrlQueryString(request);
|
|
5570
5557
|
return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);
|
|
5571
5558
|
}
|
|
@@ -5578,13 +5565,13 @@
|
|
|
5578
5565
|
if (!request || !request.code) {
|
|
5579
5566
|
throw ClientAuthError.createTokenRequestCannotBeMadeError();
|
|
5580
5567
|
}
|
|
5581
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5568
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientAcquireToken, request.correlationId);
|
|
5582
5569
|
const atsMeasurement = this.performanceClient?.startMeasurement(
|
|
5583
5570
|
// @ts-ignore
|
|
5584
5571
|
"AuthCodeClientAcquireToken", request.correlationId);
|
|
5585
5572
|
this.logger.info("in acquireToken call in auth-code client");
|
|
5586
5573
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
5587
|
-
this.performanceClient?.setPreQueueTime(
|
|
5574
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5588
5575
|
const response = await this.executeTokenRequest(this.authority, request);
|
|
5589
5576
|
// Retrieve requestId from response headers
|
|
5590
5577
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
@@ -5597,7 +5584,7 @@
|
|
|
5597
5584
|
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin, this.performanceClient);
|
|
5598
5585
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
5599
5586
|
responseHandler.validateTokenResponse(response.body);
|
|
5600
|
-
this.performanceClient?.setPreQueueTime(
|
|
5587
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
5601
5588
|
return responseHandler
|
|
5602
5589
|
.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId)
|
|
5603
5590
|
.then((result) => {
|
|
@@ -5660,8 +5647,8 @@
|
|
|
5660
5647
|
* @param request
|
|
5661
5648
|
*/
|
|
5662
5649
|
async executeTokenRequest(authority, request) {
|
|
5663
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5664
|
-
this.performanceClient?.setPreQueueTime(
|
|
5650
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
|
|
5651
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5665
5652
|
const queryParametersString = this.createTokenQueryParameters(request);
|
|
5666
5653
|
const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
5667
5654
|
const requestBody = await this.createTokenRequestBody(request);
|
|
@@ -5697,7 +5684,7 @@
|
|
|
5697
5684
|
* @param request
|
|
5698
5685
|
*/
|
|
5699
5686
|
async createTokenRequestBody(request) {
|
|
5700
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5687
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
|
|
5701
5688
|
const parameterBuilder = new RequestParameterBuilder();
|
|
5702
5689
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5703
5690
|
/*
|
|
@@ -5737,14 +5724,14 @@
|
|
|
5737
5724
|
}
|
|
5738
5725
|
parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);
|
|
5739
5726
|
parameterBuilder.addClientInfo();
|
|
5740
|
-
if (request.authenticationScheme ===
|
|
5727
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
5741
5728
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
5742
|
-
this.performanceClient?.setPreQueueTime(
|
|
5729
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
5743
5730
|
const reqCnfData = await popTokenGenerator.generateCnf(request);
|
|
5744
5731
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5745
5732
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5746
5733
|
}
|
|
5747
|
-
else if (request.authenticationScheme ===
|
|
5734
|
+
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
5748
5735
|
if (request.sshJwk) {
|
|
5749
5736
|
parameterBuilder.addSshJwk(request.sshJwk);
|
|
5750
5737
|
}
|
|
@@ -5812,7 +5799,7 @@
|
|
|
5812
5799
|
* @param request
|
|
5813
5800
|
*/
|
|
5814
5801
|
async createAuthCodeUrlQueryString(request) {
|
|
5815
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5802
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
|
|
5816
5803
|
const parameterBuilder = new RequestParameterBuilder();
|
|
5817
5804
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
5818
5805
|
const requestScopes = [
|
|
@@ -5927,7 +5914,7 @@
|
|
|
5927
5914
|
// signal ests that this is a WAM call
|
|
5928
5915
|
parameterBuilder.addNativeBroker();
|
|
5929
5916
|
// pass the req_cnf for POP
|
|
5930
|
-
if (request.authenticationScheme ===
|
|
5917
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
5931
5918
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5932
5919
|
// to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
|
|
5933
5920
|
const reqCnfData = await popTokenGenerator.generateCnf(request);
|
|
@@ -5974,7 +5961,7 @@
|
|
|
5974
5961
|
}
|
|
5975
5962
|
}
|
|
5976
5963
|
|
|
5977
|
-
/*! @azure/msal-common v14.0.0-
|
|
5964
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
5978
5965
|
|
|
5979
5966
|
/*
|
|
5980
5967
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5988,11 +5975,11 @@
|
|
|
5988
5975
|
super(configuration, performanceClient);
|
|
5989
5976
|
}
|
|
5990
5977
|
async acquireToken(request) {
|
|
5991
|
-
this.performanceClient?.addQueueMeasurement(
|
|
5992
|
-
const atsMeasurement = this.performanceClient?.startMeasurement(
|
|
5978
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
5979
|
+
const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
5993
5980
|
this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
|
|
5994
5981
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
5995
|
-
this.performanceClient?.setPreQueueTime(
|
|
5982
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
5996
5983
|
const response = await this.executeTokenRequest(request, this.authority);
|
|
5997
5984
|
const httpVerToken = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];
|
|
5998
5985
|
atsMeasurement?.addStaticFields({
|
|
@@ -6007,7 +5994,7 @@
|
|
|
6007
5994
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
6008
5995
|
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
6009
5996
|
responseHandler.validateTokenResponse(response.body);
|
|
6010
|
-
this.performanceClient?.setPreQueueTime(
|
|
5997
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);
|
|
6011
5998
|
return responseHandler
|
|
6012
5999
|
.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId)
|
|
6013
6000
|
.then((result) => {
|
|
@@ -6035,7 +6022,7 @@
|
|
|
6035
6022
|
if (!request) {
|
|
6036
6023
|
throw ClientConfigurationError.createEmptyTokenRequestError();
|
|
6037
6024
|
}
|
|
6038
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6025
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
6039
6026
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
6040
6027
|
if (!request.account) {
|
|
6041
6028
|
throw ClientAuthError.createNoAccountInSilentRequestError();
|
|
@@ -6045,7 +6032,7 @@
|
|
|
6045
6032
|
// if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest
|
|
6046
6033
|
if (isFOCI) {
|
|
6047
6034
|
try {
|
|
6048
|
-
this.performanceClient?.setPreQueueTime(
|
|
6035
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6049
6036
|
return this.acquireTokenWithCachedRefreshToken(request, true);
|
|
6050
6037
|
}
|
|
6051
6038
|
catch (e) {
|
|
@@ -6058,7 +6045,7 @@
|
|
|
6058
6045
|
e.subError === Errors.CLIENT_MISMATCH_ERROR;
|
|
6059
6046
|
// if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)
|
|
6060
6047
|
if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {
|
|
6061
|
-
this.performanceClient?.setPreQueueTime(
|
|
6048
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6062
6049
|
return this.acquireTokenWithCachedRefreshToken(request, false);
|
|
6063
6050
|
// throw in all other cases
|
|
6064
6051
|
}
|
|
@@ -6068,7 +6055,7 @@
|
|
|
6068
6055
|
}
|
|
6069
6056
|
}
|
|
6070
6057
|
// fall back to application refresh token acquisition
|
|
6071
|
-
this.performanceClient?.setPreQueueTime(
|
|
6058
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6072
6059
|
return this.acquireTokenWithCachedRefreshToken(request, false);
|
|
6073
6060
|
}
|
|
6074
6061
|
/**
|
|
@@ -6076,9 +6063,9 @@
|
|
|
6076
6063
|
* @param request
|
|
6077
6064
|
*/
|
|
6078
6065
|
async acquireTokenWithCachedRefreshToken(request, foci) {
|
|
6079
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6066
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6080
6067
|
// fetches family RT or application RT based on FOCI value
|
|
6081
|
-
const atsMeasurement = this.performanceClient?.startMeasurement(
|
|
6068
|
+
const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6082
6069
|
this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
|
|
6083
6070
|
const refreshToken = this.cacheManager.getRefreshToken(request.account, foci);
|
|
6084
6071
|
if (!refreshToken) {
|
|
@@ -6092,13 +6079,13 @@
|
|
|
6092
6079
|
const refreshTokenRequest = {
|
|
6093
6080
|
...request,
|
|
6094
6081
|
refreshToken: refreshToken.secret,
|
|
6095
|
-
authenticationScheme: request.authenticationScheme ||
|
|
6082
|
+
authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER,
|
|
6096
6083
|
ccsCredential: {
|
|
6097
6084
|
credential: request.account.homeAccountId,
|
|
6098
6085
|
type: CcsCredentialType.HOME_ACCOUNT_ID,
|
|
6099
6086
|
},
|
|
6100
6087
|
};
|
|
6101
|
-
this.performanceClient?.setPreQueueTime(
|
|
6088
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
6102
6089
|
return this.acquireToken(refreshTokenRequest);
|
|
6103
6090
|
}
|
|
6104
6091
|
/**
|
|
@@ -6107,9 +6094,9 @@
|
|
|
6107
6094
|
* @param authority
|
|
6108
6095
|
*/
|
|
6109
6096
|
async executeTokenRequest(request, authority) {
|
|
6110
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6111
|
-
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(
|
|
6112
|
-
this.performanceClient?.setPreQueueTime(
|
|
6097
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6098
|
+
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
|
|
6099
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6113
6100
|
const queryParametersString = this.createTokenQueryParameters(request);
|
|
6114
6101
|
const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
|
|
6115
6102
|
const requestBody = await this.createTokenRequestBody(request);
|
|
@@ -6144,9 +6131,9 @@
|
|
|
6144
6131
|
* @param request
|
|
6145
6132
|
*/
|
|
6146
6133
|
async createTokenRequestBody(request) {
|
|
6147
|
-
this.performanceClient?.addQueueMeasurement(
|
|
6134
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
|
|
6148
6135
|
const correlationId = request.correlationId;
|
|
6149
|
-
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(
|
|
6136
|
+
const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
|
|
6150
6137
|
const parameterBuilder = new RequestParameterBuilder();
|
|
6151
6138
|
parameterBuilder.addClientId(this.config.authOptions.clientId);
|
|
6152
6139
|
parameterBuilder.addScopes(request.scopes);
|
|
@@ -6168,14 +6155,14 @@
|
|
|
6168
6155
|
parameterBuilder.addClientAssertion(clientAssertion.assertion);
|
|
6169
6156
|
parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
|
|
6170
6157
|
}
|
|
6171
|
-
if (request.authenticationScheme ===
|
|
6158
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
6172
6159
|
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
6173
|
-
this.performanceClient?.setPreQueueTime(
|
|
6160
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
|
|
6174
6161
|
const reqCnfData = await popTokenGenerator.generateCnf(request);
|
|
6175
6162
|
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
6176
6163
|
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
6177
6164
|
}
|
|
6178
|
-
else if (request.authenticationScheme ===
|
|
6165
|
+
else if (request.authenticationScheme === AuthenticationScheme.SSH) {
|
|
6179
6166
|
if (request.sshJwk) {
|
|
6180
6167
|
parameterBuilder.addSshJwk(request.sshJwk);
|
|
6181
6168
|
}
|
|
@@ -6216,7 +6203,7 @@
|
|
|
6216
6203
|
}
|
|
6217
6204
|
}
|
|
6218
6205
|
|
|
6219
|
-
/*! @azure/msal-common v14.0.0-
|
|
6206
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
6220
6207
|
|
|
6221
6208
|
/*
|
|
6222
6209
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6261,6 +6248,12 @@
|
|
|
6261
6248
|
this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
|
|
6262
6249
|
throw ClientAuthError.createRefreshRequiredError();
|
|
6263
6250
|
}
|
|
6251
|
+
else if (!this.config.cacheOptions.claimsBasedCachingEnabled &&
|
|
6252
|
+
!StringUtils.isEmptyObj(request.claims)) {
|
|
6253
|
+
// Must refresh due to request parameters.
|
|
6254
|
+
this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims-based caching is disabled and claims were requested.");
|
|
6255
|
+
throw ClientAuthError.createRefreshRequiredError();
|
|
6256
|
+
}
|
|
6264
6257
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
6265
6258
|
if (!request.account) {
|
|
6266
6259
|
throw ClientAuthError.createNoAccountInSilentRequestError();
|
|
@@ -6313,7 +6306,7 @@
|
|
|
6313
6306
|
}
|
|
6314
6307
|
}
|
|
6315
6308
|
|
|
6316
|
-
/*! @azure/msal-common v14.0.0-
|
|
6309
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
6317
6310
|
/*
|
|
6318
6311
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6319
6312
|
* Licensed under the MIT License.
|
|
@@ -6325,7 +6318,7 @@
|
|
|
6325
6318
|
response.hasOwnProperty("jwks_uri"));
|
|
6326
6319
|
}
|
|
6327
6320
|
|
|
6328
|
-
/*! @azure/msal-common v14.0.0-
|
|
6321
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
6329
6322
|
/*
|
|
6330
6323
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6331
6324
|
* Licensed under the MIT License.
|
|
@@ -7203,7 +7196,7 @@
|
|
|
7203
7196
|
const EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
7204
7197
|
const InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
7205
7198
|
|
|
7206
|
-
/*! @azure/msal-common v14.0.0-
|
|
7199
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
7207
7200
|
/*
|
|
7208
7201
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7209
7202
|
* Licensed under the MIT License.
|
|
@@ -7211,13 +7204,12 @@
|
|
|
7211
7204
|
/**
|
|
7212
7205
|
* Protocol modes supported by MSAL.
|
|
7213
7206
|
*/
|
|
7214
|
-
|
|
7215
|
-
|
|
7216
|
-
|
|
7217
|
-
|
|
7218
|
-
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
7207
|
+
const ProtocolMode = {
|
|
7208
|
+
AAD: "AAD",
|
|
7209
|
+
OIDC: "OIDC",
|
|
7210
|
+
};
|
|
7219
7211
|
|
|
7220
|
-
/*! @azure/msal-common v14.0.0-
|
|
7212
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
7221
7213
|
|
|
7222
7214
|
/*
|
|
7223
7215
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7297,7 +7289,7 @@
|
|
|
7297
7289
|
}
|
|
7298
7290
|
}
|
|
7299
7291
|
|
|
7300
|
-
/*! @azure/msal-common v14.0.0-
|
|
7292
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
7301
7293
|
/*
|
|
7302
7294
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7303
7295
|
* Licensed under the MIT License.
|
|
@@ -7307,7 +7299,7 @@
|
|
|
7307
7299
|
response.hasOwnProperty("metadata"));
|
|
7308
7300
|
}
|
|
7309
7301
|
|
|
7310
|
-
/*! @azure/msal-common v14.0.0-
|
|
7302
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
7311
7303
|
/*
|
|
7312
7304
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7313
7305
|
* Licensed under the MIT License.
|
|
@@ -7317,7 +7309,7 @@
|
|
|
7317
7309
|
response.hasOwnProperty("error_description"));
|
|
7318
7310
|
}
|
|
7319
7311
|
|
|
7320
|
-
/*! @azure/msal-common v14.0.0-
|
|
7312
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
7321
7313
|
|
|
7322
7314
|
/*
|
|
7323
7315
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7335,14 +7327,14 @@
|
|
|
7335
7327
|
* @returns Promise<string | null>
|
|
7336
7328
|
*/
|
|
7337
7329
|
async detectRegion(environmentRegion, regionDiscoveryMetadata) {
|
|
7338
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7330
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
7339
7331
|
// Initialize auto detected region with the region from the envrionment
|
|
7340
7332
|
let autodetectedRegionName = environmentRegion;
|
|
7341
7333
|
// Check if a region was detected from the environment, if not, attempt to get the region from IMDS
|
|
7342
7334
|
if (!autodetectedRegionName) {
|
|
7343
7335
|
const options = RegionDiscovery.IMDS_OPTIONS;
|
|
7344
7336
|
try {
|
|
7345
|
-
this.performanceClient?.setPreQueueTime(
|
|
7337
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
7346
7338
|
const localIMDSVersionResponse = await this.getRegionFromIMDS(Constants.IMDS_VERSION, options);
|
|
7347
7339
|
if (localIMDSVersionResponse.status ===
|
|
7348
7340
|
ResponseCodes.httpSuccess) {
|
|
@@ -7353,14 +7345,14 @@
|
|
|
7353
7345
|
// If the response using the local IMDS version failed, try to fetch the current version of IMDS and retry.
|
|
7354
7346
|
if (localIMDSVersionResponse.status ===
|
|
7355
7347
|
ResponseCodes.httpBadRequest) {
|
|
7356
|
-
this.performanceClient?.setPreQueueTime(
|
|
7348
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
7357
7349
|
const currentIMDSVersion = await this.getCurrentVersion(options);
|
|
7358
7350
|
if (!currentIMDSVersion) {
|
|
7359
7351
|
regionDiscoveryMetadata.region_source =
|
|
7360
7352
|
RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
7361
7353
|
return null;
|
|
7362
7354
|
}
|
|
7363
|
-
this.performanceClient?.setPreQueueTime(
|
|
7355
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
7364
7356
|
const currentIMDSVersionResponse = await this.getRegionFromIMDS(currentIMDSVersion, options);
|
|
7365
7357
|
if (currentIMDSVersionResponse.status ===
|
|
7366
7358
|
ResponseCodes.httpSuccess) {
|
|
@@ -7395,7 +7387,7 @@
|
|
|
7395
7387
|
* @returns Promise<NetworkResponse<string>>
|
|
7396
7388
|
*/
|
|
7397
7389
|
async getRegionFromIMDS(version, options) {
|
|
7398
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7390
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
|
|
7399
7391
|
return this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?api-version=${version}&format=text`, options, Constants.IMDS_TIMEOUT);
|
|
7400
7392
|
}
|
|
7401
7393
|
/**
|
|
@@ -7404,7 +7396,7 @@
|
|
|
7404
7396
|
* @returns Promise<string | null>
|
|
7405
7397
|
*/
|
|
7406
7398
|
async getCurrentVersion(options) {
|
|
7407
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7399
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
|
|
7408
7400
|
try {
|
|
7409
7401
|
const response = await this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?format=json`, options);
|
|
7410
7402
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
@@ -7428,7 +7420,7 @@
|
|
|
7428
7420
|
},
|
|
7429
7421
|
};
|
|
7430
7422
|
|
|
7431
|
-
/*! @azure/msal-common v14.0.0-
|
|
7423
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
7432
7424
|
|
|
7433
7425
|
/*
|
|
7434
7426
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7604,7 +7596,7 @@
|
|
|
7604
7596
|
return authorityUri.PathSegments.length === 1
|
|
7605
7597
|
&& !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])
|
|
7606
7598
|
&& this.getAuthorityType(authorityUri) === AuthorityType.Default
|
|
7607
|
-
&& this.protocolMode ===
|
|
7599
|
+
&& this.protocolMode === ProtocolMode.AAD;
|
|
7608
7600
|
}
|
|
7609
7601
|
/**
|
|
7610
7602
|
* Replaces tenant in url path with current tenant. Defaults to common.
|
|
@@ -7648,7 +7640,7 @@
|
|
|
7648
7640
|
*/
|
|
7649
7641
|
get defaultOpenIdConfigurationEndpoint() {
|
|
7650
7642
|
if (this.authorityType === AuthorityType.Adfs ||
|
|
7651
|
-
this.protocolMode ===
|
|
7643
|
+
this.protocolMode === ProtocolMode.OIDC) {
|
|
7652
7644
|
return `${this.canonicalAuthority}.well-known/openid-configuration`;
|
|
7653
7645
|
}
|
|
7654
7646
|
return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;
|
|
@@ -7664,16 +7656,16 @@
|
|
|
7664
7656
|
* and the /authorize, /token and logout endpoints.
|
|
7665
7657
|
*/
|
|
7666
7658
|
async resolveEndpointsAsync() {
|
|
7667
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7659
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityResolveEndpointsAsync, this.correlationId);
|
|
7668
7660
|
let metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);
|
|
7669
7661
|
if (!metadataEntity) {
|
|
7670
7662
|
metadataEntity = new AuthorityMetadataEntity();
|
|
7671
7663
|
metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);
|
|
7672
7664
|
}
|
|
7673
|
-
this.performanceClient?.setPreQueueTime(
|
|
7665
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
7674
7666
|
const cloudDiscoverySource = await this.updateCloudDiscoveryMetadata(metadataEntity);
|
|
7675
7667
|
this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);
|
|
7676
|
-
this.performanceClient?.setPreQueueTime(
|
|
7668
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
7677
7669
|
const endpointSource = await this.updateEndpointMetadata(metadataEntity);
|
|
7678
7670
|
if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE &&
|
|
7679
7671
|
endpointSource !== AuthorityMetadataSource.CACHE) {
|
|
@@ -7690,7 +7682,7 @@
|
|
|
7690
7682
|
* @param metadataEntity
|
|
7691
7683
|
*/
|
|
7692
7684
|
async updateEndpointMetadata(metadataEntity) {
|
|
7693
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7685
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
|
|
7694
7686
|
let metadata = this.getEndpointMetadataFromConfig();
|
|
7695
7687
|
if (metadata) {
|
|
7696
7688
|
metadataEntity.updateEndpointMetadata(metadata, false);
|
|
@@ -7702,12 +7694,12 @@
|
|
|
7702
7694
|
// No need to update
|
|
7703
7695
|
return AuthorityMetadataSource.CACHE;
|
|
7704
7696
|
}
|
|
7705
|
-
this.performanceClient?.setPreQueueTime(
|
|
7697
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7706
7698
|
metadata = await this.getEndpointMetadataFromNetwork();
|
|
7707
7699
|
if (metadata) {
|
|
7708
7700
|
// If the user prefers to use an azure region replace the global endpoints with regional information.
|
|
7709
7701
|
if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
|
|
7710
|
-
this.performanceClient?.setPreQueueTime(
|
|
7702
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7711
7703
|
metadata = await this.updateMetadataWithRegionalInformation(metadata);
|
|
7712
7704
|
}
|
|
7713
7705
|
metadataEntity.updateEndpointMetadata(metadata, true);
|
|
@@ -7718,7 +7710,7 @@
|
|
|
7718
7710
|
!this.authorityOptions.skipAuthorityMetadataCache) {
|
|
7719
7711
|
// If the user prefers to use an azure region replace the global endpoints with regional information.
|
|
7720
7712
|
if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
|
|
7721
|
-
this.performanceClient?.setPreQueueTime(
|
|
7713
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7722
7714
|
harcodedMetadata =
|
|
7723
7715
|
await this.updateMetadataWithRegionalInformation(harcodedMetadata);
|
|
7724
7716
|
}
|
|
@@ -7761,8 +7753,8 @@
|
|
|
7761
7753
|
* @param hasHardcodedMetadata boolean
|
|
7762
7754
|
*/
|
|
7763
7755
|
async getEndpointMetadataFromNetwork() {
|
|
7764
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7765
|
-
const perfEvent = this.performanceClient?.startMeasurement(
|
|
7756
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7757
|
+
const perfEvent = this.performanceClient?.startMeasurement(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
|
|
7766
7758
|
const options = {};
|
|
7767
7759
|
/*
|
|
7768
7760
|
* TODO: Add a timeout if the authority exists in our library's
|
|
@@ -7800,37 +7792,25 @@
|
|
|
7800
7792
|
}
|
|
7801
7793
|
/**
|
|
7802
7794
|
* Update the retrieved metadata with regional information.
|
|
7795
|
+
* User selected Azure region will be used if configured.
|
|
7803
7796
|
*/
|
|
7804
7797
|
async updateMetadataWithRegionalInformation(metadata) {
|
|
7805
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7806
|
-
this.
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
this.
|
|
7815
|
-
? RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL
|
|
7816
|
-
: RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
|
|
7817
|
-
}
|
|
7818
|
-
else {
|
|
7798
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
|
|
7799
|
+
const userConfiguredAzureRegion = this.authorityOptions.azureRegionConfiguration?.azureRegion;
|
|
7800
|
+
if (userConfiguredAzureRegion) {
|
|
7801
|
+
if (userConfiguredAzureRegion !== Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
|
|
7802
|
+
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
|
|
7803
|
+
this.regionDiscoveryMetadata.region_used = userConfiguredAzureRegion;
|
|
7804
|
+
return Authority.replaceWithRegionalInformation(metadata, userConfiguredAzureRegion);
|
|
7805
|
+
}
|
|
7806
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
|
|
7807
|
+
const autodetectedRegionName = await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration?.environmentRegion, this.regionDiscoveryMetadata);
|
|
7819
7808
|
if (autodetectedRegionName) {
|
|
7820
|
-
this.regionDiscoveryMetadata.region_outcome =
|
|
7821
|
-
|
|
7822
|
-
|
|
7823
|
-
? RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED
|
|
7824
|
-
: RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
|
|
7809
|
+
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL;
|
|
7810
|
+
this.regionDiscoveryMetadata.region_used = autodetectedRegionName;
|
|
7811
|
+
return Authority.replaceWithRegionalInformation(metadata, autodetectedRegionName);
|
|
7825
7812
|
}
|
|
7826
|
-
|
|
7827
|
-
this.regionDiscoveryMetadata.region_outcome =
|
|
7828
|
-
RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
|
|
7829
|
-
}
|
|
7830
|
-
}
|
|
7831
|
-
if (azureRegion) {
|
|
7832
|
-
this.regionDiscoveryMetadata.region_used = azureRegion;
|
|
7833
|
-
return Authority.replaceWithRegionalInformation(metadata, azureRegion);
|
|
7813
|
+
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
|
|
7834
7814
|
}
|
|
7835
7815
|
return metadata;
|
|
7836
7816
|
}
|
|
@@ -7841,7 +7821,7 @@
|
|
|
7841
7821
|
* @returns AuthorityMetadataSource
|
|
7842
7822
|
*/
|
|
7843
7823
|
async updateCloudDiscoveryMetadata(metadataEntity) {
|
|
7844
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7824
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
|
|
7845
7825
|
this.logger.verbose("Attempting to get cloud discovery metadata in the config");
|
|
7846
7826
|
this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities ||
|
|
7847
7827
|
Constants.NOT_APPLICABLE}`);
|
|
@@ -7868,7 +7848,7 @@
|
|
|
7868
7848
|
this.logger.verbose("The metadata entity is expired.");
|
|
7869
7849
|
}
|
|
7870
7850
|
this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
|
|
7871
|
-
this.performanceClient?.setPreQueueTime(
|
|
7851
|
+
this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7872
7852
|
metadata = await this.getCloudDiscoveryMetadataFromNetwork();
|
|
7873
7853
|
if (metadata) {
|
|
7874
7854
|
this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
|
|
@@ -7929,7 +7909,7 @@
|
|
|
7929
7909
|
* @param hasHardcodedMetadata boolean
|
|
7930
7910
|
*/
|
|
7931
7911
|
async getCloudDiscoveryMetadataFromNetwork() {
|
|
7932
|
-
this.performanceClient?.addQueueMeasurement(
|
|
7912
|
+
this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
|
|
7933
7913
|
const instanceDiscoveryEndpoint = `${Constants.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`;
|
|
7934
7914
|
const options = {};
|
|
7935
7915
|
/*
|
|
@@ -8012,7 +7992,7 @@
|
|
|
8012
7992
|
static generateAuthority(authorityString, azureCloudOptions) {
|
|
8013
7993
|
let authorityAzureCloudInstance;
|
|
8014
7994
|
if (azureCloudOptions &&
|
|
8015
|
-
azureCloudOptions.azureCloudInstance !==
|
|
7995
|
+
azureCloudOptions.azureCloudInstance !== AzureCloudInstance.None) {
|
|
8016
7996
|
const tenant = azureCloudOptions.tenant
|
|
8017
7997
|
? azureCloudOptions.tenant
|
|
8018
7998
|
: Constants.DEFAULT_COMMON_TENANT;
|
|
@@ -8146,7 +8126,7 @@
|
|
|
8146
8126
|
AADAuthorityConstants.ORGANIZATIONS
|
|
8147
8127
|
]));
|
|
8148
8128
|
|
|
8149
|
-
/*! @azure/msal-common v14.0.0-
|
|
8129
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8150
8130
|
|
|
8151
8131
|
/*
|
|
8152
8132
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8164,12 +8144,12 @@
|
|
|
8164
8144
|
* @param protocolMode
|
|
8165
8145
|
*/
|
|
8166
8146
|
static async createDiscoveredInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
8167
|
-
performanceClient?.addQueueMeasurement(
|
|
8147
|
+
performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
|
|
8168
8148
|
const authorityUriFinal = Authority.transformCIAMAuthority(authorityUri);
|
|
8169
8149
|
// Initialize authority and perform discovery endpoint check.
|
|
8170
8150
|
const acquireTokenAuthority = AuthorityFactory.createInstance(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);
|
|
8171
8151
|
try {
|
|
8172
|
-
performanceClient?.setPreQueueTime(
|
|
8152
|
+
performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityResolveEndpointsAsync, correlationId);
|
|
8173
8153
|
await acquireTokenAuthority.resolveEndpointsAsync();
|
|
8174
8154
|
return acquireTokenAuthority;
|
|
8175
8155
|
}
|
|
@@ -8196,7 +8176,7 @@
|
|
|
8196
8176
|
}
|
|
8197
8177
|
}
|
|
8198
8178
|
|
|
8199
|
-
/*! @azure/msal-common v14.0.0-
|
|
8179
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8200
8180
|
|
|
8201
8181
|
/*
|
|
8202
8182
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8226,7 +8206,7 @@
|
|
|
8226
8206
|
}
|
|
8227
8207
|
}
|
|
8228
8208
|
|
|
8229
|
-
/*! @azure/msal-common v14.0.0-
|
|
8209
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8230
8210
|
|
|
8231
8211
|
/*
|
|
8232
8212
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8252,7 +8232,7 @@
|
|
|
8252
8232
|
}
|
|
8253
8233
|
}
|
|
8254
8234
|
|
|
8255
|
-
/*! @azure/msal-common v14.0.0-
|
|
8235
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8256
8236
|
|
|
8257
8237
|
/*
|
|
8258
8238
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8269,7 +8249,7 @@
|
|
|
8269
8249
|
},
|
|
8270
8250
|
};
|
|
8271
8251
|
|
|
8272
|
-
/*! @azure/msal-common v14.0.0-
|
|
8252
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8273
8253
|
|
|
8274
8254
|
/*
|
|
8275
8255
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8311,7 +8291,7 @@
|
|
|
8311
8291
|
}
|
|
8312
8292
|
}
|
|
8313
8293
|
|
|
8314
|
-
/*! @azure/msal-common v14.0.0-
|
|
8294
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8315
8295
|
|
|
8316
8296
|
/*
|
|
8317
8297
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8350,7 +8330,7 @@
|
|
|
8350
8330
|
}
|
|
8351
8331
|
}
|
|
8352
8332
|
|
|
8353
|
-
/*! @azure/msal-common v14.0.0-
|
|
8333
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8354
8334
|
|
|
8355
8335
|
/*
|
|
8356
8336
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8408,7 +8388,7 @@
|
|
|
8408
8388
|
}
|
|
8409
8389
|
}
|
|
8410
8390
|
|
|
8411
|
-
/*! @azure/msal-common v14.0.0-
|
|
8391
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8412
8392
|
|
|
8413
8393
|
/*
|
|
8414
8394
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8607,7 +8587,7 @@
|
|
|
8607
8587
|
}
|
|
8608
8588
|
}
|
|
8609
8589
|
|
|
8610
|
-
/*! @azure/msal-common v14.0.0-
|
|
8590
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
8611
8591
|
|
|
8612
8592
|
/*
|
|
8613
8593
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9016,20 +8996,16 @@
|
|
|
9016
8996
|
}
|
|
9017
8997
|
}
|
|
9018
8998
|
|
|
9019
|
-
/*! @azure/msal-common v14.0.0-
|
|
8999
|
+
/*! @azure/msal-common v14.0.0-beta.1 2023-07-06 */
|
|
9020
9000
|
|
|
9021
9001
|
/*
|
|
9022
9002
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
9023
9003
|
* Licensed under the MIT License.
|
|
9024
9004
|
*/
|
|
9025
9005
|
class StubPerformanceMeasurement {
|
|
9026
|
-
|
|
9027
|
-
|
|
9028
|
-
|
|
9029
|
-
endMeasurement() { }
|
|
9030
|
-
flushMeasurement() {
|
|
9031
|
-
return null;
|
|
9032
|
-
}
|
|
9006
|
+
startMeasurement() { return; }
|
|
9007
|
+
endMeasurement() { return; }
|
|
9008
|
+
flushMeasurement() { return null; }
|
|
9033
9009
|
}
|
|
9034
9010
|
class StubPerformanceClient extends PerformanceClient {
|
|
9035
9011
|
generateId() {
|
|
@@ -9038,21 +9014,11 @@
|
|
|
9038
9014
|
startPerformanceMeasurement() {
|
|
9039
9015
|
return new StubPerformanceMeasurement();
|
|
9040
9016
|
}
|
|
9041
|
-
|
|
9042
|
-
calculateQueuedTime(preQueueTime, currentTime) {
|
|
9017
|
+
calculateQueuedTime() {
|
|
9043
9018
|
return 0;
|
|
9044
9019
|
}
|
|
9045
|
-
addQueueMeasurement(
|
|
9046
|
-
|
|
9047
|
-
queueTime // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9048
|
-
) {
|
|
9049
|
-
return;
|
|
9050
|
-
}
|
|
9051
|
-
setPreQueueTime(eventName, // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9052
|
-
correlationId // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
9053
|
-
) {
|
|
9054
|
-
return;
|
|
9055
|
-
}
|
|
9020
|
+
addQueueMeasurement() { return; }
|
|
9021
|
+
setPreQueueTime() { return; }
|
|
9056
9022
|
}
|
|
9057
9023
|
|
|
9058
9024
|
/*
|
|
@@ -9581,79 +9547,72 @@
|
|
|
9581
9547
|
PREFERRED_EXTENSION_ID: "ppnbnpeolgkicgegkbkbjmhlideopiji",
|
|
9582
9548
|
MATS_TELEMETRY: "MATS",
|
|
9583
9549
|
};
|
|
9584
|
-
|
|
9585
|
-
|
|
9586
|
-
|
|
9587
|
-
|
|
9588
|
-
|
|
9589
|
-
|
|
9590
|
-
|
|
9591
|
-
|
|
9592
|
-
|
|
9593
|
-
|
|
9594
|
-
|
|
9595
|
-
BrowserCacheLocation["MemoryStorage"] = "memoryStorage";
|
|
9596
|
-
})(exports.BrowserCacheLocation || (exports.BrowserCacheLocation = {}));
|
|
9550
|
+
const NativeExtensionMethod = {
|
|
9551
|
+
HandshakeRequest: "Handshake",
|
|
9552
|
+
HandshakeResponse: "HandshakeResponse",
|
|
9553
|
+
GetToken: "GetToken",
|
|
9554
|
+
Response: "Response",
|
|
9555
|
+
};
|
|
9556
|
+
const BrowserCacheLocation = {
|
|
9557
|
+
LocalStorage: "localStorage",
|
|
9558
|
+
SessionStorage: "sessionStorage",
|
|
9559
|
+
MemoryStorage: "memoryStorage",
|
|
9560
|
+
};
|
|
9597
9561
|
/**
|
|
9598
9562
|
* HTTP Request types supported by MSAL.
|
|
9599
9563
|
*/
|
|
9600
|
-
|
|
9601
|
-
|
|
9602
|
-
|
|
9603
|
-
|
|
9604
|
-
})(HTTP_REQUEST_TYPE || (HTTP_REQUEST_TYPE = {}));
|
|
9564
|
+
const HTTP_REQUEST_TYPE = {
|
|
9565
|
+
GET: "GET",
|
|
9566
|
+
POST: "POST",
|
|
9567
|
+
};
|
|
9605
9568
|
/**
|
|
9606
9569
|
* Temporary cache keys for MSAL, deleted after any request.
|
|
9607
9570
|
*/
|
|
9608
|
-
|
|
9609
|
-
|
|
9610
|
-
|
|
9611
|
-
|
|
9612
|
-
|
|
9613
|
-
|
|
9614
|
-
|
|
9615
|
-
|
|
9616
|
-
|
|
9617
|
-
|
|
9618
|
-
|
|
9619
|
-
|
|
9620
|
-
|
|
9621
|
-
|
|
9622
|
-
|
|
9623
|
-
|
|
9624
|
-
|
|
9625
|
-
|
|
9626
|
-
|
|
9627
|
-
|
|
9628
|
-
|
|
9629
|
-
StaticCacheKeys["TOKEN_KEYS"] = "msal.token.keys";
|
|
9630
|
-
})(StaticCacheKeys || (StaticCacheKeys = {}));
|
|
9571
|
+
const TemporaryCacheKeys = {
|
|
9572
|
+
AUTHORITY: "authority",
|
|
9573
|
+
ACQUIRE_TOKEN_ACCOUNT: "acquireToken.account",
|
|
9574
|
+
SESSION_STATE: "session.state",
|
|
9575
|
+
REQUEST_STATE: "request.state",
|
|
9576
|
+
NONCE_IDTOKEN: "nonce.id_token",
|
|
9577
|
+
ORIGIN_URI: "request.origin",
|
|
9578
|
+
RENEW_STATUS: "token.renew.status",
|
|
9579
|
+
URL_HASH: "urlHash",
|
|
9580
|
+
REQUEST_PARAMS: "request.params",
|
|
9581
|
+
SCOPES: "scopes",
|
|
9582
|
+
INTERACTION_STATUS_KEY: "interaction.status",
|
|
9583
|
+
CCS_CREDENTIAL: "ccs.credential",
|
|
9584
|
+
CORRELATION_ID: "request.correlationId",
|
|
9585
|
+
NATIVE_REQUEST: "request.native",
|
|
9586
|
+
REDIRECT_CONTEXT: "request.redirect.context",
|
|
9587
|
+
};
|
|
9588
|
+
const StaticCacheKeys = {
|
|
9589
|
+
ACCOUNT_KEYS: "msal.account.keys",
|
|
9590
|
+
TOKEN_KEYS: "msal.token.keys",
|
|
9591
|
+
};
|
|
9631
9592
|
/**
|
|
9632
9593
|
* Cache keys stored in-memory
|
|
9633
9594
|
*/
|
|
9634
|
-
|
|
9635
|
-
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
})(InMemoryCacheKeys || (InMemoryCacheKeys = {}));
|
|
9595
|
+
const InMemoryCacheKeys = {
|
|
9596
|
+
WRAPPER_SKU: "wrapper.sku",
|
|
9597
|
+
WRAPPER_VER: "wrapper.version",
|
|
9598
|
+
};
|
|
9639
9599
|
/**
|
|
9640
9600
|
* API Codes for Telemetry purposes.
|
|
9641
9601
|
* Before adding a new code you must claim it in the MSAL Telemetry tracker as these number spaces are shared across all MSALs
|
|
9642
9602
|
* 0-99 Silent Flow
|
|
9643
9603
|
* 800-899 Auth Code Flow
|
|
9644
9604
|
*/
|
|
9645
|
-
|
|
9646
|
-
|
|
9647
|
-
|
|
9648
|
-
|
|
9649
|
-
|
|
9650
|
-
|
|
9651
|
-
|
|
9652
|
-
|
|
9653
|
-
|
|
9654
|
-
|
|
9655
|
-
|
|
9656
|
-
})(exports.ApiId || (exports.ApiId = {}));
|
|
9605
|
+
const ApiId = {
|
|
9606
|
+
acquireTokenRedirect: 861,
|
|
9607
|
+
acquireTokenPopup: 862,
|
|
9608
|
+
ssoSilent: 863,
|
|
9609
|
+
acquireTokenSilent_authCode: 864,
|
|
9610
|
+
handleRedirectPromise: 865,
|
|
9611
|
+
acquireTokenByCode: 866,
|
|
9612
|
+
acquireTokenSilent_silentFlow: 61,
|
|
9613
|
+
logout: 961,
|
|
9614
|
+
logoutPopup: 962,
|
|
9615
|
+
};
|
|
9657
9616
|
/*
|
|
9658
9617
|
* Interaction type of the API - used for state and telemetry
|
|
9659
9618
|
*/
|
|
@@ -9668,37 +9627,36 @@
|
|
|
9668
9627
|
* Types of interaction currently in progress.
|
|
9669
9628
|
* Used in events in wrapper libraries to invoke functions when certain interaction is in progress or all interactions are complete.
|
|
9670
9629
|
*/
|
|
9671
|
-
|
|
9672
|
-
(function (InteractionStatus) {
|
|
9630
|
+
const InteractionStatus = {
|
|
9673
9631
|
/**
|
|
9674
9632
|
* Initial status before interaction occurs
|
|
9675
9633
|
*/
|
|
9676
|
-
|
|
9634
|
+
Startup: "startup",
|
|
9677
9635
|
/**
|
|
9678
9636
|
* Status set when all login calls occuring
|
|
9679
9637
|
*/
|
|
9680
|
-
|
|
9638
|
+
Login: "login",
|
|
9681
9639
|
/**
|
|
9682
9640
|
* Status set when logout call occuring
|
|
9683
9641
|
*/
|
|
9684
|
-
|
|
9642
|
+
Logout: "logout",
|
|
9685
9643
|
/**
|
|
9686
9644
|
* Status set for acquireToken calls
|
|
9687
9645
|
*/
|
|
9688
|
-
|
|
9646
|
+
AcquireToken: "acquireToken",
|
|
9689
9647
|
/**
|
|
9690
9648
|
* Status set for ssoSilent calls
|
|
9691
9649
|
*/
|
|
9692
|
-
|
|
9650
|
+
SsoSilent: "ssoSilent",
|
|
9693
9651
|
/**
|
|
9694
9652
|
* Status set when handleRedirect in progress
|
|
9695
9653
|
*/
|
|
9696
|
-
|
|
9654
|
+
HandleRedirect: "handleRedirect",
|
|
9697
9655
|
/**
|
|
9698
9656
|
* Status set when interaction is complete
|
|
9699
9657
|
*/
|
|
9700
|
-
|
|
9701
|
-
}
|
|
9658
|
+
None: "none",
|
|
9659
|
+
};
|
|
9702
9660
|
const DEFAULT_REQUEST = {
|
|
9703
9661
|
scopes: OIDC_DEFAULT_SCOPES,
|
|
9704
9662
|
};
|
|
@@ -9707,52 +9665,50 @@
|
|
|
9707
9665
|
*/
|
|
9708
9666
|
const KEY_FORMAT_JWK = "jwk";
|
|
9709
9667
|
// Supported wrapper SKUs
|
|
9710
|
-
|
|
9711
|
-
|
|
9712
|
-
|
|
9713
|
-
|
|
9714
|
-
})(exports.WrapperSKU || (exports.WrapperSKU = {}));
|
|
9668
|
+
const WrapperSKU = {
|
|
9669
|
+
React: "@azure/msal-react",
|
|
9670
|
+
Angular: "@azure/msal-angular",
|
|
9671
|
+
};
|
|
9715
9672
|
// DatabaseStorage Constants
|
|
9716
9673
|
const DB_NAME = "msal.db";
|
|
9717
9674
|
const DB_VERSION = 1;
|
|
9718
9675
|
const DB_TABLE_NAME = `${DB_NAME}.keys`;
|
|
9719
|
-
|
|
9720
|
-
(function (CacheLookupPolicy) {
|
|
9676
|
+
const CacheLookupPolicy = {
|
|
9721
9677
|
/*
|
|
9722
9678
|
* acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired
|
|
9723
9679
|
* or cannot be found the refresh token will be used to acquire a new one. Finally, if the refresh token
|
|
9724
9680
|
* is expired acquireTokenSilent will attempt to acquire new access and refresh tokens.
|
|
9725
9681
|
*/
|
|
9726
|
-
|
|
9682
|
+
Default: 0,
|
|
9727
9683
|
/*
|
|
9728
9684
|
* acquireTokenSilent will only look for access tokens in the cache. It will not attempt to renew access or
|
|
9729
9685
|
* refresh tokens.
|
|
9730
9686
|
*/
|
|
9731
|
-
|
|
9687
|
+
AccessToken: 1,
|
|
9732
9688
|
/*
|
|
9733
9689
|
* acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired or
|
|
9734
9690
|
* cannot be found, the refresh token will be used to acquire a new one. If the refresh token is expired, it
|
|
9735
9691
|
* will not be renewed and acquireTokenSilent will fail.
|
|
9736
9692
|
*/
|
|
9737
|
-
|
|
9693
|
+
AccessTokenAndRefreshToken: 2,
|
|
9738
9694
|
/*
|
|
9739
9695
|
* acquireTokenSilent will not attempt to retrieve access tokens from the cache and will instead attempt to
|
|
9740
9696
|
* exchange the cached refresh token for a new access token. If the refresh token is expired, it will not be
|
|
9741
9697
|
* renewed and acquireTokenSilent will fail.
|
|
9742
9698
|
*/
|
|
9743
|
-
|
|
9699
|
+
RefreshToken: 3,
|
|
9744
9700
|
/*
|
|
9745
9701
|
* acquireTokenSilent will not look in the cache for the access token. It will go directly to network with the
|
|
9746
9702
|
* cached refresh token. If the refresh token is expired an attempt will be made to renew it. This is equivalent to
|
|
9747
9703
|
* setting "forceRefresh: true".
|
|
9748
9704
|
*/
|
|
9749
|
-
|
|
9705
|
+
RefreshTokenAndNetwork: 4,
|
|
9750
9706
|
/*
|
|
9751
9707
|
* acquireTokenSilent will attempt to renew both access and refresh tokens. It will not look in the cache. This will
|
|
9752
9708
|
* always fail if 3rd party cookies are blocked by the browser.
|
|
9753
9709
|
*/
|
|
9754
|
-
|
|
9755
|
-
}
|
|
9710
|
+
Skip: 5,
|
|
9711
|
+
};
|
|
9756
9712
|
|
|
9757
9713
|
/*
|
|
9758
9714
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9861,8 +9817,8 @@
|
|
|
9861
9817
|
this.windowStorage = window[cacheLocation];
|
|
9862
9818
|
}
|
|
9863
9819
|
validateWindowStorage(cacheLocation) {
|
|
9864
|
-
if (cacheLocation !==
|
|
9865
|
-
cacheLocation !==
|
|
9820
|
+
if (cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
9821
|
+
cacheLocation !== BrowserCacheLocation.SessionStorage) {
|
|
9866
9822
|
throw BrowserConfigurationAuthError.createStorageNotSupportedError(cacheLocation);
|
|
9867
9823
|
}
|
|
9868
9824
|
const storageSupported = !!window[cacheLocation];
|
|
@@ -9985,8 +9941,8 @@
|
|
|
9985
9941
|
*/
|
|
9986
9942
|
setupBrowserStorage(cacheLocation) {
|
|
9987
9943
|
switch (cacheLocation) {
|
|
9988
|
-
case
|
|
9989
|
-
case
|
|
9944
|
+
case BrowserCacheLocation.LocalStorage:
|
|
9945
|
+
case BrowserCacheLocation.SessionStorage:
|
|
9990
9946
|
try {
|
|
9991
9947
|
return new BrowserStorage(cacheLocation);
|
|
9992
9948
|
}
|
|
@@ -9994,9 +9950,9 @@
|
|
|
9994
9950
|
this.logger.verbose(e);
|
|
9995
9951
|
break;
|
|
9996
9952
|
}
|
|
9997
|
-
case
|
|
9953
|
+
case BrowserCacheLocation.MemoryStorage:
|
|
9998
9954
|
}
|
|
9999
|
-
this.cacheConfig.cacheLocation =
|
|
9955
|
+
this.cacheConfig.cacheLocation = BrowserCacheLocation.MemoryStorage;
|
|
10000
9956
|
return new MemoryStorage();
|
|
10001
9957
|
}
|
|
10002
9958
|
/**
|
|
@@ -10006,18 +9962,18 @@
|
|
|
10006
9962
|
*/
|
|
10007
9963
|
setupTemporaryCacheStorage(temporaryCacheLocation, cacheLocation) {
|
|
10008
9964
|
switch (cacheLocation) {
|
|
10009
|
-
case
|
|
10010
|
-
case
|
|
9965
|
+
case BrowserCacheLocation.LocalStorage:
|
|
9966
|
+
case BrowserCacheLocation.SessionStorage:
|
|
10011
9967
|
try {
|
|
10012
9968
|
// Temporary cache items will always be stored in session storage to mitigate problems caused by multiple tabs
|
|
10013
9969
|
return new BrowserStorage(temporaryCacheLocation ||
|
|
10014
|
-
|
|
9970
|
+
BrowserCacheLocation.SessionStorage);
|
|
10015
9971
|
}
|
|
10016
9972
|
catch (e) {
|
|
10017
9973
|
this.logger.verbose(e);
|
|
10018
9974
|
return this.internalStorage;
|
|
10019
9975
|
}
|
|
10020
|
-
case
|
|
9976
|
+
case BrowserCacheLocation.MemoryStorage:
|
|
10021
9977
|
default:
|
|
10022
9978
|
return this.internalStorage;
|
|
10023
9979
|
}
|
|
@@ -10201,8 +10157,7 @@
|
|
|
10201
10157
|
}
|
|
10202
10158
|
/**
|
|
10203
10159
|
* set account entity in the platform cache
|
|
10204
|
-
* @param
|
|
10205
|
-
* @param value
|
|
10160
|
+
* @param account
|
|
10206
10161
|
*/
|
|
10207
10162
|
setAccount(account) {
|
|
10208
10163
|
this.logger.trace("BrowserCacheManager.setAccount called");
|
|
@@ -10763,7 +10718,7 @@
|
|
|
10763
10718
|
if (!value) {
|
|
10764
10719
|
// If temp cache item not found in session/memory, check local storage for items set by old versions
|
|
10765
10720
|
if (this.cacheConfig.cacheLocation ===
|
|
10766
|
-
|
|
10721
|
+
BrowserCacheLocation.LocalStorage) {
|
|
10767
10722
|
const item = this.browserStorage.getItem(key);
|
|
10768
10723
|
if (item) {
|
|
10769
10724
|
this.logger.trace("BrowserCacheManager.getTemporaryCache: Temporary cache item found in local storage");
|
|
@@ -11223,18 +11178,30 @@
|
|
|
11223
11178
|
}
|
|
11224
11179
|
const DEFAULT_BROWSER_CACHE_MANAGER = (clientId, logger) => {
|
|
11225
11180
|
const cacheOptions = {
|
|
11226
|
-
cacheLocation:
|
|
11227
|
-
temporaryCacheLocation:
|
|
11181
|
+
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
11182
|
+
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
11228
11183
|
storeAuthStateInCookie: false,
|
|
11229
11184
|
secureCookies: false,
|
|
11230
11185
|
cacheMigrationEnabled: false,
|
|
11186
|
+
claimsBasedCachingEnabled: false,
|
|
11231
11187
|
};
|
|
11232
11188
|
return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);
|
|
11233
11189
|
};
|
|
11234
11190
|
|
|
11191
|
+
/*
|
|
11192
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11193
|
+
* Licensed under the MIT License.
|
|
11194
|
+
*/
|
|
11195
|
+
class CacheRecord extends CacheRecord$1 {
|
|
11196
|
+
constructor(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity) {
|
|
11197
|
+
super(accountEntity, idTokenEntity, accessTokenEntity, refreshTokenEntity, appMetadataEntity);
|
|
11198
|
+
this.account = accountEntity;
|
|
11199
|
+
}
|
|
11200
|
+
}
|
|
11201
|
+
|
|
11235
11202
|
/* eslint-disable header/header */
|
|
11236
11203
|
const name = "@azure/msal-browser";
|
|
11237
|
-
const version = "3.0.0-
|
|
11204
|
+
const version = "3.0.0-beta.1";
|
|
11238
11205
|
|
|
11239
11206
|
/*
|
|
11240
11207
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11643,10 +11610,13 @@
|
|
|
11643
11610
|
* Initializer function for all request APIs
|
|
11644
11611
|
* @param request
|
|
11645
11612
|
*/
|
|
11646
|
-
async initializeBaseRequest(request) {
|
|
11647
|
-
this.performanceClient.addQueueMeasurement(
|
|
11613
|
+
async initializeBaseRequest(request, account) {
|
|
11614
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
11648
11615
|
this.logger.verbose("Initializing BaseAuthRequest");
|
|
11649
11616
|
const authority = request.authority || this.config.auth.authority;
|
|
11617
|
+
if (account) {
|
|
11618
|
+
await this.validateRequestAuthority(authority, account);
|
|
11619
|
+
}
|
|
11650
11620
|
const scopes = [...((request && request.scopes) || [])];
|
|
11651
11621
|
const validatedRequest = {
|
|
11652
11622
|
...request,
|
|
@@ -11656,12 +11626,12 @@
|
|
|
11656
11626
|
};
|
|
11657
11627
|
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
11658
11628
|
if (!validatedRequest.authenticationScheme) {
|
|
11659
|
-
validatedRequest.authenticationScheme =
|
|
11629
|
+
validatedRequest.authenticationScheme = AuthenticationScheme.BEARER;
|
|
11660
11630
|
this.logger.verbose('Authentication Scheme wasn\'t explicitly set in request, defaulting to "Bearer" request');
|
|
11661
11631
|
}
|
|
11662
11632
|
else {
|
|
11663
11633
|
if (validatedRequest.authenticationScheme ===
|
|
11664
|
-
|
|
11634
|
+
AuthenticationScheme.SSH) {
|
|
11665
11635
|
if (!request.sshJwk) {
|
|
11666
11636
|
throw ClientConfigurationError.createMissingSshJwkError();
|
|
11667
11637
|
}
|
|
@@ -11671,8 +11641,11 @@
|
|
|
11671
11641
|
}
|
|
11672
11642
|
this.logger.verbose(`Authentication Scheme set to "${validatedRequest.authenticationScheme}" as configured in Auth request`);
|
|
11673
11643
|
}
|
|
11674
|
-
// Set requested claims hash if claims were requested
|
|
11675
|
-
if (
|
|
11644
|
+
// Set requested claims hash if claims-based caching is enabled and claims were requested
|
|
11645
|
+
if (this.config.cache.claimsBasedCachingEnabled &&
|
|
11646
|
+
request.claims &&
|
|
11647
|
+
// Checks for empty stringified object "{}" which doesn't qualify as requested claims
|
|
11648
|
+
!StringUtils.isEmptyObj(request.claims)) {
|
|
11676
11649
|
validatedRequest.requestedClaimsHash =
|
|
11677
11650
|
await this.browserCrypto.hashString(request.claims);
|
|
11678
11651
|
}
|
|
@@ -11692,6 +11665,16 @@
|
|
|
11692
11665
|
BrowserUtils.getCurrentUri();
|
|
11693
11666
|
return UrlString.getAbsoluteUrl(redirectUri, BrowserUtils.getCurrentUri());
|
|
11694
11667
|
}
|
|
11668
|
+
/*
|
|
11669
|
+
* If authority provided in the request does not match environment/authority specified
|
|
11670
|
+
* in the account or MSAL config, we throw an error.
|
|
11671
|
+
*/
|
|
11672
|
+
async validateRequestAuthority(authority, account) {
|
|
11673
|
+
const discoveredAuthority = await this.getDiscoveredAuthority(authority);
|
|
11674
|
+
if (!discoveredAuthority.isAlias(account.environment)) {
|
|
11675
|
+
throw ClientConfigurationError.createAuthorityMismatchError();
|
|
11676
|
+
}
|
|
11677
|
+
}
|
|
11695
11678
|
/**
|
|
11696
11679
|
*
|
|
11697
11680
|
* @param apiId
|
|
@@ -11745,7 +11728,7 @@
|
|
|
11745
11728
|
* @param request
|
|
11746
11729
|
*/
|
|
11747
11730
|
async initializeAuthorizationCodeRequest(request) {
|
|
11748
|
-
this.performanceClient.addQueueMeasurement(
|
|
11731
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
11749
11732
|
this.logger.verbose("initializeAuthorizationRequest called", request.correlationId);
|
|
11750
11733
|
const generatedPkceParams = await this.browserCrypto.generatePkceCodes();
|
|
11751
11734
|
const authCodeRequest = {
|
|
@@ -11848,9 +11831,9 @@
|
|
|
11848
11831
|
* @param authorityUrl
|
|
11849
11832
|
*/
|
|
11850
11833
|
async createAuthCodeClient(serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
|
|
11851
|
-
this.performanceClient.addQueueMeasurement(
|
|
11834
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);
|
|
11852
11835
|
// Create auth module.
|
|
11853
|
-
this.performanceClient.setPreQueueTime(
|
|
11836
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11854
11837
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions);
|
|
11855
11838
|
return new AuthorizationCodeClient(clientConfig, this.performanceClient);
|
|
11856
11839
|
}
|
|
@@ -11861,9 +11844,9 @@
|
|
|
11861
11844
|
* @param requestCorrelationId
|
|
11862
11845
|
*/
|
|
11863
11846
|
async getClientConfiguration(serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
|
|
11864
|
-
this.performanceClient.addQueueMeasurement(
|
|
11847
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
11865
11848
|
this.logger.verbose("getClientConfiguration called", this.correlationId);
|
|
11866
|
-
this.performanceClient.setPreQueueTime(
|
|
11849
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11867
11850
|
const discoveredAuthority = await this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions);
|
|
11868
11851
|
const logger = this.config.system.loggerOptions;
|
|
11869
11852
|
return {
|
|
@@ -11882,6 +11865,9 @@
|
|
|
11882
11865
|
logLevel: logger.logLevel,
|
|
11883
11866
|
correlationId: this.correlationId,
|
|
11884
11867
|
},
|
|
11868
|
+
cacheOptions: {
|
|
11869
|
+
claimsBasedCachingEnabled: this.config.cache.claimsBasedCachingEnabled,
|
|
11870
|
+
},
|
|
11885
11871
|
cryptoInterface: this.browserCrypto,
|
|
11886
11872
|
networkInterface: this.networkClient,
|
|
11887
11873
|
storageInterface: this.browserStorage,
|
|
@@ -11920,9 +11906,9 @@
|
|
|
11920
11906
|
* @param requestCorrelationId
|
|
11921
11907
|
*/
|
|
11922
11908
|
async getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions) {
|
|
11923
|
-
this.performanceClient.addQueueMeasurement(
|
|
11909
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11924
11910
|
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
|
|
11925
|
-
const getAuthorityMeasurement = this.performanceClient?.startMeasurement(
|
|
11911
|
+
const getAuthorityMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
11926
11912
|
const authorityOptions = {
|
|
11927
11913
|
protocolMode: this.config.auth.protocolMode,
|
|
11928
11914
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
@@ -11937,7 +11923,7 @@
|
|
|
11937
11923
|
// fall back to the authority from config
|
|
11938
11924
|
const builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
11939
11925
|
this.logger.verbose("Creating discovered authority with configured authority", this.correlationId);
|
|
11940
|
-
this.performanceClient.setPreQueueTime(
|
|
11926
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.correlationId);
|
|
11941
11927
|
return await AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId)
|
|
11942
11928
|
.then((result) => {
|
|
11943
11929
|
getAuthorityMeasurement.endMeasurement({
|
|
@@ -11960,14 +11946,14 @@
|
|
|
11960
11946
|
* @param interactionType
|
|
11961
11947
|
*/
|
|
11962
11948
|
async initializeAuthorizationRequest(request, interactionType) {
|
|
11963
|
-
this.performanceClient.addQueueMeasurement(
|
|
11949
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.correlationId);
|
|
11964
11950
|
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
|
|
11965
11951
|
const redirectUri = this.getRedirectUri(request.redirectUri);
|
|
11966
11952
|
const browserState = {
|
|
11967
11953
|
interactionType: interactionType,
|
|
11968
11954
|
};
|
|
11969
11955
|
const state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
11970
|
-
this.performanceClient.setPreQueueTime(
|
|
11956
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
11971
11957
|
const validatedRequest = {
|
|
11972
11958
|
...(await this.initializeBaseRequest(request)),
|
|
11973
11959
|
redirectUri: redirectUri,
|
|
@@ -12012,7 +11998,7 @@
|
|
|
12012
11998
|
* @param locationHash
|
|
12013
11999
|
*/
|
|
12014
12000
|
async handleCodeResponseFromHash(locationHash, state, authority, networkModule) {
|
|
12015
|
-
this.performanceClient.addQueueMeasurement(
|
|
12001
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromHash, this.authCodeRequest.correlationId);
|
|
12016
12002
|
this.logger.verbose("InteractionHandler.handleCodeResponse called");
|
|
12017
12003
|
// Check that location hash isn't empty.
|
|
12018
12004
|
if (StringUtils.isEmpty(locationHash)) {
|
|
@@ -12038,7 +12024,7 @@
|
|
|
12038
12024
|
throw e;
|
|
12039
12025
|
}
|
|
12040
12026
|
}
|
|
12041
|
-
this.performanceClient.setPreQueueTime(
|
|
12027
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
12042
12028
|
return this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule);
|
|
12043
12029
|
}
|
|
12044
12030
|
/**
|
|
@@ -12050,7 +12036,7 @@
|
|
|
12050
12036
|
* @returns
|
|
12051
12037
|
*/
|
|
12052
12038
|
async handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule, validateNonce = true) {
|
|
12053
|
-
this.performanceClient.addQueueMeasurement(
|
|
12039
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromServer, this.authCodeRequest.correlationId);
|
|
12054
12040
|
this.logger.trace("InteractionHandler.handleCodeResponseFromServer called");
|
|
12055
12041
|
// Handle code response.
|
|
12056
12042
|
const stateKey = this.browserStorage.generateStateKey(state);
|
|
@@ -12065,7 +12051,7 @@
|
|
|
12065
12051
|
this.authCodeRequest.code = authCodeResponse.code;
|
|
12066
12052
|
// Check for new cloud instance
|
|
12067
12053
|
if (authCodeResponse.cloud_instance_host_name) {
|
|
12068
|
-
this.performanceClient.setPreQueueTime(
|
|
12054
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
12069
12055
|
await this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule);
|
|
12070
12056
|
}
|
|
12071
12057
|
// Nonce validation not needed when redirect not involved (e.g. hybrid spa, renewing token via rt)
|
|
@@ -12084,7 +12070,7 @@
|
|
|
12084
12070
|
}
|
|
12085
12071
|
}
|
|
12086
12072
|
// Acquire token with retrieved code.
|
|
12087
|
-
this.performanceClient.setPreQueueTime(
|
|
12073
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AuthClientAcquireToken, this.authCodeRequest.correlationId);
|
|
12088
12074
|
const tokenResponse = await this.authModule.acquireToken(this.authCodeRequest, authCodeResponse);
|
|
12089
12075
|
this.browserStorage.cleanRequestByState(state);
|
|
12090
12076
|
return tokenResponse;
|
|
@@ -12096,7 +12082,7 @@
|
|
|
12096
12082
|
* @param networkModule
|
|
12097
12083
|
*/
|
|
12098
12084
|
async updateTokenEndpointAuthority(cloudInstanceHostname, authority, networkModule) {
|
|
12099
|
-
this.performanceClient.addQueueMeasurement(
|
|
12085
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.UpdateTokenEndpointAuthority, this.authCodeRequest.correlationId);
|
|
12100
12086
|
const cloudInstanceAuthorityUri = `https://${cloudInstanceHostname}/${authority.tenant}/`;
|
|
12101
12087
|
const cloudInstanceAuthority = await AuthorityFactory.createDiscoveredInstance(cloudInstanceAuthorityUri, networkModule, this.browserStorage, authority.options, this.logger, this.performanceClient, this.authCodeRequest.correlationId);
|
|
12102
12088
|
this.authModule.updateAuthority(cloudInstanceAuthority);
|
|
@@ -12147,7 +12133,7 @@
|
|
|
12147
12133
|
this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);
|
|
12148
12134
|
this.logger.infoPii(`RedirectHandler.initiateAuthRequest: Navigate to: ${requestUrl}`);
|
|
12149
12135
|
const navigationOptions = {
|
|
12150
|
-
apiId:
|
|
12136
|
+
apiId: ApiId.acquireTokenRedirect,
|
|
12151
12137
|
timeout: params.redirectTimeout,
|
|
12152
12138
|
noHistory: false,
|
|
12153
12139
|
};
|
|
@@ -12243,48 +12229,48 @@
|
|
|
12243
12229
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12244
12230
|
* Licensed under the MIT License.
|
|
12245
12231
|
*/
|
|
12246
|
-
|
|
12247
|
-
|
|
12248
|
-
|
|
12249
|
-
|
|
12250
|
-
|
|
12251
|
-
|
|
12252
|
-
|
|
12253
|
-
|
|
12254
|
-
|
|
12255
|
-
|
|
12256
|
-
|
|
12257
|
-
|
|
12258
|
-
|
|
12259
|
-
|
|
12260
|
-
|
|
12261
|
-
|
|
12262
|
-
|
|
12263
|
-
|
|
12264
|
-
|
|
12265
|
-
|
|
12266
|
-
|
|
12267
|
-
|
|
12268
|
-
|
|
12269
|
-
|
|
12270
|
-
|
|
12271
|
-
|
|
12272
|
-
}
|
|
12232
|
+
const EventType = {
|
|
12233
|
+
INITIALIZE_START: "msal:initializeStart",
|
|
12234
|
+
INITIALIZE_END: "msal:initializeEnd",
|
|
12235
|
+
ACCOUNT_ADDED: "msal:accountAdded",
|
|
12236
|
+
ACCOUNT_REMOVED: "msal:accountRemoved",
|
|
12237
|
+
LOGIN_START: "msal:loginStart",
|
|
12238
|
+
LOGIN_SUCCESS: "msal:loginSuccess",
|
|
12239
|
+
LOGIN_FAILURE: "msal:loginFailure",
|
|
12240
|
+
ACQUIRE_TOKEN_START: "msal:acquireTokenStart",
|
|
12241
|
+
ACQUIRE_TOKEN_SUCCESS: "msal:acquireTokenSuccess",
|
|
12242
|
+
ACQUIRE_TOKEN_FAILURE: "msal:acquireTokenFailure",
|
|
12243
|
+
ACQUIRE_TOKEN_NETWORK_START: "msal:acquireTokenFromNetworkStart",
|
|
12244
|
+
SSO_SILENT_START: "msal:ssoSilentStart",
|
|
12245
|
+
SSO_SILENT_SUCCESS: "msal:ssoSilentSuccess",
|
|
12246
|
+
SSO_SILENT_FAILURE: "msal:ssoSilentFailure",
|
|
12247
|
+
ACQUIRE_TOKEN_BY_CODE_START: "msal:acquireTokenByCodeStart",
|
|
12248
|
+
ACQUIRE_TOKEN_BY_CODE_SUCCESS: "msal:acquireTokenByCodeSuccess",
|
|
12249
|
+
ACQUIRE_TOKEN_BY_CODE_FAILURE: "msal:acquireTokenByCodeFailure",
|
|
12250
|
+
HANDLE_REDIRECT_START: "msal:handleRedirectStart",
|
|
12251
|
+
HANDLE_REDIRECT_END: "msal:handleRedirectEnd",
|
|
12252
|
+
POPUP_OPENED: "msal:popupOpened",
|
|
12253
|
+
LOGOUT_START: "msal:logoutStart",
|
|
12254
|
+
LOGOUT_SUCCESS: "msal:logoutSuccess",
|
|
12255
|
+
LOGOUT_FAILURE: "msal:logoutFailure",
|
|
12256
|
+
LOGOUT_END: "msal:logoutEnd",
|
|
12257
|
+
RESTORE_FROM_BFCACHE: "msal:restoreFromBFCache"
|
|
12258
|
+
};
|
|
12273
12259
|
|
|
12274
12260
|
/*
|
|
12275
12261
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12276
12262
|
* Licensed under the MIT License.
|
|
12277
12263
|
*/
|
|
12278
|
-
|
|
12279
|
-
|
|
12280
|
-
|
|
12281
|
-
|
|
12282
|
-
|
|
12283
|
-
|
|
12284
|
-
|
|
12285
|
-
|
|
12286
|
-
|
|
12287
|
-
}
|
|
12264
|
+
const INVALID_METHOD_ERROR = -2147186943;
|
|
12265
|
+
const NativeStatusCode = {
|
|
12266
|
+
USER_INTERACTION_REQUIRED: "USER_INTERACTION_REQUIRED",
|
|
12267
|
+
USER_CANCEL: "USER_CANCEL",
|
|
12268
|
+
NO_NETWORK: "NO_NETWORK",
|
|
12269
|
+
TRANSIENT_ERROR: "TRANSIENT_ERROR",
|
|
12270
|
+
PERSISTENT_ERROR: "PERSISTENT_ERROR",
|
|
12271
|
+
DISABLED: "DISABLED",
|
|
12272
|
+
ACCOUNT_UNAVAILABLE: "ACCOUNT_UNAVAILABLE",
|
|
12273
|
+
};
|
|
12288
12274
|
const NativeAuthErrorMessage = {
|
|
12289
12275
|
extensionError: {
|
|
12290
12276
|
code: "ContentError",
|
|
@@ -12315,6 +12301,11 @@
|
|
|
12315
12301
|
this.ext.status === NativeStatusCode.DISABLED)) {
|
|
12316
12302
|
return true;
|
|
12317
12303
|
}
|
|
12304
|
+
if (this.ext &&
|
|
12305
|
+
this.ext.error &&
|
|
12306
|
+
this.ext.error === INVALID_METHOD_ERROR) {
|
|
12307
|
+
return true;
|
|
12308
|
+
}
|
|
12318
12309
|
switch (this.errorCode) {
|
|
12319
12310
|
case NativeAuthErrorMessage.extensionError.code:
|
|
12320
12311
|
return true;
|
|
@@ -12370,9 +12361,9 @@
|
|
|
12370
12361
|
* @param silentRequest
|
|
12371
12362
|
*/
|
|
12372
12363
|
async acquireToken(silentRequest) {
|
|
12373
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(
|
|
12364
|
+
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
|
|
12374
12365
|
// Telemetry manager only used to increment cacheHits here
|
|
12375
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
12366
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
12376
12367
|
const silentAuthClient = await this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
12377
12368
|
this.logger.verbose("Silent auth client created");
|
|
12378
12369
|
try {
|
|
@@ -12412,16 +12403,16 @@
|
|
|
12412
12403
|
*/
|
|
12413
12404
|
async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
12414
12405
|
// Create auth module.
|
|
12415
|
-
this.performanceClient.setPreQueueTime(
|
|
12406
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
12416
12407
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
12417
12408
|
return new SilentFlowClient(clientConfig, this.performanceClient);
|
|
12418
12409
|
}
|
|
12419
12410
|
async initializeSilentRequest(request, account) {
|
|
12420
|
-
this.performanceClient.addQueueMeasurement(
|
|
12421
|
-
this.performanceClient.setPreQueueTime(
|
|
12411
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);
|
|
12412
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
12422
12413
|
return {
|
|
12423
12414
|
...request,
|
|
12424
|
-
...
|
|
12415
|
+
...await this.initializeBaseRequest(request, account),
|
|
12425
12416
|
account: account,
|
|
12426
12417
|
forceRefresh: request.forceRefresh || false,
|
|
12427
12418
|
};
|
|
@@ -12448,7 +12439,7 @@
|
|
|
12448
12439
|
async acquireToken(request) {
|
|
12449
12440
|
this.logger.trace("NativeInteractionClient - acquireToken called.");
|
|
12450
12441
|
// start the perf measurement
|
|
12451
|
-
const nativeATMeasurement = this.performanceClient.startMeasurement(
|
|
12442
|
+
const nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
|
|
12452
12443
|
const reqTimestamp = TimeUtils.nowSeconds();
|
|
12453
12444
|
// initialize native request
|
|
12454
12445
|
const nativeRequest = await this.initializeNativeRequest(request);
|
|
@@ -12518,7 +12509,7 @@
|
|
|
12518
12509
|
this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided");
|
|
12519
12510
|
throw ClientAuthError.createNoAccountFoundError();
|
|
12520
12511
|
}
|
|
12521
|
-
// fetch the account from
|
|
12512
|
+
// fetch the account from browser cache
|
|
12522
12513
|
const account = this.browserStorage.getAccountInfoFilteredBy({
|
|
12523
12514
|
nativeAccountId,
|
|
12524
12515
|
});
|
|
@@ -12558,7 +12549,7 @@
|
|
|
12558
12549
|
}
|
|
12559
12550
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify(nativeRequest), true);
|
|
12560
12551
|
const navigationOptions = {
|
|
12561
|
-
apiId:
|
|
12552
|
+
apiId: ApiId.acquireTokenRedirect,
|
|
12562
12553
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
12563
12554
|
noHistory: false,
|
|
12564
12555
|
};
|
|
@@ -12636,7 +12627,7 @@
|
|
|
12636
12627
|
const result = await this.generateAuthenticationResult(response, request, idTokenObj, accountEntity, authority.canonicalAuthority, reqTimestamp);
|
|
12637
12628
|
// cache accounts and tokens in the appropriate storage
|
|
12638
12629
|
this.cacheAccount(accountEntity);
|
|
12639
|
-
this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
12630
|
+
this.cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
12640
12631
|
return result;
|
|
12641
12632
|
}
|
|
12642
12633
|
/**
|
|
@@ -12686,7 +12677,7 @@
|
|
|
12686
12677
|
* @param response
|
|
12687
12678
|
*/
|
|
12688
12679
|
async generatePopAccessToken(response, request) {
|
|
12689
|
-
if (request.tokenType ===
|
|
12680
|
+
if (request.tokenType === AuthenticationScheme.POP) {
|
|
12690
12681
|
/**
|
|
12691
12682
|
* This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
|
|
12692
12683
|
* is still received, SHR is calculated locally
|
|
@@ -12744,9 +12735,9 @@
|
|
|
12744
12735
|
Constants.EMPTY_STRING;
|
|
12745
12736
|
// generate PoP token as needed
|
|
12746
12737
|
const responseAccessToken = await this.generatePopAccessToken(response, request);
|
|
12747
|
-
const tokenType = request.tokenType ===
|
|
12748
|
-
?
|
|
12749
|
-
:
|
|
12738
|
+
const tokenType = request.tokenType === AuthenticationScheme.POP
|
|
12739
|
+
? AuthenticationScheme.POP
|
|
12740
|
+
: AuthenticationScheme.BEARER;
|
|
12750
12741
|
const result = {
|
|
12751
12742
|
authority: authority,
|
|
12752
12743
|
uniqueId: uid,
|
|
@@ -12787,20 +12778,21 @@
|
|
|
12787
12778
|
* @param tenantId
|
|
12788
12779
|
* @param reqTimestamp
|
|
12789
12780
|
*/
|
|
12790
|
-
cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
12791
|
-
|
|
12792
|
-
const idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
12793
|
-
this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
|
|
12781
|
+
cacheNativeTokens(response, request, homeAccountIdentifier, accountEntity, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
12782
|
+
const cachedIdToken = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
12794
12783
|
// cache accessToken in inmemory storage
|
|
12795
|
-
const expiresIn = request.tokenType ===
|
|
12784
|
+
const expiresIn = request.tokenType === AuthenticationScheme.POP
|
|
12796
12785
|
? Constants.SHR_NONCE_VALIDITY
|
|
12797
12786
|
: (typeof response.expires_in === "string"
|
|
12798
12787
|
? parseInt(response.expires_in, 10)
|
|
12799
12788
|
: response.expires_in) || 0;
|
|
12800
12789
|
const tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
12801
12790
|
const responseScopes = this.generateScopes(response, request);
|
|
12802
|
-
const
|
|
12803
|
-
|
|
12791
|
+
const cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenObj
|
|
12792
|
+
? idTokenObj.claims.tid || Constants.EMPTY_STRING
|
|
12793
|
+
: tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
|
|
12794
|
+
const nativeCacheRecord = new CacheRecord(accountEntity, cachedIdToken, cachedAccessToken);
|
|
12795
|
+
this.nativeStorageManager.saveCacheRecord(nativeCacheRecord);
|
|
12804
12796
|
}
|
|
12805
12797
|
addTelemetryFromNativeResponse(response) {
|
|
12806
12798
|
const mats = this.getMATSFromResponse(response);
|
|
@@ -12878,6 +12870,9 @@
|
|
|
12878
12870
|
async initializeNativeRequest(request) {
|
|
12879
12871
|
this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
|
|
12880
12872
|
const authority = request.authority || this.config.auth.authority;
|
|
12873
|
+
if (request.account) {
|
|
12874
|
+
await this.validateRequestAuthority(authority, request.account);
|
|
12875
|
+
}
|
|
12881
12876
|
const canonicalAuthority = new UrlString(authority);
|
|
12882
12877
|
canonicalAuthority.validateAsUri();
|
|
12883
12878
|
// 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.
|
|
@@ -12887,8 +12882,8 @@
|
|
|
12887
12882
|
const getPrompt = () => {
|
|
12888
12883
|
// If request is silent, prompt is always none
|
|
12889
12884
|
switch (this.apiId) {
|
|
12890
|
-
case
|
|
12891
|
-
case
|
|
12885
|
+
case ApiId.ssoSilent:
|
|
12886
|
+
case ApiId.acquireTokenSilent_silentFlow:
|
|
12892
12887
|
this.logger.trace("initializeNativeRequest: silent request sets prompt to none");
|
|
12893
12888
|
return PromptValue.NONE;
|
|
12894
12889
|
}
|
|
@@ -12927,7 +12922,7 @@
|
|
|
12927
12922
|
},
|
|
12928
12923
|
extendedExpiryToken: false, // Make this configurable?
|
|
12929
12924
|
};
|
|
12930
|
-
if (request.authenticationScheme ===
|
|
12925
|
+
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
12931
12926
|
// add POP request type
|
|
12932
12927
|
const shrParameters = {
|
|
12933
12928
|
resourceRequestUri: request.resourceRequestUri,
|
|
@@ -12959,7 +12954,7 @@
|
|
|
12959
12954
|
this.messageChannel = new MessageChannel();
|
|
12960
12955
|
this.windowListener = this.onWindowMessage.bind(this); // Window event callback doesn't have access to 'this' unless it's bound
|
|
12961
12956
|
this.performanceClient = performanceClient;
|
|
12962
|
-
this.handshakeEvent = performanceClient.startMeasurement(
|
|
12957
|
+
this.handshakeEvent = performanceClient.startMeasurement(PerformanceEvents.NativeMessageHandlerHandshake);
|
|
12963
12958
|
this.crypto = crypto;
|
|
12964
12959
|
}
|
|
12965
12960
|
/**
|
|
@@ -13188,8 +13183,8 @@
|
|
|
13188
13183
|
}
|
|
13189
13184
|
if (authenticationScheme) {
|
|
13190
13185
|
switch (authenticationScheme) {
|
|
13191
|
-
case
|
|
13192
|
-
case
|
|
13186
|
+
case AuthenticationScheme.BEARER:
|
|
13187
|
+
case AuthenticationScheme.POP:
|
|
13193
13188
|
logger.trace("isNativeAvailable: authenticationScheme is supported, returning true");
|
|
13194
13189
|
return true;
|
|
13195
13190
|
default:
|
|
@@ -13215,23 +13210,24 @@
|
|
|
13215
13210
|
* @param request
|
|
13216
13211
|
*/
|
|
13217
13212
|
async acquireToken(request) {
|
|
13218
|
-
this.performanceClient.setPreQueueTime(
|
|
13213
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
13219
13214
|
const validRequest = await this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect);
|
|
13220
13215
|
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
13221
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13216
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenRedirect);
|
|
13222
13217
|
const handleBackButton = (event) => {
|
|
13223
13218
|
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
13224
13219
|
if (event.persisted) {
|
|
13225
13220
|
this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
|
|
13226
13221
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
13222
|
+
this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, exports.InteractionType.Redirect);
|
|
13227
13223
|
}
|
|
13228
13224
|
};
|
|
13229
13225
|
try {
|
|
13230
13226
|
// Create auth code request and generate PKCE params
|
|
13231
|
-
this.performanceClient.setPreQueueTime(
|
|
13227
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
13232
13228
|
const authCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);
|
|
13233
13229
|
// Initialize the client
|
|
13234
|
-
this.performanceClient.setPreQueueTime(
|
|
13230
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
13235
13231
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);
|
|
13236
13232
|
this.logger.verbose("Auth code client created");
|
|
13237
13233
|
// Create redirect interaction handler.
|
|
@@ -13270,7 +13266,7 @@
|
|
|
13270
13266
|
* @param hash
|
|
13271
13267
|
*/
|
|
13272
13268
|
async handleRedirectPromise(hash) {
|
|
13273
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13269
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.handleRedirectPromise);
|
|
13274
13270
|
try {
|
|
13275
13271
|
if (!this.browserStorage.isInteractionInProgress(true)) {
|
|
13276
13272
|
this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null.");
|
|
@@ -13322,7 +13318,7 @@
|
|
|
13322
13318
|
*/
|
|
13323
13319
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);
|
|
13324
13320
|
const navigationOptions = {
|
|
13325
|
-
apiId:
|
|
13321
|
+
apiId: ApiId.handleRedirectPromise,
|
|
13326
13322
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
13327
13323
|
noHistory: true,
|
|
13328
13324
|
};
|
|
@@ -13395,7 +13391,7 @@
|
|
|
13395
13391
|
if (!this.nativeMessageHandler) {
|
|
13396
13392
|
throw BrowserAuthError.createNativeConnectionNotEstablishedError();
|
|
13397
13393
|
}
|
|
13398
|
-
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
13394
|
+
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);
|
|
13399
13395
|
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);
|
|
13400
13396
|
return nativeInteractionClient
|
|
13401
13397
|
.acquireToken({
|
|
@@ -13412,7 +13408,7 @@
|
|
|
13412
13408
|
if (!currentAuthority) {
|
|
13413
13409
|
throw BrowserAuthError.createNoCachedAuthorityError();
|
|
13414
13410
|
}
|
|
13415
|
-
this.performanceClient.setPreQueueTime(
|
|
13411
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, cachedRequest.correlationId);
|
|
13416
13412
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, currentAuthority);
|
|
13417
13413
|
this.logger.verbose("Auth code client created");
|
|
13418
13414
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);
|
|
@@ -13427,22 +13423,22 @@
|
|
|
13427
13423
|
async logout(logoutRequest) {
|
|
13428
13424
|
this.logger.verbose("logoutRedirect called");
|
|
13429
13425
|
const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
|
13430
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13426
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logout);
|
|
13431
13427
|
try {
|
|
13432
|
-
this.eventHandler.emitEvent(
|
|
13428
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_START, exports.InteractionType.Redirect, logoutRequest);
|
|
13433
13429
|
// Clear cache on logout
|
|
13434
13430
|
await this.clearCacheOnLogout(validLogoutRequest.account);
|
|
13435
13431
|
const navigationOptions = {
|
|
13436
|
-
apiId:
|
|
13432
|
+
apiId: ApiId.logout,
|
|
13437
13433
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
13438
13434
|
noHistory: false,
|
|
13439
13435
|
};
|
|
13440
|
-
this.performanceClient.setPreQueueTime(
|
|
13436
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validLogoutRequest.correlationId);
|
|
13441
13437
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, logoutRequest && logoutRequest.authority);
|
|
13442
13438
|
this.logger.verbose("Auth code client created");
|
|
13443
13439
|
// Create logout string and navigate user window to logout.
|
|
13444
13440
|
const logoutUri = authClient.getLogoutUri(validLogoutRequest);
|
|
13445
|
-
this.eventHandler.emitEvent(
|
|
13441
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Redirect, validLogoutRequest);
|
|
13446
13442
|
// Check if onRedirectNavigate is implemented, and invoke it if so
|
|
13447
13443
|
if (logoutRequest &&
|
|
13448
13444
|
typeof logoutRequest.onRedirectNavigate === "function") {
|
|
@@ -13476,11 +13472,11 @@
|
|
|
13476
13472
|
e.setCorrelationId(this.correlationId);
|
|
13477
13473
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
13478
13474
|
}
|
|
13479
|
-
this.eventHandler.emitEvent(
|
|
13480
|
-
this.eventHandler.emitEvent(
|
|
13475
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
13476
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Redirect);
|
|
13481
13477
|
throw e;
|
|
13482
13478
|
}
|
|
13483
|
-
this.eventHandler.emitEvent(
|
|
13479
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Redirect);
|
|
13484
13480
|
}
|
|
13485
13481
|
/**
|
|
13486
13482
|
* Use to get the redirectStartPage either from request or use current window
|
|
@@ -13569,16 +13565,16 @@
|
|
|
13569
13565
|
*/
|
|
13570
13566
|
async acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup) {
|
|
13571
13567
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
13572
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13573
|
-
this.performanceClient.setPreQueueTime(
|
|
13568
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);
|
|
13569
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
13574
13570
|
const validRequest = await this.initializeAuthorizationRequest(request, exports.InteractionType.Popup);
|
|
13575
13571
|
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
|
|
13576
13572
|
try {
|
|
13577
13573
|
// Create auth code request and generate PKCE params
|
|
13578
|
-
this.performanceClient.setPreQueueTime(
|
|
13574
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
13579
13575
|
const authCodeRequest = await this.initializeAuthorizationCodeRequest(validRequest);
|
|
13580
13576
|
// Initialize the client
|
|
13581
|
-
this.performanceClient.setPreQueueTime(
|
|
13577
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
13582
13578
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions);
|
|
13583
13579
|
this.logger.verbose("Auth code client created");
|
|
13584
13580
|
const isNativeBroker = NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);
|
|
@@ -13586,7 +13582,7 @@
|
|
|
13586
13582
|
let fetchNativeAccountIdMeasurement;
|
|
13587
13583
|
if (isNativeBroker) {
|
|
13588
13584
|
fetchNativeAccountIdMeasurement =
|
|
13589
|
-
this.performanceClient.startMeasurement(
|
|
13585
|
+
this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);
|
|
13590
13586
|
}
|
|
13591
13587
|
// Create acquire token url.
|
|
13592
13588
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
@@ -13602,7 +13598,7 @@
|
|
|
13602
13598
|
popupWindowAttributes,
|
|
13603
13599
|
};
|
|
13604
13600
|
const popupWindow = this.initiateAuthRequest(navigateUrl, popupParameters);
|
|
13605
|
-
this.eventHandler.emitEvent(
|
|
13601
|
+
this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
|
|
13606
13602
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
13607
13603
|
const hash = await this.monitorPopupForHash(popupWindow);
|
|
13608
13604
|
// Deserialize hash fragment response parameters.
|
|
@@ -13622,7 +13618,7 @@
|
|
|
13622
13618
|
if (!this.nativeMessageHandler) {
|
|
13623
13619
|
throw BrowserAuthError.createNativeConnectionNotEstablishedError();
|
|
13624
13620
|
}
|
|
13625
|
-
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
13621
|
+
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);
|
|
13626
13622
|
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);
|
|
13627
13623
|
return nativeInteractionClient
|
|
13628
13624
|
.acquireToken({
|
|
@@ -13662,29 +13658,29 @@
|
|
|
13662
13658
|
*/
|
|
13663
13659
|
async logoutPopupAsync(validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
|
|
13664
13660
|
this.logger.verbose("logoutPopupAsync called");
|
|
13665
|
-
this.eventHandler.emitEvent(
|
|
13666
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
13661
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_START, exports.InteractionType.Popup, validRequest);
|
|
13662
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);
|
|
13667
13663
|
try {
|
|
13668
13664
|
// Clear cache on logout
|
|
13669
13665
|
await this.clearCacheOnLogout(validRequest.account);
|
|
13670
13666
|
// Initialize the client
|
|
13671
|
-
this.performanceClient.setPreQueueTime(
|
|
13667
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, validRequest.correlationId);
|
|
13672
13668
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, requestAuthority);
|
|
13673
13669
|
this.logger.verbose("Auth code client created");
|
|
13674
13670
|
// Create logout string and navigate user window to logout.
|
|
13675
13671
|
const logoutUri = authClient.getLogoutUri(validRequest);
|
|
13676
|
-
this.eventHandler.emitEvent(
|
|
13672
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, exports.InteractionType.Popup, validRequest);
|
|
13677
13673
|
// Open the popup window to requestUrl.
|
|
13678
13674
|
const popupWindow = this.openPopup(logoutUri, {
|
|
13679
13675
|
popupName,
|
|
13680
13676
|
popupWindowAttributes,
|
|
13681
13677
|
popup,
|
|
13682
13678
|
});
|
|
13683
|
-
this.eventHandler.emitEvent(
|
|
13679
|
+
this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
|
|
13684
13680
|
await this.waitForLogoutPopup(popupWindow);
|
|
13685
13681
|
if (mainWindowRedirectUri) {
|
|
13686
13682
|
const navigationOptions = {
|
|
13687
|
-
apiId:
|
|
13683
|
+
apiId: ApiId.logoutPopup,
|
|
13688
13684
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
13689
13685
|
noHistory: false,
|
|
13690
13686
|
};
|
|
@@ -13707,11 +13703,11 @@
|
|
|
13707
13703
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
13708
13704
|
}
|
|
13709
13705
|
this.browserStorage.setInteractionInProgress(false);
|
|
13710
|
-
this.eventHandler.emitEvent(
|
|
13711
|
-
this.eventHandler.emitEvent(
|
|
13706
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null, e);
|
|
13707
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
13712
13708
|
throw e;
|
|
13713
13709
|
}
|
|
13714
|
-
this.eventHandler.emitEvent(
|
|
13710
|
+
this.eventHandler.emitEvent(EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
13715
13711
|
}
|
|
13716
13712
|
/**
|
|
13717
13713
|
* Opens a popup window with given request Url.
|
|
@@ -14040,24 +14036,25 @@
|
|
|
14040
14036
|
postLogoutRedirectUri: Constants.EMPTY_STRING,
|
|
14041
14037
|
navigateToLoginRequestUrl: true,
|
|
14042
14038
|
clientCapabilities: [],
|
|
14043
|
-
protocolMode:
|
|
14039
|
+
protocolMode: ProtocolMode.AAD,
|
|
14044
14040
|
azureCloudOptions: {
|
|
14045
|
-
azureCloudInstance:
|
|
14041
|
+
azureCloudInstance: AzureCloudInstance.None,
|
|
14046
14042
|
tenant: Constants.EMPTY_STRING,
|
|
14047
14043
|
},
|
|
14048
14044
|
skipAuthorityMetadataCache: false,
|
|
14049
14045
|
};
|
|
14050
14046
|
// Default cache options for browser
|
|
14051
14047
|
const DEFAULT_CACHE_OPTIONS = {
|
|
14052
|
-
cacheLocation:
|
|
14053
|
-
temporaryCacheLocation:
|
|
14048
|
+
cacheLocation: BrowserCacheLocation.SessionStorage,
|
|
14049
|
+
temporaryCacheLocation: BrowserCacheLocation.SessionStorage,
|
|
14054
14050
|
storeAuthStateInCookie: false,
|
|
14055
14051
|
secureCookies: false,
|
|
14056
14052
|
// 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
|
|
14057
14053
|
cacheMigrationEnabled: userInputCache &&
|
|
14058
|
-
userInputCache.cacheLocation ===
|
|
14054
|
+
userInputCache.cacheLocation === BrowserCacheLocation.LocalStorage
|
|
14059
14055
|
? true
|
|
14060
14056
|
: false,
|
|
14057
|
+
claimsBasedCachingEnabled: false,
|
|
14061
14058
|
};
|
|
14062
14059
|
// Default logger options for browser
|
|
14063
14060
|
const DEFAULT_LOGGER_OPTIONS = {
|
|
@@ -14088,10 +14085,6 @@
|
|
|
14088
14085
|
nativeBrokerHandshakeTimeout: userInputSystem?.nativeBrokerHandshakeTimeout ||
|
|
14089
14086
|
DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
|
|
14090
14087
|
pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS,
|
|
14091
|
-
cryptoOptions: {
|
|
14092
|
-
useMsrCrypto: false,
|
|
14093
|
-
entropy: undefined,
|
|
14094
|
-
},
|
|
14095
14088
|
};
|
|
14096
14089
|
const providedSystemOptions = {
|
|
14097
14090
|
...userInputSystem,
|
|
@@ -14128,14 +14121,14 @@
|
|
|
14128
14121
|
* @param userRequestScopes
|
|
14129
14122
|
*/
|
|
14130
14123
|
async initiateAuthRequest(requestUrl) {
|
|
14131
|
-
this.performanceClient.addQueueMeasurement(
|
|
14124
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerInitiateAuthRequest, this.authCodeRequest.correlationId);
|
|
14132
14125
|
if (StringUtils.isEmpty(requestUrl)) {
|
|
14133
14126
|
// Throw error if request URL is empty.
|
|
14134
14127
|
this.logger.info("Navigate url is empty");
|
|
14135
14128
|
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
14136
14129
|
}
|
|
14137
14130
|
if (this.navigateFrameWait) {
|
|
14138
|
-
this.performanceClient.setPreQueueTime(
|
|
14131
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
14139
14132
|
return await this.loadFrame(requestUrl);
|
|
14140
14133
|
}
|
|
14141
14134
|
return this.loadFrameSync(requestUrl);
|
|
@@ -14146,7 +14139,7 @@
|
|
|
14146
14139
|
* @param timeout
|
|
14147
14140
|
*/
|
|
14148
14141
|
monitorIframeForHash(iframe, timeout) {
|
|
14149
|
-
this.performanceClient.addQueueMeasurement(
|
|
14142
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerMonitorIframeForHash, this.authCodeRequest.correlationId);
|
|
14150
14143
|
return new Promise((resolve, reject) => {
|
|
14151
14144
|
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
14152
14145
|
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.`);
|
|
@@ -14219,7 +14212,7 @@
|
|
|
14219
14212
|
* @ignore
|
|
14220
14213
|
*/
|
|
14221
14214
|
loadFrame(urlNavigate) {
|
|
14222
|
-
this.performanceClient.addQueueMeasurement(
|
|
14215
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerLoadFrame, this.authCodeRequest.correlationId);
|
|
14223
14216
|
/*
|
|
14224
14217
|
* This trick overcomes iframe navigation in IE
|
|
14225
14218
|
* IE does not load the page consistently in iframe
|
|
@@ -14290,9 +14283,9 @@
|
|
|
14290
14283
|
* @param request
|
|
14291
14284
|
*/
|
|
14292
14285
|
async acquireToken(request) {
|
|
14293
|
-
this.performanceClient.addQueueMeasurement(
|
|
14286
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
14294
14287
|
this.logger.verbose("acquireTokenByIframe called");
|
|
14295
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(
|
|
14288
|
+
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
14296
14289
|
// Check that we have some SSO data
|
|
14297
14290
|
if (StringUtils.isEmpty(request.loginHint) &&
|
|
14298
14291
|
StringUtils.isEmpty(request.sid) &&
|
|
@@ -14309,7 +14302,7 @@
|
|
|
14309
14302
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
14310
14303
|
}
|
|
14311
14304
|
// Create silent request
|
|
14312
|
-
this.performanceClient.setPreQueueTime(
|
|
14305
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
14313
14306
|
const silentRequest = await this.initializeAuthorizationRequest({
|
|
14314
14307
|
...request,
|
|
14315
14308
|
prompt: request.prompt || PromptValue.NONE,
|
|
@@ -14318,10 +14311,10 @@
|
|
|
14318
14311
|
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
14319
14312
|
try {
|
|
14320
14313
|
// Initialize the client
|
|
14321
|
-
this.performanceClient.setPreQueueTime(
|
|
14314
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, request.correlationId);
|
|
14322
14315
|
const authClient = await this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
14323
14316
|
this.logger.verbose("Auth code client created");
|
|
14324
|
-
this.performanceClient.setPreQueueTime(
|
|
14317
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientTokenHelper, request.correlationId);
|
|
14325
14318
|
return await this.silentTokenHelper(authClient, silentRequest).then((result) => {
|
|
14326
14319
|
acquireTokenMeasurement.endMeasurement({
|
|
14327
14320
|
success: true,
|
|
@@ -14359,12 +14352,12 @@
|
|
|
14359
14352
|
* @param userRequestScopes
|
|
14360
14353
|
*/
|
|
14361
14354
|
async silentTokenHelper(authClient, silentRequest) {
|
|
14362
|
-
this.performanceClient.addQueueMeasurement(
|
|
14355
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, silentRequest.correlationId);
|
|
14363
14356
|
// Create auth code request and generate PKCE params
|
|
14364
|
-
this.performanceClient.setPreQueueTime(
|
|
14357
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, silentRequest.correlationId);
|
|
14365
14358
|
const authCodeRequest = await this.initializeAuthorizationCodeRequest(silentRequest);
|
|
14366
14359
|
// Create authorize request url
|
|
14367
|
-
this.performanceClient.setPreQueueTime(
|
|
14360
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.GetAuthCodeUrl, silentRequest.correlationId);
|
|
14368
14361
|
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
14369
14362
|
...silentRequest,
|
|
14370
14363
|
nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
|
|
@@ -14372,10 +14365,10 @@
|
|
|
14372
14365
|
// Create silent handler
|
|
14373
14366
|
const silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);
|
|
14374
14367
|
// Get the frame handle for the silent request
|
|
14375
|
-
this.performanceClient.setPreQueueTime(
|
|
14368
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerInitiateAuthRequest, silentRequest.correlationId);
|
|
14376
14369
|
const msalFrame = await silentHandler.initiateAuthRequest(navigateUrl);
|
|
14377
14370
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
14378
|
-
this.performanceClient.setPreQueueTime(
|
|
14371
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentHandlerMonitorIframeForHash, silentRequest.correlationId);
|
|
14379
14372
|
const hash = await silentHandler.monitorIframeForHash(msalFrame, this.config.system.iframeHashTimeout);
|
|
14380
14373
|
// Deserialize hash fragment response parameters.
|
|
14381
14374
|
const serverParams = UrlString.getDeserializedHash(hash);
|
|
@@ -14398,7 +14391,7 @@
|
|
|
14398
14391
|
});
|
|
14399
14392
|
}
|
|
14400
14393
|
// Handle response from hash string
|
|
14401
|
-
this.performanceClient.setPreQueueTime(
|
|
14394
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.HandleCodeResponseFromHash, silentRequest.correlationId);
|
|
14402
14395
|
return silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient);
|
|
14403
14396
|
}
|
|
14404
14397
|
}
|
|
@@ -14413,20 +14406,21 @@
|
|
|
14413
14406
|
* @param request
|
|
14414
14407
|
*/
|
|
14415
14408
|
async acquireToken(request) {
|
|
14416
|
-
this.performanceClient.addQueueMeasurement(
|
|
14417
|
-
this.performanceClient.setPreQueueTime(
|
|
14409
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
|
14410
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeBaseRequest, request.correlationId);
|
|
14418
14411
|
const silentRequest = {
|
|
14419
14412
|
...request,
|
|
14420
|
-
...
|
|
14413
|
+
...await this.initializeBaseRequest(request, request.account)
|
|
14421
14414
|
};
|
|
14422
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(
|
|
14423
|
-
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
14415
|
+
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
|
|
14416
|
+
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
14424
14417
|
const refreshTokenClient = await this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
14425
14418
|
this.logger.verbose("Refresh token client created");
|
|
14426
14419
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
14427
|
-
this.performanceClient.setPreQueueTime(
|
|
14420
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
|
|
14428
14421
|
return refreshTokenClient
|
|
14429
14422
|
.acquireTokenByRefreshToken(silentRequest)
|
|
14423
|
+
.then((result) => result)
|
|
14430
14424
|
.then((result) => {
|
|
14431
14425
|
acquireTokenMeasurement.endMeasurement({
|
|
14432
14426
|
success: true,
|
|
@@ -14460,7 +14454,7 @@
|
|
|
14460
14454
|
*/
|
|
14461
14455
|
async createRefreshTokenClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
14462
14456
|
// Create auth module.
|
|
14463
|
-
this.performanceClient.setPreQueueTime(
|
|
14457
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
14464
14458
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
14465
14459
|
return new RefreshTokenClient(clientConfig, this.performanceClient);
|
|
14466
14460
|
}
|
|
@@ -14573,11 +14567,11 @@
|
|
|
14573
14567
|
const accountInfo = accountEntity.getAccountInfo();
|
|
14574
14568
|
if (!e.oldValue && e.newValue) {
|
|
14575
14569
|
this.logger.info("Account was added to cache in a different window");
|
|
14576
|
-
this.emitEvent(
|
|
14570
|
+
this.emitEvent(EventType.ACCOUNT_ADDED, undefined, accountInfo);
|
|
14577
14571
|
}
|
|
14578
14572
|
else if (!e.newValue && e.oldValue) {
|
|
14579
14573
|
this.logger.info("Account was removed from cache in a different window");
|
|
14580
|
-
this.emitEvent(
|
|
14574
|
+
this.emitEvent(EventType.ACCOUNT_REMOVED, undefined, accountInfo);
|
|
14581
14575
|
}
|
|
14582
14576
|
}
|
|
14583
14577
|
catch (e) {
|
|
@@ -14784,18 +14778,6 @@
|
|
|
14784
14778
|
}
|
|
14785
14779
|
return aBytes;
|
|
14786
14780
|
}
|
|
14787
|
-
/**
|
|
14788
|
-
* Converst string to ArrayBuffer
|
|
14789
|
-
* @param dataString
|
|
14790
|
-
*/
|
|
14791
|
-
static stringToArrayBuffer(dataString) {
|
|
14792
|
-
const data = new ArrayBuffer(dataString.length);
|
|
14793
|
-
const dataView = new Uint8Array(data);
|
|
14794
|
-
for (let i = 0; i < dataString.length; i++) {
|
|
14795
|
-
dataView[i] = dataString.charCodeAt(i);
|
|
14796
|
-
}
|
|
14797
|
-
return data;
|
|
14798
|
-
}
|
|
14799
14781
|
/**
|
|
14800
14782
|
* Converts Uint8Array to a string
|
|
14801
14783
|
* @param aBytes
|
|
@@ -15093,115 +15075,6 @@
|
|
|
15093
15075
|
}
|
|
15094
15076
|
}
|
|
15095
15077
|
|
|
15096
|
-
/*
|
|
15097
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15098
|
-
* Licensed under the MIT License.
|
|
15099
|
-
*/
|
|
15100
|
-
class MsrBrowserCrypto {
|
|
15101
|
-
initPrng(entropy) {
|
|
15102
|
-
// Turn into array, as initPrng seems to not always like Uint8Array (even though it should support both)
|
|
15103
|
-
return window.msrCrypto.initPrng([...entropy]);
|
|
15104
|
-
}
|
|
15105
|
-
getRandomValues(dataBuffer) {
|
|
15106
|
-
return window.msrCrypto.getRandomValues(dataBuffer);
|
|
15107
|
-
}
|
|
15108
|
-
async generateKey(algorithm, extractable, keyUsages) {
|
|
15109
|
-
return window.msrCrypto.subtle.generateKey(algorithm, extractable, keyUsages);
|
|
15110
|
-
}
|
|
15111
|
-
async exportKey(key) {
|
|
15112
|
-
return window.msrCrypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
15113
|
-
}
|
|
15114
|
-
async importKey(keyData, algorithm, extractable, keyUsages) {
|
|
15115
|
-
return window.msrCrypto.subtle.importKey(KEY_FORMAT_JWK, keyData, algorithm, extractable, keyUsages);
|
|
15116
|
-
}
|
|
15117
|
-
async sign(algorithm, key, data) {
|
|
15118
|
-
return window.msrCrypto.subtle.sign(algorithm, key, data);
|
|
15119
|
-
}
|
|
15120
|
-
async digest(algorithm, data) {
|
|
15121
|
-
return window.msrCrypto.subtle.digest(algorithm, data);
|
|
15122
|
-
}
|
|
15123
|
-
}
|
|
15124
|
-
|
|
15125
|
-
/*
|
|
15126
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15127
|
-
* Licensed under the MIT License.
|
|
15128
|
-
*/
|
|
15129
|
-
class MsBrowserCrypto {
|
|
15130
|
-
getRandomValues(dataBuffer) {
|
|
15131
|
-
return window["msCrypto"].getRandomValues(dataBuffer);
|
|
15132
|
-
}
|
|
15133
|
-
async generateKey(algorithm, extractable, keyUsages) {
|
|
15134
|
-
return new Promise((resolve, reject) => {
|
|
15135
|
-
const msGenerateKey = window["msCrypto"].subtle.generateKey(algorithm, extractable, keyUsages);
|
|
15136
|
-
msGenerateKey.addEventListener("complete", (e) => {
|
|
15137
|
-
resolve(e.target.result);
|
|
15138
|
-
});
|
|
15139
|
-
msGenerateKey.addEventListener("error", (error) => {
|
|
15140
|
-
reject(error);
|
|
15141
|
-
});
|
|
15142
|
-
});
|
|
15143
|
-
}
|
|
15144
|
-
async exportKey(key) {
|
|
15145
|
-
return new Promise((resolve, reject) => {
|
|
15146
|
-
const msExportKey = window["msCrypto"].subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
15147
|
-
msExportKey.addEventListener("complete", (e) => {
|
|
15148
|
-
const resultBuffer = e.target.result;
|
|
15149
|
-
const resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))
|
|
15150
|
-
.replace(/\r/g, Constants.EMPTY_STRING)
|
|
15151
|
-
.replace(/\n/g, Constants.EMPTY_STRING)
|
|
15152
|
-
.replace(/\t/g, Constants.EMPTY_STRING)
|
|
15153
|
-
.split(" ")
|
|
15154
|
-
.join(Constants.EMPTY_STRING)
|
|
15155
|
-
.replace("\u0000", Constants.EMPTY_STRING);
|
|
15156
|
-
try {
|
|
15157
|
-
resolve(JSON.parse(resultString));
|
|
15158
|
-
}
|
|
15159
|
-
catch (e) {
|
|
15160
|
-
reject(e);
|
|
15161
|
-
}
|
|
15162
|
-
});
|
|
15163
|
-
msExportKey.addEventListener("error", (error) => {
|
|
15164
|
-
reject(error);
|
|
15165
|
-
});
|
|
15166
|
-
});
|
|
15167
|
-
}
|
|
15168
|
-
async importKey(keyData, algorithm, extractable, keyUsages) {
|
|
15169
|
-
const keyString = BrowserStringUtils.getSortedObjectString(keyData);
|
|
15170
|
-
const keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);
|
|
15171
|
-
return new Promise((resolve, reject) => {
|
|
15172
|
-
const msImportKey = window["msCrypto"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer, algorithm, extractable, keyUsages);
|
|
15173
|
-
msImportKey.addEventListener("complete", (e) => {
|
|
15174
|
-
resolve(e.target.result);
|
|
15175
|
-
});
|
|
15176
|
-
msImportKey.addEventListener("error", (error) => {
|
|
15177
|
-
reject(error);
|
|
15178
|
-
});
|
|
15179
|
-
});
|
|
15180
|
-
}
|
|
15181
|
-
async sign(algorithm, key, data) {
|
|
15182
|
-
return new Promise((resolve, reject) => {
|
|
15183
|
-
const msSign = window["msCrypto"].subtle.sign(algorithm, key, data);
|
|
15184
|
-
msSign.addEventListener("complete", (e) => {
|
|
15185
|
-
resolve(e.target.result);
|
|
15186
|
-
});
|
|
15187
|
-
msSign.addEventListener("error", (error) => {
|
|
15188
|
-
reject(error);
|
|
15189
|
-
});
|
|
15190
|
-
});
|
|
15191
|
-
}
|
|
15192
|
-
async digest(algorithm, data) {
|
|
15193
|
-
return new Promise((resolve, reject) => {
|
|
15194
|
-
const digestOperation = window["msCrypto"].subtle.digest(algorithm, data.buffer);
|
|
15195
|
-
digestOperation.addEventListener("complete", (e) => {
|
|
15196
|
-
resolve(e.target.result);
|
|
15197
|
-
});
|
|
15198
|
-
digestOperation.addEventListener("error", (error) => {
|
|
15199
|
-
reject(error);
|
|
15200
|
-
});
|
|
15201
|
-
});
|
|
15202
|
-
}
|
|
15203
|
-
}
|
|
15204
|
-
|
|
15205
15078
|
/*
|
|
15206
15079
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15207
15080
|
* Licensed under the MIT License.
|
|
@@ -15222,40 +15095,16 @@
|
|
|
15222
15095
|
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
15223
15096
|
*/
|
|
15224
15097
|
class BrowserCrypto {
|
|
15225
|
-
constructor(logger
|
|
15098
|
+
constructor(logger) {
|
|
15226
15099
|
this.logger = logger;
|
|
15227
|
-
this.cryptoOptions = cryptoOptions;
|
|
15228
15100
|
if (this.hasBrowserCrypto()) {
|
|
15229
15101
|
// Use standard modern web crypto if available
|
|
15230
15102
|
this.logger.verbose("BrowserCrypto: modern crypto interface available");
|
|
15231
15103
|
this.subtleCrypto = new ModernBrowserCrypto();
|
|
15232
15104
|
}
|
|
15233
|
-
else if (this.hasIECrypto()) {
|
|
15234
|
-
// For IE11, use msCrypto interface
|
|
15235
|
-
this.logger.verbose("BrowserCrypto: MS crypto interface available");
|
|
15236
|
-
this.subtleCrypto = new MsBrowserCrypto();
|
|
15237
|
-
}
|
|
15238
|
-
else if (this.hasMsrCrypto() && this.cryptoOptions?.useMsrCrypto) {
|
|
15239
|
-
// For other browsers, use MSR Crypto if found
|
|
15240
|
-
this.logger.verbose("BrowserCrypto: MSR crypto interface available");
|
|
15241
|
-
this.subtleCrypto = new MsrBrowserCrypto();
|
|
15242
|
-
}
|
|
15243
15105
|
else {
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
}
|
|
15247
|
-
this.logger.error("BrowserCrypto: No crypto interfaces available.");
|
|
15248
|
-
throw BrowserAuthError.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");
|
|
15249
|
-
}
|
|
15250
|
-
// Mainly needed for MSR Crypto: https://github.com/microsoft/MSR-JavaScript-Crypto#random-number-generator-prng
|
|
15251
|
-
if (this.subtleCrypto.initPrng) {
|
|
15252
|
-
this.logger.verbose("BrowserCrypto: Interface requires entropy");
|
|
15253
|
-
if (!this.cryptoOptions?.entropy) {
|
|
15254
|
-
this.logger.error("BrowserCrypto: Interface requires entropy but none provided.");
|
|
15255
|
-
throw BrowserConfigurationAuthError.createEntropyNotProvided();
|
|
15256
|
-
}
|
|
15257
|
-
this.logger.verbose("BrowserCrypto: Entropy provided");
|
|
15258
|
-
this.subtleCrypto.initPrng(this.cryptoOptions.entropy);
|
|
15106
|
+
this.logger.error("BrowserCrypto: crypto interface is unavailable");
|
|
15107
|
+
throw BrowserAuthError.createCryptoNotAvailableError("Browser crypto interface is not available.");
|
|
15259
15108
|
}
|
|
15260
15109
|
this.keygenAlgorithmOptions = {
|
|
15261
15110
|
name: PKCS1_V15_KEYGEN_ALG,
|
|
@@ -15264,24 +15113,12 @@
|
|
|
15264
15113
|
publicExponent: PUBLIC_EXPONENT,
|
|
15265
15114
|
};
|
|
15266
15115
|
}
|
|
15267
|
-
/**
|
|
15268
|
-
* Check whether IE crypto or other browser cryptography is available.
|
|
15269
|
-
*/
|
|
15270
|
-
hasIECrypto() {
|
|
15271
|
-
return "msCrypto" in window;
|
|
15272
|
-
}
|
|
15273
15116
|
/**
|
|
15274
15117
|
* Check whether browser crypto is available.
|
|
15275
15118
|
*/
|
|
15276
15119
|
hasBrowserCrypto() {
|
|
15277
15120
|
return "crypto" in window;
|
|
15278
15121
|
}
|
|
15279
|
-
/**
|
|
15280
|
-
* Check whether MSR crypto polyfill is available
|
|
15281
|
-
*/
|
|
15282
|
-
hasMsrCrypto() {
|
|
15283
|
-
return "msrCrypto" in window;
|
|
15284
|
-
}
|
|
15285
15122
|
/**
|
|
15286
15123
|
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
15287
15124
|
* @param dataString
|
|
@@ -15309,7 +15146,6 @@
|
|
|
15309
15146
|
/**
|
|
15310
15147
|
* Export key as Json Web Key (JWK)
|
|
15311
15148
|
* @param key
|
|
15312
|
-
* @param format
|
|
15313
15149
|
*/
|
|
15314
15150
|
async exportJwk(key) {
|
|
15315
15151
|
return this.subtleCrypto.exportKey(key);
|
|
@@ -15317,7 +15153,6 @@
|
|
|
15317
15153
|
/**
|
|
15318
15154
|
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
15319
15155
|
* @param key
|
|
15320
|
-
* @param format
|
|
15321
15156
|
* @param extractable
|
|
15322
15157
|
* @param usages
|
|
15323
15158
|
*/
|
|
@@ -15662,11 +15497,10 @@
|
|
|
15662
15497
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15663
15498
|
* Licensed under the MIT License.
|
|
15664
15499
|
*/
|
|
15665
|
-
|
|
15666
|
-
|
|
15667
|
-
|
|
15668
|
-
|
|
15669
|
-
})(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));
|
|
15500
|
+
const CryptoKeyStoreNames = {
|
|
15501
|
+
asymmetricKeys: "asymmetricKeys",
|
|
15502
|
+
symmetricKeys: "symmetricKeys",
|
|
15503
|
+
};
|
|
15670
15504
|
/**
|
|
15671
15505
|
* MSAL CryptoKeyStore DB Version 2
|
|
15672
15506
|
*/
|
|
@@ -15709,10 +15543,10 @@
|
|
|
15709
15543
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
15710
15544
|
*/
|
|
15711
15545
|
class CryptoOps {
|
|
15712
|
-
constructor(logger, performanceClient
|
|
15546
|
+
constructor(logger, performanceClient) {
|
|
15713
15547
|
this.logger = logger;
|
|
15714
15548
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
15715
|
-
this.browserCrypto = new BrowserCrypto(this.logger
|
|
15549
|
+
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
15716
15550
|
this.b64Encode = new Base64Encode();
|
|
15717
15551
|
this.b64Decode = new Base64Decode();
|
|
15718
15552
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
@@ -15752,7 +15586,7 @@
|
|
|
15752
15586
|
* @param request
|
|
15753
15587
|
*/
|
|
15754
15588
|
async getPublicKeyThumbprint(request) {
|
|
15755
|
-
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(
|
|
15589
|
+
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);
|
|
15756
15590
|
// Generate Keypair
|
|
15757
15591
|
const keyPair = await this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES);
|
|
15758
15592
|
// Generate Thumbprint for Public Key
|
|
@@ -15803,7 +15637,7 @@
|
|
|
15803
15637
|
* @param kid
|
|
15804
15638
|
*/
|
|
15805
15639
|
async signJwt(payload, kid, correlationId) {
|
|
15806
|
-
const signJwtMeasurement = this.performanceClient?.startMeasurement(
|
|
15640
|
+
const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
15807
15641
|
const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);
|
|
15808
15642
|
if (!cachedKeyPair) {
|
|
15809
15643
|
throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);
|
|
@@ -15827,7 +15661,7 @@
|
|
|
15827
15661
|
// Form token string
|
|
15828
15662
|
const tokenString = `${encodedShrHeader}.${encodedPayload}`;
|
|
15829
15663
|
// Sign token
|
|
15830
|
-
const tokenBuffer = BrowserStringUtils.
|
|
15664
|
+
const tokenBuffer = BrowserStringUtils.stringToUtf8Arr(tokenString);
|
|
15831
15665
|
const signatureBuffer = await this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer);
|
|
15832
15666
|
const encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
15833
15667
|
const signedJwt = `${tokenString}.${encodedSignature}`;
|
|
@@ -15949,9 +15783,9 @@
|
|
|
15949
15783
|
* Licensed under the MIT License.
|
|
15950
15784
|
*/
|
|
15951
15785
|
class BrowserPerformanceClient extends PerformanceClient {
|
|
15952
|
-
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry
|
|
15786
|
+
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
|
|
15953
15787
|
super(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry);
|
|
15954
|
-
this.browserCrypto = new BrowserCrypto(this.logger
|
|
15788
|
+
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
15955
15789
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
15956
15790
|
}
|
|
15957
15791
|
startPerformanceMeasurement(measureName, correlationId) {
|
|
@@ -16080,6 +15914,7 @@
|
|
|
16080
15914
|
BrowserConstants: BrowserConstants,
|
|
16081
15915
|
BrowserPerformanceClient: BrowserPerformanceClient,
|
|
16082
15916
|
BrowserPerformanceMeasurement: BrowserPerformanceMeasurement,
|
|
15917
|
+
CacheRecord: CacheRecord,
|
|
16083
15918
|
CryptoOps: CryptoOps,
|
|
16084
15919
|
EventHandler: EventHandler,
|
|
16085
15920
|
NativeAuthError: NativeAuthError,
|
|
@@ -16092,7 +15927,7 @@
|
|
|
16092
15927
|
SilentIframeClient: SilentIframeClient,
|
|
16093
15928
|
SilentRefreshClient: SilentRefreshClient,
|
|
16094
15929
|
StandardInteractionClient: StandardInteractionClient,
|
|
16095
|
-
|
|
15930
|
+
TemporaryCacheKeys: TemporaryCacheKeys
|
|
16096
15931
|
});
|
|
16097
15932
|
|
|
16098
15933
|
/*
|
|
@@ -16468,9 +16303,7 @@
|
|
|
16468
16303
|
uniqueId: uid,
|
|
16469
16304
|
tenantId: tid,
|
|
16470
16305
|
scopes: responseScopes,
|
|
16471
|
-
account: cacheRecord
|
|
16472
|
-
? cacheRecord.account.getAccountInfo()
|
|
16473
|
-
: null,
|
|
16306
|
+
account: cacheRecord.account.getAccountInfo(),
|
|
16474
16307
|
idToken: idTokenObj ? idTokenObj.rawToken : Constants.EMPTY_STRING,
|
|
16475
16308
|
idTokenClaims: idTokenObj ? idTokenObj.claims : {},
|
|
16476
16309
|
accessToken: accessToken,
|
|
@@ -16522,7 +16355,7 @@
|
|
|
16522
16355
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
16523
16356
|
}
|
|
16524
16357
|
// Create silent request
|
|
16525
|
-
this.performanceClient.setPreQueueTime(
|
|
16358
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, request.correlationId);
|
|
16526
16359
|
const silentRequest = await this.initializeAuthorizationRequest(request, exports.InteractionType.Silent);
|
|
16527
16360
|
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
|
|
16528
16361
|
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
@@ -16533,7 +16366,7 @@
|
|
|
16533
16366
|
code: request.code,
|
|
16534
16367
|
};
|
|
16535
16368
|
// Initialize the client
|
|
16536
|
-
this.performanceClient.setPreQueueTime(
|
|
16369
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetClientConfiguration, request.correlationId);
|
|
16537
16370
|
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, silentRequest.authority);
|
|
16538
16371
|
const authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
|
|
16539
16372
|
this.logger.verbose("Auth code client created");
|
|
@@ -16611,11 +16444,11 @@
|
|
|
16611
16444
|
this.hybridAuthCodeResponses = new Map();
|
|
16612
16445
|
// Initialize performance client
|
|
16613
16446
|
this.performanceClient = this.isBrowserEnvironment
|
|
16614
|
-
? new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application
|
|
16447
|
+
? new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application)
|
|
16615
16448
|
: new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);
|
|
16616
16449
|
// Initialize the crypto class.
|
|
16617
16450
|
this.browserCrypto = this.isBrowserEnvironment
|
|
16618
|
-
? new CryptoOps(this.logger, this.performanceClient
|
|
16451
|
+
? new CryptoOps(this.logger, this.performanceClient)
|
|
16619
16452
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
16620
16453
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
16621
16454
|
// Initialize the browser storage class.
|
|
@@ -16624,11 +16457,12 @@
|
|
|
16624
16457
|
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
|
|
16625
16458
|
// initialize in memory storage for native flows
|
|
16626
16459
|
const nativeCacheOptions = {
|
|
16627
|
-
cacheLocation:
|
|
16628
|
-
temporaryCacheLocation:
|
|
16460
|
+
cacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
16461
|
+
temporaryCacheLocation: BrowserCacheLocation.MemoryStorage,
|
|
16629
16462
|
storeAuthStateInCookie: false,
|
|
16630
16463
|
secureCookies: false,
|
|
16631
16464
|
cacheMigrationEnabled: false,
|
|
16465
|
+
claimsBasedCachingEnabled: false,
|
|
16632
16466
|
};
|
|
16633
16467
|
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
|
|
16634
16468
|
// Initialize the token cache
|
|
@@ -16664,8 +16498,8 @@
|
|
|
16664
16498
|
return;
|
|
16665
16499
|
}
|
|
16666
16500
|
const allowNativeBroker = this.config.system.allowNativeBroker;
|
|
16667
|
-
const initMeasurement = this.performanceClient.startMeasurement(
|
|
16668
|
-
this.eventHandler.emitEvent(
|
|
16501
|
+
const initMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.InitializeClientApplication);
|
|
16502
|
+
this.eventHandler.emitEvent(EventType.INITIALIZE_START);
|
|
16669
16503
|
if (allowNativeBroker) {
|
|
16670
16504
|
try {
|
|
16671
16505
|
this.nativeExtensionProvider =
|
|
@@ -16676,7 +16510,7 @@
|
|
|
16676
16510
|
}
|
|
16677
16511
|
}
|
|
16678
16512
|
this.initialized = true;
|
|
16679
|
-
this.eventHandler.emitEvent(
|
|
16513
|
+
this.eventHandler.emitEvent(EventType.INITIALIZE_END);
|
|
16680
16514
|
initMeasurement.endMeasurement({ allowNativeBroker, success: true });
|
|
16681
16515
|
}
|
|
16682
16516
|
// #region Redirect Flow
|
|
@@ -16701,7 +16535,7 @@
|
|
|
16701
16535
|
const redirectResponseKey = hash || Constants.EMPTY_STRING;
|
|
16702
16536
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
16703
16537
|
if (typeof response === "undefined") {
|
|
16704
|
-
this.eventHandler.emitEvent(
|
|
16538
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
16705
16539
|
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
16706
16540
|
const request = this.browserStorage.getCachedNativeRequest();
|
|
16707
16541
|
let redirectResponse;
|
|
@@ -16710,7 +16544,7 @@
|
|
|
16710
16544
|
this.nativeExtensionProvider &&
|
|
16711
16545
|
!hash) {
|
|
16712
16546
|
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
16713
|
-
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
16547
|
+
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);
|
|
16714
16548
|
redirectResponse = nativeClient.handleRedirectPromise();
|
|
16715
16549
|
}
|
|
16716
16550
|
else {
|
|
@@ -16727,26 +16561,26 @@
|
|
|
16727
16561
|
const isLoggingIn = loggedInAccounts.length <
|
|
16728
16562
|
this.getAllAccounts().length;
|
|
16729
16563
|
if (isLoggingIn) {
|
|
16730
|
-
this.eventHandler.emitEvent(
|
|
16564
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
16731
16565
|
this.logger.verbose("handleRedirectResponse returned result, login success");
|
|
16732
16566
|
}
|
|
16733
16567
|
else {
|
|
16734
|
-
this.eventHandler.emitEvent(
|
|
16568
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Redirect, result);
|
|
16735
16569
|
this.logger.verbose("handleRedirectResponse returned result, acquire token success");
|
|
16736
16570
|
}
|
|
16737
16571
|
}
|
|
16738
|
-
this.eventHandler.emitEvent(
|
|
16572
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
16739
16573
|
return result;
|
|
16740
16574
|
})
|
|
16741
16575
|
.catch((e) => {
|
|
16742
16576
|
// Emit login event if there is an account
|
|
16743
16577
|
if (loggedInAccounts.length > 0) {
|
|
16744
|
-
this.eventHandler.emitEvent(
|
|
16578
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16745
16579
|
}
|
|
16746
16580
|
else {
|
|
16747
|
-
this.eventHandler.emitEvent(
|
|
16581
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16748
16582
|
}
|
|
16749
|
-
this.eventHandler.emitEvent(
|
|
16583
|
+
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, exports.InteractionType.Redirect);
|
|
16750
16584
|
throw e;
|
|
16751
16585
|
});
|
|
16752
16586
|
this.redirectResponse.set(redirectResponseKey, response);
|
|
@@ -16776,14 +16610,14 @@
|
|
|
16776
16610
|
// If logged in, emit acquire token events
|
|
16777
16611
|
const isLoggedIn = this.getAllAccounts().length > 0;
|
|
16778
16612
|
if (isLoggedIn) {
|
|
16779
|
-
this.eventHandler.emitEvent(
|
|
16613
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
|
|
16780
16614
|
}
|
|
16781
16615
|
else {
|
|
16782
|
-
this.eventHandler.emitEvent(
|
|
16616
|
+
this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Redirect, request);
|
|
16783
16617
|
}
|
|
16784
16618
|
let result;
|
|
16785
16619
|
if (this.nativeExtensionProvider && this.canUseNative(request)) {
|
|
16786
|
-
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
16620
|
+
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);
|
|
16787
16621
|
result = nativeClient
|
|
16788
16622
|
.acquireTokenRedirect(request)
|
|
16789
16623
|
.catch((e) => {
|
|
@@ -16808,10 +16642,10 @@
|
|
|
16808
16642
|
return result.catch((e) => {
|
|
16809
16643
|
// If logged in, emit acquire token events
|
|
16810
16644
|
if (isLoggedIn) {
|
|
16811
|
-
this.eventHandler.emitEvent(
|
|
16645
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16812
16646
|
}
|
|
16813
16647
|
else {
|
|
16814
|
-
this.eventHandler.emitEvent(
|
|
16648
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Redirect, null, e);
|
|
16815
16649
|
}
|
|
16816
16650
|
throw e;
|
|
16817
16651
|
});
|
|
@@ -16827,7 +16661,7 @@
|
|
|
16827
16661
|
*/
|
|
16828
16662
|
acquireTokenPopup(request) {
|
|
16829
16663
|
const correlationId = this.getRequestCorrelationId(request);
|
|
16830
|
-
const atPopupMeasurement = this.performanceClient.startMeasurement(
|
|
16664
|
+
const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);
|
|
16831
16665
|
try {
|
|
16832
16666
|
this.logger.verbose("acquireTokenPopup called", correlationId);
|
|
16833
16667
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
@@ -16839,14 +16673,14 @@
|
|
|
16839
16673
|
// If logged in, emit acquire token events
|
|
16840
16674
|
const loggedInAccounts = this.getAllAccounts();
|
|
16841
16675
|
if (loggedInAccounts.length > 0) {
|
|
16842
|
-
this.eventHandler.emitEvent(
|
|
16676
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Popup, request);
|
|
16843
16677
|
}
|
|
16844
16678
|
else {
|
|
16845
|
-
this.eventHandler.emitEvent(
|
|
16679
|
+
this.eventHandler.emitEvent(EventType.LOGIN_START, exports.InteractionType.Popup, request);
|
|
16846
16680
|
}
|
|
16847
16681
|
let result;
|
|
16848
16682
|
if (this.canUseNative(request)) {
|
|
16849
|
-
result = this.acquireTokenNative(request,
|
|
16683
|
+
result = this.acquireTokenNative(request, ApiId.acquireTokenPopup)
|
|
16850
16684
|
.then((response) => {
|
|
16851
16685
|
this.browserStorage.setInteractionInProgress(false);
|
|
16852
16686
|
atPopupMeasurement.endMeasurement({
|
|
@@ -16882,10 +16716,10 @@
|
|
|
16882
16716
|
*/
|
|
16883
16717
|
const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;
|
|
16884
16718
|
if (isLoggingIn) {
|
|
16885
|
-
this.eventHandler.emitEvent(
|
|
16719
|
+
this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, exports.InteractionType.Popup, result);
|
|
16886
16720
|
}
|
|
16887
16721
|
else {
|
|
16888
|
-
this.eventHandler.emitEvent(
|
|
16722
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Popup, result);
|
|
16889
16723
|
}
|
|
16890
16724
|
atPopupMeasurement.addStaticFields({
|
|
16891
16725
|
accessTokenSize: result.accessToken.length,
|
|
@@ -16899,10 +16733,10 @@
|
|
|
16899
16733
|
})
|
|
16900
16734
|
.catch((e) => {
|
|
16901
16735
|
if (loggedInAccounts.length > 0) {
|
|
16902
|
-
this.eventHandler.emitEvent(
|
|
16736
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
16903
16737
|
}
|
|
16904
16738
|
else {
|
|
16905
|
-
this.eventHandler.emitEvent(
|
|
16739
|
+
this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
16906
16740
|
}
|
|
16907
16741
|
atPopupMeasurement.endMeasurement({
|
|
16908
16742
|
errorCode: e.errorCode,
|
|
@@ -16950,16 +16784,16 @@
|
|
|
16950
16784
|
correlationId: correlationId,
|
|
16951
16785
|
};
|
|
16952
16786
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
16953
|
-
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(
|
|
16787
|
+
this.ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);
|
|
16954
16788
|
this.ssoSilentMeasurement?.increment({
|
|
16955
16789
|
visibilityChangeCount: 0,
|
|
16956
16790
|
});
|
|
16957
16791
|
document.addEventListener("visibilitychange", this.trackPageVisibilityWithMeasurement);
|
|
16958
16792
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
16959
|
-
this.eventHandler.emitEvent(
|
|
16793
|
+
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, exports.InteractionType.Silent, validRequest);
|
|
16960
16794
|
let result;
|
|
16961
16795
|
if (this.canUseNative(validRequest)) {
|
|
16962
|
-
result = this.acquireTokenNative(validRequest,
|
|
16796
|
+
result = this.acquireTokenNative(validRequest, ApiId.ssoSilent).catch((e) => {
|
|
16963
16797
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
16964
16798
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
16965
16799
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
@@ -16975,7 +16809,7 @@
|
|
|
16975
16809
|
}
|
|
16976
16810
|
return result
|
|
16977
16811
|
.then((response) => {
|
|
16978
|
-
this.eventHandler.emitEvent(
|
|
16812
|
+
this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
16979
16813
|
this.ssoSilentMeasurement?.addStaticFields({
|
|
16980
16814
|
accessTokenSize: response.accessToken.length,
|
|
16981
16815
|
idTokenSize: response.idToken.length,
|
|
@@ -16988,7 +16822,7 @@
|
|
|
16988
16822
|
return response;
|
|
16989
16823
|
})
|
|
16990
16824
|
.catch((e) => {
|
|
16991
|
-
this.eventHandler.emitEvent(
|
|
16825
|
+
this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
16992
16826
|
this.ssoSilentMeasurement?.endMeasurement({
|
|
16993
16827
|
errorCode: e.errorCode,
|
|
16994
16828
|
subErrorCode: e.subError,
|
|
@@ -17014,8 +16848,8 @@
|
|
|
17014
16848
|
const correlationId = this.getRequestCorrelationId(request);
|
|
17015
16849
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
17016
16850
|
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
17017
|
-
this.eventHandler.emitEvent(
|
|
17018
|
-
const atbcMeasurement = this.performanceClient.startMeasurement(
|
|
16851
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
16852
|
+
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, request.correlationId);
|
|
17019
16853
|
try {
|
|
17020
16854
|
if (request.code && request.nativeAccountId) {
|
|
17021
16855
|
// Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.
|
|
@@ -17031,7 +16865,7 @@
|
|
|
17031
16865
|
correlationId,
|
|
17032
16866
|
})
|
|
17033
16867
|
.then((result) => {
|
|
17034
|
-
this.eventHandler.emitEvent(
|
|
16868
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
|
|
17035
16869
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
17036
16870
|
atbcMeasurement.addStaticFields({
|
|
17037
16871
|
accessTokenSize: result.accessToken.length,
|
|
@@ -17046,7 +16880,7 @@
|
|
|
17046
16880
|
})
|
|
17047
16881
|
.catch((error) => {
|
|
17048
16882
|
this.hybridAuthCodeResponses.delete(hybridAuthCode);
|
|
17049
|
-
this.eventHandler.emitEvent(
|
|
16883
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, error);
|
|
17050
16884
|
atbcMeasurement.endMeasurement({
|
|
17051
16885
|
errorCode: error.errorCode,
|
|
17052
16886
|
subErrorCode: error.subError,
|
|
@@ -17064,7 +16898,7 @@
|
|
|
17064
16898
|
}
|
|
17065
16899
|
else if (request.nativeAccountId) {
|
|
17066
16900
|
if (this.canUseNative(request, request.nativeAccountId)) {
|
|
17067
|
-
return this.acquireTokenNative(request,
|
|
16901
|
+
return this.acquireTokenNative(request, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e) => {
|
|
17068
16902
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
17069
16903
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
17070
16904
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
@@ -17081,7 +16915,7 @@
|
|
|
17081
16915
|
}
|
|
17082
16916
|
}
|
|
17083
16917
|
catch (e) {
|
|
17084
|
-
this.eventHandler.emitEvent(
|
|
16918
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
17085
16919
|
atbcMeasurement.endMeasurement({
|
|
17086
16920
|
errorCode: (e instanceof AuthError && e.errorCode) || undefined,
|
|
17087
16921
|
subErrorCode: (e instanceof AuthError && e.subError) || undefined,
|
|
@@ -17098,7 +16932,7 @@
|
|
|
17098
16932
|
async acquireTokenByCodeAsync(request) {
|
|
17099
16933
|
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
|
|
17100
16934
|
this.acquireTokenByCodeAsyncMeasurement =
|
|
17101
|
-
this.performanceClient.startMeasurement(
|
|
16935
|
+
this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCodeAsync, request.correlationId);
|
|
17102
16936
|
this.acquireTokenByCodeAsyncMeasurement?.increment({
|
|
17103
16937
|
visibilityChangeCount: 0,
|
|
17104
16938
|
});
|
|
@@ -17136,11 +16970,11 @@
|
|
|
17136
16970
|
* @returns A promise that, when resolved, returns the access token
|
|
17137
16971
|
*/
|
|
17138
16972
|
async acquireTokenFromCache(silentCacheClient, commonRequest, silentRequest) {
|
|
17139
|
-
this.performanceClient.addQueueMeasurement(
|
|
16973
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenFromCache, commonRequest.correlationId);
|
|
17140
16974
|
switch (silentRequest.cacheLookupPolicy) {
|
|
17141
|
-
case
|
|
17142
|
-
case
|
|
17143
|
-
case
|
|
16975
|
+
case CacheLookupPolicy.Default:
|
|
16976
|
+
case CacheLookupPolicy.AccessToken:
|
|
16977
|
+
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
17144
16978
|
return silentCacheClient.acquireToken(commonRequest);
|
|
17145
16979
|
default:
|
|
17146
16980
|
throw ClientAuthError.createRefreshRequiredError();
|
|
@@ -17153,14 +16987,14 @@
|
|
|
17153
16987
|
* @returns A promise that, when resolved, returns the access token
|
|
17154
16988
|
*/
|
|
17155
16989
|
async acquireTokenByRefreshToken(commonRequest, silentRequest) {
|
|
17156
|
-
this.performanceClient.addQueueMeasurement(
|
|
16990
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenByRefreshToken, commonRequest.correlationId);
|
|
17157
16991
|
switch (silentRequest.cacheLookupPolicy) {
|
|
17158
|
-
case
|
|
17159
|
-
case
|
|
17160
|
-
case
|
|
17161
|
-
case
|
|
16992
|
+
case CacheLookupPolicy.Default:
|
|
16993
|
+
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
16994
|
+
case CacheLookupPolicy.RefreshToken:
|
|
16995
|
+
case CacheLookupPolicy.RefreshTokenAndNetwork:
|
|
17162
16996
|
const silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);
|
|
17163
|
-
this.performanceClient.setPreQueueTime(
|
|
16997
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentRefreshClientAcquireToken, commonRequest.correlationId);
|
|
17164
16998
|
return silentRefreshClient.acquireToken(commonRequest);
|
|
17165
16999
|
default:
|
|
17166
17000
|
throw ClientAuthError.createRefreshRequiredError();
|
|
@@ -17172,9 +17006,9 @@
|
|
|
17172
17006
|
* @returns A promise that, when resolved, returns the access token
|
|
17173
17007
|
*/
|
|
17174
17008
|
async acquireTokenBySilentIframe(request) {
|
|
17175
|
-
this.performanceClient.addQueueMeasurement(
|
|
17009
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenBySilentIframe, request.correlationId);
|
|
17176
17010
|
const silentIframeClient = this.createSilentIframeClient(request.correlationId);
|
|
17177
|
-
this.performanceClient.setPreQueueTime(
|
|
17011
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
17178
17012
|
return silentIframeClient.acquireToken(request);
|
|
17179
17013
|
}
|
|
17180
17014
|
// #endregion
|
|
@@ -17332,9 +17166,9 @@
|
|
|
17332
17166
|
*
|
|
17333
17167
|
* @protected
|
|
17334
17168
|
* @param {InteractionType} interactionType What kind of interaction is being used
|
|
17335
|
-
* @param {boolean} [
|
|
17169
|
+
* @param {boolean} [isAppEmbedded=false] Whether to set interaction in progress temp cache flag
|
|
17336
17170
|
*/
|
|
17337
|
-
preflightBrowserEnvironmentCheck(interactionType,
|
|
17171
|
+
preflightBrowserEnvironmentCheck(interactionType, isAppEmbedded = false) {
|
|
17338
17172
|
this.logger.verbose("preflightBrowserEnvironmentCheck started");
|
|
17339
17173
|
// Block request if not in browser environment
|
|
17340
17174
|
BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
@@ -17344,18 +17178,23 @@
|
|
|
17344
17178
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
17345
17179
|
// Block redirectUri opened in a popup from calling MSAL APIs
|
|
17346
17180
|
BrowserUtils.blockAcquireTokenInPopups();
|
|
17347
|
-
|
|
17348
|
-
|
|
17181
|
+
/*
|
|
17182
|
+
* Block token acquisition before initialize has been called if native brokering is enabled in top-frame.
|
|
17183
|
+
* Skip check if application is embedded.
|
|
17184
|
+
*/
|
|
17185
|
+
if (!isAppEmbedded) {
|
|
17186
|
+
BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);
|
|
17187
|
+
}
|
|
17349
17188
|
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
|
|
17350
17189
|
if (interactionType === exports.InteractionType.Redirect &&
|
|
17351
17190
|
this.config.cache.cacheLocation ===
|
|
17352
|
-
|
|
17191
|
+
BrowserCacheLocation.MemoryStorage &&
|
|
17353
17192
|
!this.config.cache.storeAuthStateInCookie) {
|
|
17354
17193
|
throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
|
|
17355
17194
|
}
|
|
17356
17195
|
if (interactionType === exports.InteractionType.Redirect ||
|
|
17357
17196
|
interactionType === exports.InteractionType.Popup) {
|
|
17358
|
-
this.preflightInteractiveRequest(
|
|
17197
|
+
this.preflightInteractiveRequest(!isAppEmbedded);
|
|
17359
17198
|
}
|
|
17360
17199
|
}
|
|
17361
17200
|
/**
|
|
@@ -17443,7 +17282,7 @@
|
|
|
17443
17282
|
* @param correlationId
|
|
17444
17283
|
*/
|
|
17445
17284
|
createSilentIframeClient(correlationId) {
|
|
17446
|
-
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
17285
|
+
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
|
|
17447
17286
|
}
|
|
17448
17287
|
/**
|
|
17449
17288
|
* Returns new instance of the Silent Cache Interaction Client
|
|
@@ -17461,7 +17300,7 @@
|
|
|
17461
17300
|
* Returns new instance of the Silent AuthCode Interaction Client
|
|
17462
17301
|
*/
|
|
17463
17302
|
createSilentAuthCodeClient(correlationId) {
|
|
17464
|
-
return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient,
|
|
17303
|
+
return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, this.nativeExtensionProvider, correlationId);
|
|
17465
17304
|
}
|
|
17466
17305
|
/**
|
|
17467
17306
|
* Adds event callbacks to array
|
|
@@ -17670,7 +17509,7 @@
|
|
|
17670
17509
|
*/
|
|
17671
17510
|
async acquireTokenSilent(request) {
|
|
17672
17511
|
const correlationId = this.getRequestCorrelationId(request);
|
|
17673
|
-
const atsMeasurement = this.performanceClient.startMeasurement(
|
|
17512
|
+
const atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);
|
|
17674
17513
|
atsMeasurement.addStaticFields({
|
|
17675
17514
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
17676
17515
|
});
|
|
@@ -17696,7 +17535,7 @@
|
|
|
17696
17535
|
const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
|
|
17697
17536
|
if (typeof cachedResponse === "undefined") {
|
|
17698
17537
|
this.logger.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
|
|
17699
|
-
this.performanceClient.setPreQueueTime(
|
|
17538
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenSilentAsync, correlationId);
|
|
17700
17539
|
const response = this.acquireTokenSilentAsync({
|
|
17701
17540
|
...request,
|
|
17702
17541
|
correlationId,
|
|
@@ -17742,9 +17581,9 @@
|
|
|
17742
17581
|
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
|
|
17743
17582
|
*/
|
|
17744
17583
|
async acquireTokenSilentAsync(request, account) {
|
|
17745
|
-
this.performanceClient.addQueueMeasurement(
|
|
17746
|
-
this.eventHandler.emitEvent(
|
|
17747
|
-
this.atsAsyncMeasurement = this.performanceClient.startMeasurement(
|
|
17584
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
17585
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
17586
|
+
this.atsAsyncMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
|
|
17748
17587
|
this.atsAsyncMeasurement?.increment({
|
|
17749
17588
|
visibilityChangeCount: 0,
|
|
17750
17589
|
});
|
|
@@ -17757,7 +17596,7 @@
|
|
|
17757
17596
|
...request,
|
|
17758
17597
|
account,
|
|
17759
17598
|
};
|
|
17760
|
-
result = this.acquireTokenNative(silentRequest,
|
|
17599
|
+
result = this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e) => {
|
|
17761
17600
|
// If native token acquisition fails for availability reasons fallback to web flow
|
|
17762
17601
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
17763
17602
|
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
|
|
@@ -17772,23 +17611,23 @@
|
|
|
17772
17611
|
else {
|
|
17773
17612
|
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
|
|
17774
17613
|
const silentCacheClient = this.createSilentCacheClient(request.correlationId);
|
|
17775
|
-
this.performanceClient.setPreQueueTime(
|
|
17614
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.InitializeSilentRequest, request.correlationId);
|
|
17776
17615
|
const silentRequest = await silentCacheClient.initializeSilentRequest(request, account);
|
|
17777
17616
|
const requestWithCLP = {
|
|
17778
17617
|
...request,
|
|
17779
17618
|
// set the request's CacheLookupPolicy to Default if it was not optionally passed in
|
|
17780
|
-
cacheLookupPolicy: request.cacheLookupPolicy ||
|
|
17619
|
+
cacheLookupPolicy: request.cacheLookupPolicy || CacheLookupPolicy.Default,
|
|
17781
17620
|
};
|
|
17782
|
-
this.performanceClient.setPreQueueTime(
|
|
17621
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenFromCache, silentRequest.correlationId);
|
|
17783
17622
|
result = this.acquireTokenFromCache(silentCacheClient, silentRequest, requestWithCLP).catch((cacheError) => {
|
|
17784
17623
|
if (requestWithCLP.cacheLookupPolicy ===
|
|
17785
|
-
|
|
17624
|
+
CacheLookupPolicy.AccessToken) {
|
|
17786
17625
|
throw cacheError;
|
|
17787
17626
|
}
|
|
17788
17627
|
// block the reload if it occurred inside a hidden iframe
|
|
17789
17628
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
17790
|
-
this.eventHandler.emitEvent(
|
|
17791
|
-
this.performanceClient.setPreQueueTime(
|
|
17629
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest);
|
|
17630
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenByRefreshToken, silentRequest.correlationId);
|
|
17792
17631
|
return this.acquireTokenByRefreshToken(silentRequest, requestWithCLP).catch((refreshTokenError) => {
|
|
17793
17632
|
const isServerError = refreshTokenError instanceof ServerError;
|
|
17794
17633
|
const isInteractionRequiredError = refreshTokenError instanceof
|
|
@@ -17799,22 +17638,22 @@
|
|
|
17799
17638
|
!isInvalidGrantError ||
|
|
17800
17639
|
isInteractionRequiredError ||
|
|
17801
17640
|
requestWithCLP.cacheLookupPolicy ===
|
|
17802
|
-
|
|
17641
|
+
CacheLookupPolicy.AccessTokenAndRefreshToken ||
|
|
17803
17642
|
requestWithCLP.cacheLookupPolicy ===
|
|
17804
|
-
|
|
17643
|
+
CacheLookupPolicy.RefreshToken) &&
|
|
17805
17644
|
requestWithCLP.cacheLookupPolicy !==
|
|
17806
|
-
|
|
17645
|
+
CacheLookupPolicy.Skip) {
|
|
17807
17646
|
throw refreshTokenError;
|
|
17808
17647
|
}
|
|
17809
17648
|
this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", request.correlationId);
|
|
17810
|
-
this.performanceClient.setPreQueueTime(
|
|
17649
|
+
this.performanceClient.setPreQueueTime(PerformanceEvents.AcquireTokenBySilentIframe, silentRequest.correlationId);
|
|
17811
17650
|
return this.acquireTokenBySilentIframe(silentRequest);
|
|
17812
17651
|
});
|
|
17813
17652
|
});
|
|
17814
17653
|
}
|
|
17815
17654
|
return result
|
|
17816
17655
|
.then((response) => {
|
|
17817
|
-
this.eventHandler.emitEvent(
|
|
17656
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
17818
17657
|
this.atsAsyncMeasurement?.endMeasurement({
|
|
17819
17658
|
success: true,
|
|
17820
17659
|
fromCache: response.fromCache,
|
|
@@ -17824,7 +17663,7 @@
|
|
|
17824
17663
|
return response;
|
|
17825
17664
|
})
|
|
17826
17665
|
.catch((tokenRenewalError) => {
|
|
17827
|
-
this.eventHandler.emitEvent(
|
|
17666
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
17828
17667
|
this.atsAsyncMeasurement?.endMeasurement({
|
|
17829
17668
|
errorCode: tokenRenewalError.errorCode,
|
|
17830
17669
|
subErrorCode: tokenRenewalError.subError,
|
|
@@ -18260,55 +18099,56 @@
|
|
|
18260
18099
|
*/
|
|
18261
18100
|
static getInteractionStatusFromEvent(message, currentStatus) {
|
|
18262
18101
|
switch (message.eventType) {
|
|
18263
|
-
case
|
|
18264
|
-
return
|
|
18265
|
-
case
|
|
18266
|
-
return
|
|
18267
|
-
case
|
|
18102
|
+
case EventType.LOGIN_START:
|
|
18103
|
+
return InteractionStatus.Login;
|
|
18104
|
+
case EventType.SSO_SILENT_START:
|
|
18105
|
+
return InteractionStatus.SsoSilent;
|
|
18106
|
+
case EventType.ACQUIRE_TOKEN_START:
|
|
18268
18107
|
if (message.interactionType === exports.InteractionType.Redirect ||
|
|
18269
18108
|
message.interactionType === exports.InteractionType.Popup) {
|
|
18270
|
-
return
|
|
18109
|
+
return InteractionStatus.AcquireToken;
|
|
18271
18110
|
}
|
|
18272
18111
|
break;
|
|
18273
|
-
case
|
|
18274
|
-
return
|
|
18275
|
-
case
|
|
18276
|
-
return
|
|
18277
|
-
case
|
|
18278
|
-
case
|
|
18112
|
+
case EventType.HANDLE_REDIRECT_START:
|
|
18113
|
+
return InteractionStatus.HandleRedirect;
|
|
18114
|
+
case EventType.LOGOUT_START:
|
|
18115
|
+
return InteractionStatus.Logout;
|
|
18116
|
+
case EventType.SSO_SILENT_SUCCESS:
|
|
18117
|
+
case EventType.SSO_SILENT_FAILURE:
|
|
18279
18118
|
if (currentStatus &&
|
|
18280
|
-
currentStatus !==
|
|
18119
|
+
currentStatus !== InteractionStatus.SsoSilent) {
|
|
18281
18120
|
// Prevent this event from clearing any status other than ssoSilent
|
|
18282
18121
|
break;
|
|
18283
18122
|
}
|
|
18284
|
-
return
|
|
18285
|
-
case
|
|
18123
|
+
return InteractionStatus.None;
|
|
18124
|
+
case EventType.LOGOUT_END:
|
|
18286
18125
|
if (currentStatus &&
|
|
18287
|
-
currentStatus !==
|
|
18126
|
+
currentStatus !== InteractionStatus.Logout) {
|
|
18288
18127
|
// Prevent this event from clearing any status other than logout
|
|
18289
18128
|
break;
|
|
18290
18129
|
}
|
|
18291
|
-
return
|
|
18292
|
-
case
|
|
18130
|
+
return InteractionStatus.None;
|
|
18131
|
+
case EventType.HANDLE_REDIRECT_END:
|
|
18293
18132
|
if (currentStatus &&
|
|
18294
|
-
currentStatus !==
|
|
18133
|
+
currentStatus !== InteractionStatus.HandleRedirect) {
|
|
18295
18134
|
// Prevent this event from clearing any status other than handleRedirect
|
|
18296
18135
|
break;
|
|
18297
18136
|
}
|
|
18298
|
-
return
|
|
18299
|
-
case
|
|
18300
|
-
case
|
|
18301
|
-
case
|
|
18302
|
-
case
|
|
18137
|
+
return InteractionStatus.None;
|
|
18138
|
+
case EventType.LOGIN_SUCCESS:
|
|
18139
|
+
case EventType.LOGIN_FAILURE:
|
|
18140
|
+
case EventType.ACQUIRE_TOKEN_SUCCESS:
|
|
18141
|
+
case EventType.ACQUIRE_TOKEN_FAILURE:
|
|
18142
|
+
case EventType.RESTORE_FROM_BFCACHE:
|
|
18303
18143
|
if (message.interactionType === exports.InteractionType.Redirect ||
|
|
18304
18144
|
message.interactionType === exports.InteractionType.Popup) {
|
|
18305
18145
|
if (currentStatus &&
|
|
18306
|
-
currentStatus !==
|
|
18307
|
-
currentStatus !==
|
|
18146
|
+
currentStatus !== InteractionStatus.Login &&
|
|
18147
|
+
currentStatus !== InteractionStatus.AcquireToken) {
|
|
18308
18148
|
// Prevent this event from clearing any status other than login or acquireToken
|
|
18309
18149
|
break;
|
|
18310
18150
|
}
|
|
18311
|
-
return
|
|
18151
|
+
return InteractionStatus.None;
|
|
18312
18152
|
}
|
|
18313
18153
|
break;
|
|
18314
18154
|
}
|
|
@@ -18357,30 +18197,41 @@
|
|
|
18357
18197
|
}
|
|
18358
18198
|
|
|
18359
18199
|
exports.AccountEntity = AccountEntity;
|
|
18200
|
+
exports.ApiId = ApiId;
|
|
18360
18201
|
exports.AuthError = AuthError;
|
|
18361
18202
|
exports.AuthErrorMessage = AuthErrorMessage;
|
|
18362
18203
|
exports.AuthenticationHeaderParser = AuthenticationHeaderParser;
|
|
18204
|
+
exports.AuthenticationScheme = AuthenticationScheme;
|
|
18205
|
+
exports.AzureCloudInstance = AzureCloudInstance;
|
|
18363
18206
|
exports.BrowserAuthError = BrowserAuthError;
|
|
18364
18207
|
exports.BrowserAuthErrorMessage = BrowserAuthErrorMessage;
|
|
18208
|
+
exports.BrowserCacheLocation = BrowserCacheLocation;
|
|
18365
18209
|
exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
|
|
18366
18210
|
exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
|
|
18367
18211
|
exports.BrowserUtils = BrowserUtils;
|
|
18212
|
+
exports.CacheLookupPolicy = CacheLookupPolicy;
|
|
18368
18213
|
exports.ClientAuthError = ClientAuthError;
|
|
18369
18214
|
exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
|
|
18370
18215
|
exports.ClientConfigurationError = ClientConfigurationError;
|
|
18371
18216
|
exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
|
|
18372
18217
|
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
|
|
18373
18218
|
exports.EventMessageUtils = EventMessageUtils;
|
|
18219
|
+
exports.EventType = EventType;
|
|
18374
18220
|
exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
|
|
18375
18221
|
exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
|
|
18222
|
+
exports.InteractionStatus = InteractionStatus;
|
|
18376
18223
|
exports.Logger = Logger;
|
|
18377
18224
|
exports.NavigationClient = NavigationClient;
|
|
18378
18225
|
exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
|
|
18226
|
+
exports.PerformanceEvents = PerformanceEvents;
|
|
18227
|
+
exports.PromptValue = PromptValue;
|
|
18228
|
+
exports.ProtocolMode = ProtocolMode;
|
|
18379
18229
|
exports.PublicClientApplication = PublicClientApplication;
|
|
18380
18230
|
exports.ServerError = ServerError;
|
|
18381
18231
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
18382
18232
|
exports.StringUtils = StringUtils;
|
|
18383
18233
|
exports.UrlString = UrlString;
|
|
18234
|
+
exports.WrapperSKU = WrapperSKU;
|
|
18384
18235
|
exports.internals = internals;
|
|
18385
18236
|
exports.stubbedPublicClientApplication = stubbedPublicClientApplication;
|
|
18386
18237
|
exports.version = version;
|