@azure/msal-common 14.0.0-alpha.2 → 14.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/account/AuthToken.js +1 -1
  2. package/dist/account/CcsCredential.d.ts +5 -4
  3. package/dist/account/CcsCredential.d.ts.map +1 -1
  4. package/dist/account/CcsCredential.js +5 -6
  5. package/dist/account/CcsCredential.js.map +1 -1
  6. package/dist/account/ClientInfo.js +1 -1
  7. package/dist/authority/Authority.js +1 -1
  8. package/dist/authority/AuthorityFactory.js +1 -1
  9. package/dist/authority/AuthorityMetadata.js +1 -1
  10. package/dist/authority/AuthorityOptions.d.ts +9 -8
  11. package/dist/authority/AuthorityOptions.d.ts.map +1 -1
  12. package/dist/authority/AuthorityOptions.js +9 -10
  13. package/dist/authority/AuthorityOptions.js.map +1 -1
  14. package/dist/authority/AuthorityType.d.ts +7 -6
  15. package/dist/authority/AuthorityType.d.ts.map +1 -1
  16. package/dist/authority/AuthorityType.js +7 -8
  17. package/dist/authority/AuthorityType.js.map +1 -1
  18. package/dist/authority/CloudInstanceDiscoveryErrorResponse.js +1 -1
  19. package/dist/authority/CloudInstanceDiscoveryResponse.js +1 -1
  20. package/dist/authority/OpenIdConfigResponse.js +1 -1
  21. package/dist/authority/ProtocolMode.d.ts +5 -4
  22. package/dist/authority/ProtocolMode.d.ts.map +1 -1
  23. package/dist/authority/ProtocolMode.js +5 -6
  24. package/dist/authority/ProtocolMode.js.map +1 -1
  25. package/dist/authority/RegionDiscovery.js +1 -1
  26. package/dist/cache/CacheManager.js +1 -1
  27. package/dist/cache/entities/AccessTokenEntity.js +1 -1
  28. package/dist/cache/entities/AccountEntity.js +1 -1
  29. package/dist/cache/entities/AppMetadataEntity.js +1 -1
  30. package/dist/cache/entities/AuthorityMetadataEntity.js +1 -1
  31. package/dist/cache/entities/CacheRecord.js +1 -1
  32. package/dist/cache/entities/CredentialEntity.js +1 -1
  33. package/dist/cache/entities/IdTokenEntity.js +1 -1
  34. package/dist/cache/entities/RefreshTokenEntity.js +1 -1
  35. package/dist/cache/entities/ServerTelemetryEntity.js +1 -1
  36. package/dist/cache/entities/ThrottlingEntity.js +1 -1
  37. package/dist/cache/persistence/TokenCacheContext.js +1 -1
  38. package/dist/client/AuthorizationCodeClient.js +1 -1
  39. package/dist/client/BaseClient.js +1 -1
  40. package/dist/client/RefreshTokenClient.js +1 -1
  41. package/dist/client/SilentFlowClient.js +1 -1
  42. package/dist/config/ClientConfiguration.js +1 -1
  43. package/dist/crypto/ICrypto.js +1 -1
  44. package/dist/crypto/JoseHeader.js +1 -1
  45. package/dist/crypto/PopTokenGenerator.d.ts +5 -4
  46. package/dist/crypto/PopTokenGenerator.d.ts.map +1 -1
  47. package/dist/crypto/PopTokenGenerator.js +5 -6
  48. package/dist/crypto/PopTokenGenerator.js.map +1 -1
  49. package/dist/error/AuthError.js +1 -1
  50. package/dist/error/ClientAuthError.js +1 -1
  51. package/dist/error/ClientConfigurationError.d.ts +8 -0
  52. package/dist/error/ClientConfigurationError.d.ts.map +1 -1
  53. package/dist/error/ClientConfigurationError.js +12 -2
  54. package/dist/error/ClientConfigurationError.js.map +1 -1
  55. package/dist/error/InteractionRequiredAuthError.js +1 -1
  56. package/dist/error/JoseHeaderError.js +1 -1
  57. package/dist/error/ServerError.js +1 -1
  58. package/dist/index.cjs.js +524 -545
  59. package/dist/index.cjs.js.map +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/logger/Logger.js +1 -1
  62. package/dist/network/INetworkModule.js +1 -1
  63. package/dist/network/NetworkManager.js +1 -1
  64. package/dist/network/ThrottlingUtils.js +1 -1
  65. package/dist/packageMetadata.d.ts +1 -1
  66. package/dist/packageMetadata.d.ts.map +1 -1
  67. package/dist/packageMetadata.js +2 -2
  68. package/dist/request/AuthenticationHeaderParser.js +1 -1
  69. package/dist/request/RequestParameterBuilder.js +1 -1
  70. package/dist/request/RequestValidator.js +2 -3
  71. package/dist/request/RequestValidator.js.map +1 -1
  72. package/dist/request/ScopeSet.js +1 -1
  73. package/dist/response/ResponseHandler.js +1 -1
  74. package/dist/telemetry/performance/PerformanceClient.js +1 -1
  75. package/dist/telemetry/performance/PerformanceEvent.d.ts +73 -71
  76. package/dist/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
  77. package/dist/telemetry/performance/PerformanceEvent.js +72 -74
  78. package/dist/telemetry/performance/PerformanceEvent.js.map +1 -1
  79. package/dist/telemetry/performance/StubPerformanceClient.d.ts +3 -7
  80. package/dist/telemetry/performance/StubPerformanceClient.d.ts.map +1 -1
  81. package/dist/telemetry/performance/StubPerformanceClient.js +7 -21
  82. package/dist/telemetry/performance/StubPerformanceClient.js.map +1 -1
  83. package/dist/telemetry/server/ServerTelemetryManager.js +1 -1
  84. package/dist/url/UrlString.js +1 -1
  85. package/dist/utils/Constants.d.ts +193 -179
  86. package/dist/utils/Constants.d.ts.map +1 -1
  87. package/dist/utils/Constants.js +174 -194
  88. package/dist/utils/Constants.js.map +1 -1
  89. package/dist/utils/ProtocolUtils.js +1 -1
  90. package/dist/utils/StringUtils.js +1 -1
  91. package/dist/utils/TimeUtils.js +1 -1
  92. package/package.json +8 -1
package/dist/index.cjs.js CHANGED
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-common v14.0.0-alpha.2 2023-05-17 */
1
+ /*! @azure/msal-common v14.0.0-beta.0 2023-06-19 */
2
2
  'use strict';
3
3
  'use strict';
4
4
 
@@ -74,100 +74,95 @@ const OIDC_SCOPES = [...OIDC_DEFAULT_SCOPES, Constants.EMAIL_SCOPE];
74
74
  /**
75
75
  * Request header names
76
76
  */
77
- exports.HeaderNames = void 0;
78
- (function (HeaderNames) {
79
- HeaderNames["CONTENT_TYPE"] = "Content-Type";
80
- HeaderNames["RETRY_AFTER"] = "Retry-After";
81
- HeaderNames["CCS_HEADER"] = "X-AnchorMailbox";
82
- HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
83
- HeaderNames["AuthenticationInfo"] = "Authentication-Info";
84
- HeaderNames["X_MS_REQUEST_ID"] = "x-ms-request-id";
85
- HeaderNames["X_MS_HTTP_VERSION"] = "x-ms-httpver";
86
- })(exports.HeaderNames || (exports.HeaderNames = {}));
77
+ const HeaderNames = {
78
+ CONTENT_TYPE: "Content-Type",
79
+ RETRY_AFTER: "Retry-After",
80
+ CCS_HEADER: "X-AnchorMailbox",
81
+ WWWAuthenticate: "WWW-Authenticate",
82
+ AuthenticationInfo: "Authentication-Info",
83
+ X_MS_REQUEST_ID: "x-ms-request-id",
84
+ X_MS_HTTP_VERSION: "x-ms-httpver",
85
+ };
87
86
  /**
88
87
  * Persistent cache keys MSAL which stay while user is logged in.
89
88
  */
90
- exports.PersistentCacheKeys = void 0;
91
- (function (PersistentCacheKeys) {
92
- PersistentCacheKeys["ID_TOKEN"] = "idtoken";
93
- PersistentCacheKeys["CLIENT_INFO"] = "client.info";
94
- PersistentCacheKeys["ADAL_ID_TOKEN"] = "adal.idtoken";
95
- PersistentCacheKeys["ERROR"] = "error";
96
- PersistentCacheKeys["ERROR_DESC"] = "error.description";
97
- PersistentCacheKeys["ACTIVE_ACCOUNT"] = "active-account";
98
- PersistentCacheKeys["ACTIVE_ACCOUNT_FILTERS"] = "active-account-filters";
99
- })(exports.PersistentCacheKeys || (exports.PersistentCacheKeys = {}));
89
+ const PersistentCacheKeys = {
90
+ ID_TOKEN: "idtoken",
91
+ CLIENT_INFO: "client.info",
92
+ ADAL_ID_TOKEN: "adal.idtoken",
93
+ ERROR: "error",
94
+ ERROR_DESC: "error.description",
95
+ ACTIVE_ACCOUNT: "active-account",
96
+ ACTIVE_ACCOUNT_FILTERS: "active-account-filters", // new cache entry for active_account for a more robust version for browser
97
+ };
100
98
  /**
101
99
  * String constants related to AAD Authority
102
100
  */
103
- exports.AADAuthorityConstants = void 0;
104
- (function (AADAuthorityConstants) {
105
- AADAuthorityConstants["COMMON"] = "common";
106
- AADAuthorityConstants["ORGANIZATIONS"] = "organizations";
107
- AADAuthorityConstants["CONSUMERS"] = "consumers";
108
- })(exports.AADAuthorityConstants || (exports.AADAuthorityConstants = {}));
101
+ const AADAuthorityConstants = {
102
+ COMMON: "common",
103
+ ORGANIZATIONS: "organizations",
104
+ CONSUMERS: "consumers",
105
+ };
109
106
  /**
110
107
  * Keys in the hashParams sent by AAD Server
111
108
  */
112
- exports.AADServerParamKeys = void 0;
113
- (function (AADServerParamKeys) {
114
- AADServerParamKeys["CLIENT_ID"] = "client_id";
115
- AADServerParamKeys["REDIRECT_URI"] = "redirect_uri";
116
- AADServerParamKeys["RESPONSE_TYPE"] = "response_type";
117
- AADServerParamKeys["RESPONSE_MODE"] = "response_mode";
118
- AADServerParamKeys["GRANT_TYPE"] = "grant_type";
119
- AADServerParamKeys["CLAIMS"] = "claims";
120
- AADServerParamKeys["SCOPE"] = "scope";
121
- AADServerParamKeys["ERROR"] = "error";
122
- AADServerParamKeys["ERROR_DESCRIPTION"] = "error_description";
123
- AADServerParamKeys["ACCESS_TOKEN"] = "access_token";
124
- AADServerParamKeys["ID_TOKEN"] = "id_token";
125
- AADServerParamKeys["REFRESH_TOKEN"] = "refresh_token";
126
- AADServerParamKeys["EXPIRES_IN"] = "expires_in";
127
- AADServerParamKeys["STATE"] = "state";
128
- AADServerParamKeys["NONCE"] = "nonce";
129
- AADServerParamKeys["PROMPT"] = "prompt";
130
- AADServerParamKeys["SESSION_STATE"] = "session_state";
131
- AADServerParamKeys["CLIENT_INFO"] = "client_info";
132
- AADServerParamKeys["CODE"] = "code";
133
- AADServerParamKeys["CODE_CHALLENGE"] = "code_challenge";
134
- AADServerParamKeys["CODE_CHALLENGE_METHOD"] = "code_challenge_method";
135
- AADServerParamKeys["CODE_VERIFIER"] = "code_verifier";
136
- AADServerParamKeys["CLIENT_REQUEST_ID"] = "client-request-id";
137
- AADServerParamKeys["X_CLIENT_SKU"] = "x-client-SKU";
138
- AADServerParamKeys["X_CLIENT_VER"] = "x-client-VER";
139
- AADServerParamKeys["X_CLIENT_OS"] = "x-client-OS";
140
- AADServerParamKeys["X_CLIENT_CPU"] = "x-client-CPU";
141
- AADServerParamKeys["X_CLIENT_CURR_TELEM"] = "x-client-current-telemetry";
142
- AADServerParamKeys["X_CLIENT_LAST_TELEM"] = "x-client-last-telemetry";
143
- AADServerParamKeys["X_MS_LIB_CAPABILITY"] = "x-ms-lib-capability";
144
- AADServerParamKeys["X_APP_NAME"] = "x-app-name";
145
- AADServerParamKeys["X_APP_VER"] = "x-app-ver";
146
- AADServerParamKeys["POST_LOGOUT_URI"] = "post_logout_redirect_uri";
147
- AADServerParamKeys["ID_TOKEN_HINT"] = "id_token_hint";
148
- AADServerParamKeys["DEVICE_CODE"] = "device_code";
149
- AADServerParamKeys["CLIENT_SECRET"] = "client_secret";
150
- AADServerParamKeys["CLIENT_ASSERTION"] = "client_assertion";
151
- AADServerParamKeys["CLIENT_ASSERTION_TYPE"] = "client_assertion_type";
152
- AADServerParamKeys["TOKEN_TYPE"] = "token_type";
153
- AADServerParamKeys["REQ_CNF"] = "req_cnf";
154
- AADServerParamKeys["OBO_ASSERTION"] = "assertion";
155
- AADServerParamKeys["REQUESTED_TOKEN_USE"] = "requested_token_use";
156
- AADServerParamKeys["ON_BEHALF_OF"] = "on_behalf_of";
157
- AADServerParamKeys["FOCI"] = "foci";
158
- AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
159
- AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
160
- AADServerParamKeys["NATIVE_BROKER"] = "nativebroker";
161
- AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
162
- })(exports.AADServerParamKeys || (exports.AADServerParamKeys = {}));
109
+ const AADServerParamKeys = {
110
+ CLIENT_ID: "client_id",
111
+ REDIRECT_URI: "redirect_uri",
112
+ RESPONSE_TYPE: "response_type",
113
+ RESPONSE_MODE: "response_mode",
114
+ GRANT_TYPE: "grant_type",
115
+ CLAIMS: "claims",
116
+ SCOPE: "scope",
117
+ ERROR: "error",
118
+ ERROR_DESCRIPTION: "error_description",
119
+ ACCESS_TOKEN: "access_token",
120
+ ID_TOKEN: "id_token",
121
+ REFRESH_TOKEN: "refresh_token",
122
+ EXPIRES_IN: "expires_in",
123
+ STATE: "state",
124
+ NONCE: "nonce",
125
+ PROMPT: "prompt",
126
+ SESSION_STATE: "session_state",
127
+ CLIENT_INFO: "client_info",
128
+ CODE: "code",
129
+ CODE_CHALLENGE: "code_challenge",
130
+ CODE_CHALLENGE_METHOD: "code_challenge_method",
131
+ CODE_VERIFIER: "code_verifier",
132
+ CLIENT_REQUEST_ID: "client-request-id",
133
+ X_CLIENT_SKU: "x-client-SKU",
134
+ X_CLIENT_VER: "x-client-VER",
135
+ X_CLIENT_OS: "x-client-OS",
136
+ X_CLIENT_CPU: "x-client-CPU",
137
+ X_CLIENT_CURR_TELEM: "x-client-current-telemetry",
138
+ X_CLIENT_LAST_TELEM: "x-client-last-telemetry",
139
+ X_MS_LIB_CAPABILITY: "x-ms-lib-capability",
140
+ X_APP_NAME: "x-app-name",
141
+ X_APP_VER: "x-app-ver",
142
+ POST_LOGOUT_URI: "post_logout_redirect_uri",
143
+ ID_TOKEN_HINT: "id_token_hint",
144
+ DEVICE_CODE: "device_code",
145
+ CLIENT_SECRET: "client_secret",
146
+ CLIENT_ASSERTION: "client_assertion",
147
+ CLIENT_ASSERTION_TYPE: "client_assertion_type",
148
+ TOKEN_TYPE: "token_type",
149
+ REQ_CNF: "req_cnf",
150
+ OBO_ASSERTION: "assertion",
151
+ REQUESTED_TOKEN_USE: "requested_token_use",
152
+ ON_BEHALF_OF: "on_behalf_of",
153
+ FOCI: "foci",
154
+ CCS_HEADER: "X-AnchorMailbox",
155
+ RETURN_SPA_CODE: "return_spa_code",
156
+ NATIVE_BROKER: "nativebroker",
157
+ LOGOUT_HINT: "logout_hint",
158
+ };
163
159
  /**
164
160
  * Claims request keys
165
161
  */
166
- exports.ClaimsRequestKeys = void 0;
167
- (function (ClaimsRequestKeys) {
168
- ClaimsRequestKeys["ACCESS_TOKEN"] = "access_token";
169
- ClaimsRequestKeys["XMS_CC"] = "xms_cc";
170
- })(exports.ClaimsRequestKeys || (exports.ClaimsRequestKeys = {}));
162
+ const ClaimsRequestKeys = {
163
+ ACCESS_TOKEN: "access_token",
164
+ XMS_CC: "xms_cc",
165
+ };
171
166
  /**
172
167
  * we considered making this "enum" in the request instead of string, however it looks like the allowed list of
173
168
  * prompt values kept changing over past couple of years. There are some undocumented prompt values for some
@@ -184,18 +179,17 @@ const PromptValue = {
184
179
  /**
185
180
  * SSO Types - generated to populate hints
186
181
  */
187
- exports.SSOTypes = void 0;
188
- (function (SSOTypes) {
189
- SSOTypes["ACCOUNT"] = "account";
190
- SSOTypes["SID"] = "sid";
191
- SSOTypes["LOGIN_HINT"] = "login_hint";
192
- SSOTypes["ID_TOKEN"] = "id_token";
193
- SSOTypes["DOMAIN_HINT"] = "domain_hint";
194
- SSOTypes["ORGANIZATIONS"] = "organizations";
195
- SSOTypes["CONSUMERS"] = "consumers";
196
- SSOTypes["ACCOUNT_ID"] = "accountIdentifier";
197
- SSOTypes["HOMEACCOUNT_ID"] = "homeAccountIdentifier";
198
- })(exports.SSOTypes || (exports.SSOTypes = {}));
182
+ const SSOTypes = {
183
+ ACCOUNT: "account",
184
+ SID: "sid",
185
+ LOGIN_HINT: "login_hint",
186
+ ID_TOKEN: "id_token",
187
+ DOMAIN_HINT: "domain_hint",
188
+ ORGANIZATIONS: "organizations",
189
+ CONSUMERS: "consumers",
190
+ ACCOUNT_ID: "accountIdentifier",
191
+ HOMEACCOUNT_ID: "homeAccountIdentifier",
192
+ };
199
193
  /**
200
194
  * allowed values for codeVerifier
201
195
  */
@@ -203,80 +197,65 @@ const CodeChallengeMethodValues = {
203
197
  PLAIN: "plain",
204
198
  S256: "S256",
205
199
  };
206
- /**
207
- * The method used to encode the code verifier for the code challenge parameter. can be one
208
- * of plain or s256. if excluded, code challenge is assumed to be plaintext. for more
209
- * information, see the pkce rcf: https://tools.ietf.org/html/rfc7636
210
- */
211
- [
212
- CodeChallengeMethodValues.PLAIN,
213
- CodeChallengeMethodValues.S256,
214
- ];
215
200
  /**
216
201
  * allowed values for response_mode
217
202
  */
218
- exports.ResponseMode = void 0;
219
- (function (ResponseMode) {
220
- ResponseMode["QUERY"] = "query";
221
- ResponseMode["FRAGMENT"] = "fragment";
222
- ResponseMode["FORM_POST"] = "form_post";
223
- })(exports.ResponseMode || (exports.ResponseMode = {}));
203
+ const ResponseMode = {
204
+ QUERY: "query",
205
+ FRAGMENT: "fragment",
206
+ FORM_POST: "form_post",
207
+ };
224
208
  /**
225
209
  * allowed grant_type
226
210
  */
227
- exports.GrantType = void 0;
228
- (function (GrantType) {
229
- GrantType["IMPLICIT_GRANT"] = "implicit";
230
- GrantType["AUTHORIZATION_CODE_GRANT"] = "authorization_code";
231
- GrantType["CLIENT_CREDENTIALS_GRANT"] = "client_credentials";
232
- GrantType["RESOURCE_OWNER_PASSWORD_GRANT"] = "password";
233
- GrantType["REFRESH_TOKEN_GRANT"] = "refresh_token";
234
- GrantType["DEVICE_CODE_GRANT"] = "device_code";
235
- GrantType["JWT_BEARER"] = "urn:ietf:params:oauth:grant-type:jwt-bearer";
236
- })(exports.GrantType || (exports.GrantType = {}));
211
+ const GrantType = {
212
+ IMPLICIT_GRANT: "implicit",
213
+ AUTHORIZATION_CODE_GRANT: "authorization_code",
214
+ CLIENT_CREDENTIALS_GRANT: "client_credentials",
215
+ RESOURCE_OWNER_PASSWORD_GRANT: "password",
216
+ REFRESH_TOKEN_GRANT: "refresh_token",
217
+ DEVICE_CODE_GRANT: "device_code",
218
+ JWT_BEARER: "urn:ietf:params:oauth:grant-type:jwt-bearer",
219
+ };
237
220
  /**
238
221
  * Account types in Cache
239
222
  */
240
- exports.CacheAccountType = void 0;
241
- (function (CacheAccountType) {
242
- CacheAccountType["MSSTS_ACCOUNT_TYPE"] = "MSSTS";
243
- CacheAccountType["ADFS_ACCOUNT_TYPE"] = "ADFS";
244
- CacheAccountType["MSAV1_ACCOUNT_TYPE"] = "MSA";
245
- CacheAccountType["GENERIC_ACCOUNT_TYPE"] = "Generic";
246
- })(exports.CacheAccountType || (exports.CacheAccountType = {}));
223
+ const CacheAccountType = {
224
+ MSSTS_ACCOUNT_TYPE: "MSSTS",
225
+ ADFS_ACCOUNT_TYPE: "ADFS",
226
+ MSAV1_ACCOUNT_TYPE: "MSA",
227
+ GENERIC_ACCOUNT_TYPE: "Generic", // NTLM, Kerberos, FBA, Basic etc
228
+ };
247
229
  /**
248
230
  * Separators used in cache
249
231
  */
250
- var Separators;
251
- (function (Separators) {
252
- Separators["CACHE_KEY_SEPARATOR"] = "-";
253
- Separators["CLIENT_INFO_SEPARATOR"] = ".";
254
- })(Separators || (Separators = {}));
232
+ const Separators = {
233
+ CACHE_KEY_SEPARATOR: "-",
234
+ CLIENT_INFO_SEPARATOR: ".",
235
+ };
255
236
  /**
256
237
  * Credential Type stored in the cache
257
238
  */
258
- exports.CredentialType = void 0;
259
- (function (CredentialType) {
260
- CredentialType["ID_TOKEN"] = "IdToken";
261
- CredentialType["ACCESS_TOKEN"] = "AccessToken";
262
- CredentialType["ACCESS_TOKEN_WITH_AUTH_SCHEME"] = "AccessToken_With_AuthScheme";
263
- CredentialType["REFRESH_TOKEN"] = "RefreshToken";
264
- })(exports.CredentialType || (exports.CredentialType = {}));
239
+ const CredentialType = {
240
+ ID_TOKEN: "IdToken",
241
+ ACCESS_TOKEN: "AccessToken",
242
+ ACCESS_TOKEN_WITH_AUTH_SCHEME: "AccessToken_With_AuthScheme",
243
+ REFRESH_TOKEN: "RefreshToken",
244
+ };
265
245
  /**
266
246
  * Combine all cache types
267
247
  */
268
- exports.CacheType = void 0;
269
- (function (CacheType) {
270
- CacheType[CacheType["ADFS"] = 1001] = "ADFS";
271
- CacheType[CacheType["MSA"] = 1002] = "MSA";
272
- CacheType[CacheType["MSSTS"] = 1003] = "MSSTS";
273
- CacheType[CacheType["GENERIC"] = 1004] = "GENERIC";
274
- CacheType[CacheType["ACCESS_TOKEN"] = 2001] = "ACCESS_TOKEN";
275
- CacheType[CacheType["REFRESH_TOKEN"] = 2002] = "REFRESH_TOKEN";
276
- CacheType[CacheType["ID_TOKEN"] = 2003] = "ID_TOKEN";
277
- CacheType[CacheType["APP_METADATA"] = 3001] = "APP_METADATA";
278
- CacheType[CacheType["UNDEFINED"] = 9999] = "UNDEFINED";
279
- })(exports.CacheType || (exports.CacheType = {}));
248
+ const CacheType = {
249
+ ADFS: 1001,
250
+ MSA: 1002,
251
+ MSSTS: 1003,
252
+ GENERIC: 1004,
253
+ ACCESS_TOKEN: 2001,
254
+ REFRESH_TOKEN: 2002,
255
+ ID_TOKEN: 2003,
256
+ APP_METADATA: 3001,
257
+ UNDEFINED: 9999,
258
+ };
280
259
  /**
281
260
  * More Cache related constants
282
261
  */
@@ -287,13 +266,12 @@ const AUTHORITY_METADATA_CONSTANTS = {
287
266
  CACHE_KEY: "authority-metadata",
288
267
  REFRESH_TIME_SECONDS: 3600 * 24, // 24 Hours
289
268
  };
290
- var AuthorityMetadataSource;
291
- (function (AuthorityMetadataSource) {
292
- AuthorityMetadataSource["CONFIG"] = "config";
293
- AuthorityMetadataSource["CACHE"] = "cache";
294
- AuthorityMetadataSource["NETWORK"] = "network";
295
- AuthorityMetadataSource["HARDCODED_VALUES"] = "hardcoded_values";
296
- })(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
269
+ const AuthorityMetadataSource = {
270
+ CONFIG: "config",
271
+ CACHE: "cache",
272
+ NETWORK: "network",
273
+ HARDCODED_VALUES: "hardcoded_values",
274
+ };
297
275
  const SERVER_TELEM_CONSTANTS = {
298
276
  SCHEMA_VERSION: 5,
299
277
  MAX_CUR_HEADER_BYTES: 80,
@@ -309,12 +287,11 @@ const SERVER_TELEM_CONSTANTS = {
309
287
  /**
310
288
  * Type of the authentication request
311
289
  */
312
- exports.AuthenticationScheme = void 0;
313
- (function (AuthenticationScheme) {
314
- AuthenticationScheme["BEARER"] = "Bearer";
315
- AuthenticationScheme["POP"] = "pop";
316
- AuthenticationScheme["SSH"] = "ssh-cert";
317
- })(exports.AuthenticationScheme || (exports.AuthenticationScheme = {}));
290
+ const AuthenticationScheme = {
291
+ BEARER: "Bearer",
292
+ POP: "pop",
293
+ SSH: "ssh-cert",
294
+ };
318
295
  /**
319
296
  * Constants related to throttling
320
297
  */
@@ -335,54 +312,48 @@ const Errors = {
335
312
  /**
336
313
  * Password grant parameters
337
314
  */
338
- exports.PasswordGrantConstants = void 0;
339
- (function (PasswordGrantConstants) {
340
- PasswordGrantConstants["username"] = "username";
341
- PasswordGrantConstants["password"] = "password";
342
- })(exports.PasswordGrantConstants || (exports.PasswordGrantConstants = {}));
315
+ const PasswordGrantConstants = {
316
+ username: "username",
317
+ password: "password",
318
+ };
343
319
  /**
344
320
  * Response codes
345
321
  */
346
- var ResponseCodes;
347
- (function (ResponseCodes) {
348
- ResponseCodes[ResponseCodes["httpSuccess"] = 200] = "httpSuccess";
349
- ResponseCodes[ResponseCodes["httpBadRequest"] = 400] = "httpBadRequest";
350
- })(ResponseCodes || (ResponseCodes = {}));
322
+ const ResponseCodes = {
323
+ httpSuccess: 200,
324
+ httpBadRequest: 400,
325
+ };
351
326
  /**
352
327
  * Region Discovery Sources
353
328
  */
354
- var RegionDiscoverySources;
355
- (function (RegionDiscoverySources) {
356
- RegionDiscoverySources["FAILED_AUTO_DETECTION"] = "1";
357
- RegionDiscoverySources["INTERNAL_CACHE"] = "2";
358
- RegionDiscoverySources["ENVIRONMENT_VARIABLE"] = "3";
359
- RegionDiscoverySources["IMDS"] = "4";
360
- })(RegionDiscoverySources || (RegionDiscoverySources = {}));
329
+ const RegionDiscoverySources = {
330
+ FAILED_AUTO_DETECTION: "1",
331
+ INTERNAL_CACHE: "2",
332
+ ENVIRONMENT_VARIABLE: "3",
333
+ IMDS: "4",
334
+ };
361
335
  /**
362
336
  * Region Discovery Outcomes
363
337
  */
364
- var RegionDiscoveryOutcomes;
365
- (function (RegionDiscoveryOutcomes) {
366
- RegionDiscoveryOutcomes["CONFIGURED_MATCHES_DETECTED"] = "1";
367
- RegionDiscoveryOutcomes["CONFIGURED_NO_AUTO_DETECTION"] = "2";
368
- RegionDiscoveryOutcomes["CONFIGURED_NOT_DETECTED"] = "3";
369
- RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_SUCCESSFUL"] = "4";
370
- RegionDiscoveryOutcomes["AUTO_DETECTION_REQUESTED_FAILED"] = "5";
371
- })(RegionDiscoveryOutcomes || (RegionDiscoveryOutcomes = {}));
372
- exports.CacheOutcome = void 0;
373
- (function (CacheOutcome) {
374
- CacheOutcome["NO_CACHE_HIT"] = "0";
375
- CacheOutcome["FORCE_REFRESH"] = "1";
376
- CacheOutcome["NO_CACHED_ACCESS_TOKEN"] = "2";
377
- CacheOutcome["CACHED_ACCESS_TOKEN_EXPIRED"] = "3";
378
- CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
379
- })(exports.CacheOutcome || (exports.CacheOutcome = {}));
380
- var JsonTypes;
381
- (function (JsonTypes) {
382
- JsonTypes["Jwt"] = "JWT";
383
- JsonTypes["Jwk"] = "JWK";
384
- JsonTypes["Pop"] = "pop";
385
- })(JsonTypes || (JsonTypes = {}));
338
+ const RegionDiscoveryOutcomes = {
339
+ CONFIGURED_MATCHES_DETECTED: "1",
340
+ CONFIGURED_NO_AUTO_DETECTION: "2",
341
+ CONFIGURED_NOT_DETECTED: "3",
342
+ AUTO_DETECTION_REQUESTED_SUCCESSFUL: "4",
343
+ AUTO_DETECTION_REQUESTED_FAILED: "5",
344
+ };
345
+ const CacheOutcome = {
346
+ NO_CACHE_HIT: "0",
347
+ FORCE_REFRESH: "1",
348
+ NO_CACHED_ACCESS_TOKEN: "2",
349
+ CACHED_ACCESS_TOKEN_EXPIRED: "3",
350
+ REFRESH_CACHED_ACCESS_TOKEN: "4",
351
+ };
352
+ const JsonTypes = {
353
+ Jwt: "JWT",
354
+ Jwk: "JWK",
355
+ Pop: "pop",
356
+ };
386
357
  const ONE_DAY_IN_MS = 86400000;
387
358
 
388
359
  /*
@@ -1325,27 +1296,26 @@ class Logger {
1325
1296
 
1326
1297
  /* eslint-disable header/header */
1327
1298
  const name = "@azure/msal-common";
1328
- const version = "14.0.0-alpha.2";
1299
+ const version = "14.0.0-beta.0";
1329
1300
 
1330
1301
  /*
1331
1302
  * Copyright (c) Microsoft Corporation. All rights reserved.
1332
1303
  * Licensed under the MIT License.
1333
1304
  */
1334
- exports.AzureCloudInstance = void 0;
1335
- (function (AzureCloudInstance) {
1305
+ const AzureCloudInstance = {
1336
1306
  // AzureCloudInstance is not specified.
1337
- AzureCloudInstance[AzureCloudInstance["None"] = 0] = "None";
1307
+ None: "none",
1338
1308
  // Microsoft Azure public cloud
1339
- AzureCloudInstance["AzurePublic"] = "https://login.microsoftonline.com";
1309
+ AzurePublic: "https://login.microsoftonline.com",
1340
1310
  // Microsoft PPE
1341
- AzureCloudInstance["AzurePpe"] = "https://login.windows-ppe.net";
1311
+ AzurePpe: "https://login.windows-ppe.net",
1342
1312
  // Microsoft Chinese national cloud
1343
- AzureCloudInstance["AzureChina"] = "https://login.chinacloudapi.cn";
1313
+ AzureChina: "https://login.chinacloudapi.cn",
1344
1314
  // Microsoft German national cloud ("Black Forest")
1345
- AzureCloudInstance["AzureGermany"] = "https://login.microsoftonline.de";
1315
+ AzureGermany: "https://login.microsoftonline.de",
1346
1316
  // US Government cloud
1347
- AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
1348
- })(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
1317
+ AzureUsGovernment: "https://login.microsoftonline.us",
1318
+ };
1349
1319
 
1350
1320
  /*
1351
1321
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1445,8 +1415,12 @@ const ClientConfigurationErrorMessage = {
1445
1415
  },
1446
1416
  invalidAuthenticationHeader: {
1447
1417
  code: "invalid_authentication_header",
1448
- desc: "Invalid authentication header provided",
1418
+ desc: "Invalid authentication header provided"
1449
1419
  },
1420
+ authorityMismatch: {
1421
+ code: "authority_mismatch",
1422
+ 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."
1423
+ }
1450
1424
  };
1451
1425
  /**
1452
1426
  * Error thrown when there is an error in configuration of the MSAL.js library.
@@ -1595,6 +1569,12 @@ class ClientConfigurationError extends ClientAuthError {
1595
1569
  static createInvalidAuthenticationHeaderError(invalidHeaderName, details) {
1596
1570
  return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAuthenticationHeader.code, `${ClientConfigurationErrorMessage.invalidAuthenticationHeader.desc}. Invalid header: ${invalidHeaderName}. Details: ${details}`);
1597
1571
  }
1572
+ /**
1573
+ * Create an error when the authority provided in request does not match authority provided in account or MSAL.js configuration.
1574
+ */
1575
+ static createAuthorityMismatchError() {
1576
+ return new ClientConfigurationError(ClientConfigurationErrorMessage.authorityMismatch.code, ClientConfigurationErrorMessage.authorityMismatch.desc);
1577
+ }
1598
1578
  }
1599
1579
 
1600
1580
  /*
@@ -1840,13 +1820,12 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
1840
1820
  /**
1841
1821
  * Authority types supported by MSAL.
1842
1822
  */
1843
- exports.AuthorityType = void 0;
1844
- (function (AuthorityType) {
1845
- AuthorityType[AuthorityType["Default"] = 0] = "Default";
1846
- AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
1847
- AuthorityType[AuthorityType["Dsts"] = 2] = "Dsts";
1848
- AuthorityType[AuthorityType["Ciam"] = 3] = "Ciam";
1849
- })(exports.AuthorityType || (exports.AuthorityType = {}));
1823
+ const AuthorityType = {
1824
+ Default: 0,
1825
+ Adfs: 1,
1826
+ Dsts: 2,
1827
+ Ciam: 3
1828
+ };
1850
1829
 
1851
1830
  /*
1852
1831
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1900,14 +1879,14 @@ class AccountEntity {
1900
1879
  */
1901
1880
  generateType() {
1902
1881
  switch (this.authorityType) {
1903
- case exports.CacheAccountType.ADFS_ACCOUNT_TYPE:
1904
- return exports.CacheType.ADFS;
1905
- case exports.CacheAccountType.MSAV1_ACCOUNT_TYPE:
1906
- return exports.CacheType.MSA;
1907
- case exports.CacheAccountType.MSSTS_ACCOUNT_TYPE:
1908
- return exports.CacheType.MSSTS;
1909
- case exports.CacheAccountType.GENERIC_ACCOUNT_TYPE:
1910
- return exports.CacheType.GENERIC;
1882
+ case CacheAccountType.ADFS_ACCOUNT_TYPE:
1883
+ return CacheType.ADFS;
1884
+ case CacheAccountType.MSAV1_ACCOUNT_TYPE:
1885
+ return CacheType.MSA;
1886
+ case CacheAccountType.MSSTS_ACCOUNT_TYPE:
1887
+ return CacheType.MSSTS;
1888
+ case CacheAccountType.GENERIC_ACCOUNT_TYPE:
1889
+ return CacheType.GENERIC;
1911
1890
  default: {
1912
1891
  throw ClientAuthError.createUnexpectedAccountTypeError();
1913
1892
  }
@@ -1949,7 +1928,7 @@ class AccountEntity {
1949
1928
  */
1950
1929
  static createAccount(clientInfo, homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment, nativeAccountId) {
1951
1930
  const account = new AccountEntity();
1952
- account.authorityType = exports.CacheAccountType.MSSTS_ACCOUNT_TYPE;
1931
+ account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;
1953
1932
  account.clientInfo = clientInfo;
1954
1933
  account.homeAccountId = homeAccountId;
1955
1934
  account.nativeAccountId = nativeAccountId;
@@ -1992,9 +1971,9 @@ class AccountEntity {
1992
1971
  static createGenericAccount(homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment) {
1993
1972
  const account = new AccountEntity();
1994
1973
  account.authorityType =
1995
- authority && authority.authorityType === exports.AuthorityType.Adfs
1996
- ? exports.CacheAccountType.ADFS_ACCOUNT_TYPE
1997
- : exports.CacheAccountType.GENERIC_ACCOUNT_TYPE;
1974
+ authority && authority.authorityType === AuthorityType.Adfs
1975
+ ? CacheAccountType.ADFS_ACCOUNT_TYPE
1976
+ : CacheAccountType.GENERIC_ACCOUNT_TYPE;
1998
1977
  account.homeAccountId = homeAccountId;
1999
1978
  // non AAD scenarios can have empty realm
2000
1979
  account.realm = Constants.EMPTY_STRING;
@@ -2032,8 +2011,8 @@ class AccountEntity {
2032
2011
  ? idToken.claims.sub
2033
2012
  : Constants.EMPTY_STRING;
2034
2013
  // since ADFS does not have tid and does not set client_info
2035
- if (authType === exports.AuthorityType.Adfs ||
2036
- authType === exports.AuthorityType.Dsts) {
2014
+ if (authType === AuthorityType.Adfs ||
2015
+ authType === AuthorityType.Dsts) {
2037
2016
  return accountId;
2038
2017
  }
2039
2018
  // for cases where there is clientInfo
@@ -2343,20 +2322,20 @@ class CacheManager {
2343
2322
  }
2344
2323
  const lowerCaseKey = key.toLowerCase();
2345
2324
  // Credential keys must indicate what credential type they represent
2346
- if (lowerCaseKey.indexOf(exports.CredentialType.ID_TOKEN.toLowerCase()) ===
2325
+ if (lowerCaseKey.indexOf(CredentialType.ID_TOKEN.toLowerCase()) ===
2347
2326
  -1 &&
2348
- lowerCaseKey.indexOf(exports.CredentialType.ACCESS_TOKEN.toLowerCase()) ===
2327
+ lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN.toLowerCase()) ===
2349
2328
  -1 &&
2350
- lowerCaseKey.indexOf(exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) === -1 &&
2351
- lowerCaseKey.indexOf(exports.CredentialType.REFRESH_TOKEN.toLowerCase()) ===
2329
+ lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) === -1 &&
2330
+ lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) ===
2352
2331
  -1) {
2353
2332
  return false;
2354
2333
  }
2355
- if (lowerCaseKey.indexOf(exports.CredentialType.REFRESH_TOKEN.toLowerCase()) >
2334
+ if (lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) >
2356
2335
  -1) {
2357
2336
  // Refresh tokens must contain the client id or family id
2358
- const clientIdValidation = `${exports.CredentialType.REFRESH_TOKEN}${Separators.CACHE_KEY_SEPARATOR}${this.clientId}${Separators.CACHE_KEY_SEPARATOR}`;
2359
- const familyIdValidation = `${exports.CredentialType.REFRESH_TOKEN}${Separators.CACHE_KEY_SEPARATOR}${THE_FAMILY_ID}${Separators.CACHE_KEY_SEPARATOR}`;
2337
+ const clientIdValidation = `${CredentialType.REFRESH_TOKEN}${Separators.CACHE_KEY_SEPARATOR}${this.clientId}${Separators.CACHE_KEY_SEPARATOR}`;
2338
+ const familyIdValidation = `${CredentialType.REFRESH_TOKEN}${Separators.CACHE_KEY_SEPARATOR}${THE_FAMILY_ID}${Separators.CACHE_KEY_SEPARATOR}`;
2360
2339
  if (lowerCaseKey.indexOf(clientIdValidation.toLowerCase()) === -1 &&
2361
2340
  lowerCaseKey.indexOf(familyIdValidation.toLowerCase()) === -1) {
2362
2341
  return false;
@@ -2420,13 +2399,13 @@ class CacheManager {
2420
2399
  }
2421
2400
  // Access Token with Auth Scheme specific matching
2422
2401
  if (entity.credentialType ===
2423
- exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
2402
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
2424
2403
  if (!!filter.tokenType &&
2425
2404
  !this.matchTokenType(entity, filter.tokenType)) {
2426
2405
  return false;
2427
2406
  }
2428
2407
  // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
2429
- if (filter.tokenType === exports.AuthenticationScheme.SSH) {
2408
+ if (filter.tokenType === AuthenticationScheme.SSH) {
2430
2409
  if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
2431
2410
  return false;
2432
2411
  }
@@ -2553,8 +2532,8 @@ class CacheManager {
2553
2532
  }
2554
2533
  // Remove Token Binding Key from key store for PoP Tokens Credentials
2555
2534
  if (credential.credentialType.toLowerCase() ===
2556
- exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
2557
- if (credential.tokenType === exports.AuthenticationScheme.POP) {
2535
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
2536
+ if (credential.tokenType === AuthenticationScheme.POP) {
2558
2537
  const accessTokenWithAuthSchemeEntity = credential;
2559
2538
  const kid = accessTokenWithAuthSchemeEntity.keyId;
2560
2539
  if (kid) {
@@ -2626,7 +2605,7 @@ class CacheManager {
2626
2605
  const idTokenFilter = {
2627
2606
  homeAccountId: account.homeAccountId,
2628
2607
  environment: account.environment,
2629
- credentialType: exports.CredentialType.ID_TOKEN,
2608
+ credentialType: CredentialType.ID_TOKEN,
2630
2609
  clientId: this.clientId,
2631
2610
  realm: account.tenantId,
2632
2611
  };
@@ -2706,16 +2685,16 @@ class CacheManager {
2706
2685
  getAccessToken(account, request, tokenKeys) {
2707
2686
  this.commonLogger.trace("CacheManager - getAccessToken called");
2708
2687
  const scopes = ScopeSet.createSearchScopes(request.scopes);
2709
- const authScheme = request.authenticationScheme || exports.AuthenticationScheme.BEARER;
2688
+ const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
2710
2689
  /*
2711
2690
  * Distinguish between Bearer and PoP/SSH token cache types
2712
2691
  * Cast to lowercase to handle "bearer" from ADFS
2713
2692
  */
2714
2693
  const credentialType = authScheme &&
2715
2694
  authScheme.toLowerCase() !==
2716
- exports.AuthenticationScheme.BEARER.toLowerCase()
2717
- ? exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
2718
- : exports.CredentialType.ACCESS_TOKEN;
2695
+ AuthenticationScheme.BEARER.toLowerCase()
2696
+ ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
2697
+ : CredentialType.ACCESS_TOKEN;
2719
2698
  const accessTokenFilter = {
2720
2699
  homeAccountId: account.homeAccountId,
2721
2700
  environment: account.environment,
@@ -2825,7 +2804,7 @@ class CacheManager {
2825
2804
  const refreshTokenFilter = {
2826
2805
  homeAccountId: account.homeAccountId,
2827
2806
  environment: account.environment,
2828
- credentialType: exports.CredentialType.REFRESH_TOKEN,
2807
+ credentialType: CredentialType.REFRESH_TOKEN,
2829
2808
  clientId: this.clientId,
2830
2809
  familyId: id,
2831
2810
  };
@@ -3002,9 +2981,9 @@ class CacheManager {
3002
2981
  * @param target
3003
2982
  */
3004
2983
  matchTarget(entity, target) {
3005
- const isNotAccessTokenCredential = entity.credentialType !== exports.CredentialType.ACCESS_TOKEN &&
2984
+ const isNotAccessTokenCredential = entity.credentialType !== CredentialType.ACCESS_TOKEN &&
3006
2985
  entity.credentialType !==
3007
- exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
2986
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
3008
2987
  if (isNotAccessTokenCredential || !entity.target) {
3009
2988
  return false;
3010
2989
  }
@@ -3197,7 +3176,7 @@ const DEFAULT_CLIENT_CREDENTIALS = {
3197
3176
  clientAssertion: undefined,
3198
3177
  };
3199
3178
  const DEFAULT_AZURE_CLOUD_OPTIONS = {
3200
- azureCloudInstance: exports.AzureCloudInstance.None,
3179
+ azureCloudInstance: AzureCloudInstance.None,
3201
3180
  tenant: `${Constants.DEFAULT_COMMON_TENANT}`,
3202
3181
  };
3203
3182
  const DEFAULT_TELEMETRY_OPTIONS = {
@@ -3300,7 +3279,7 @@ class ThrottlingUtils {
3300
3279
  if (ThrottlingUtils.checkResponseStatus(response) ||
3301
3280
  ThrottlingUtils.checkResponseForRetryAfter(response)) {
3302
3281
  const thumbprintValue = {
3303
- throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[exports.HeaderNames.RETRY_AFTER])),
3282
+ throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(response.headers[HeaderNames.RETRY_AFTER])),
3304
3283
  error: response.body.error,
3305
3284
  errorCodes: response.body.error_codes,
3306
3285
  errorMessage: response.body.error_description,
@@ -3323,7 +3302,7 @@ class ThrottlingUtils {
3323
3302
  */
3324
3303
  static checkResponseForRetryAfter(response) {
3325
3304
  if (response.headers) {
3326
- return (response.headers.hasOwnProperty(exports.HeaderNames.RETRY_AFTER) &&
3305
+ return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
3327
3306
  (response.status < 200 || response.status >= 300));
3328
3307
  }
3329
3308
  return false;
@@ -3395,11 +3374,10 @@ class NetworkManager {
3395
3374
  * Copyright (c) Microsoft Corporation. All rights reserved.
3396
3375
  * Licensed under the MIT License.
3397
3376
  */
3398
- exports.CcsCredentialType = void 0;
3399
- (function (CcsCredentialType) {
3400
- CcsCredentialType["HOME_ACCOUNT_ID"] = "home_account_id";
3401
- CcsCredentialType["UPN"] = "UPN";
3402
- })(exports.CcsCredentialType || (exports.CcsCredentialType = {}));
3377
+ const CcsCredentialType = {
3378
+ HOME_ACCOUNT_ID: "home_account_id",
3379
+ UPN: "UPN",
3380
+ };
3403
3381
 
3404
3382
  /*
3405
3383
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3480,8 +3458,7 @@ class RequestValidator {
3480
3458
  }
3481
3459
  });
3482
3460
  // remove empty string parameters
3483
- return Object.fromEntries(Object.entries(eQParams).filter(([key, value]) => value !== "") // eslint-disable-line @typescript-eslint/no-unused-vars
3484
- );
3461
+ return Object.fromEntries(Object.entries(eQParams).filter(kv => kv[1] !== ""));
3485
3462
  }
3486
3463
  }
3487
3464
 
@@ -3497,26 +3474,26 @@ class RequestParameterBuilder {
3497
3474
  * add response_type = code
3498
3475
  */
3499
3476
  addResponseTypeCode() {
3500
- this.parameters.set(exports.AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE));
3477
+ this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(Constants.CODE_RESPONSE_TYPE));
3501
3478
  }
3502
3479
  /**
3503
3480
  * add response_type = token id_token
3504
3481
  */
3505
3482
  addResponseTypeForTokenAndIdToken() {
3506
- this.parameters.set(exports.AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(`${Constants.TOKEN_RESPONSE_TYPE} ${Constants.ID_TOKEN_RESPONSE_TYPE}`));
3483
+ this.parameters.set(AADServerParamKeys.RESPONSE_TYPE, encodeURIComponent(`${Constants.TOKEN_RESPONSE_TYPE} ${Constants.ID_TOKEN_RESPONSE_TYPE}`));
3507
3484
  }
3508
3485
  /**
3509
3486
  * add response_mode. defaults to query.
3510
3487
  * @param responseMode
3511
3488
  */
3512
3489
  addResponseMode(responseMode) {
3513
- this.parameters.set(exports.AADServerParamKeys.RESPONSE_MODE, encodeURIComponent(responseMode ? responseMode : exports.ResponseMode.QUERY));
3490
+ this.parameters.set(AADServerParamKeys.RESPONSE_MODE, encodeURIComponent(responseMode ? responseMode : ResponseMode.QUERY));
3514
3491
  }
3515
3492
  /**
3516
3493
  * Add flag to indicate STS should attempt to use WAM if available
3517
3494
  */
3518
3495
  addNativeBroker() {
3519
- this.parameters.set(exports.AADServerParamKeys.NATIVE_BROKER, encodeURIComponent("1"));
3496
+ this.parameters.set(AADServerParamKeys.NATIVE_BROKER, encodeURIComponent("1"));
3520
3497
  }
3521
3498
  /**
3522
3499
  * add scopes. set addOidcScopes to false to prevent default scopes in non-user scenarios
@@ -3528,14 +3505,14 @@ class RequestParameterBuilder {
3528
3505
  ? [...(scopes || []), ...OIDC_DEFAULT_SCOPES]
3529
3506
  : scopes || [];
3530
3507
  const scopeSet = new ScopeSet(requestScopes);
3531
- this.parameters.set(exports.AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));
3508
+ this.parameters.set(AADServerParamKeys.SCOPE, encodeURIComponent(scopeSet.printScopes()));
3532
3509
  }
3533
3510
  /**
3534
3511
  * add clientId
3535
3512
  * @param clientId
3536
3513
  */
3537
3514
  addClientId(clientId) {
3538
- this.parameters.set(exports.AADServerParamKeys.CLIENT_ID, encodeURIComponent(clientId));
3515
+ this.parameters.set(AADServerParamKeys.CLIENT_ID, encodeURIComponent(clientId));
3539
3516
  }
3540
3517
  /**
3541
3518
  * add redirect_uri
@@ -3543,7 +3520,7 @@ class RequestParameterBuilder {
3543
3520
  */
3544
3521
  addRedirectUri(redirectUri) {
3545
3522
  RequestValidator.validateRedirectUri(redirectUri);
3546
- this.parameters.set(exports.AADServerParamKeys.REDIRECT_URI, encodeURIComponent(redirectUri));
3523
+ this.parameters.set(AADServerParamKeys.REDIRECT_URI, encodeURIComponent(redirectUri));
3547
3524
  }
3548
3525
  /**
3549
3526
  * add post logout redirectUri
@@ -3551,49 +3528,49 @@ class RequestParameterBuilder {
3551
3528
  */
3552
3529
  addPostLogoutRedirectUri(redirectUri) {
3553
3530
  RequestValidator.validateRedirectUri(redirectUri);
3554
- this.parameters.set(exports.AADServerParamKeys.POST_LOGOUT_URI, encodeURIComponent(redirectUri));
3531
+ this.parameters.set(AADServerParamKeys.POST_LOGOUT_URI, encodeURIComponent(redirectUri));
3555
3532
  }
3556
3533
  /**
3557
3534
  * add id_token_hint to logout request
3558
3535
  * @param idTokenHint
3559
3536
  */
3560
3537
  addIdTokenHint(idTokenHint) {
3561
- this.parameters.set(exports.AADServerParamKeys.ID_TOKEN_HINT, encodeURIComponent(idTokenHint));
3538
+ this.parameters.set(AADServerParamKeys.ID_TOKEN_HINT, encodeURIComponent(idTokenHint));
3562
3539
  }
3563
3540
  /**
3564
3541
  * add domain_hint
3565
3542
  * @param domainHint
3566
3543
  */
3567
3544
  addDomainHint(domainHint) {
3568
- this.parameters.set(exports.SSOTypes.DOMAIN_HINT, encodeURIComponent(domainHint));
3545
+ this.parameters.set(SSOTypes.DOMAIN_HINT, encodeURIComponent(domainHint));
3569
3546
  }
3570
3547
  /**
3571
3548
  * add login_hint
3572
3549
  * @param loginHint
3573
3550
  */
3574
3551
  addLoginHint(loginHint) {
3575
- this.parameters.set(exports.SSOTypes.LOGIN_HINT, encodeURIComponent(loginHint));
3552
+ this.parameters.set(SSOTypes.LOGIN_HINT, encodeURIComponent(loginHint));
3576
3553
  }
3577
3554
  /**
3578
3555
  * Adds the CCS (Cache Credential Service) query parameter for login_hint
3579
3556
  * @param loginHint
3580
3557
  */
3581
3558
  addCcsUpn(loginHint) {
3582
- this.parameters.set(exports.HeaderNames.CCS_HEADER, encodeURIComponent(`UPN:${loginHint}`));
3559
+ this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent(`UPN:${loginHint}`));
3583
3560
  }
3584
3561
  /**
3585
3562
  * Adds the CCS (Cache Credential Service) query parameter for account object
3586
3563
  * @param loginHint
3587
3564
  */
3588
3565
  addCcsOid(clientInfo) {
3589
- this.parameters.set(exports.HeaderNames.CCS_HEADER, encodeURIComponent(`Oid:${clientInfo.uid}@${clientInfo.utid}`));
3566
+ this.parameters.set(HeaderNames.CCS_HEADER, encodeURIComponent(`Oid:${clientInfo.uid}@${clientInfo.utid}`));
3590
3567
  }
3591
3568
  /**
3592
3569
  * add sid
3593
3570
  * @param sid
3594
3571
  */
3595
3572
  addSid(sid) {
3596
- this.parameters.set(exports.SSOTypes.SID, encodeURIComponent(sid));
3573
+ this.parameters.set(SSOTypes.SID, encodeURIComponent(sid));
3597
3574
  }
3598
3575
  /**
3599
3576
  * add claims
@@ -3602,14 +3579,14 @@ class RequestParameterBuilder {
3602
3579
  addClaims(claims, clientCapabilities) {
3603
3580
  const mergedClaims = this.addClientCapabilitiesToClaims(claims, clientCapabilities);
3604
3581
  RequestValidator.validateClaims(mergedClaims);
3605
- this.parameters.set(exports.AADServerParamKeys.CLAIMS, encodeURIComponent(mergedClaims));
3582
+ this.parameters.set(AADServerParamKeys.CLAIMS, encodeURIComponent(mergedClaims));
3606
3583
  }
3607
3584
  /**
3608
3585
  * add correlationId
3609
3586
  * @param correlationId
3610
3587
  */
3611
3588
  addCorrelationId(correlationId) {
3612
- this.parameters.set(exports.AADServerParamKeys.CLIENT_REQUEST_ID, encodeURIComponent(correlationId));
3589
+ this.parameters.set(AADServerParamKeys.CLIENT_REQUEST_ID, encodeURIComponent(correlationId));
3613
3590
  }
3614
3591
  /**
3615
3592
  * add library info query params
@@ -3617,13 +3594,13 @@ class RequestParameterBuilder {
3617
3594
  */
3618
3595
  addLibraryInfo(libraryInfo) {
3619
3596
  // Telemetry Info
3620
- this.parameters.set(exports.AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);
3621
- this.parameters.set(exports.AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);
3597
+ this.parameters.set(AADServerParamKeys.X_CLIENT_SKU, libraryInfo.sku);
3598
+ this.parameters.set(AADServerParamKeys.X_CLIENT_VER, libraryInfo.version);
3622
3599
  if (libraryInfo.os) {
3623
- this.parameters.set(exports.AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);
3600
+ this.parameters.set(AADServerParamKeys.X_CLIENT_OS, libraryInfo.os);
3624
3601
  }
3625
3602
  if (libraryInfo.cpu) {
3626
- this.parameters.set(exports.AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);
3603
+ this.parameters.set(AADServerParamKeys.X_CLIENT_CPU, libraryInfo.cpu);
3627
3604
  }
3628
3605
  }
3629
3606
  /**
@@ -3632,10 +3609,10 @@ class RequestParameterBuilder {
3632
3609
  */
3633
3610
  addApplicationTelemetry(appTelemetry) {
3634
3611
  if (appTelemetry?.appName) {
3635
- this.parameters.set(exports.AADServerParamKeys.X_APP_NAME, appTelemetry.appName);
3612
+ this.parameters.set(AADServerParamKeys.X_APP_NAME, appTelemetry.appName);
3636
3613
  }
3637
3614
  if (appTelemetry?.appVersion) {
3638
- this.parameters.set(exports.AADServerParamKeys.X_APP_VER, appTelemetry.appVersion);
3615
+ this.parameters.set(AADServerParamKeys.X_APP_VER, appTelemetry.appVersion);
3639
3616
  }
3640
3617
  }
3641
3618
  /**
@@ -3644,7 +3621,7 @@ class RequestParameterBuilder {
3644
3621
  */
3645
3622
  addPrompt(prompt) {
3646
3623
  RequestValidator.validatePrompt(prompt);
3647
- this.parameters.set(`${exports.AADServerParamKeys.PROMPT}`, encodeURIComponent(prompt));
3624
+ this.parameters.set(`${AADServerParamKeys.PROMPT}`, encodeURIComponent(prompt));
3648
3625
  }
3649
3626
  /**
3650
3627
  * add state
@@ -3652,7 +3629,7 @@ class RequestParameterBuilder {
3652
3629
  */
3653
3630
  addState(state) {
3654
3631
  if (!StringUtils.isEmpty(state)) {
3655
- this.parameters.set(exports.AADServerParamKeys.STATE, encodeURIComponent(state));
3632
+ this.parameters.set(AADServerParamKeys.STATE, encodeURIComponent(state));
3656
3633
  }
3657
3634
  }
3658
3635
  /**
@@ -3660,7 +3637,7 @@ class RequestParameterBuilder {
3660
3637
  * @param nonce
3661
3638
  */
3662
3639
  addNonce(nonce) {
3663
- this.parameters.set(exports.AADServerParamKeys.NONCE, encodeURIComponent(nonce));
3640
+ this.parameters.set(AADServerParamKeys.NONCE, encodeURIComponent(nonce));
3664
3641
  }
3665
3642
  /**
3666
3643
  * add code_challenge and code_challenge_method
@@ -3671,8 +3648,8 @@ class RequestParameterBuilder {
3671
3648
  addCodeChallengeParams(codeChallenge, codeChallengeMethod) {
3672
3649
  RequestValidator.validateCodeChallengeParams(codeChallenge, codeChallengeMethod);
3673
3650
  if (codeChallenge && codeChallengeMethod) {
3674
- this.parameters.set(exports.AADServerParamKeys.CODE_CHALLENGE, encodeURIComponent(codeChallenge));
3675
- this.parameters.set(exports.AADServerParamKeys.CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));
3651
+ this.parameters.set(AADServerParamKeys.CODE_CHALLENGE, encodeURIComponent(codeChallenge));
3652
+ this.parameters.set(AADServerParamKeys.CODE_CHALLENGE_METHOD, encodeURIComponent(codeChallengeMethod));
3676
3653
  }
3677
3654
  else {
3678
3655
  throw ClientConfigurationError.createInvalidCodeChallengeParamsError();
@@ -3683,35 +3660,35 @@ class RequestParameterBuilder {
3683
3660
  * @param code
3684
3661
  */
3685
3662
  addAuthorizationCode(code) {
3686
- this.parameters.set(exports.AADServerParamKeys.CODE, encodeURIComponent(code));
3663
+ this.parameters.set(AADServerParamKeys.CODE, encodeURIComponent(code));
3687
3664
  }
3688
3665
  /**
3689
3666
  * add the `authorization_code` passed by the user to exchange for a token
3690
3667
  * @param code
3691
3668
  */
3692
3669
  addDeviceCode(code) {
3693
- this.parameters.set(exports.AADServerParamKeys.DEVICE_CODE, encodeURIComponent(code));
3670
+ this.parameters.set(AADServerParamKeys.DEVICE_CODE, encodeURIComponent(code));
3694
3671
  }
3695
3672
  /**
3696
3673
  * add the `refreshToken` passed by the user
3697
3674
  * @param refreshToken
3698
3675
  */
3699
3676
  addRefreshToken(refreshToken) {
3700
- this.parameters.set(exports.AADServerParamKeys.REFRESH_TOKEN, encodeURIComponent(refreshToken));
3677
+ this.parameters.set(AADServerParamKeys.REFRESH_TOKEN, encodeURIComponent(refreshToken));
3701
3678
  }
3702
3679
  /**
3703
3680
  * add the `code_verifier` passed by the user to exchange for a token
3704
3681
  * @param codeVerifier
3705
3682
  */
3706
3683
  addCodeVerifier(codeVerifier) {
3707
- this.parameters.set(exports.AADServerParamKeys.CODE_VERIFIER, encodeURIComponent(codeVerifier));
3684
+ this.parameters.set(AADServerParamKeys.CODE_VERIFIER, encodeURIComponent(codeVerifier));
3708
3685
  }
3709
3686
  /**
3710
3687
  * add client_secret
3711
3688
  * @param clientSecret
3712
3689
  */
3713
3690
  addClientSecret(clientSecret) {
3714
- this.parameters.set(exports.AADServerParamKeys.CLIENT_SECRET, encodeURIComponent(clientSecret));
3691
+ this.parameters.set(AADServerParamKeys.CLIENT_SECRET, encodeURIComponent(clientSecret));
3715
3692
  }
3716
3693
  /**
3717
3694
  * add clientAssertion for confidential client flows
@@ -3719,7 +3696,7 @@ class RequestParameterBuilder {
3719
3696
  */
3720
3697
  addClientAssertion(clientAssertion) {
3721
3698
  if (!StringUtils.isEmpty(clientAssertion)) {
3722
- this.parameters.set(exports.AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));
3699
+ this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));
3723
3700
  }
3724
3701
  }
3725
3702
  /**
@@ -3728,7 +3705,7 @@ class RequestParameterBuilder {
3728
3705
  */
3729
3706
  addClientAssertionType(clientAssertionType) {
3730
3707
  if (!StringUtils.isEmpty(clientAssertionType)) {
3731
- this.parameters.set(exports.AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));
3708
+ this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));
3732
3709
  }
3733
3710
  }
3734
3711
  /**
@@ -3736,21 +3713,21 @@ class RequestParameterBuilder {
3736
3713
  * @param clientAssertion
3737
3714
  */
3738
3715
  addOboAssertion(oboAssertion) {
3739
- this.parameters.set(exports.AADServerParamKeys.OBO_ASSERTION, encodeURIComponent(oboAssertion));
3716
+ this.parameters.set(AADServerParamKeys.OBO_ASSERTION, encodeURIComponent(oboAssertion));
3740
3717
  }
3741
3718
  /**
3742
3719
  * add grant type
3743
3720
  * @param grantType
3744
3721
  */
3745
3722
  addRequestTokenUse(tokenUse) {
3746
- this.parameters.set(exports.AADServerParamKeys.REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));
3723
+ this.parameters.set(AADServerParamKeys.REQUESTED_TOKEN_USE, encodeURIComponent(tokenUse));
3747
3724
  }
3748
3725
  /**
3749
3726
  * add grant type
3750
3727
  * @param grantType
3751
3728
  */
3752
3729
  addGrantType(grantType) {
3753
- this.parameters.set(exports.AADServerParamKeys.GRANT_TYPE, encodeURIComponent(grantType));
3730
+ this.parameters.set(AADServerParamKeys.GRANT_TYPE, encodeURIComponent(grantType));
3754
3731
  }
3755
3732
  /**
3756
3733
  * add client info
@@ -3784,12 +3761,12 @@ class RequestParameterBuilder {
3784
3761
  }
3785
3762
  }
3786
3763
  if (clientCapabilities && clientCapabilities.length > 0) {
3787
- if (!mergedClaims.hasOwnProperty(exports.ClaimsRequestKeys.ACCESS_TOKEN)) {
3764
+ if (!mergedClaims.hasOwnProperty(ClaimsRequestKeys.ACCESS_TOKEN)) {
3788
3765
  // Add access_token key to claims object
3789
- mergedClaims[exports.ClaimsRequestKeys.ACCESS_TOKEN] = {};
3766
+ mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN] = {};
3790
3767
  }
3791
3768
  // Add xms_cc claim with provided clientCapabilities to access_token key
3792
- mergedClaims[exports.ClaimsRequestKeys.ACCESS_TOKEN][exports.ClaimsRequestKeys.XMS_CC] = {
3769
+ mergedClaims[ClaimsRequestKeys.ACCESS_TOKEN][ClaimsRequestKeys.XMS_CC] = {
3793
3770
  values: clientCapabilities,
3794
3771
  };
3795
3772
  }
@@ -3800,14 +3777,14 @@ class RequestParameterBuilder {
3800
3777
  * @param username
3801
3778
  */
3802
3779
  addUsername(username) {
3803
- this.parameters.set(exports.PasswordGrantConstants.username, encodeURIComponent(username));
3780
+ this.parameters.set(PasswordGrantConstants.username, encodeURIComponent(username));
3804
3781
  }
3805
3782
  /**
3806
3783
  * adds `password` for Password Grant flow
3807
3784
  * @param password
3808
3785
  */
3809
3786
  addPassword(password) {
3810
- this.parameters.set(exports.PasswordGrantConstants.password, encodeURIComponent(password));
3787
+ this.parameters.set(PasswordGrantConstants.password, encodeURIComponent(password));
3811
3788
  }
3812
3789
  /**
3813
3790
  * add pop_jwk to query params
@@ -3815,8 +3792,8 @@ class RequestParameterBuilder {
3815
3792
  */
3816
3793
  addPopToken(cnfString) {
3817
3794
  if (!StringUtils.isEmpty(cnfString)) {
3818
- this.parameters.set(exports.AADServerParamKeys.TOKEN_TYPE, exports.AuthenticationScheme.POP);
3819
- this.parameters.set(exports.AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));
3795
+ this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.POP);
3796
+ this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(cnfString));
3820
3797
  }
3821
3798
  }
3822
3799
  /**
@@ -3824,8 +3801,8 @@ class RequestParameterBuilder {
3824
3801
  */
3825
3802
  addSshJwk(sshJwkString) {
3826
3803
  if (!StringUtils.isEmpty(sshJwkString)) {
3827
- this.parameters.set(exports.AADServerParamKeys.TOKEN_TYPE, exports.AuthenticationScheme.SSH);
3828
- this.parameters.set(exports.AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));
3804
+ this.parameters.set(AADServerParamKeys.TOKEN_TYPE, AuthenticationScheme.SSH);
3805
+ this.parameters.set(AADServerParamKeys.REQ_CNF, encodeURIComponent(sshJwkString));
3829
3806
  }
3830
3807
  }
3831
3808
  /**
@@ -3833,20 +3810,20 @@ class RequestParameterBuilder {
3833
3810
  * @param serverTelemetryManager
3834
3811
  */
3835
3812
  addServerTelemetry(serverTelemetryManager) {
3836
- this.parameters.set(exports.AADServerParamKeys.X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());
3837
- this.parameters.set(exports.AADServerParamKeys.X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
3813
+ this.parameters.set(AADServerParamKeys.X_CLIENT_CURR_TELEM, serverTelemetryManager.generateCurrentRequestHeaderValue());
3814
+ this.parameters.set(AADServerParamKeys.X_CLIENT_LAST_TELEM, serverTelemetryManager.generateLastRequestHeaderValue());
3838
3815
  }
3839
3816
  /**
3840
3817
  * Adds parameter that indicates to the server that throttling is supported
3841
3818
  */
3842
3819
  addThrottling() {
3843
- this.parameters.set(exports.AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
3820
+ this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
3844
3821
  }
3845
3822
  /**
3846
3823
  * Adds logout_hint parameter for "silent" logout which prevent server account picker
3847
3824
  */
3848
3825
  addLogoutHint(logoutHint) {
3849
- this.parameters.set(exports.AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
3826
+ this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
3850
3827
  }
3851
3828
  /**
3852
3829
  * Utility to create a URL from the params map
@@ -3893,21 +3870,21 @@ class BaseClient {
3893
3870
  */
3894
3871
  createTokenRequestHeaders(ccsCred) {
3895
3872
  const headers = {};
3896
- headers[exports.HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
3873
+ headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;
3897
3874
  if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {
3898
3875
  switch (ccsCred.type) {
3899
- case exports.CcsCredentialType.HOME_ACCOUNT_ID:
3876
+ case CcsCredentialType.HOME_ACCOUNT_ID:
3900
3877
  try {
3901
3878
  const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
3902
- headers[exports.HeaderNames.CCS_HEADER] = `Oid:${clientInfo.uid}@${clientInfo.utid}`;
3879
+ headers[HeaderNames.CCS_HEADER] = `Oid:${clientInfo.uid}@${clientInfo.utid}`;
3903
3880
  }
3904
3881
  catch (e) {
3905
3882
  this.logger.verbose("Could not parse home account ID for CCS Header: " +
3906
3883
  e);
3907
3884
  }
3908
3885
  break;
3909
- case exports.CcsCredentialType.UPN:
3910
- headers[exports.HeaderNames.CCS_HEADER] = `UPN: ${ccsCred.credential}`;
3886
+ case CcsCredentialType.UPN:
3887
+ headers[HeaderNames.CCS_HEADER] = `UPN: ${ccsCred.credential}`;
3911
3888
  break;
3912
3889
  }
3913
3890
  }
@@ -4009,13 +3986,13 @@ class CredentialEntity {
4009
3986
  */
4010
3987
  generateType() {
4011
3988
  switch (this.credentialType) {
4012
- case exports.CredentialType.ID_TOKEN:
4013
- return exports.CacheType.ID_TOKEN;
4014
- case exports.CredentialType.ACCESS_TOKEN:
4015
- case exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
4016
- return exports.CacheType.ACCESS_TOKEN;
4017
- case exports.CredentialType.REFRESH_TOKEN:
4018
- return exports.CacheType.REFRESH_TOKEN;
3989
+ case CredentialType.ID_TOKEN:
3990
+ return CacheType.ID_TOKEN;
3991
+ case CredentialType.ACCESS_TOKEN:
3992
+ case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
3993
+ return CacheType.ACCESS_TOKEN;
3994
+ case CredentialType.REFRESH_TOKEN:
3995
+ return CacheType.REFRESH_TOKEN;
4019
3996
  default: {
4020
3997
  throw ClientAuthError.createUnexpectedCredentialTypeError();
4021
3998
  }
@@ -4052,7 +4029,7 @@ class CredentialEntity {
4052
4029
  * @param familyId
4053
4030
  */
4054
4031
  static generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId) {
4055
- const clientOrFamilyId = credentialType === exports.CredentialType.REFRESH_TOKEN
4032
+ const clientOrFamilyId = credentialType === CredentialType.REFRESH_TOKEN
4056
4033
  ? familyId || clientId
4057
4034
  : clientId;
4058
4035
  const credentialId = [
@@ -4084,7 +4061,7 @@ class CredentialEntity {
4084
4061
  */
4085
4062
  return tokenType &&
4086
4063
  tokenType.toLowerCase() !==
4087
- exports.AuthenticationScheme.BEARER.toLowerCase()
4064
+ AuthenticationScheme.BEARER.toLowerCase()
4088
4065
  ? tokenType.toLowerCase()
4089
4066
  : Constants.EMPTY_STRING;
4090
4067
  }
@@ -4121,7 +4098,7 @@ class IdTokenEntity extends CredentialEntity {
4121
4098
  */
4122
4099
  static createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {
4123
4100
  const idTokenEntity = new IdTokenEntity();
4124
- idTokenEntity.credentialType = exports.CredentialType.ID_TOKEN;
4101
+ idTokenEntity.credentialType = CredentialType.ID_TOKEN;
4125
4102
  idTokenEntity.homeAccountId = homeAccountId;
4126
4103
  idTokenEntity.environment = environment;
4127
4104
  idTokenEntity.clientId = clientId;
@@ -4143,7 +4120,7 @@ class IdTokenEntity extends CredentialEntity {
4143
4120
  entity.hasOwnProperty("realm") &&
4144
4121
  entity.hasOwnProperty("clientId") &&
4145
4122
  entity.hasOwnProperty("secret") &&
4146
- entity["credentialType"] === exports.CredentialType.ID_TOKEN);
4123
+ entity["credentialType"] === CredentialType.ID_TOKEN);
4147
4124
  }
4148
4125
  }
4149
4126
 
@@ -4236,7 +4213,7 @@ class AccessTokenEntity extends CredentialEntity {
4236
4213
  static createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, userAssertionHash, keyId, requestedClaims, requestedClaimsHash) {
4237
4214
  const atEntity = new AccessTokenEntity();
4238
4215
  atEntity.homeAccountId = homeAccountId;
4239
- atEntity.credentialType = exports.CredentialType.ACCESS_TOKEN;
4216
+ atEntity.credentialType = CredentialType.ACCESS_TOKEN;
4240
4217
  atEntity.secret = accessToken;
4241
4218
  const currentTime = TimeUtils.nowSeconds();
4242
4219
  atEntity.cachedAt = currentTime.toString();
@@ -4255,7 +4232,7 @@ class AccessTokenEntity extends CredentialEntity {
4255
4232
  atEntity.target = scopes;
4256
4233
  atEntity.userAssertionHash = userAssertionHash;
4257
4234
  atEntity.tokenType = StringUtils.isEmpty(tokenType)
4258
- ? exports.AuthenticationScheme.BEARER
4235
+ ? AuthenticationScheme.BEARER
4259
4236
  : tokenType;
4260
4237
  if (requestedClaims) {
4261
4238
  atEntity.requestedClaims = requestedClaims;
@@ -4266,11 +4243,11 @@ class AccessTokenEntity extends CredentialEntity {
4266
4243
  * Cast to lower to handle "bearer" from ADFS
4267
4244
  */
4268
4245
  if (atEntity.tokenType?.toLowerCase() !==
4269
- exports.AuthenticationScheme.BEARER.toLowerCase()) {
4246
+ AuthenticationScheme.BEARER.toLowerCase()) {
4270
4247
  atEntity.credentialType =
4271
- exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
4248
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
4272
4249
  switch (atEntity.tokenType) {
4273
- case exports.AuthenticationScheme.POP:
4250
+ case AuthenticationScheme.POP:
4274
4251
  // Make sure keyId is present and add it to credential
4275
4252
  const tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
4276
4253
  if (!tokenClaims?.cnf?.kid) {
@@ -4278,7 +4255,7 @@ class AccessTokenEntity extends CredentialEntity {
4278
4255
  }
4279
4256
  atEntity.keyId = tokenClaims.cnf.kid;
4280
4257
  break;
4281
- case exports.AuthenticationScheme.SSH:
4258
+ case AuthenticationScheme.SSH:
4282
4259
  atEntity.keyId = keyId;
4283
4260
  }
4284
4261
  }
@@ -4299,9 +4276,9 @@ class AccessTokenEntity extends CredentialEntity {
4299
4276
  entity.hasOwnProperty("clientId") &&
4300
4277
  entity.hasOwnProperty("secret") &&
4301
4278
  entity.hasOwnProperty("target") &&
4302
- (entity["credentialType"] === exports.CredentialType.ACCESS_TOKEN ||
4279
+ (entity["credentialType"] === CredentialType.ACCESS_TOKEN ||
4303
4280
  entity["credentialType"] ===
4304
- exports.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));
4281
+ CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));
4305
4282
  }
4306
4283
  }
4307
4284
 
@@ -4339,7 +4316,7 @@ class RefreshTokenEntity extends CredentialEntity {
4339
4316
  static createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash) {
4340
4317
  const rtEntity = new RefreshTokenEntity();
4341
4318
  rtEntity.clientId = clientId;
4342
- rtEntity.credentialType = exports.CredentialType.REFRESH_TOKEN;
4319
+ rtEntity.credentialType = CredentialType.REFRESH_TOKEN;
4343
4320
  rtEntity.environment = environment;
4344
4321
  rtEntity.homeAccountId = homeAccountId;
4345
4322
  rtEntity.secret = refreshToken;
@@ -4361,7 +4338,7 @@ class RefreshTokenEntity extends CredentialEntity {
4361
4338
  entity.hasOwnProperty("credentialType") &&
4362
4339
  entity.hasOwnProperty("clientId") &&
4363
4340
  entity.hasOwnProperty("secret") &&
4364
- entity["credentialType"] === exports.CredentialType.REFRESH_TOKEN);
4341
+ entity["credentialType"] === CredentialType.REFRESH_TOKEN);
4365
4342
  }
4366
4343
  }
4367
4344
 
@@ -4623,8 +4600,8 @@ class UrlString {
4623
4600
  const pathArray = urlObject.PathSegments;
4624
4601
  if (tenantId &&
4625
4602
  pathArray.length !== 0 &&
4626
- (pathArray[0] === exports.AADAuthorityConstants.COMMON ||
4627
- pathArray[0] === exports.AADAuthorityConstants.ORGANIZATIONS)) {
4603
+ (pathArray[0] === AADAuthorityConstants.COMMON ||
4604
+ pathArray[0] === AADAuthorityConstants.ORGANIZATIONS)) {
4628
4605
  pathArray[0] = tenantId;
4629
4606
  }
4630
4607
  return UrlString.constructAuthorityUriFromObject(urlObject);
@@ -4783,212 +4760,210 @@ class UrlString {
4783
4760
  * @export
4784
4761
  * @enum {number}
4785
4762
  */
4786
- exports.PerformanceEvents = void 0;
4787
- (function (PerformanceEvents) {
4763
+ const PerformanceEvents = {
4788
4764
  /**
4789
4765
  * acquireTokenByCode API (msal-browser and msal-node).
4790
4766
  * Used to acquire tokens by trading an authorization code against the token endpoint.
4791
4767
  */
4792
- PerformanceEvents["AcquireTokenByCode"] = "acquireTokenByCode";
4768
+ AcquireTokenByCode: "acquireTokenByCode",
4793
4769
  /**
4794
4770
  * acquireTokenByRefreshToken API (msal-browser and msal-node).
4795
4771
  * Used to renew an access token using a refresh token against the token endpoint.
4796
4772
  */
4797
- PerformanceEvents["AcquireTokenByRefreshToken"] = "acquireTokenByRefreshToken";
4773
+ AcquireTokenByRefreshToken: "acquireTokenByRefreshToken",
4798
4774
  /**
4799
4775
  * acquireTokenSilent API (msal-browser and msal-node).
4800
4776
  * Used to silently acquire a new access token (from the cache or the network).
4801
4777
  */
4802
- PerformanceEvents["AcquireTokenSilent"] = "acquireTokenSilent";
4778
+ AcquireTokenSilent: "acquireTokenSilent",
4803
4779
  /**
4804
4780
  * acquireTokenSilentAsync (msal-browser).
4805
4781
  * Internal API for acquireTokenSilent.
4806
4782
  */
4807
- PerformanceEvents["AcquireTokenSilentAsync"] = "acquireTokenSilentAsync";
4783
+ AcquireTokenSilentAsync: "acquireTokenSilentAsync",
4808
4784
  /**
4809
4785
  * acquireTokenPopup (msal-browser).
4810
4786
  * Used to acquire a new access token interactively through pop ups
4811
4787
  */
4812
- PerformanceEvents["AcquireTokenPopup"] = "acquireTokenPopup";
4788
+ AcquireTokenPopup: "acquireTokenPopup",
4813
4789
  /**
4814
4790
  * getPublicKeyThumbprint API in CryptoOpts class (msal-browser).
4815
4791
  * Used to generate a public/private keypair and generate a public key thumbprint for pop requests.
4816
4792
  */
4817
- PerformanceEvents["CryptoOptsGetPublicKeyThumbprint"] = "cryptoOptsGetPublicKeyThumbprint";
4793
+ CryptoOptsGetPublicKeyThumbprint: "cryptoOptsGetPublicKeyThumbprint",
4818
4794
  /**
4819
4795
  * signJwt API in CryptoOpts class (msal-browser).
4820
4796
  * Used to signed a pop token.
4821
4797
  */
4822
- PerformanceEvents["CryptoOptsSignJwt"] = "cryptoOptsSignJwt";
4798
+ CryptoOptsSignJwt: "cryptoOptsSignJwt",
4823
4799
  /**
4824
4800
  * acquireToken API in the SilentCacheClient class (msal-browser).
4825
4801
  * Used to read access tokens from the cache.
4826
4802
  */
4827
- PerformanceEvents["SilentCacheClientAcquireToken"] = "silentCacheClientAcquireToken";
4803
+ SilentCacheClientAcquireToken: "silentCacheClientAcquireToken",
4828
4804
  /**
4829
4805
  * acquireToken API in the SilentIframeClient class (msal-browser).
4830
4806
  * Used to acquire a new set of tokens from the authorize endpoint in a hidden iframe.
4831
4807
  */
4832
- PerformanceEvents["SilentIframeClientAcquireToken"] = "silentIframeClientAcquireToken";
4808
+ SilentIframeClientAcquireToken: "silentIframeClientAcquireToken",
4833
4809
  /**
4834
4810
  * acquireToken API in SilentRereshClient (msal-browser).
4835
4811
  * Used to acquire a new set of tokens from the token endpoint using a refresh token.
4836
4812
  */
4837
- PerformanceEvents["SilentRefreshClientAcquireToken"] = "silentRefreshClientAcquireToken";
4813
+ SilentRefreshClientAcquireToken: "silentRefreshClientAcquireToken",
4838
4814
  /**
4839
4815
  * ssoSilent API (msal-browser).
4840
4816
  * Used to silently acquire an authorization code and set of tokens using a hidden iframe.
4841
4817
  */
4842
- PerformanceEvents["SsoSilent"] = "ssoSilent";
4818
+ SsoSilent: "ssoSilent",
4843
4819
  /**
4844
4820
  * getDiscoveredAuthority API in StandardInteractionClient class (msal-browser).
4845
4821
  * Used to load authority metadata for a request.
4846
4822
  */
4847
- PerformanceEvents["StandardInteractionClientGetDiscoveredAuthority"] = "standardInteractionClientGetDiscoveredAuthority";
4823
+ StandardInteractionClientGetDiscoveredAuthority: "standardInteractionClientGetDiscoveredAuthority",
4848
4824
  /**
4849
4825
  * acquireToken APIs in msal-browser.
4850
4826
  * Used to make an /authorize endpoint call with native brokering enabled.
4851
4827
  */
4852
- PerformanceEvents["FetchAccountIdWithNativeBroker"] = "fetchAccountIdWithNativeBroker";
4828
+ FetchAccountIdWithNativeBroker: "fetchAccountIdWithNativeBroker",
4853
4829
  /**
4854
4830
  * acquireToken API in NativeInteractionClient class (msal-browser).
4855
4831
  * Used to acquire a token from Native component when native brokering is enabled.
4856
4832
  */
4857
- PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
4833
+ NativeInteractionClientAcquireToken: "nativeInteractionClientAcquireToken",
4858
4834
  /**
4859
4835
  * Time spent creating default headers for requests to token endpoint
4860
4836
  */
4861
- PerformanceEvents["BaseClientCreateTokenRequestHeaders"] = "baseClientCreateTokenRequestHeaders";
4837
+ BaseClientCreateTokenRequestHeaders: "baseClientCreateTokenRequestHeaders",
4862
4838
  /**
4863
4839
  * Used to measure the time taken for completing embedded-broker handshake (PW-Broker).
4864
4840
  */
4865
- PerformanceEvents["BrokerHandhshake"] = "brokerHandshake";
4841
+ BrokerHandhshake: "brokerHandshake",
4866
4842
  /**
4867
4843
  * acquireTokenByRefreshToken API in BrokerClientApplication (PW-Broker) .
4868
4844
  */
4869
- PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
4845
+ AcquireTokenByRefreshTokenInBroker: "acquireTokenByRefreshTokenInBroker",
4870
4846
  /**
4871
4847
  * Time taken for token acquisition by broker
4872
4848
  */
4873
- PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
4849
+ AcquireTokenByBroker: "acquireTokenByBroker",
4874
4850
  /**
4875
4851
  * Time spent on the network for refresh token acquisition
4876
4852
  */
4877
- PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
4853
+ RefreshTokenClientExecuteTokenRequest: "refreshTokenClientExecuteTokenRequest",
4878
4854
  /**
4879
4855
  * Time taken for acquiring refresh token , records RT size
4880
4856
  */
4881
- PerformanceEvents["RefreshTokenClientAcquireToken"] = "refreshTokenClientAcquireToken";
4857
+ RefreshTokenClientAcquireToken: "refreshTokenClientAcquireToken",
4882
4858
  /**
4883
4859
  * Time taken for acquiring cached refresh token
4884
4860
  */
4885
- PerformanceEvents["RefreshTokenClientAcquireTokenWithCachedRefreshToken"] = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
4861
+ RefreshTokenClientAcquireTokenWithCachedRefreshToken: "refreshTokenClientAcquireTokenWithCachedRefreshToken",
4886
4862
  /**
4887
4863
  * acquireTokenByRefreshToken API in RefreshTokenClient (msal-common).
4888
4864
  */
4889
- PerformanceEvents["RefreshTokenClientAcquireTokenByRefreshToken"] = "refreshTokenClientAcquireTokenByRefreshToken";
4865
+ RefreshTokenClientAcquireTokenByRefreshToken: "refreshTokenClientAcquireTokenByRefreshToken",
4890
4866
  /**
4891
4867
  * Helper function to create token request body in RefreshTokenClient (msal-common).
4892
4868
  */
4893
- PerformanceEvents["RefreshTokenClientCreateTokenRequestBody"] = "refreshTokenClientCreateTokenRequestBody";
4869
+ RefreshTokenClientCreateTokenRequestBody: "refreshTokenClientCreateTokenRequestBody",
4894
4870
  /**
4895
4871
  * acquireTokenFromCache (msal-browser).
4896
4872
  * Internal API for acquiring token from cache
4897
4873
  */
4898
- PerformanceEvents["AcquireTokenFromCache"] = "acquireTokenFromCache";
4874
+ AcquireTokenFromCache: "acquireTokenFromCache",
4899
4875
  /**
4900
4876
  * acquireTokenBySilentIframe (msal-browser).
4901
4877
  * Internal API for acquiring token by silent Iframe
4902
4878
  */
4903
- PerformanceEvents["AcquireTokenBySilentIframe"] = "acquireTokenBySilentIframe";
4879
+ AcquireTokenBySilentIframe: "acquireTokenBySilentIframe",
4904
4880
  /**
4905
4881
  * Internal API for initializing base request in BaseInteractionClient (msal-browser)
4906
4882
  */
4907
- PerformanceEvents["InitializeBaseRequest"] = "initializeBaseRequest";
4883
+ InitializeBaseRequest: "initializeBaseRequest",
4908
4884
  /**
4909
4885
  * Internal API for initializing silent request in SilentCacheClient (msal-browser)
4910
4886
  */
4911
- PerformanceEvents["InitializeSilentRequest"] = "initializeSilentRequest";
4912
- PerformanceEvents["InitializeClientApplication"] = "initializeClientApplication";
4887
+ InitializeSilentRequest: "initializeSilentRequest",
4888
+ InitializeClientApplication: "initializeClientApplication",
4913
4889
  /**
4914
4890
  * Helper function in SilentIframeClient class (msal-browser).
4915
4891
  */
4916
- PerformanceEvents["SilentIframeClientTokenHelper"] = "silentIframeClientTokenHelper";
4892
+ SilentIframeClientTokenHelper: "silentIframeClientTokenHelper",
4917
4893
  /**
4918
4894
  * SilentHandler
4919
4895
  */
4920
- PerformanceEvents["SilentHandlerInitiateAuthRequest"] = "silentHandlerInitiateAuthRequest";
4921
- PerformanceEvents["SilentHandlerMonitorIframeForHash"] = "silentHandlerMonitorIframeForHash";
4922
- PerformanceEvents["SilentHandlerLoadFrame"] = "silentHandlerLoadFrame";
4896
+ SilentHandlerInitiateAuthRequest: "silentHandlerInitiateAuthRequest",
4897
+ SilentHandlerMonitorIframeForHash: "silentHandlerMonitorIframeForHash",
4898
+ SilentHandlerLoadFrame: "silentHandlerLoadFrame",
4923
4899
  /**
4924
4900
  * Helper functions in StandardInteractionClient class (msal-browser)
4925
4901
  */
4926
- PerformanceEvents["StandardInteractionClientCreateAuthCodeClient"] = "standardInteractionClientCreateAuthCodeClient";
4927
- PerformanceEvents["StandardInteractionClientGetClientConfiguration"] = "standardInteractionClientGetClientConfiguration";
4928
- PerformanceEvents["StandardInteractionClientInitializeAuthorizationRequest"] = "standardInteractionClientInitializeAuthorizationRequest";
4929
- PerformanceEvents["StandardInteractionClientInitializeAuthorizationCodeRequest"] = "standardInteractionClientInitializeAuthorizationCodeRequest";
4902
+ StandardInteractionClientCreateAuthCodeClient: "standardInteractionClientCreateAuthCodeClient",
4903
+ StandardInteractionClientGetClientConfiguration: "standardInteractionClientGetClientConfiguration",
4904
+ StandardInteractionClientInitializeAuthorizationRequest: "standardInteractionClientInitializeAuthorizationRequest",
4905
+ StandardInteractionClientInitializeAuthorizationCodeRequest: "standardInteractionClientInitializeAuthorizationCodeRequest",
4930
4906
  /**
4931
4907
  * getAuthCodeUrl API (msal-browser and msal-node).
4932
4908
  */
4933
- PerformanceEvents["GetAuthCodeUrl"] = "getAuthCodeUrl";
4909
+ GetAuthCodeUrl: "getAuthCodeUrl",
4934
4910
  /**
4935
4911
  * Functions from InteractionHandler (msal-browser)
4936
4912
  */
4937
- PerformanceEvents["HandleCodeResponseFromServer"] = "handleCodeResponseFromServer";
4938
- PerformanceEvents["HandleCodeResponseFromHash"] = "handleCodeResponseFromHash";
4939
- PerformanceEvents["UpdateTokenEndpointAuthority"] = "updateTokenEndpointAuthority";
4913
+ HandleCodeResponseFromServer: "handleCodeResponseFromServer",
4914
+ HandleCodeResponseFromHash: "handleCodeResponseFromHash",
4915
+ UpdateTokenEndpointAuthority: "updateTokenEndpointAuthority",
4940
4916
  /**
4941
4917
  * APIs in Authorization Code Client (msal-common)
4942
4918
  */
4943
- PerformanceEvents["AuthClientAcquireToken"] = "authClientAcquireToken";
4944
- PerformanceEvents["AuthClientExecuteTokenRequest"] = "authClientExecuteTokenRequest";
4945
- PerformanceEvents["AuthClientCreateTokenRequestBody"] = "authClientCreateTokenRequestBody";
4946
- PerformanceEvents["AuthClientCreateQueryString"] = "authClientCreateQueryString";
4919
+ AuthClientAcquireToken: "authClientAcquireToken",
4920
+ AuthClientExecuteTokenRequest: "authClientExecuteTokenRequest",
4921
+ AuthClientCreateTokenRequestBody: "authClientCreateTokenRequestBody",
4922
+ AuthClientCreateQueryString: "authClientCreateQueryString",
4947
4923
  /**
4948
4924
  * Generate functions in PopTokenGenerator (msal-common)
4949
4925
  */
4950
- PerformanceEvents["PopTokenGenerateCnf"] = "popTokenGenerateCnf";
4951
- PerformanceEvents["PopTokenGenerateKid"] = "popTokenGenerateKid";
4926
+ PopTokenGenerateCnf: "popTokenGenerateCnf",
4927
+ PopTokenGenerateKid: "popTokenGenerateKid",
4952
4928
  /**
4953
4929
  * handleServerTokenResponse API in ResponseHandler (msal-common)
4954
4930
  */
4955
- PerformanceEvents["HandleServerTokenResponse"] = "handleServerTokenResponse";
4931
+ HandleServerTokenResponse: "handleServerTokenResponse",
4956
4932
  /**
4957
4933
  * Authority functions
4958
4934
  */
4959
- PerformanceEvents["AuthorityFactoryCreateDiscoveredInstance"] = "authorityFactoryCreateDiscoveredInstance";
4960
- PerformanceEvents["AuthorityResolveEndpointsAsync"] = "authorityResolveEndpointsAsync";
4961
- PerformanceEvents["AuthorityGetCloudDiscoveryMetadataFromNetwork"] = "authorityGetCloudDiscoveryMetadataFromNetwork";
4962
- PerformanceEvents["AuthorityUpdateCloudDiscoveryMetadata"] = "authorityUpdateCloudDiscoveryMetadata";
4963
- PerformanceEvents["AuthorityGetEndpointMetadataFromNetwork"] = "authorityGetEndpointMetadataFromNetwork";
4964
- PerformanceEvents["AuthorityUpdateEndpointMetadata"] = "authorityUpdateEndpointMetadata";
4965
- PerformanceEvents["AuthorityUpdateMetadataWithRegionalInformation"] = "authorityUpdateMetadataWithRegionalInformation";
4935
+ AuthorityFactoryCreateDiscoveredInstance: "authorityFactoryCreateDiscoveredInstance",
4936
+ AuthorityResolveEndpointsAsync: "authorityResolveEndpointsAsync",
4937
+ AuthorityGetCloudDiscoveryMetadataFromNetwork: "authorityGetCloudDiscoveryMetadataFromNetwork",
4938
+ AuthorityUpdateCloudDiscoveryMetadata: "authorityUpdateCloudDiscoveryMetadata",
4939
+ AuthorityGetEndpointMetadataFromNetwork: "authorityGetEndpointMetadataFromNetwork",
4940
+ AuthorityUpdateEndpointMetadata: "authorityUpdateEndpointMetadata",
4941
+ AuthorityUpdateMetadataWithRegionalInformation: "authorityUpdateMetadataWithRegionalInformation",
4966
4942
  /**
4967
4943
  * Region Discovery functions
4968
4944
  */
4969
- PerformanceEvents["RegionDiscoveryDetectRegion"] = "regionDiscoveryDetectRegion";
4970
- PerformanceEvents["RegionDiscoveryGetRegionFromIMDS"] = "regionDiscoveryGetRegionFromIMDS";
4971
- PerformanceEvents["RegionDiscoveryGetCurrentVersion"] = "regionDiscoveryGetCurrentVersion";
4972
- PerformanceEvents["AcquireTokenByCodeAsync"] = "acquireTokenByCodeAsync";
4973
- PerformanceEvents["GetEndpointMetadataFromNetwork"] = "getEndpointMetadataFromNetwork";
4974
- PerformanceEvents["GetCloudDiscoveryMetadataFromNetworkMeasurement"] = "getCloudDiscoveryMetadataFromNetworkMeasurement";
4975
- PerformanceEvents["HandleRedirectPromiseMeasurement"] = "handleRedirectPromiseMeasurement";
4976
- PerformanceEvents["UpdateCloudDiscoveryMetadataMeasurement"] = "updateCloudDiscoveryMetadataMeasurement";
4977
- PerformanceEvents["UsernamePasswordClientAcquireToken"] = "usernamePasswordClientAcquireToken";
4978
- PerformanceEvents["NativeMessageHandlerHandshake"] = "nativeMessageHandlerHandshake";
4979
- })(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
4945
+ RegionDiscoveryDetectRegion: "regionDiscoveryDetectRegion",
4946
+ RegionDiscoveryGetRegionFromIMDS: "regionDiscoveryGetRegionFromIMDS",
4947
+ RegionDiscoveryGetCurrentVersion: "regionDiscoveryGetCurrentVersion",
4948
+ AcquireTokenByCodeAsync: "acquireTokenByCodeAsync",
4949
+ GetEndpointMetadataFromNetwork: "getEndpointMetadataFromNetwork",
4950
+ GetCloudDiscoveryMetadataFromNetworkMeasurement: "getCloudDiscoveryMetadataFromNetworkMeasurement",
4951
+ HandleRedirectPromiseMeasurement: "handleRedirectPromiseMeasurement",
4952
+ UpdateCloudDiscoveryMetadataMeasurement: "updateCloudDiscoveryMetadataMeasurement",
4953
+ UsernamePasswordClientAcquireToken: "usernamePasswordClientAcquireToken",
4954
+ NativeMessageHandlerHandshake: "nativeMessageHandlerHandshake",
4955
+ };
4980
4956
  /**
4981
4957
  * State of the performance event.
4982
4958
  *
4983
4959
  * @export
4984
4960
  * @enum {number}
4985
4961
  */
4986
- exports.PerformanceEventStatus = void 0;
4987
- (function (PerformanceEventStatus) {
4988
- PerformanceEventStatus[PerformanceEventStatus["NotStarted"] = 0] = "NotStarted";
4989
- PerformanceEventStatus[PerformanceEventStatus["InProgress"] = 1] = "InProgress";
4990
- PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
4991
- })(exports.PerformanceEventStatus || (exports.PerformanceEventStatus = {}));
4962
+ const PerformanceEventStatus = {
4963
+ NotStarted: 0,
4964
+ InProgress: 1,
4965
+ Completed: 2,
4966
+ };
4992
4967
  const IntFields = new Set([
4993
4968
  "accessTokenSize",
4994
4969
  "durationMs",
@@ -5005,11 +4980,10 @@ const IntFields = new Set([
5005
4980
  * Copyright (c) Microsoft Corporation. All rights reserved.
5006
4981
  * Licensed under the MIT License.
5007
4982
  */
5008
- var KeyLocation;
5009
- (function (KeyLocation) {
5010
- KeyLocation["SW"] = "sw";
5011
- KeyLocation["UHW"] = "uhw";
5012
- })(KeyLocation || (KeyLocation = {}));
4983
+ const KeyLocation = {
4984
+ SW: "sw",
4985
+ UHW: "uhw",
4986
+ };
5013
4987
  class PopTokenGenerator {
5014
4988
  constructor(cryptoUtils, performanceClient) {
5015
4989
  this.cryptoUtils = cryptoUtils;
@@ -5022,8 +4996,8 @@ class PopTokenGenerator {
5022
4996
  * @returns
5023
4997
  */
5024
4998
  async generateCnf(request) {
5025
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
5026
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateKid, request.correlationId);
4999
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
5000
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateKid, request.correlationId);
5027
5001
  const reqCnf = await this.generateKid(request);
5028
5002
  const reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
5029
5003
  return {
@@ -5038,7 +5012,7 @@ class PopTokenGenerator {
5038
5012
  * @returns
5039
5013
  */
5040
5014
  async generateKid(request) {
5041
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.PopTokenGenerateKid, request.correlationId);
5015
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.PopTokenGenerateKid, request.correlationId);
5042
5016
  const kidThumbprint = await this.cryptoUtils.getPublicKeyThumbprint(request);
5043
5017
  return {
5044
5018
  kid: kidThumbprint,
@@ -5246,7 +5220,7 @@ class ResponseHandler {
5246
5220
  * @param authority
5247
5221
  */
5248
5222
  async handleServerTokenResponse(serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
5249
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.HandleServerTokenResponse, serverTokenResponse.correlation_id);
5223
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.HandleServerTokenResponse, serverTokenResponse.correlation_id);
5250
5224
  // create an idToken object (not entity)
5251
5225
  let idTokenObj;
5252
5226
  if (serverTokenResponse.id_token) {
@@ -5389,7 +5363,7 @@ class ResponseHandler {
5389
5363
  ? authCodePayload.msgraph_host
5390
5364
  : Constants.EMPTY_STRING;
5391
5365
  // ADFS does not require client_info in the response
5392
- if (authorityType === exports.AuthorityType.Adfs) {
5366
+ if (authorityType === AuthorityType.Adfs) {
5393
5367
  this.logger.verbose("Authority type is ADFS, creating ADFS account");
5394
5368
  return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);
5395
5369
  }
@@ -5419,7 +5393,7 @@ class ResponseHandler {
5419
5393
  let extExpiresOn;
5420
5394
  let familyId = Constants.EMPTY_STRING;
5421
5395
  if (cacheRecord.accessToken) {
5422
- if (cacheRecord.accessToken.tokenType === exports.AuthenticationScheme.POP) {
5396
+ if (cacheRecord.accessToken.tokenType === AuthenticationScheme.POP) {
5423
5397
  const popTokenGenerator = new PopTokenGenerator(cryptoObj);
5424
5398
  const { secret, keyId } = cacheRecord.accessToken;
5425
5399
  if (!keyId) {
@@ -5503,8 +5477,8 @@ class AuthorizationCodeClient extends BaseClient {
5503
5477
  * @param request
5504
5478
  */
5505
5479
  async getAuthCodeUrl(request) {
5506
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.GetAuthCodeUrl, request.correlationId);
5507
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
5480
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.GetAuthCodeUrl, request.correlationId);
5481
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
5508
5482
  const queryString = await this.createAuthCodeUrlQueryString(request);
5509
5483
  return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);
5510
5484
  }
@@ -5517,17 +5491,17 @@ class AuthorizationCodeClient extends BaseClient {
5517
5491
  if (!request || !request.code) {
5518
5492
  throw ClientAuthError.createTokenRequestCannotBeMadeError();
5519
5493
  }
5520
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthClientAcquireToken, request.correlationId);
5494
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientAcquireToken, request.correlationId);
5521
5495
  const atsMeasurement = this.performanceClient?.startMeasurement(
5522
5496
  // @ts-ignore
5523
5497
  "AuthCodeClientAcquireToken", request.correlationId);
5524
5498
  this.logger.info("in acquireToken call in auth-code client");
5525
5499
  const reqTimestamp = TimeUtils.nowSeconds();
5526
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
5500
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
5527
5501
  const response = await this.executeTokenRequest(this.authority, request);
5528
5502
  // Retrieve requestId from response headers
5529
- const requestId = response.headers?.[exports.HeaderNames.X_MS_REQUEST_ID];
5530
- const httpVerAuthority = response.headers?.[exports.HeaderNames.X_MS_HTTP_VERSION];
5503
+ const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
5504
+ const httpVerAuthority = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];
5531
5505
  if (httpVerAuthority) {
5532
5506
  atsMeasurement?.addStaticFields({
5533
5507
  httpVerAuthority,
@@ -5536,7 +5510,7 @@ class AuthorizationCodeClient extends BaseClient {
5536
5510
  const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin, this.performanceClient);
5537
5511
  // Validate response. This function throws a server error if an error is returned by the server.
5538
5512
  responseHandler.validateTokenResponse(response.body);
5539
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.HandleServerTokenResponse, request.correlationId);
5513
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);
5540
5514
  return responseHandler
5541
5515
  .handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId)
5542
5516
  .then((result) => {
@@ -5599,8 +5573,8 @@ class AuthorizationCodeClient extends BaseClient {
5599
5573
  * @param request
5600
5574
  */
5601
5575
  async executeTokenRequest(authority, request) {
5602
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
5603
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
5576
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);
5577
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
5604
5578
  const queryParametersString = this.createTokenQueryParameters(request);
5605
5579
  const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
5606
5580
  const requestBody = await this.createTokenRequestBody(request);
@@ -5610,7 +5584,7 @@ class AuthorizationCodeClient extends BaseClient {
5610
5584
  const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);
5611
5585
  ccsCredential = {
5612
5586
  credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,
5613
- type: exports.CcsCredentialType.HOME_ACCOUNT_ID,
5587
+ type: CcsCredentialType.HOME_ACCOUNT_ID,
5614
5588
  };
5615
5589
  }
5616
5590
  catch (e) {
@@ -5636,7 +5610,7 @@ class AuthorizationCodeClient extends BaseClient {
5636
5610
  * @param request
5637
5611
  */
5638
5612
  async createTokenRequestBody(request) {
5639
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
5613
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);
5640
5614
  const parameterBuilder = new RequestParameterBuilder();
5641
5615
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5642
5616
  /*
@@ -5674,16 +5648,16 @@ class AuthorizationCodeClient extends BaseClient {
5674
5648
  parameterBuilder.addClientAssertion(clientAssertion.assertion);
5675
5649
  parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
5676
5650
  }
5677
- parameterBuilder.addGrantType(exports.GrantType.AUTHORIZATION_CODE_GRANT);
5651
+ parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);
5678
5652
  parameterBuilder.addClientInfo();
5679
- if (request.authenticationScheme === exports.AuthenticationScheme.POP) {
5653
+ if (request.authenticationScheme === AuthenticationScheme.POP) {
5680
5654
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
5681
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
5655
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
5682
5656
  const reqCnfData = await popTokenGenerator.generateCnf(request);
5683
5657
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
5684
5658
  parameterBuilder.addPopToken(reqCnfData.reqCnfString);
5685
5659
  }
5686
- else if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
5660
+ else if (request.authenticationScheme === AuthenticationScheme.SSH) {
5687
5661
  if (request.sshJwk) {
5688
5662
  parameterBuilder.addSshJwk(request.sshJwk);
5689
5663
  }
@@ -5705,7 +5679,7 @@ class AuthorizationCodeClient extends BaseClient {
5705
5679
  const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils);
5706
5680
  ccsCred = {
5707
5681
  credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,
5708
- type: exports.CcsCredentialType.HOME_ACCOUNT_ID,
5682
+ type: CcsCredentialType.HOME_ACCOUNT_ID,
5709
5683
  };
5710
5684
  }
5711
5685
  catch (e) {
@@ -5718,7 +5692,7 @@ class AuthorizationCodeClient extends BaseClient {
5718
5692
  // Adds these as parameters in the request instead of headers to prevent CORS preflight request
5719
5693
  if (this.config.systemOptions.preventCorsPreflight && ccsCred) {
5720
5694
  switch (ccsCred.type) {
5721
- case exports.CcsCredentialType.HOME_ACCOUNT_ID:
5695
+ case CcsCredentialType.HOME_ACCOUNT_ID:
5722
5696
  try {
5723
5697
  const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);
5724
5698
  parameterBuilder.addCcsOid(clientInfo);
@@ -5728,7 +5702,7 @@ class AuthorizationCodeClient extends BaseClient {
5728
5702
  e);
5729
5703
  }
5730
5704
  break;
5731
- case exports.CcsCredentialType.UPN:
5705
+ case CcsCredentialType.UPN:
5732
5706
  parameterBuilder.addCcsUpn(ccsCred.credential);
5733
5707
  break;
5734
5708
  }
@@ -5739,9 +5713,9 @@ class AuthorizationCodeClient extends BaseClient {
5739
5713
  // Add hybrid spa parameters if not already provided
5740
5714
  if (request.enableSpaAuthorizationCode &&
5741
5715
  (!request.tokenBodyParameters ||
5742
- !request.tokenBodyParameters[exports.AADServerParamKeys.RETURN_SPA_CODE])) {
5716
+ !request.tokenBodyParameters[AADServerParamKeys.RETURN_SPA_CODE])) {
5743
5717
  parameterBuilder.addExtraQueryParameters({
5744
- [exports.AADServerParamKeys.RETURN_SPA_CODE]: "1",
5718
+ [AADServerParamKeys.RETURN_SPA_CODE]: "1",
5745
5719
  });
5746
5720
  }
5747
5721
  return parameterBuilder.createQueryString();
@@ -5751,7 +5725,7 @@ class AuthorizationCodeClient extends BaseClient {
5751
5725
  * @param request
5752
5726
  */
5753
5727
  async createAuthCodeUrlQueryString(request) {
5754
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
5728
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);
5755
5729
  const parameterBuilder = new RequestParameterBuilder();
5756
5730
  parameterBuilder.addClientId(this.config.authOptions.clientId);
5757
5731
  const requestScopes = [
@@ -5866,7 +5840,7 @@ class AuthorizationCodeClient extends BaseClient {
5866
5840
  // signal ests that this is a WAM call
5867
5841
  parameterBuilder.addNativeBroker();
5868
5842
  // pass the req_cnf for POP
5869
- if (request.authenticationScheme === exports.AuthenticationScheme.POP) {
5843
+ if (request.authenticationScheme === AuthenticationScheme.POP) {
5870
5844
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
5871
5845
  // to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
5872
5846
  const reqCnfData = await popTokenGenerator.generateCnf(request);
@@ -5925,13 +5899,13 @@ class RefreshTokenClient extends BaseClient {
5925
5899
  super(configuration, performanceClient);
5926
5900
  }
5927
5901
  async acquireToken(request) {
5928
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
5929
- const atsMeasurement = this.performanceClient?.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
5902
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
5903
+ const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
5930
5904
  this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
5931
5905
  const reqTimestamp = TimeUtils.nowSeconds();
5932
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
5906
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
5933
5907
  const response = await this.executeTokenRequest(request, this.authority);
5934
- const httpVerToken = response.headers?.[exports.HeaderNames.X_MS_HTTP_VERSION];
5908
+ const httpVerToken = response.headers?.[HeaderNames.X_MS_HTTP_VERSION];
5935
5909
  atsMeasurement?.addStaticFields({
5936
5910
  refreshTokenSize: response.body.refresh_token?.length || 0,
5937
5911
  });
@@ -5941,10 +5915,10 @@ class RefreshTokenClient extends BaseClient {
5941
5915
  });
5942
5916
  }
5943
5917
  // Retrieve requestId from response headers
5944
- const requestId = response.headers?.[exports.HeaderNames.X_MS_REQUEST_ID];
5918
+ const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
5945
5919
  const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
5946
5920
  responseHandler.validateTokenResponse(response.body);
5947
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.HandleServerTokenResponse, request.correlationId);
5921
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.HandleServerTokenResponse, request.correlationId);
5948
5922
  return responseHandler
5949
5923
  .handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId)
5950
5924
  .then((result) => {
@@ -5972,7 +5946,7 @@ class RefreshTokenClient extends BaseClient {
5972
5946
  if (!request) {
5973
5947
  throw ClientConfigurationError.createEmptyTokenRequestError();
5974
5948
  }
5975
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
5949
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);
5976
5950
  // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
5977
5951
  if (!request.account) {
5978
5952
  throw ClientAuthError.createNoAccountInSilentRequestError();
@@ -5982,7 +5956,7 @@ class RefreshTokenClient extends BaseClient {
5982
5956
  // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest
5983
5957
  if (isFOCI) {
5984
5958
  try {
5985
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
5959
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
5986
5960
  return this.acquireTokenWithCachedRefreshToken(request, true);
5987
5961
  }
5988
5962
  catch (e) {
@@ -5995,7 +5969,7 @@ class RefreshTokenClient extends BaseClient {
5995
5969
  e.subError === Errors.CLIENT_MISMATCH_ERROR;
5996
5970
  // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)
5997
5971
  if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {
5998
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
5972
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
5999
5973
  return this.acquireTokenWithCachedRefreshToken(request, false);
6000
5974
  // throw in all other cases
6001
5975
  }
@@ -6005,7 +5979,7 @@ class RefreshTokenClient extends BaseClient {
6005
5979
  }
6006
5980
  }
6007
5981
  // fall back to application refresh token acquisition
6008
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
5982
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
6009
5983
  return this.acquireTokenWithCachedRefreshToken(request, false);
6010
5984
  }
6011
5985
  /**
@@ -6013,9 +5987,9 @@ class RefreshTokenClient extends BaseClient {
6013
5987
  * @param request
6014
5988
  */
6015
5989
  async acquireTokenWithCachedRefreshToken(request, foci) {
6016
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
5990
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
6017
5991
  // fetches family RT or application RT based on FOCI value
6018
- const atsMeasurement = this.performanceClient?.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
5992
+ const atsMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
6019
5993
  this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
6020
5994
  const refreshToken = this.cacheManager.getRefreshToken(request.account, foci);
6021
5995
  if (!refreshToken) {
@@ -6029,13 +6003,13 @@ class RefreshTokenClient extends BaseClient {
6029
6003
  const refreshTokenRequest = {
6030
6004
  ...request,
6031
6005
  refreshToken: refreshToken.secret,
6032
- authenticationScheme: request.authenticationScheme || exports.AuthenticationScheme.BEARER,
6006
+ authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER,
6033
6007
  ccsCredential: {
6034
6008
  credential: request.account.homeAccountId,
6035
- type: exports.CcsCredentialType.HOME_ACCOUNT_ID,
6009
+ type: CcsCredentialType.HOME_ACCOUNT_ID,
6036
6010
  },
6037
6011
  };
6038
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
6012
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
6039
6013
  return this.acquireToken(refreshTokenRequest);
6040
6014
  }
6041
6015
  /**
@@ -6044,9 +6018,9 @@ class RefreshTokenClient extends BaseClient {
6044
6018
  * @param authority
6045
6019
  */
6046
6020
  async executeTokenRequest(request, authority) {
6047
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
6048
- const acquireTokenMeasurement = this.performanceClient?.startMeasurement(exports.PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
6049
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
6021
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
6022
+ const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);
6023
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
6050
6024
  const queryParametersString = this.createTokenQueryParameters(request);
6051
6025
  const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);
6052
6026
  const requestBody = await this.createTokenRequestBody(request);
@@ -6081,13 +6055,13 @@ class RefreshTokenClient extends BaseClient {
6081
6055
  * @param request
6082
6056
  */
6083
6057
  async createTokenRequestBody(request) {
6084
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
6058
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);
6085
6059
  const correlationId = request.correlationId;
6086
- const acquireTokenMeasurement = this.performanceClient?.startMeasurement(exports.PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
6060
+ const acquireTokenMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.BaseClientCreateTokenRequestHeaders, correlationId);
6087
6061
  const parameterBuilder = new RequestParameterBuilder();
6088
6062
  parameterBuilder.addClientId(this.config.authOptions.clientId);
6089
6063
  parameterBuilder.addScopes(request.scopes);
6090
- parameterBuilder.addGrantType(exports.GrantType.REFRESH_TOKEN_GRANT);
6064
+ parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);
6091
6065
  parameterBuilder.addClientInfo();
6092
6066
  parameterBuilder.addLibraryInfo(this.config.libraryInfo);
6093
6067
  parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);
@@ -6105,14 +6079,14 @@ class RefreshTokenClient extends BaseClient {
6105
6079
  parameterBuilder.addClientAssertion(clientAssertion.assertion);
6106
6080
  parameterBuilder.addClientAssertionType(clientAssertion.assertionType);
6107
6081
  }
6108
- if (request.authenticationScheme === exports.AuthenticationScheme.POP) {
6082
+ if (request.authenticationScheme === AuthenticationScheme.POP) {
6109
6083
  const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
6110
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
6084
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.PopTokenGenerateCnf, request.correlationId);
6111
6085
  const reqCnfData = await popTokenGenerator.generateCnf(request);
6112
6086
  // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
6113
6087
  parameterBuilder.addPopToken(reqCnfData.reqCnfString);
6114
6088
  }
6115
- else if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
6089
+ else if (request.authenticationScheme === AuthenticationScheme.SSH) {
6116
6090
  if (request.sshJwk) {
6117
6091
  parameterBuilder.addSshJwk(request.sshJwk);
6118
6092
  }
@@ -6131,7 +6105,7 @@ class RefreshTokenClient extends BaseClient {
6131
6105
  if (this.config.systemOptions.preventCorsPreflight &&
6132
6106
  request.ccsCredential) {
6133
6107
  switch (request.ccsCredential.type) {
6134
- case exports.CcsCredentialType.HOME_ACCOUNT_ID:
6108
+ case CcsCredentialType.HOME_ACCOUNT_ID:
6135
6109
  try {
6136
6110
  const clientInfo = buildClientInfoFromHomeAccountId(request.ccsCredential.credential);
6137
6111
  parameterBuilder.addCcsOid(clientInfo);
@@ -6141,7 +6115,7 @@ class RefreshTokenClient extends BaseClient {
6141
6115
  e);
6142
6116
  }
6143
6117
  break;
6144
- case exports.CcsCredentialType.UPN:
6118
+ case CcsCredentialType.UPN:
6145
6119
  parameterBuilder.addCcsUpn(request.ccsCredential.credential);
6146
6120
  break;
6147
6121
  }
@@ -6192,7 +6166,7 @@ class SilentFlowClient extends BaseClient {
6192
6166
  }
6193
6167
  if (request.forceRefresh) {
6194
6168
  // Must refresh due to present force_refresh flag.
6195
- this.serverTelemetryManager?.setCacheOutcome(exports.CacheOutcome.FORCE_REFRESH);
6169
+ this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.FORCE_REFRESH);
6196
6170
  this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
6197
6171
  throw ClientAuthError.createRefreshRequiredError();
6198
6172
  }
@@ -6204,21 +6178,21 @@ class SilentFlowClient extends BaseClient {
6204
6178
  const cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment);
6205
6179
  if (!cacheRecord.accessToken) {
6206
6180
  // Must refresh due to non-existent access_token.
6207
- this.serverTelemetryManager?.setCacheOutcome(exports.CacheOutcome.NO_CACHED_ACCESS_TOKEN);
6181
+ this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
6208
6182
  this.logger.info("SilentFlowClient:acquireCachedToken - No access token found in cache for the given properties.");
6209
6183
  throw ClientAuthError.createRefreshRequiredError();
6210
6184
  }
6211
6185
  else if (TimeUtils.wasClockTurnedBack(cacheRecord.accessToken.cachedAt) ||
6212
6186
  TimeUtils.isTokenExpired(cacheRecord.accessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
6213
6187
  // Must refresh due to expired access_token.
6214
- this.serverTelemetryManager?.setCacheOutcome(exports.CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
6188
+ this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED);
6215
6189
  this.logger.info(`SilentFlowClient:acquireCachedToken - Cached access token is expired or will expire within ${this.config.systemOptions.tokenRenewalOffsetSeconds} seconds.`);
6216
6190
  throw ClientAuthError.createRefreshRequiredError();
6217
6191
  }
6218
6192
  else if (cacheRecord.accessToken.refreshOn &&
6219
6193
  TimeUtils.isTokenExpired(cacheRecord.accessToken.refreshOn, 0)) {
6220
6194
  // Must refresh due to the refresh_in value.
6221
- this.serverTelemetryManager?.setCacheOutcome(exports.CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);
6195
+ this.serverTelemetryManager?.setCacheOutcome(CacheOutcome.REFRESH_CACHED_ACCESS_TOKEN);
6222
6196
  this.logger.info("SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'.");
6223
6197
  throw ClientAuthError.createRefreshRequiredError();
6224
6198
  }
@@ -7143,11 +7117,10 @@ const InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
7143
7117
  /**
7144
7118
  * Protocol modes supported by MSAL.
7145
7119
  */
7146
- exports.ProtocolMode = void 0;
7147
- (function (ProtocolMode) {
7148
- ProtocolMode["AAD"] = "AAD";
7149
- ProtocolMode["OIDC"] = "OIDC";
7150
- })(exports.ProtocolMode || (exports.ProtocolMode = {}));
7120
+ const ProtocolMode = {
7121
+ AAD: "AAD",
7122
+ OIDC: "OIDC",
7123
+ };
7151
7124
 
7152
7125
  /*
7153
7126
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7261,14 +7234,14 @@ class RegionDiscovery {
7261
7234
  * @returns Promise<string | null>
7262
7235
  */
7263
7236
  async detectRegion(environmentRegion, regionDiscoveryMetadata) {
7264
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7237
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7265
7238
  // Initialize auto detected region with the region from the envrionment
7266
7239
  let autodetectedRegionName = environmentRegion;
7267
7240
  // Check if a region was detected from the environment, if not, attempt to get the region from IMDS
7268
7241
  if (!autodetectedRegionName) {
7269
7242
  const options = RegionDiscovery.IMDS_OPTIONS;
7270
7243
  try {
7271
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
7244
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
7272
7245
  const localIMDSVersionResponse = await this.getRegionFromIMDS(Constants.IMDS_VERSION, options);
7273
7246
  if (localIMDSVersionResponse.status ===
7274
7247
  ResponseCodes.httpSuccess) {
@@ -7279,14 +7252,14 @@ class RegionDiscovery {
7279
7252
  // If the response using the local IMDS version failed, try to fetch the current version of IMDS and retry.
7280
7253
  if (localIMDSVersionResponse.status ===
7281
7254
  ResponseCodes.httpBadRequest) {
7282
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
7255
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
7283
7256
  const currentIMDSVersion = await this.getCurrentVersion(options);
7284
7257
  if (!currentIMDSVersion) {
7285
7258
  regionDiscoveryMetadata.region_source =
7286
7259
  RegionDiscoverySources.FAILED_AUTO_DETECTION;
7287
7260
  return null;
7288
7261
  }
7289
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
7262
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
7290
7263
  const currentIMDSVersionResponse = await this.getRegionFromIMDS(currentIMDSVersion, options);
7291
7264
  if (currentIMDSVersionResponse.status ===
7292
7265
  ResponseCodes.httpSuccess) {
@@ -7321,7 +7294,7 @@ class RegionDiscovery {
7321
7294
  * @returns Promise<NetworkResponse<string>>
7322
7295
  */
7323
7296
  async getRegionFromIMDS(version, options) {
7324
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
7297
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetRegionFromIMDS, this.correlationId);
7325
7298
  return this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?api-version=${version}&format=text`, options, Constants.IMDS_TIMEOUT);
7326
7299
  }
7327
7300
  /**
@@ -7330,7 +7303,7 @@ class RegionDiscovery {
7330
7303
  * @returns Promise<string | null>
7331
7304
  */
7332
7305
  async getCurrentVersion(options) {
7333
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
7306
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.RegionDiscoveryGetCurrentVersion, this.correlationId);
7334
7307
  try {
7335
7308
  const response = await this.networkInterface.sendGetRequestAsync(`${Constants.IMDS_ENDPOINT}?format=json`, options);
7336
7309
  // When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
@@ -7387,18 +7360,18 @@ class Authority {
7387
7360
  getAuthorityType(authorityUri) {
7388
7361
  // CIAM auth url pattern is being standardized as: <tenant>.ciamlogin.com
7389
7362
  if (authorityUri.HostNameAndPort.endsWith(Constants.CIAM_AUTH_URL)) {
7390
- return exports.AuthorityType.Ciam;
7363
+ return AuthorityType.Ciam;
7391
7364
  }
7392
7365
  const pathSegments = authorityUri.PathSegments;
7393
7366
  if (pathSegments.length) {
7394
7367
  switch (pathSegments[0].toLowerCase()) {
7395
7368
  case Constants.ADFS:
7396
- return exports.AuthorityType.Adfs;
7369
+ return AuthorityType.Adfs;
7397
7370
  case Constants.DSTS:
7398
- return exports.AuthorityType.Dsts;
7371
+ return AuthorityType.Dsts;
7399
7372
  }
7400
7373
  }
7401
- return exports.AuthorityType.Default;
7374
+ return AuthorityType.Default;
7402
7375
  }
7403
7376
  // See above for AuthorityType
7404
7377
  get authorityType() {
@@ -7527,8 +7500,8 @@ class Authority {
7527
7500
  canReplaceTenant(authorityUri) {
7528
7501
  return authorityUri.PathSegments.length === 1
7529
7502
  && !Authority.reservedTenantDomains.has(authorityUri.PathSegments[0])
7530
- && this.getAuthorityType(authorityUri) === exports.AuthorityType.Default
7531
- && this.protocolMode === exports.ProtocolMode.AAD;
7503
+ && this.getAuthorityType(authorityUri) === AuthorityType.Default
7504
+ && this.protocolMode === ProtocolMode.AAD;
7532
7505
  }
7533
7506
  /**
7534
7507
  * Replaces tenant in url path with current tenant. Defaults to common.
@@ -7571,8 +7544,8 @@ class Authority {
7571
7544
  * The default open id configuration endpoint for any canonical authority.
7572
7545
  */
7573
7546
  get defaultOpenIdConfigurationEndpoint() {
7574
- if (this.authorityType === exports.AuthorityType.Adfs ||
7575
- this.protocolMode === exports.ProtocolMode.OIDC) {
7547
+ if (this.authorityType === AuthorityType.Adfs ||
7548
+ this.protocolMode === ProtocolMode.OIDC) {
7576
7549
  return `${this.canonicalAuthority}.well-known/openid-configuration`;
7577
7550
  }
7578
7551
  return `${this.canonicalAuthority}v2.0/.well-known/openid-configuration`;
@@ -7588,16 +7561,16 @@ class Authority {
7588
7561
  * and the /authorize, /token and logout endpoints.
7589
7562
  */
7590
7563
  async resolveEndpointsAsync() {
7591
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthorityResolveEndpointsAsync, this.correlationId);
7564
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityResolveEndpointsAsync, this.correlationId);
7592
7565
  let metadataEntity = this.cacheManager.getAuthorityMetadataByAlias(this.hostnameAndPort);
7593
7566
  if (!metadataEntity) {
7594
7567
  metadataEntity = new AuthorityMetadataEntity();
7595
7568
  metadataEntity.updateCanonicalAuthority(this.canonicalAuthority);
7596
7569
  }
7597
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
7570
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
7598
7571
  const cloudDiscoverySource = await this.updateCloudDiscoveryMetadata(metadataEntity);
7599
7572
  this.canonicalAuthority = this.canonicalAuthority.replace(this.hostnameAndPort, metadataEntity.preferred_network);
7600
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
7573
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
7601
7574
  const endpointSource = await this.updateEndpointMetadata(metadataEntity);
7602
7575
  if (cloudDiscoverySource !== AuthorityMetadataSource.CACHE &&
7603
7576
  endpointSource !== AuthorityMetadataSource.CACHE) {
@@ -7614,7 +7587,7 @@ class Authority {
7614
7587
  * @param metadataEntity
7615
7588
  */
7616
7589
  async updateEndpointMetadata(metadataEntity) {
7617
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
7590
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateEndpointMetadata, this.correlationId);
7618
7591
  let metadata = this.getEndpointMetadataFromConfig();
7619
7592
  if (metadata) {
7620
7593
  metadataEntity.updateEndpointMetadata(metadata, false);
@@ -7626,12 +7599,12 @@ class Authority {
7626
7599
  // No need to update
7627
7600
  return AuthorityMetadataSource.CACHE;
7628
7601
  }
7629
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
7602
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
7630
7603
  metadata = await this.getEndpointMetadataFromNetwork();
7631
7604
  if (metadata) {
7632
7605
  // If the user prefers to use an azure region replace the global endpoints with regional information.
7633
7606
  if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
7634
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7607
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7635
7608
  metadata = await this.updateMetadataWithRegionalInformation(metadata);
7636
7609
  }
7637
7610
  metadataEntity.updateEndpointMetadata(metadata, true);
@@ -7642,7 +7615,7 @@ class Authority {
7642
7615
  !this.authorityOptions.skipAuthorityMetadataCache) {
7643
7616
  // If the user prefers to use an azure region replace the global endpoints with regional information.
7644
7617
  if (this.authorityOptions.azureRegionConfiguration?.azureRegion) {
7645
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7618
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7646
7619
  harcodedMetadata =
7647
7620
  await this.updateMetadataWithRegionalInformation(harcodedMetadata);
7648
7621
  }
@@ -7685,8 +7658,8 @@ class Authority {
7685
7658
  * @param hasHardcodedMetadata boolean
7686
7659
  */
7687
7660
  async getEndpointMetadataFromNetwork() {
7688
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
7689
- const perfEvent = this.performanceClient?.startMeasurement(exports.PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
7661
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
7662
+ const perfEvent = this.performanceClient?.startMeasurement(PerformanceEvents.AuthorityGetEndpointMetadataFromNetwork, this.correlationId);
7690
7663
  const options = {};
7691
7664
  /*
7692
7665
  * TODO: Add a timeout if the authority exists in our library's
@@ -7726,8 +7699,8 @@ class Authority {
7726
7699
  * Update the retrieved metadata with regional information.
7727
7700
  */
7728
7701
  async updateMetadataWithRegionalInformation(metadata) {
7729
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7730
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7702
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateMetadataWithRegionalInformation, this.correlationId);
7703
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.RegionDiscoveryDetectRegion, this.correlationId);
7731
7704
  const autodetectedRegionName = await this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration?.environmentRegion, this.regionDiscoveryMetadata);
7732
7705
  const azureRegion = this.authorityOptions.azureRegionConfiguration?.azureRegion ===
7733
7706
  Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
@@ -7765,7 +7738,7 @@ class Authority {
7765
7738
  * @returns AuthorityMetadataSource
7766
7739
  */
7767
7740
  async updateCloudDiscoveryMetadata(metadataEntity) {
7768
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
7741
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityUpdateCloudDiscoveryMetadata, this.correlationId);
7769
7742
  this.logger.verbose("Attempting to get cloud discovery metadata in the config");
7770
7743
  this.logger.verbosePii(`Known Authorities: ${this.authorityOptions.knownAuthorities ||
7771
7744
  Constants.NOT_APPLICABLE}`);
@@ -7792,7 +7765,7 @@ class Authority {
7792
7765
  this.logger.verbose("The metadata entity is expired.");
7793
7766
  }
7794
7767
  this.logger.verbose("Did not find cloud discovery metadata in the cache... Attempting to get cloud discovery metadata from the network.");
7795
- this.performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
7768
+ this.performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
7796
7769
  metadata = await this.getCloudDiscoveryMetadataFromNetwork();
7797
7770
  if (metadata) {
7798
7771
  this.logger.verbose("cloud discovery metadata was successfully returned from getCloudDiscoveryMetadataFromNetwork()");
@@ -7815,7 +7788,7 @@ class Authority {
7815
7788
  */
7816
7789
  getCloudDiscoveryMetadataFromConfig() {
7817
7790
  // CIAM does not support cloud discovery metadata
7818
- if (this.authorityType === exports.AuthorityType.Ciam) {
7791
+ if (this.authorityType === AuthorityType.Ciam) {
7819
7792
  this.logger.verbose("CIAM authorities do not support cloud discovery metadata, generate the aliases from authority host.");
7820
7793
  return Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
7821
7794
  }
@@ -7853,7 +7826,7 @@ class Authority {
7853
7826
  * @param hasHardcodedMetadata boolean
7854
7827
  */
7855
7828
  async getCloudDiscoveryMetadataFromNetwork() {
7856
- this.performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
7829
+ this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityGetCloudDiscoveryMetadataFromNetwork, this.correlationId);
7857
7830
  const instanceDiscoveryEndpoint = `${Constants.AAD_INSTANCE_DISCOVERY_ENDPT}${this.canonicalAuthority}oauth2/v2.0/authorize`;
7858
7831
  const options = {};
7859
7832
  /*
@@ -7936,7 +7909,7 @@ class Authority {
7936
7909
  static generateAuthority(authorityString, azureCloudOptions) {
7937
7910
  let authorityAzureCloudInstance;
7938
7911
  if (azureCloudOptions &&
7939
- azureCloudOptions.azureCloudInstance !== exports.AzureCloudInstance.None) {
7912
+ azureCloudOptions.azureCloudInstance !== AzureCloudInstance.None) {
7940
7913
  const tenant = azureCloudOptions.tenant
7941
7914
  ? azureCloudOptions.tenant
7942
7915
  : Constants.DEFAULT_COMMON_TENANT;
@@ -8065,9 +8038,9 @@ class Authority {
8065
8038
  Authority.reservedTenantDomains = (new Set([
8066
8039
  "{tenant}",
8067
8040
  "{tenantid}",
8068
- exports.AADAuthorityConstants.COMMON,
8069
- exports.AADAuthorityConstants.CONSUMERS,
8070
- exports.AADAuthorityConstants.ORGANIZATIONS
8041
+ AADAuthorityConstants.COMMON,
8042
+ AADAuthorityConstants.CONSUMERS,
8043
+ AADAuthorityConstants.ORGANIZATIONS
8071
8044
  ]));
8072
8045
 
8073
8046
  /*
@@ -8086,12 +8059,12 @@ class AuthorityFactory {
8086
8059
  * @param protocolMode
8087
8060
  */
8088
8061
  static async createDiscoveredInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
8089
- performanceClient?.addQueueMeasurement(exports.PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
8062
+ performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
8090
8063
  const authorityUriFinal = Authority.transformCIAMAuthority(authorityUri);
8091
8064
  // Initialize authority and perform discovery endpoint check.
8092
8065
  const acquireTokenAuthority = AuthorityFactory.createInstance(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger, performanceClient, correlationId);
8093
8066
  try {
8094
- performanceClient?.setPreQueueTime(exports.PerformanceEvents.AuthorityResolveEndpointsAsync, correlationId);
8067
+ performanceClient?.setPreQueueTime(PerformanceEvents.AuthorityResolveEndpointsAsync, correlationId);
8095
8068
  await acquireTokenAuthority.resolveEndpointsAsync();
8096
8069
  return acquireTokenAuthority;
8097
8070
  }
@@ -8280,22 +8253,22 @@ class AuthenticationHeaderParser {
8280
8253
  */
8281
8254
  getShrNonce() {
8282
8255
  // Attempt to parse nonce from Authentiacation-Info
8283
- const authenticationInfo = this.headers[exports.HeaderNames.AuthenticationInfo];
8256
+ const authenticationInfo = this.headers[HeaderNames.AuthenticationInfo];
8284
8257
  if (authenticationInfo) {
8285
8258
  const authenticationInfoChallenges = this.parseChallenges(authenticationInfo);
8286
8259
  if (authenticationInfoChallenges.nextnonce) {
8287
8260
  return authenticationInfoChallenges.nextnonce;
8288
8261
  }
8289
- throw ClientConfigurationError.createInvalidAuthenticationHeaderError(exports.HeaderNames.AuthenticationInfo, "nextnonce challenge is missing.");
8262
+ throw ClientConfigurationError.createInvalidAuthenticationHeaderError(HeaderNames.AuthenticationInfo, "nextnonce challenge is missing.");
8290
8263
  }
8291
8264
  // Attempt to parse nonce from WWW-Authenticate
8292
- const wwwAuthenticate = this.headers[exports.HeaderNames.WWWAuthenticate];
8265
+ const wwwAuthenticate = this.headers[HeaderNames.WWWAuthenticate];
8293
8266
  if (wwwAuthenticate) {
8294
8267
  const wwwAuthenticateChallenges = this.parseChallenges(wwwAuthenticate);
8295
8268
  if (wwwAuthenticateChallenges.nonce) {
8296
8269
  return wwwAuthenticateChallenges.nonce;
8297
8270
  }
8298
- throw ClientConfigurationError.createInvalidAuthenticationHeaderError(exports.HeaderNames.WWWAuthenticate, "nonce challenge is missing.");
8271
+ throw ClientConfigurationError.createInvalidAuthenticationHeaderError(HeaderNames.WWWAuthenticate, "nonce challenge is missing.");
8299
8272
  }
8300
8273
  // If neither header is present, throw missing headers error
8301
8274
  throw ClientConfigurationError.createMissingNonceAuthenticationHeadersError();
@@ -8324,7 +8297,7 @@ class AuthenticationHeaderParser {
8324
8297
  */
8325
8298
  class ServerTelemetryManager {
8326
8299
  constructor(telemetryRequest, cacheManager) {
8327
- this.cacheOutcome = exports.CacheOutcome.NO_CACHE_HIT;
8300
+ this.cacheOutcome = CacheOutcome.NO_CACHE_HIT;
8328
8301
  this.cacheManager = cacheManager;
8329
8302
  this.apiId = telemetryRequest.apiId;
8330
8303
  this.correlationId = telemetryRequest.correlationId;
@@ -8665,7 +8638,7 @@ class PerformanceClient {
8665
8638
  performanceMeasurement.startMeasurement();
8666
8639
  const inProgressEvent = {
8667
8640
  eventId: this.generateId(),
8668
- status: exports.PerformanceEventStatus.InProgress,
8641
+ status: PerformanceEventStatus.InProgress,
8669
8642
  authority: this.authority,
8670
8643
  libraryName: this.libraryName,
8671
8644
  libraryVersion: this.libraryVersion,
@@ -8757,7 +8730,7 @@ class PerformanceClient {
8757
8730
  queuedTimeMs: queueInfo.totalQueueTime,
8758
8731
  queuedCount: queueInfo.totalQueueCount,
8759
8732
  queuedManuallyCompletedCount: queueInfo.manuallyCompletedCount,
8760
- status: exports.PerformanceEventStatus.Completed,
8733
+ status: PerformanceEventStatus.Completed,
8761
8734
  incompleteSubsCount,
8762
8735
  };
8763
8736
  this.truncateIntegralFields(finalEvent, this.getIntFields());
@@ -8927,13 +8900,9 @@ class PerformanceClient {
8927
8900
  * Licensed under the MIT License.
8928
8901
  */
8929
8902
  class StubPerformanceMeasurement {
8930
- /* eslint-disable-next-line @typescript-eslint/no-empty-function */
8931
- startMeasurement() { }
8932
- /* eslint-disable-next-line @typescript-eslint/no-empty-function */
8933
- endMeasurement() { }
8934
- flushMeasurement() {
8935
- return null;
8936
- }
8903
+ startMeasurement() { return; }
8904
+ endMeasurement() { return; }
8905
+ flushMeasurement() { return null; }
8937
8906
  }
8938
8907
  class StubPerformanceClient extends PerformanceClient {
8939
8908
  generateId() {
@@ -8942,23 +8911,15 @@ class StubPerformanceClient extends PerformanceClient {
8942
8911
  startPerformanceMeasurement() {
8943
8912
  return new StubPerformanceMeasurement();
8944
8913
  }
8945
- /* eslint-disable-next-line @typescript-eslint/no-unused-vars */
8946
- calculateQueuedTime(preQueueTime, currentTime) {
8914
+ calculateQueuedTime() {
8947
8915
  return 0;
8948
8916
  }
8949
- addQueueMeasurement(eventName, // eslint-disable-line @typescript-eslint/no-unused-vars
8950
- correlationId, // eslint-disable-line @typescript-eslint/no-unused-vars
8951
- queueTime // eslint-disable-line @typescript-eslint/no-unused-vars
8952
- ) {
8953
- return;
8954
- }
8955
- setPreQueueTime(eventName, // eslint-disable-line @typescript-eslint/no-unused-vars
8956
- correlationId // eslint-disable-line @typescript-eslint/no-unused-vars
8957
- ) {
8958
- return;
8959
- }
8917
+ addQueueMeasurement() { return; }
8918
+ setPreQueueTime() { return; }
8960
8919
  }
8961
8920
 
8921
+ exports.AADAuthorityConstants = AADAuthorityConstants;
8922
+ exports.AADServerParamKeys = AADServerParamKeys;
8962
8923
  exports.AccessTokenEntity = AccessTokenEntity;
8963
8924
  exports.AccountEntity = AccountEntity;
8964
8925
  exports.AppMetadataEntity = AppMetadataEntity;
@@ -8966,13 +8927,21 @@ exports.AuthError = AuthError;
8966
8927
  exports.AuthErrorMessage = AuthErrorMessage;
8967
8928
  exports.AuthToken = AuthToken;
8968
8929
  exports.AuthenticationHeaderParser = AuthenticationHeaderParser;
8930
+ exports.AuthenticationScheme = AuthenticationScheme;
8969
8931
  exports.Authority = Authority;
8970
8932
  exports.AuthorityFactory = AuthorityFactory;
8971
8933
  exports.AuthorityMetadataEntity = AuthorityMetadataEntity;
8934
+ exports.AuthorityType = AuthorityType;
8972
8935
  exports.AuthorizationCodeClient = AuthorizationCodeClient;
8936
+ exports.AzureCloudInstance = AzureCloudInstance;
8973
8937
  exports.BaseClient = BaseClient;
8938
+ exports.CacheAccountType = CacheAccountType;
8974
8939
  exports.CacheManager = CacheManager;
8940
+ exports.CacheOutcome = CacheOutcome;
8975
8941
  exports.CacheRecord = CacheRecord;
8942
+ exports.CacheType = CacheType;
8943
+ exports.CcsCredentialType = CcsCredentialType;
8944
+ exports.ClaimsRequestKeys = ClaimsRequestKeys;
8976
8945
  exports.ClientAuthError = ClientAuthError;
8977
8946
  exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
8978
8947
  exports.ClientConfigurationError = ClientConfigurationError;
@@ -8980,10 +8949,13 @@ exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
8980
8949
  exports.CodeChallengeMethodValues = CodeChallengeMethodValues;
8981
8950
  exports.Constants = Constants;
8982
8951
  exports.CredentialEntity = CredentialEntity;
8952
+ exports.CredentialType = CredentialType;
8983
8953
  exports.DEFAULT_CRYPTO_IMPLEMENTATION = DEFAULT_CRYPTO_IMPLEMENTATION;
8984
8954
  exports.DEFAULT_SYSTEM_OPTIONS = DEFAULT_SYSTEM_OPTIONS;
8985
8955
  exports.DefaultStorageClass = DefaultStorageClass;
8986
8956
  exports.Errors = Errors;
8957
+ exports.GrantType = GrantType;
8958
+ exports.HeaderNames = HeaderNames;
8987
8959
  exports.IdToken = AuthToken;
8988
8960
  exports.IdTokenEntity = IdTokenEntity;
8989
8961
  exports.IntFields = IntFields;
@@ -8994,14 +8966,21 @@ exports.Logger = Logger;
8994
8966
  exports.NetworkManager = NetworkManager;
8995
8967
  exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
8996
8968
  exports.ONE_DAY_IN_MS = ONE_DAY_IN_MS;
8969
+ exports.PasswordGrantConstants = PasswordGrantConstants;
8997
8970
  exports.PerformanceClient = PerformanceClient;
8971
+ exports.PerformanceEventStatus = PerformanceEventStatus;
8972
+ exports.PerformanceEvents = PerformanceEvents;
8973
+ exports.PersistentCacheKeys = PersistentCacheKeys;
8998
8974
  exports.PopTokenGenerator = PopTokenGenerator;
8999
8975
  exports.PromptValue = PromptValue;
8976
+ exports.ProtocolMode = ProtocolMode;
9000
8977
  exports.ProtocolUtils = ProtocolUtils;
9001
8978
  exports.RefreshTokenClient = RefreshTokenClient;
9002
8979
  exports.RefreshTokenEntity = RefreshTokenEntity;
9003
8980
  exports.RequestParameterBuilder = RequestParameterBuilder;
9004
8981
  exports.ResponseHandler = ResponseHandler;
8982
+ exports.ResponseMode = ResponseMode;
8983
+ exports.SSOTypes = SSOTypes;
9005
8984
  exports.ScopeSet = ScopeSet;
9006
8985
  exports.ServerError = ServerError;
9007
8986
  exports.ServerTelemetryEntity = ServerTelemetryEntity;