@azure/msal-browser 2.28.2 → 2.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.d.ts +19 -10
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +67 -66
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.js +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +37 -10
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
- package/dist/cache/AsyncMemoryStorage.d.ts +7 -2
- package/dist/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +19 -15
- package/dist/cache/AsyncMemoryStorage.js.map +1 -1
- package/dist/cache/BrowserCacheManager.js +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/CryptoKeyStore.d.ts +18 -0
- package/dist/cache/CryptoKeyStore.d.ts.map +1 -0
- package/dist/cache/CryptoKeyStore.js +58 -0
- package/dist/cache/CryptoKeyStore.js.map +1 -0
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.js +10 -22
- package/dist/cache/DatabaseStorage.js.map +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.js +1 -1
- package/dist/config/Configuration.d.ts +16 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +5 -2
- package/dist/config/Configuration.js.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +19 -59
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.js +65 -180
- package/dist/crypto/BrowserCrypto.js.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +2 -13
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +10 -40
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.js +1 -1
- package/dist/crypto/ISubtleCrypto.d.ts +10 -0
- package/dist/crypto/ISubtleCrypto.d.ts.map +1 -0
- package/dist/crypto/ModernBrowserCrypto.d.ts +10 -0
- package/dist/crypto/ModernBrowserCrypto.d.ts.map +1 -0
- package/dist/crypto/ModernBrowserCrypto.js +55 -0
- package/dist/crypto/ModernBrowserCrypto.js.map +1 -0
- package/dist/crypto/MsBrowserCrypto.d.ts +10 -0
- package/dist/crypto/MsBrowserCrypto.d.ts.map +1 -0
- package/dist/crypto/MsBrowserCrypto.js +112 -0
- package/dist/crypto/MsBrowserCrypto.js.map +1 -0
- package/dist/crypto/MsrBrowserCrypto.d.ts +18 -0
- package/dist/crypto/MsrBrowserCrypto.d.ts.map +1 -0
- package/dist/crypto/MsrBrowserCrypto.js +59 -0
- package/dist/crypto/MsrBrowserCrypto.js.map +1 -0
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.js +1 -1
- package/dist/encode/Base64Encode.js +1 -1
- package/dist/error/BrowserAuthError.js +2 -2
- package/dist/error/BrowserAuthError.js.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.d.ts +8 -0
- package/dist/error/BrowserConfigurationAuthError.d.ts.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +11 -1
- package/dist/error/BrowserConfigurationAuthError.js.map +1 -1
- package/dist/error/NativeAuthError.js +1 -1
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.js +1 -1
- package/dist/event/EventType.js +1 -1
- package/dist/index.cjs.js +710 -410
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/interaction_client/BaseInteractionClient.js +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +3 -2
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
- package/dist/interaction_client/PopupClient.js +1 -1
- package/dist/interaction_client/RedirectClient.js +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +1 -1
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +8 -7
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +3 -2
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/internals.js +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.js +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/PopupRequest.d.ts +1 -0
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/RedirectRequest.d.ts +1 -0
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/SilentRequest.d.ts +9 -2
- package/dist/request/SilentRequest.d.ts.map +1 -1
- package/dist/request/SsoSilentRequest.d.ts +1 -0
- package/dist/request/SsoSilentRequest.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +2 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +3 -3
- package/dist/telemetry/BrowserPerformanceClient.js.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
- package/dist/utils/BrowserConstants.d.ts +8 -0
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +40 -3
- package/dist/utils/BrowserConstants.js.map +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.d.ts +5 -0
- package/dist/utils/BrowserStringUtils.d.ts.map +1 -1
- package/dist/utils/BrowserStringUtils.js +8 -1
- package/dist/utils/BrowserStringUtils.js.map +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.js +710 -410
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +37 -37
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.29.0 2022-10-03 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -117,7 +117,7 @@ function __spread() {
|
|
|
117
117
|
return ar;
|
|
118
118
|
}
|
|
119
119
|
|
|
120
|
-
/*! @azure/msal-common v7.
|
|
120
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
121
121
|
/*! *****************************************************************************
|
|
122
122
|
Copyright (c) Microsoft Corporation.
|
|
123
123
|
|
|
@@ -204,7 +204,7 @@ function __spreadArrays() {
|
|
|
204
204
|
return r;
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
/*! @azure/msal-common v7.
|
|
207
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
208
208
|
|
|
209
209
|
/*
|
|
210
210
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -221,6 +221,7 @@ var Constants = {
|
|
|
221
221
|
DEFAULT_COMMON_TENANT: "common",
|
|
222
222
|
// ADFS String
|
|
223
223
|
ADFS: "adfs",
|
|
224
|
+
DSTS: "dstsv2",
|
|
224
225
|
// Default AAD Instance Discovery Endpoint
|
|
225
226
|
AAD_INSTANCE_DISCOVERY_ENDPT: "https://login.microsoftonline.com/common/discovery/instance?api-version=1.1&authorization_endpoint=",
|
|
226
227
|
// Resource delimiter - used for certain cache entries
|
|
@@ -252,6 +253,7 @@ var Constants = {
|
|
|
252
253
|
IMDS_TIMEOUT: 2000,
|
|
253
254
|
AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
|
|
254
255
|
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
|
|
256
|
+
REGIONAL_AUTH_NON_MSI_QUERY_STRING: "allowestsrnonmsi=true",
|
|
255
257
|
KNOWN_PUBLIC_CLOUDS: ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"],
|
|
256
258
|
TOKEN_RESPONSE_TYPE: "token",
|
|
257
259
|
ID_TOKEN_RESPONSE_TYPE: "id_token",
|
|
@@ -275,6 +277,7 @@ var HeaderNames;
|
|
|
275
277
|
HeaderNames["CCS_HEADER"] = "X-AnchorMailbox";
|
|
276
278
|
HeaderNames["WWWAuthenticate"] = "WWW-Authenticate";
|
|
277
279
|
HeaderNames["AuthenticationInfo"] = "Authentication-Info";
|
|
280
|
+
HeaderNames["X_MS_REQUEST_ID"] = "x-ms-request-id";
|
|
278
281
|
})(HeaderNames || (HeaderNames = {}));
|
|
279
282
|
/**
|
|
280
283
|
* Persistent cache keys MSAL which stay while user is logged in.
|
|
@@ -370,7 +373,8 @@ var PromptValue = {
|
|
|
370
373
|
SELECT_ACCOUNT: "select_account",
|
|
371
374
|
CONSENT: "consent",
|
|
372
375
|
NONE: "none",
|
|
373
|
-
CREATE: "create"
|
|
376
|
+
CREATE: "create",
|
|
377
|
+
NO_SESSION: "no_session"
|
|
374
378
|
};
|
|
375
379
|
/**
|
|
376
380
|
* SSO Types - generated to populate hints
|
|
@@ -581,7 +585,7 @@ var JsonTypes;
|
|
|
581
585
|
JsonTypes["Jwk"] = "JWK";
|
|
582
586
|
})(JsonTypes || (JsonTypes = {}));
|
|
583
587
|
|
|
584
|
-
/*! @azure/msal-common v7.
|
|
588
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
585
589
|
|
|
586
590
|
/*
|
|
587
591
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -637,7 +641,7 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
637
641
|
return AuthError;
|
|
638
642
|
}(Error));
|
|
639
643
|
|
|
640
|
-
/*! @azure/msal-common v7.
|
|
644
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
641
645
|
|
|
642
646
|
/*
|
|
643
647
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -712,7 +716,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
712
716
|
}
|
|
713
717
|
};
|
|
714
718
|
|
|
715
|
-
/*! @azure/msal-common v7.
|
|
719
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
716
720
|
|
|
717
721
|
/*
|
|
718
722
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -778,6 +782,16 @@ var ClientAuthErrorMessage = {
|
|
|
778
782
|
code: "nonce_not_found",
|
|
779
783
|
desc: "nonce not found"
|
|
780
784
|
},
|
|
785
|
+
authTimeNotFoundError: {
|
|
786
|
+
code: "auth_time_not_found",
|
|
787
|
+
desc: "Max Age was requested and the ID token is missing the auth_time variable." +
|
|
788
|
+
" auth_time is an optional claim and is not enabled by default - it must be enabled." +
|
|
789
|
+
" See https://aka.ms/msaljs/optional-claims for more information."
|
|
790
|
+
},
|
|
791
|
+
maxAgeTranspiredError: {
|
|
792
|
+
code: "max_age_transpired",
|
|
793
|
+
desc: "Max Age is set to 0, or too much time has elapsed since the last end-user authentication."
|
|
794
|
+
},
|
|
781
795
|
noTokensFoundError: {
|
|
782
796
|
code: "no_tokens_found",
|
|
783
797
|
desc: "No tokens were found for the given scopes, and no authorization code was passed to acquireToken. You must retrieve an authorization code before making a call to acquireToken()."
|
|
@@ -998,6 +1012,19 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
998
1012
|
ClientAuthError.createNonceMismatchError = function () {
|
|
999
1013
|
return new ClientAuthError(ClientAuthErrorMessage.nonceMismatchError.code, ClientAuthErrorMessage.nonceMismatchError.desc);
|
|
1000
1014
|
};
|
|
1015
|
+
/**
|
|
1016
|
+
* Creates an error thrown when max_age was provided in the request, but auth_time is not in the token claims
|
|
1017
|
+
* @param missingNonce
|
|
1018
|
+
*/
|
|
1019
|
+
ClientAuthError.createAuthTimeNotFoundError = function () {
|
|
1020
|
+
return new ClientAuthError(ClientAuthErrorMessage.authTimeNotFoundError.code, ClientAuthErrorMessage.authTimeNotFoundError.desc);
|
|
1021
|
+
};
|
|
1022
|
+
/**
|
|
1023
|
+
* Creates an error thrown when too much time has elapsed since the last end-user authentication
|
|
1024
|
+
*/
|
|
1025
|
+
ClientAuthError.createMaxAgeTranspiredError = function () {
|
|
1026
|
+
return new ClientAuthError(ClientAuthErrorMessage.maxAgeTranspiredError.code, ClientAuthErrorMessage.maxAgeTranspiredError.desc);
|
|
1027
|
+
};
|
|
1001
1028
|
/**
|
|
1002
1029
|
* Creates an error thrown when the mnonce is not present
|
|
1003
1030
|
* @param missingNonce
|
|
@@ -1184,7 +1211,7 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
1184
1211
|
return ClientAuthError;
|
|
1185
1212
|
}(AuthError));
|
|
1186
1213
|
|
|
1187
|
-
/*! @azure/msal-common v7.
|
|
1214
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
1188
1215
|
|
|
1189
1216
|
/*
|
|
1190
1217
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1309,7 +1336,7 @@ var StringUtils = /** @class */ (function () {
|
|
|
1309
1336
|
return StringUtils;
|
|
1310
1337
|
}());
|
|
1311
1338
|
|
|
1312
|
-
/*! @azure/msal-common v7.
|
|
1339
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
1313
1340
|
|
|
1314
1341
|
/*
|
|
1315
1342
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1489,12 +1516,12 @@ var Logger = /** @class */ (function () {
|
|
|
1489
1516
|
return Logger;
|
|
1490
1517
|
}());
|
|
1491
1518
|
|
|
1492
|
-
/*! @azure/msal-common v7.
|
|
1519
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
1493
1520
|
/* eslint-disable header/header */
|
|
1494
1521
|
var name$1 = "@azure/msal-common";
|
|
1495
|
-
var version$1 = "7.
|
|
1522
|
+
var version$1 = "7.5.0";
|
|
1496
1523
|
|
|
1497
|
-
/*! @azure/msal-common v7.
|
|
1524
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
1498
1525
|
/*
|
|
1499
1526
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1500
1527
|
* Licensed under the MIT License.
|
|
@@ -1515,7 +1542,7 @@ exports.AzureCloudInstance = void 0;
|
|
|
1515
1542
|
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1516
1543
|
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1517
1544
|
|
|
1518
|
-
/*! @azure/msal-common v7.
|
|
1545
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
1519
1546
|
|
|
1520
1547
|
/*
|
|
1521
1548
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1674,7 +1701,7 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1674
1701
|
return CredentialEntity;
|
|
1675
1702
|
}());
|
|
1676
1703
|
|
|
1677
|
-
/*! @azure/msal-common v7.
|
|
1704
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
1678
1705
|
|
|
1679
1706
|
/*
|
|
1680
1707
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1722,7 +1749,7 @@ var ClientConfigurationErrorMessage = {
|
|
|
1722
1749
|
},
|
|
1723
1750
|
invalidPrompt: {
|
|
1724
1751
|
code: "invalid_prompt_value",
|
|
1725
|
-
desc: "Supported prompt values are 'login', 'select_account', 'consent', 'create' and '
|
|
1752
|
+
desc: "Supported prompt values are 'login', 'select_account', 'consent', 'create', 'none' and 'no_session'. Please see here for valid configuration options: https://azuread.github.io/microsoft-authentication-library-for-js/ref/modules/_azure_msal_common.html#commonauthorizationurlrequest",
|
|
1726
1753
|
},
|
|
1727
1754
|
invalidClaimsRequest: {
|
|
1728
1755
|
code: "invalid_claims",
|
|
@@ -1929,7 +1956,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1929
1956
|
return ClientConfigurationError;
|
|
1930
1957
|
}(ClientAuthError));
|
|
1931
1958
|
|
|
1932
|
-
/*! @azure/msal-common v7.
|
|
1959
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
1933
1960
|
|
|
1934
1961
|
/*
|
|
1935
1962
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2113,7 +2140,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2113
2140
|
return ScopeSet;
|
|
2114
2141
|
}());
|
|
2115
2142
|
|
|
2116
|
-
/*! @azure/msal-common v7.
|
|
2143
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
2117
2144
|
|
|
2118
2145
|
/*
|
|
2119
2146
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2151,7 +2178,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2151
2178
|
};
|
|
2152
2179
|
}
|
|
2153
2180
|
|
|
2154
|
-
/*! @azure/msal-common v7.
|
|
2181
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
2155
2182
|
/*
|
|
2156
2183
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2157
2184
|
* Licensed under the MIT License.
|
|
@@ -2163,9 +2190,10 @@ var AuthorityType;
|
|
|
2163
2190
|
(function (AuthorityType) {
|
|
2164
2191
|
AuthorityType[AuthorityType["Default"] = 0] = "Default";
|
|
2165
2192
|
AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
|
|
2193
|
+
AuthorityType[AuthorityType["Dsts"] = 2] = "Dsts";
|
|
2166
2194
|
})(AuthorityType || (AuthorityType = {}));
|
|
2167
2195
|
|
|
2168
|
-
/*! @azure/msal-common v7.
|
|
2196
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
2169
2197
|
|
|
2170
2198
|
/*
|
|
2171
2199
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2287,10 +2315,13 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2287
2315
|
// How do you account for MSA CID here?
|
|
2288
2316
|
account.localAccountId = ((_b = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _b === void 0 ? void 0 : _b.oid) || ((_c = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _c === void 0 ? void 0 : _c.sub) || Constants.EMPTY_STRING;
|
|
2289
2317
|
/*
|
|
2290
|
-
* In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
|
|
2291
|
-
* This field should not be relied upon if a custom
|
|
2318
|
+
* In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
|
|
2319
|
+
* In most cases it will contain a single email. This field should not be relied upon if a custom
|
|
2320
|
+
* policy is configured to return more than 1 email.
|
|
2292
2321
|
*/
|
|
2293
|
-
|
|
2322
|
+
var preferredUsername = (_d = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _d === void 0 ? void 0 : _d.preferred_username;
|
|
2323
|
+
var email = ((_e = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _e === void 0 ? void 0 : _e.emails) ? idToken.claims.emails[0] : null;
|
|
2324
|
+
account.username = preferredUsername || email || Constants.EMPTY_STRING;
|
|
2294
2325
|
account.name = (_f = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _f === void 0 ? void 0 : _f.name;
|
|
2295
2326
|
}
|
|
2296
2327
|
account.cloudGraphHostName = cloudGraphHostName;
|
|
@@ -2305,7 +2336,8 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2305
2336
|
AccountEntity.createGenericAccount = function (homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment) {
|
|
2306
2337
|
var _a, _b, _c, _d;
|
|
2307
2338
|
var account = new AccountEntity();
|
|
2308
|
-
account.authorityType = (authority &&
|
|
2339
|
+
account.authorityType = (authority &&
|
|
2340
|
+
authority.authorityType === AuthorityType.Adfs) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;
|
|
2309
2341
|
account.homeAccountId = homeAccountId;
|
|
2310
2342
|
// non AAD scenarios can have empty realm
|
|
2311
2343
|
account.realm = Constants.EMPTY_STRING;
|
|
@@ -2339,7 +2371,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2339
2371
|
var _a;
|
|
2340
2372
|
var accountId = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.sub) ? idToken.claims.sub : Constants.EMPTY_STRING;
|
|
2341
2373
|
// since ADFS does not have tid and does not set client_info
|
|
2342
|
-
if (authType === AuthorityType.Adfs) {
|
|
2374
|
+
if (authType === AuthorityType.Adfs || authType === AuthorityType.Dsts) {
|
|
2343
2375
|
return accountId;
|
|
2344
2376
|
}
|
|
2345
2377
|
// for cases where there is clientInfo
|
|
@@ -2400,7 +2432,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2400
2432
|
return AccountEntity;
|
|
2401
2433
|
}());
|
|
2402
2434
|
|
|
2403
|
-
/*! @azure/msal-common v7.
|
|
2435
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
2404
2436
|
|
|
2405
2437
|
/*
|
|
2406
2438
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2435,10 +2467,24 @@ var AuthToken = /** @class */ (function () {
|
|
|
2435
2467
|
throw ClientAuthError.createTokenParsingError(err);
|
|
2436
2468
|
}
|
|
2437
2469
|
};
|
|
2470
|
+
/**
|
|
2471
|
+
* Determine if the token's max_age has transpired
|
|
2472
|
+
*/
|
|
2473
|
+
AuthToken.checkMaxAge = function (authTime, maxAge) {
|
|
2474
|
+
/*
|
|
2475
|
+
* per https://openid.net/specs/openid-connect-core-1_0.html#AuthRequest
|
|
2476
|
+
* To force an immediate re-authentication: If an app requires that a user re-authenticate prior to access,
|
|
2477
|
+
* provide a value of 0 for the max_age parameter and the AS will force a fresh login.
|
|
2478
|
+
*/
|
|
2479
|
+
var fiveMinuteSkew = 300000; // five minutes in milliseconds
|
|
2480
|
+
if ((maxAge === 0) || ((Date.now() - fiveMinuteSkew) > (authTime + maxAge))) {
|
|
2481
|
+
throw ClientAuthError.createMaxAgeTranspiredError();
|
|
2482
|
+
}
|
|
2483
|
+
};
|
|
2438
2484
|
return AuthToken;
|
|
2439
2485
|
}());
|
|
2440
2486
|
|
|
2441
|
-
/*! @azure/msal-common v7.
|
|
2487
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
2442
2488
|
|
|
2443
2489
|
/*
|
|
2444
2490
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3313,7 +3359,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3313
3359
|
return DefaultStorageClass;
|
|
3314
3360
|
}(CacheManager));
|
|
3315
3361
|
|
|
3316
|
-
/*! @azure/msal-common v7.
|
|
3362
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3317
3363
|
|
|
3318
3364
|
/*
|
|
3319
3365
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3407,7 +3453,7 @@ function buildAuthOptions(authOptions) {
|
|
|
3407
3453
|
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
|
|
3408
3454
|
}
|
|
3409
3455
|
|
|
3410
|
-
/*! @azure/msal-common v7.
|
|
3456
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3411
3457
|
|
|
3412
3458
|
/*
|
|
3413
3459
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3427,7 +3473,7 @@ var ServerError = /** @class */ (function (_super) {
|
|
|
3427
3473
|
return ServerError;
|
|
3428
3474
|
}(AuthError));
|
|
3429
3475
|
|
|
3430
|
-
/*! @azure/msal-common v7.
|
|
3476
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3431
3477
|
|
|
3432
3478
|
/*
|
|
3433
3479
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3523,7 +3569,7 @@ var ThrottlingUtils = /** @class */ (function () {
|
|
|
3523
3569
|
return ThrottlingUtils;
|
|
3524
3570
|
}());
|
|
3525
3571
|
|
|
3526
|
-
/*! @azure/msal-common v7.
|
|
3572
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3527
3573
|
|
|
3528
3574
|
/*
|
|
3529
3575
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3572,7 +3618,7 @@ var NetworkManager = /** @class */ (function () {
|
|
|
3572
3618
|
return NetworkManager;
|
|
3573
3619
|
}());
|
|
3574
3620
|
|
|
3575
|
-
/*! @azure/msal-common v7.
|
|
3621
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3576
3622
|
/*
|
|
3577
3623
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3578
3624
|
* Licensed under the MIT License.
|
|
@@ -3583,7 +3629,7 @@ var CcsCredentialType;
|
|
|
3583
3629
|
CcsCredentialType["UPN"] = "UPN";
|
|
3584
3630
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3585
3631
|
|
|
3586
|
-
/*! @azure/msal-common v7.
|
|
3632
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3587
3633
|
|
|
3588
3634
|
/*
|
|
3589
3635
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3674,7 +3720,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
3674
3720
|
return BaseClient;
|
|
3675
3721
|
}());
|
|
3676
3722
|
|
|
3677
|
-
/*! @azure/msal-common v7.
|
|
3723
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3678
3724
|
|
|
3679
3725
|
/*
|
|
3680
3726
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3760,7 +3806,7 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3760
3806
|
return RequestValidator;
|
|
3761
3807
|
}());
|
|
3762
3808
|
|
|
3763
|
-
/*! @azure/msal-common v7.
|
|
3809
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
3764
3810
|
|
|
3765
3811
|
/*
|
|
3766
3812
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4138,7 +4184,7 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
4138
4184
|
return RequestParameterBuilder;
|
|
4139
4185
|
}());
|
|
4140
4186
|
|
|
4141
|
-
/*! @azure/msal-common v7.
|
|
4187
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4142
4188
|
|
|
4143
4189
|
/*
|
|
4144
4190
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4202,7 +4248,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4202
4248
|
return IdTokenEntity;
|
|
4203
4249
|
}(CredentialEntity));
|
|
4204
4250
|
|
|
4205
|
-
/*! @azure/msal-common v7.
|
|
4251
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4206
4252
|
/*
|
|
4207
4253
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4208
4254
|
* Licensed under the MIT License.
|
|
@@ -4252,7 +4298,7 @@ var TimeUtils = /** @class */ (function () {
|
|
|
4252
4298
|
return TimeUtils;
|
|
4253
4299
|
}());
|
|
4254
4300
|
|
|
4255
|
-
/*! @azure/msal-common v7.
|
|
4301
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4256
4302
|
|
|
4257
4303
|
/*
|
|
4258
4304
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4366,7 +4412,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4366
4412
|
return AccessTokenEntity;
|
|
4367
4413
|
}(CredentialEntity));
|
|
4368
4414
|
|
|
4369
|
-
/*! @azure/msal-common v7.
|
|
4415
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4370
4416
|
|
|
4371
4417
|
/*
|
|
4372
4418
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4433,7 +4479,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
|
|
|
4433
4479
|
return RefreshTokenEntity;
|
|
4434
4480
|
}(CredentialEntity));
|
|
4435
4481
|
|
|
4436
|
-
/*! @azure/msal-common v7.
|
|
4482
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4437
4483
|
|
|
4438
4484
|
/*
|
|
4439
4485
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4508,7 +4554,7 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
|
4508
4554
|
return InteractionRequiredAuthError;
|
|
4509
4555
|
}(AuthError));
|
|
4510
4556
|
|
|
4511
|
-
/*! @azure/msal-common v7.
|
|
4557
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4512
4558
|
/*
|
|
4513
4559
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4514
4560
|
* Licensed under the MIT License.
|
|
@@ -4524,7 +4570,7 @@ var CacheRecord = /** @class */ (function () {
|
|
|
4524
4570
|
return CacheRecord;
|
|
4525
4571
|
}());
|
|
4526
4572
|
|
|
4527
|
-
/*! @azure/msal-common v7.
|
|
4573
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4528
4574
|
|
|
4529
4575
|
/*
|
|
4530
4576
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4595,7 +4641,7 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4595
4641
|
return ProtocolUtils;
|
|
4596
4642
|
}());
|
|
4597
4643
|
|
|
4598
|
-
/*! @azure/msal-common v7.
|
|
4644
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4599
4645
|
|
|
4600
4646
|
/*
|
|
4601
4647
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4829,7 +4875,7 @@ var UrlString = /** @class */ (function () {
|
|
|
4829
4875
|
return UrlString;
|
|
4830
4876
|
}());
|
|
4831
4877
|
|
|
4832
|
-
/*! @azure/msal-common v7.
|
|
4878
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4833
4879
|
|
|
4834
4880
|
/*
|
|
4835
4881
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4930,7 +4976,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4930
4976
|
return PopTokenGenerator;
|
|
4931
4977
|
}());
|
|
4932
4978
|
|
|
4933
|
-
/*! @azure/msal-common v7.
|
|
4979
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
4934
4980
|
|
|
4935
4981
|
/*
|
|
4936
4982
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5000,7 +5046,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5000
5046
|
return AppMetadataEntity;
|
|
5001
5047
|
}());
|
|
5002
5048
|
|
|
5003
|
-
/*! @azure/msal-common v7.
|
|
5049
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
5004
5050
|
/*
|
|
5005
5051
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5006
5052
|
* Licensed under the MIT License.
|
|
@@ -5036,7 +5082,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
5036
5082
|
return TokenCacheContext;
|
|
5037
5083
|
}());
|
|
5038
5084
|
|
|
5039
|
-
/*! @azure/msal-common v7.
|
|
5085
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
5040
5086
|
|
|
5041
5087
|
/*
|
|
5042
5088
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5097,9 +5143,9 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5097
5143
|
* @param serverTokenResponse
|
|
5098
5144
|
* @param authority
|
|
5099
5145
|
*/
|
|
5100
|
-
ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse) {
|
|
5146
|
+
ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse, forceCacheRefreshTokenResponse, serverRequestId) {
|
|
5101
5147
|
return __awaiter(this, void 0, void 0, function () {
|
|
5102
|
-
var idTokenObj, requestStateObj, cacheRecord, cacheContext, key, account;
|
|
5148
|
+
var idTokenObj, authTime, requestStateObj, cacheRecord, cacheContext, key, account;
|
|
5103
5149
|
return __generator(this, function (_a) {
|
|
5104
5150
|
switch (_a.label) {
|
|
5105
5151
|
case 0:
|
|
@@ -5111,6 +5157,14 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5111
5157
|
throw ClientAuthError.createNonceMismatchError();
|
|
5112
5158
|
}
|
|
5113
5159
|
}
|
|
5160
|
+
// token max_age check
|
|
5161
|
+
if (request.maxAge || (request.maxAge === 0)) {
|
|
5162
|
+
authTime = idTokenObj.claims.auth_time;
|
|
5163
|
+
if (!authTime) {
|
|
5164
|
+
throw ClientAuthError.createAuthTimeNotFoundError();
|
|
5165
|
+
}
|
|
5166
|
+
AuthToken.checkMaxAge(authTime, request.maxAge);
|
|
5167
|
+
}
|
|
5114
5168
|
}
|
|
5115
5169
|
// generate homeAccountId
|
|
5116
5170
|
this.homeAccountIdentifier = AccountEntity.generateHomeAccountId(serverTokenResponse.client_info || Constants.EMPTY_STRING, authority.authorityType, this.logger, this.cryptoObj, idTokenObj);
|
|
@@ -5142,7 +5196,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5142
5196
|
account = this.cacheStorage.getAccount(key);
|
|
5143
5197
|
if (!account) {
|
|
5144
5198
|
this.logger.warning("Account used to refresh tokens not in persistence, refreshed tokens will not be stored in the cache");
|
|
5145
|
-
return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined)];
|
|
5199
|
+
return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, undefined, serverRequestId)];
|
|
5146
5200
|
}
|
|
5147
5201
|
}
|
|
5148
5202
|
return [4 /*yield*/, this.cacheStorage.saveCacheRecord(cacheRecord)];
|
|
@@ -5157,7 +5211,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5157
5211
|
_a.sent();
|
|
5158
5212
|
_a.label = 7;
|
|
5159
5213
|
case 7: return [7 /*endfinally*/];
|
|
5160
|
-
case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code)];
|
|
5214
|
+
case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse.spa_code, serverRequestId)];
|
|
5161
5215
|
}
|
|
5162
5216
|
});
|
|
5163
5217
|
});
|
|
@@ -5243,7 +5297,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5243
5297
|
* @param fromTokenCache
|
|
5244
5298
|
* @param stateString
|
|
5245
5299
|
*/
|
|
5246
|
-
ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, code) {
|
|
5300
|
+
ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, code, requestId) {
|
|
5247
5301
|
var _a, _b, _c;
|
|
5248
5302
|
return __awaiter(this, void 0, void 0, function () {
|
|
5249
5303
|
var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, _d, secret, keyId, uid, tid;
|
|
@@ -5291,6 +5345,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5291
5345
|
fromCache: fromTokenCache,
|
|
5292
5346
|
expiresOn: expiresOn,
|
|
5293
5347
|
correlationId: request.correlationId,
|
|
5348
|
+
requestId: requestId || Constants.EMPTY_STRING,
|
|
5294
5349
|
extExpiresOn: extExpiresOn,
|
|
5295
5350
|
familyId: familyId,
|
|
5296
5351
|
tokenType: ((_a = cacheRecord.accessToken) === null || _a === void 0 ? void 0 : _a.tokenType) || Constants.EMPTY_STRING,
|
|
@@ -5307,7 +5362,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5307
5362
|
return ResponseHandler;
|
|
5308
5363
|
}());
|
|
5309
5364
|
|
|
5310
|
-
/*! @azure/msal-common v7.
|
|
5365
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
5311
5366
|
|
|
5312
5367
|
/*
|
|
5313
5368
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5353,10 +5408,11 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5353
5408
|
* @param request
|
|
5354
5409
|
*/
|
|
5355
5410
|
AuthorizationCodeClient.prototype.acquireToken = function (request, authCodePayload) {
|
|
5411
|
+
var _a;
|
|
5356
5412
|
return __awaiter(this, void 0, void 0, function () {
|
|
5357
|
-
var reqTimestamp, response, responseHandler;
|
|
5358
|
-
return __generator(this, function (
|
|
5359
|
-
switch (
|
|
5413
|
+
var reqTimestamp, response, requestId, responseHandler;
|
|
5414
|
+
return __generator(this, function (_b) {
|
|
5415
|
+
switch (_b.label) {
|
|
5360
5416
|
case 0:
|
|
5361
5417
|
this.logger.info("in acquireToken call");
|
|
5362
5418
|
if (!request || StringUtils.isEmpty(request.code)) {
|
|
@@ -5365,12 +5421,13 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5365
5421
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
5366
5422
|
return [4 /*yield*/, this.executeTokenRequest(this.authority, request)];
|
|
5367
5423
|
case 1:
|
|
5368
|
-
response =
|
|
5424
|
+
response = _b.sent();
|
|
5425
|
+
requestId = (_a = response.headers) === null || _a === void 0 ? void 0 : _a[HeaderNames.X_MS_REQUEST_ID];
|
|
5369
5426
|
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
5370
5427
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
5371
5428
|
responseHandler.validateTokenResponse(response.body);
|
|
5372
|
-
return [4 /*yield*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload)];
|
|
5373
|
-
case 2: return [2 /*return*/,
|
|
5429
|
+
return [4 /*yield*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId)];
|
|
5430
|
+
case 2: return [2 /*return*/, _b.sent()];
|
|
5374
5431
|
}
|
|
5375
5432
|
});
|
|
5376
5433
|
});
|
|
@@ -5758,7 +5815,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5758
5815
|
return AuthorizationCodeClient;
|
|
5759
5816
|
}(BaseClient));
|
|
5760
5817
|
|
|
5761
|
-
/*! @azure/msal-common v7.
|
|
5818
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
5762
5819
|
/*
|
|
5763
5820
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5764
5821
|
* Licensed under the MIT License.
|
|
@@ -5841,10 +5898,6 @@ exports.PerformanceEvents = void 0;
|
|
|
5841
5898
|
* Used to acquire a token from Native component when native brokering is enabled.
|
|
5842
5899
|
*/
|
|
5843
5900
|
PerformanceEvents["NativeInteractionClientAcquireToken"] = "nativeInteractionClientAcquireToken";
|
|
5844
|
-
/**
|
|
5845
|
-
* Time spent on the network for refresh token acquisition
|
|
5846
|
-
*/
|
|
5847
|
-
PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
|
|
5848
5901
|
/**
|
|
5849
5902
|
* Time spent creating default headers for requests to token endpoint
|
|
5850
5903
|
*/
|
|
@@ -5858,10 +5911,21 @@ exports.PerformanceEvents = void 0;
|
|
|
5858
5911
|
*/
|
|
5859
5912
|
PerformanceEvents["AcquireTokenByRefreshTokenInBroker"] = "acquireTokenByRefreshTokenInBroker";
|
|
5860
5913
|
/**
|
|
5861
|
-
*
|
|
5862
|
-
* Used to acquire a token on behalf of the embedded application (PW-Broker).
|
|
5914
|
+
* Time taken for token acquisition by broker
|
|
5863
5915
|
*/
|
|
5864
5916
|
PerformanceEvents["AcquireTokenByBroker"] = "acquireTokenByBroker";
|
|
5917
|
+
/**
|
|
5918
|
+
* Time spent on the network for refresh token acquisition
|
|
5919
|
+
*/
|
|
5920
|
+
PerformanceEvents["RefreshTokenClientExecuteTokenRequest"] = "refreshTokenClientExecuteTokenRequest";
|
|
5921
|
+
/**
|
|
5922
|
+
* Time taken for acquiring refresh token , records RT size
|
|
5923
|
+
*/
|
|
5924
|
+
PerformanceEvents["RefreshTokenClientAcquireToken"] = "refreshTokenClientAcquireToken";
|
|
5925
|
+
/**
|
|
5926
|
+
* Time taken for acquiring cached refresh token
|
|
5927
|
+
*/
|
|
5928
|
+
PerformanceEvents["RefreshTokenClientAcquireTokenWithCachedRefreshToken"] = "refreshTokenClientAcquireTokenWithCachedRefreshToken";
|
|
5865
5929
|
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
5866
5930
|
/**
|
|
5867
5931
|
* State of the performance event.
|
|
@@ -5876,7 +5940,7 @@ var PerformanceEventStatus;
|
|
|
5876
5940
|
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
|
|
5877
5941
|
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
5878
5942
|
|
|
5879
|
-
/*! @azure/msal-common v7.
|
|
5943
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
5880
5944
|
|
|
5881
5945
|
/*
|
|
5882
5946
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5891,18 +5955,40 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5891
5955
|
return _super.call(this, configuration, performanceClient) || this;
|
|
5892
5956
|
}
|
|
5893
5957
|
RefreshTokenClient.prototype.acquireToken = function (request) {
|
|
5958
|
+
var _a, _b;
|
|
5894
5959
|
return __awaiter(this, void 0, void 0, function () {
|
|
5895
|
-
var reqTimestamp, response, responseHandler;
|
|
5896
|
-
|
|
5897
|
-
|
|
5960
|
+
var atsMeasurement, reqTimestamp, response, requestId, responseHandler;
|
|
5961
|
+
var _this = this;
|
|
5962
|
+
return __generator(this, function (_c) {
|
|
5963
|
+
switch (_c.label) {
|
|
5898
5964
|
case 0:
|
|
5965
|
+
atsMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
5966
|
+
this.logger.verbose("RefreshTokenClientAcquireToken called", request.correlationId);
|
|
5899
5967
|
reqTimestamp = TimeUtils.nowSeconds();
|
|
5900
5968
|
return [4 /*yield*/, this.executeTokenRequest(request, this.authority)];
|
|
5901
5969
|
case 1:
|
|
5902
|
-
response =
|
|
5970
|
+
response = _c.sent();
|
|
5971
|
+
requestId = (_b = response.headers) === null || _b === void 0 ? void 0 : _b[HeaderNames.X_MS_REQUEST_ID];
|
|
5903
5972
|
responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);
|
|
5904
5973
|
responseHandler.validateTokenResponse(response.body);
|
|
5905
|
-
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache)
|
|
5974
|
+
return [2 /*return*/, responseHandler.handleServerTokenResponse(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId).then(function (result) {
|
|
5975
|
+
var _a;
|
|
5976
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5977
|
+
success: true,
|
|
5978
|
+
refreshTokenSize: ((_a = response.body.refresh_token) === null || _a === void 0 ? void 0 : _a.length) || 0
|
|
5979
|
+
});
|
|
5980
|
+
return result;
|
|
5981
|
+
})
|
|
5982
|
+
.catch(function (error) {
|
|
5983
|
+
_this.logger.verbose("Error in fetching refresh token", request.correlationId);
|
|
5984
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
5985
|
+
errorCode: error.errorCode,
|
|
5986
|
+
subErrorCode: error.subError,
|
|
5987
|
+
success: false,
|
|
5988
|
+
refreshTokenSize: undefined
|
|
5989
|
+
});
|
|
5990
|
+
throw error;
|
|
5991
|
+
})];
|
|
5906
5992
|
}
|
|
5907
5993
|
});
|
|
5908
5994
|
});
|
|
@@ -5952,14 +6038,21 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5952
6038
|
* @param request
|
|
5953
6039
|
*/
|
|
5954
6040
|
RefreshTokenClient.prototype.acquireTokenWithCachedRefreshToken = function (request, foci) {
|
|
6041
|
+
var _a;
|
|
5955
6042
|
return __awaiter(this, void 0, void 0, function () {
|
|
5956
|
-
var refreshToken, refreshTokenRequest;
|
|
5957
|
-
return __generator(this, function (
|
|
6043
|
+
var atsMeasurement, refreshToken, refreshTokenRequest;
|
|
6044
|
+
return __generator(this, function (_b) {
|
|
6045
|
+
atsMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(exports.PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
6046
|
+
this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
|
|
5958
6047
|
refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);
|
|
5959
|
-
// no refresh Token
|
|
5960
6048
|
if (!refreshToken) {
|
|
6049
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.discardMeasurement();
|
|
5961
6050
|
throw InteractionRequiredAuthError.createNoTokensFoundError();
|
|
5962
6051
|
}
|
|
6052
|
+
// attach cached RT size to the current measurement
|
|
6053
|
+
atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.endMeasurement({
|
|
6054
|
+
success: true
|
|
6055
|
+
});
|
|
5963
6056
|
refreshTokenRequest = __assign(__assign({}, request), { refreshToken: refreshToken.secret, authenticationScheme: request.authenticationScheme || exports.AuthenticationScheme.BEARER, ccsCredential: {
|
|
5964
6057
|
credential: request.account.homeAccountId,
|
|
5965
6058
|
type: CcsCredentialType.HOME_ACCOUNT_ID
|
|
@@ -6112,7 +6205,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
6112
6205
|
return RefreshTokenClient;
|
|
6113
6206
|
}(BaseClient));
|
|
6114
6207
|
|
|
6115
|
-
/*! @azure/msal-common v7.
|
|
6208
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6116
6209
|
|
|
6117
6210
|
/*
|
|
6118
6211
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6212,13 +6305,21 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
6212
6305
|
*/
|
|
6213
6306
|
SilentFlowClient.prototype.generateResultFromCacheRecord = function (cacheRecord, request) {
|
|
6214
6307
|
return __awaiter(this, void 0, void 0, function () {
|
|
6215
|
-
var idTokenObj;
|
|
6308
|
+
var idTokenObj, authTime;
|
|
6216
6309
|
return __generator(this, function (_a) {
|
|
6217
6310
|
switch (_a.label) {
|
|
6218
6311
|
case 0:
|
|
6219
6312
|
if (cacheRecord.idToken) {
|
|
6220
6313
|
idTokenObj = new AuthToken(cacheRecord.idToken.secret, this.config.cryptoInterface);
|
|
6221
6314
|
}
|
|
6315
|
+
// token max_age check
|
|
6316
|
+
if (request.maxAge || (request.maxAge === 0)) {
|
|
6317
|
+
authTime = idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.auth_time;
|
|
6318
|
+
if (!authTime) {
|
|
6319
|
+
throw ClientAuthError.createAuthTimeNotFoundError();
|
|
6320
|
+
}
|
|
6321
|
+
AuthToken.checkMaxAge(authTime, request.maxAge);
|
|
6322
|
+
}
|
|
6222
6323
|
return [4 /*yield*/, ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, idTokenObj)];
|
|
6223
6324
|
case 1: return [2 /*return*/, _a.sent()];
|
|
6224
6325
|
}
|
|
@@ -6228,7 +6329,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
6228
6329
|
return SilentFlowClient;
|
|
6229
6330
|
}(BaseClient));
|
|
6230
6331
|
|
|
6231
|
-
/*! @azure/msal-common v7.
|
|
6332
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6232
6333
|
/*
|
|
6233
6334
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6234
6335
|
* Licensed under the MIT License.
|
|
@@ -6240,7 +6341,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
6240
6341
|
response.hasOwnProperty("jwks_uri"));
|
|
6241
6342
|
}
|
|
6242
6343
|
|
|
6243
|
-
/*! @azure/msal-common v7.
|
|
6344
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6244
6345
|
/*
|
|
6245
6346
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6246
6347
|
* Licensed under the MIT License.
|
|
@@ -6249,7 +6350,7 @@ var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/
|
|
|
6249
6350
|
var EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
6250
6351
|
var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
6251
6352
|
|
|
6252
|
-
/*! @azure/msal-common v7.
|
|
6353
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6253
6354
|
/*
|
|
6254
6355
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6255
6356
|
* Licensed under the MIT License.
|
|
@@ -6263,7 +6364,7 @@ exports.ProtocolMode = void 0;
|
|
|
6263
6364
|
ProtocolMode["OIDC"] = "OIDC";
|
|
6264
6365
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
6265
6366
|
|
|
6266
|
-
/*! @azure/msal-common v7.
|
|
6367
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6267
6368
|
|
|
6268
6369
|
/*
|
|
6269
6370
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6340,7 +6441,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
|
|
|
6340
6441
|
return AuthorityMetadataEntity;
|
|
6341
6442
|
}());
|
|
6342
6443
|
|
|
6343
|
-
/*! @azure/msal-common v7.
|
|
6444
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6344
6445
|
/*
|
|
6345
6446
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6346
6447
|
* Licensed under the MIT License.
|
|
@@ -6350,7 +6451,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
6350
6451
|
response.hasOwnProperty("metadata"));
|
|
6351
6452
|
}
|
|
6352
6453
|
|
|
6353
|
-
/*! @azure/msal-common v7.
|
|
6454
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6354
6455
|
|
|
6355
6456
|
/*
|
|
6356
6457
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6472,7 +6573,7 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6472
6573
|
return RegionDiscovery;
|
|
6473
6574
|
}());
|
|
6474
6575
|
|
|
6475
|
-
/*! @azure/msal-common v7.
|
|
6576
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
6476
6577
|
|
|
6477
6578
|
/*
|
|
6478
6579
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6497,8 +6598,13 @@ var Authority = /** @class */ (function () {
|
|
|
6497
6598
|
// See above for AuthorityType
|
|
6498
6599
|
get: function () {
|
|
6499
6600
|
var pathSegments = this.canonicalAuthorityUrlComponents.PathSegments;
|
|
6500
|
-
if (pathSegments.length
|
|
6501
|
-
|
|
6601
|
+
if (pathSegments.length) {
|
|
6602
|
+
switch (pathSegments[0].toLowerCase()) {
|
|
6603
|
+
case Constants.ADFS:
|
|
6604
|
+
return AuthorityType.Adfs;
|
|
6605
|
+
case Constants.DSTS:
|
|
6606
|
+
return AuthorityType.Dsts;
|
|
6607
|
+
}
|
|
6502
6608
|
}
|
|
6503
6609
|
return AuthorityType.Default;
|
|
6504
6610
|
},
|
|
@@ -6702,7 +6808,9 @@ var Authority = /** @class */ (function () {
|
|
|
6702
6808
|
* The default open id configuration endpoint for any canonical authority.
|
|
6703
6809
|
*/
|
|
6704
6810
|
get: function () {
|
|
6705
|
-
if (this.authorityType === AuthorityType.Adfs ||
|
|
6811
|
+
if (this.authorityType === AuthorityType.Adfs ||
|
|
6812
|
+
this.authorityType === AuthorityType.Dsts ||
|
|
6813
|
+
this.protocolMode === exports.ProtocolMode.OIDC) {
|
|
6706
6814
|
return this.canonicalAuthority + ".well-known/openid-configuration";
|
|
6707
6815
|
}
|
|
6708
6816
|
return this.canonicalAuthority + "v2.0/.well-known/openid-configuration";
|
|
@@ -6800,8 +6908,9 @@ var Authority = /** @class */ (function () {
|
|
|
6800
6908
|
});
|
|
6801
6909
|
};
|
|
6802
6910
|
/**
|
|
6803
|
-
* Compares the number of url components after the domain to determine if the cached
|
|
6804
|
-
*
|
|
6911
|
+
* Compares the number of url components after the domain to determine if the cached
|
|
6912
|
+
* authority metadata can be used for the requested authority. Protects against same domain different
|
|
6913
|
+
* authority such as login.microsoftonline.com/tenant and login.microsoftonline.com/tfp/tenant/policy
|
|
6805
6914
|
* @param metadataEntity
|
|
6806
6915
|
*/
|
|
6807
6916
|
Authority.prototype.isAuthoritySameType = function (metadataEntity) {
|
|
@@ -6841,7 +6950,8 @@ var Authority = /** @class */ (function () {
|
|
|
6841
6950
|
_a.label = 1;
|
|
6842
6951
|
case 1:
|
|
6843
6952
|
_a.trys.push([1, 3, , 4]);
|
|
6844
|
-
return [4 /*yield*/, this.networkInterface.
|
|
6953
|
+
return [4 /*yield*/, this.networkInterface.
|
|
6954
|
+
sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
|
|
6845
6955
|
case 2:
|
|
6846
6956
|
response = _a.sent();
|
|
6847
6957
|
return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
|
|
@@ -6902,7 +7012,8 @@ var Authority = /** @class */ (function () {
|
|
|
6902
7012
|
});
|
|
6903
7013
|
};
|
|
6904
7014
|
/**
|
|
6905
|
-
* Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache
|
|
7015
|
+
* Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache
|
|
7016
|
+
* and returns where the information was retrieved from
|
|
6906
7017
|
* @param cachedMetadata
|
|
6907
7018
|
* @param newMetadata
|
|
6908
7019
|
*/
|
|
@@ -7125,7 +7236,7 @@ var Authority = /** @class */ (function () {
|
|
|
7125
7236
|
Authority.replaceWithRegionalInformation = function (metadata, azureRegion) {
|
|
7126
7237
|
metadata.authorization_endpoint = Authority.buildRegionalAuthorityString(metadata.authorization_endpoint, azureRegion);
|
|
7127
7238
|
// TODO: Enquire on whether we should leave the query string or remove it before releasing the feature
|
|
7128
|
-
metadata.token_endpoint = Authority.buildRegionalAuthorityString(metadata.token_endpoint, azureRegion,
|
|
7239
|
+
metadata.token_endpoint = Authority.buildRegionalAuthorityString(metadata.token_endpoint, azureRegion, Constants.REGIONAL_AUTH_NON_MSI_QUERY_STRING);
|
|
7129
7240
|
if (metadata.end_session_endpoint) {
|
|
7130
7241
|
metadata.end_session_endpoint = Authority.buildRegionalAuthorityString(metadata.end_session_endpoint, azureRegion);
|
|
7131
7242
|
}
|
|
@@ -7134,7 +7245,7 @@ var Authority = /** @class */ (function () {
|
|
|
7134
7245
|
return Authority;
|
|
7135
7246
|
}());
|
|
7136
7247
|
|
|
7137
|
-
/*! @azure/msal-common v7.
|
|
7248
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7138
7249
|
|
|
7139
7250
|
/*
|
|
7140
7251
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7195,7 +7306,7 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
7195
7306
|
return AuthorityFactory;
|
|
7196
7307
|
}());
|
|
7197
7308
|
|
|
7198
|
-
/*! @azure/msal-common v7.
|
|
7309
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7199
7310
|
|
|
7200
7311
|
/*
|
|
7201
7312
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7226,7 +7337,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
|
|
|
7226
7337
|
return ServerTelemetryEntity;
|
|
7227
7338
|
}());
|
|
7228
7339
|
|
|
7229
|
-
/*! @azure/msal-common v7.
|
|
7340
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7230
7341
|
|
|
7231
7342
|
/*
|
|
7232
7343
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7254,7 +7365,7 @@ var ThrottlingEntity = /** @class */ (function () {
|
|
|
7254
7365
|
return ThrottlingEntity;
|
|
7255
7366
|
}());
|
|
7256
7367
|
|
|
7257
|
-
/*! @azure/msal-common v7.
|
|
7368
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7258
7369
|
|
|
7259
7370
|
/*
|
|
7260
7371
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7271,7 +7382,7 @@ var StubbedNetworkModule = {
|
|
|
7271
7382
|
}
|
|
7272
7383
|
};
|
|
7273
7384
|
|
|
7274
|
-
/*! @azure/msal-common v7.
|
|
7385
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7275
7386
|
|
|
7276
7387
|
/*
|
|
7277
7388
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7316,7 +7427,7 @@ var JoseHeaderError = /** @class */ (function (_super) {
|
|
|
7316
7427
|
return JoseHeaderError;
|
|
7317
7428
|
}(AuthError));
|
|
7318
7429
|
|
|
7319
|
-
/*! @azure/msal-common v7.
|
|
7430
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7320
7431
|
|
|
7321
7432
|
/*
|
|
7322
7433
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7356,7 +7467,7 @@ var JoseHeader = /** @class */ (function () {
|
|
|
7356
7467
|
return JoseHeader;
|
|
7357
7468
|
}());
|
|
7358
7469
|
|
|
7359
|
-
/*! @azure/msal-common v7.
|
|
7470
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7360
7471
|
|
|
7361
7472
|
/*
|
|
7362
7473
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7415,7 +7526,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
|
|
|
7415
7526
|
return AuthenticationHeaderParser;
|
|
7416
7527
|
}());
|
|
7417
7528
|
|
|
7418
|
-
/*! @azure/msal-common v7.
|
|
7529
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7419
7530
|
|
|
7420
7531
|
/*
|
|
7421
7532
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7577,7 +7688,7 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
7577
7688
|
return ServerTelemetryManager;
|
|
7578
7689
|
}());
|
|
7579
7690
|
|
|
7580
|
-
/*! @azure/msal-common v7.
|
|
7691
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7581
7692
|
|
|
7582
7693
|
/*
|
|
7583
7694
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7786,6 +7897,9 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7786
7897
|
if (current.idTokenSize) {
|
|
7787
7898
|
previous.idTokenSize = current.idTokenSize;
|
|
7788
7899
|
}
|
|
7900
|
+
if (current.refreshTokenSize) {
|
|
7901
|
+
previous.refreshTokenSize = current.refreshTokenSize;
|
|
7902
|
+
}
|
|
7789
7903
|
}
|
|
7790
7904
|
return previous;
|
|
7791
7905
|
}, topLevelEvent);
|
|
@@ -7853,7 +7967,7 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7853
7967
|
return PerformanceClient;
|
|
7854
7968
|
}());
|
|
7855
7969
|
|
|
7856
|
-
/*! @azure/msal-common v7.
|
|
7970
|
+
/*! @azure/msal-common v7.5.0 2022-10-03 */
|
|
7857
7971
|
|
|
7858
7972
|
/*
|
|
7859
7973
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7979,7 +8093,7 @@ var BrowserAuthErrorMessage = {
|
|
|
7979
8093
|
},
|
|
7980
8094
|
silentPromptValueError: {
|
|
7981
8095
|
code: "silent_prompt_value_error",
|
|
7982
|
-
desc: "The value given for the prompt value is not valid for silent requests - must be set to 'none'."
|
|
8096
|
+
desc: "The value given for the prompt value is not valid for silent requests - must be set to 'none' or 'no_session'."
|
|
7983
8097
|
},
|
|
7984
8098
|
noTokenRequestCacheError: {
|
|
7985
8099
|
code: "no_token_request_cache_error",
|
|
@@ -8530,7 +8644,44 @@ exports.WrapperSKU = void 0;
|
|
|
8530
8644
|
// DatabaseStorage Constants
|
|
8531
8645
|
var DB_NAME = "msal.db";
|
|
8532
8646
|
var DB_VERSION = 1;
|
|
8533
|
-
var DB_TABLE_NAME = DB_NAME + ".keys";
|
|
8647
|
+
var DB_TABLE_NAME = DB_NAME + ".keys";
|
|
8648
|
+
exports.CacheLookupPolicy = void 0;
|
|
8649
|
+
(function (CacheLookupPolicy) {
|
|
8650
|
+
/*
|
|
8651
|
+
* acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired
|
|
8652
|
+
* or cannot be found the refresh token will be used to acquire a new one. Finally, if the refresh token
|
|
8653
|
+
* is expired acquireTokenSilent will attempt to acquire new access and refresh tokens.
|
|
8654
|
+
*/
|
|
8655
|
+
CacheLookupPolicy[CacheLookupPolicy["Default"] = 0] = "Default";
|
|
8656
|
+
/*
|
|
8657
|
+
* acquireTokenSilent will only look for access tokens in the cache. It will not attempt to renew access or
|
|
8658
|
+
* refresh tokens.
|
|
8659
|
+
*/
|
|
8660
|
+
CacheLookupPolicy[CacheLookupPolicy["AccessToken"] = 1] = "AccessToken";
|
|
8661
|
+
/*
|
|
8662
|
+
* acquireTokenSilent will attempt to retrieve an access token from the cache. If the access token is expired or
|
|
8663
|
+
* cannot be found, the refresh token will be used to acquire a new one. If the refresh token is expired, it
|
|
8664
|
+
* will not be renewed and acquireTokenSilent will fail.
|
|
8665
|
+
*/
|
|
8666
|
+
CacheLookupPolicy[CacheLookupPolicy["AccessTokenAndRefreshToken"] = 2] = "AccessTokenAndRefreshToken";
|
|
8667
|
+
/*
|
|
8668
|
+
* acquireTokenSilent will not attempt to retrieve access tokens from the cache and will instead attempt to
|
|
8669
|
+
* exchange the cached refresh token for a new access token. If the refresh token is expired, it will not be
|
|
8670
|
+
* renewed and acquireTokenSilent will fail.
|
|
8671
|
+
*/
|
|
8672
|
+
CacheLookupPolicy[CacheLookupPolicy["RefreshToken"] = 3] = "RefreshToken";
|
|
8673
|
+
/*
|
|
8674
|
+
* acquireTokenSilent will not look in the cache for the access token. It will go directly to network with the
|
|
8675
|
+
* cached refresh token. If the refresh token is expired an attempt will be made to renew it. This is equivalent to
|
|
8676
|
+
* setting "forceRefresh: true".
|
|
8677
|
+
*/
|
|
8678
|
+
CacheLookupPolicy[CacheLookupPolicy["RefreshTokenAndNetwork"] = 4] = "RefreshTokenAndNetwork";
|
|
8679
|
+
/*
|
|
8680
|
+
* acquireTokenSilent will attempt to renew both access and refresh tokens. It will not look in the cache. This will
|
|
8681
|
+
* always fail if 3rd party cookies are blocked by the browser.
|
|
8682
|
+
*/
|
|
8683
|
+
CacheLookupPolicy[CacheLookupPolicy["Skip"] = 5] = "Skip";
|
|
8684
|
+
})(exports.CacheLookupPolicy || (exports.CacheLookupPolicy = {}));
|
|
8534
8685
|
|
|
8535
8686
|
/*
|
|
8536
8687
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8569,6 +8720,10 @@ var BrowserConfigurationAuthErrorMessage = {
|
|
|
8569
8720
|
inMemRedirectUnavailable: {
|
|
8570
8721
|
code: "in_mem_redirect_unavailable",
|
|
8571
8722
|
desc: "Redirect cannot be supported. In-memory storage was selected and storeAuthStateInCookie=false, which would cause the library to be unable to handle the incoming hash. If you would like to use the redirect API, please use session/localStorage or set storeAuthStateInCookie=true."
|
|
8723
|
+
},
|
|
8724
|
+
entropyNotProvided: {
|
|
8725
|
+
code: "entropy_not_provided",
|
|
8726
|
+
desc: "The available browser crypto interface requires entropy set via system.cryptoOptions.entropy configuration option."
|
|
8572
8727
|
}
|
|
8573
8728
|
};
|
|
8574
8729
|
/**
|
|
@@ -8619,6 +8774,12 @@ var BrowserConfigurationAuthError = /** @class */ (function (_super) {
|
|
|
8619
8774
|
BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError = function () {
|
|
8620
8775
|
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.code, BrowserConfigurationAuthErrorMessage.inMemRedirectUnavailable.desc);
|
|
8621
8776
|
};
|
|
8777
|
+
/**
|
|
8778
|
+
* Creates an error thrown when a crypto interface that requires entropy is initialized without entropy
|
|
8779
|
+
*/
|
|
8780
|
+
BrowserConfigurationAuthError.createEntropyNotProvided = function () {
|
|
8781
|
+
return new BrowserConfigurationAuthError(BrowserConfigurationAuthErrorMessage.entropyNotProvided.code, BrowserConfigurationAuthErrorMessage.entropyNotProvided.desc);
|
|
8782
|
+
};
|
|
8622
8783
|
return BrowserConfigurationAuthError;
|
|
8623
8784
|
}(AuthError));
|
|
8624
8785
|
|
|
@@ -9681,7 +9842,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
|
|
|
9681
9842
|
|
|
9682
9843
|
/* eslint-disable header/header */
|
|
9683
9844
|
var name = "@azure/msal-browser";
|
|
9684
|
-
var version = "2.
|
|
9845
|
+
var version = "2.29.0";
|
|
9685
9846
|
|
|
9686
9847
|
/*
|
|
9687
9848
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11084,7 +11245,8 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
11084
11245
|
.then(function (result) {
|
|
11085
11246
|
nativeATMeasurement.endMeasurement({
|
|
11086
11247
|
success: true,
|
|
11087
|
-
isNativeBroker: true
|
|
11248
|
+
isNativeBroker: true,
|
|
11249
|
+
requestId: result.requestId
|
|
11088
11250
|
});
|
|
11089
11251
|
return result;
|
|
11090
11252
|
})
|
|
@@ -12624,7 +12786,10 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
12624
12786
|
// Default system options for browser
|
|
12625
12787
|
var DEFAULT_BROWSER_SYSTEM_OPTIONS = __assign$1(__assign$1({}, DEFAULT_SYSTEM_OPTIONS), { loggerOptions: DEFAULT_LOGGER_OPTIONS, networkClient: isBrowserEnvironment ? BrowserUtils.getBrowserNetworkClient() : StubbedNetworkModule, navigationClient: new NavigationClient(), loadFrameTimeout: 0,
|
|
12626
12788
|
// If loadFrameTimeout is provided, use that as default.
|
|
12627
|
-
windowHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false, allowNativeBroker: false, nativeBrokerHandshakeTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.nativeBrokerHandshakeTimeout) || DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS
|
|
12789
|
+
windowHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false, allowNativeBroker: false, nativeBrokerHandshakeTimeout: (userInputSystem === null || userInputSystem === void 0 ? void 0 : userInputSystem.nativeBrokerHandshakeTimeout) || DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS, cryptoOptions: {
|
|
12790
|
+
useMsrCrypto: false,
|
|
12791
|
+
entropy: undefined
|
|
12792
|
+
} });
|
|
12628
12793
|
var DEFAULT_TELEMETRY_OPTIONS = {
|
|
12629
12794
|
application: {
|
|
12630
12795
|
appName: Constants.EMPTY_STRING,
|
|
@@ -12805,7 +12970,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12805
12970
|
return _this;
|
|
12806
12971
|
}
|
|
12807
12972
|
/**
|
|
12808
|
-
* Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none
|
|
12973
|
+
* Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session
|
|
12809
12974
|
* @param request
|
|
12810
12975
|
*/
|
|
12811
12976
|
SilentIframeClient.prototype.acquireToken = function (request) {
|
|
@@ -12820,14 +12985,14 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12820
12985
|
if (StringUtils.isEmpty(request.loginHint) && StringUtils.isEmpty(request.sid) && (!request.account || StringUtils.isEmpty(request.account.username))) {
|
|
12821
12986
|
this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
|
|
12822
12987
|
}
|
|
12823
|
-
// Check that prompt is set to none, throw error if it is set to anything else.
|
|
12824
|
-
if (request.prompt && request.prompt !== PromptValue.NONE) {
|
|
12988
|
+
// Check that prompt is set to none or no_session, throw error if it is set to anything else.
|
|
12989
|
+
if (request.prompt && (request.prompt !== PromptValue.NONE) && (request.prompt !== PromptValue.NO_SESSION)) {
|
|
12825
12990
|
acquireTokenMeasurement.endMeasurement({
|
|
12826
12991
|
success: false
|
|
12827
12992
|
});
|
|
12828
12993
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
12829
12994
|
}
|
|
12830
|
-
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
12995
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: request.prompt || PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
12831
12996
|
case 1:
|
|
12832
12997
|
silentRequest = _a.sent();
|
|
12833
12998
|
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
|
|
@@ -12842,7 +13007,8 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12842
13007
|
return [4 /*yield*/, this.silentTokenHelper(authClient, silentRequest).then(function (result) {
|
|
12843
13008
|
acquireTokenMeasurement.endMeasurement({
|
|
12844
13009
|
success: true,
|
|
12845
|
-
fromCache: false
|
|
13010
|
+
fromCache: false,
|
|
13011
|
+
requestId: result.requestId
|
|
12846
13012
|
});
|
|
12847
13013
|
return result;
|
|
12848
13014
|
})];
|
|
@@ -12906,7 +13072,7 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12906
13072
|
}
|
|
12907
13073
|
nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.apiId, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, this.correlationId);
|
|
12908
13074
|
userRequestState = ProtocolUtils.parseRequestState(this.browserCrypto, state).userRequestState;
|
|
12909
|
-
return [2 /*return*/, nativeInteractionClient.acquireToken(__assign$1(__assign$1({}, silentRequest), { state: userRequestState, prompt: PromptValue.NONE })).finally(function () {
|
|
13075
|
+
return [2 /*return*/, nativeInteractionClient.acquireToken(__assign$1(__assign$1({}, silentRequest), { state: userRequestState, prompt: silentRequest.prompt || PromptValue.NONE })).finally(function () {
|
|
12910
13076
|
_this.browserStorage.cleanRequestByState(state);
|
|
12911
13077
|
})];
|
|
12912
13078
|
}
|
|
@@ -12954,7 +13120,8 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
12954
13120
|
.then(function (result) {
|
|
12955
13121
|
acquireTokenMeasurement.endMeasurement({
|
|
12956
13122
|
success: true,
|
|
12957
|
-
fromCache: result.fromCache
|
|
13123
|
+
fromCache: result.fromCache,
|
|
13124
|
+
requestId: result.requestId
|
|
12958
13125
|
});
|
|
12959
13126
|
return result;
|
|
12960
13127
|
})
|
|
@@ -13360,6 +13527,13 @@ var BrowserStringUtils = /** @class */ (function () {
|
|
|
13360
13527
|
}
|
|
13361
13528
|
return sView;
|
|
13362
13529
|
};
|
|
13530
|
+
/**
|
|
13531
|
+
* Returns stringified jwk.
|
|
13532
|
+
* @param jwk
|
|
13533
|
+
*/
|
|
13534
|
+
BrowserStringUtils.getSortedObjectString = function (obj) {
|
|
13535
|
+
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
13536
|
+
};
|
|
13363
13537
|
return BrowserStringUtils;
|
|
13364
13538
|
}());
|
|
13365
13539
|
|
|
@@ -13602,178 +13776,117 @@ var PkceGenerator = /** @class */ (function () {
|
|
|
13602
13776
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13603
13777
|
* Licensed under the MIT License.
|
|
13604
13778
|
*/
|
|
13605
|
-
/**
|
|
13606
|
-
|
|
13607
|
-
*/
|
|
13608
|
-
// RSA KeyGen Algorithm
|
|
13609
|
-
var PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
13610
|
-
// SHA-256 hashing algorithm
|
|
13611
|
-
var S256_HASH_ALG = "SHA-256";
|
|
13612
|
-
// MOD length for PoP tokens
|
|
13613
|
-
var MODULUS_LENGTH = 2048;
|
|
13614
|
-
// Public Exponent
|
|
13615
|
-
var PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
13616
|
-
/**
|
|
13617
|
-
* This class implements functions used by the browser library to perform cryptography operations such as
|
|
13618
|
-
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
13619
|
-
*/
|
|
13620
|
-
var BrowserCrypto = /** @class */ (function () {
|
|
13621
|
-
function BrowserCrypto(logger) {
|
|
13622
|
-
this.logger = logger;
|
|
13623
|
-
if (!(this.hasCryptoAPI())) {
|
|
13624
|
-
throw BrowserAuthError.createCryptoNotAvailableError("Browser crypto or msCrypto object not available.");
|
|
13625
|
-
}
|
|
13626
|
-
this._keygenAlgorithmOptions = {
|
|
13627
|
-
name: PKCS1_V15_KEYGEN_ALG,
|
|
13628
|
-
hash: S256_HASH_ALG,
|
|
13629
|
-
modulusLength: MODULUS_LENGTH,
|
|
13630
|
-
publicExponent: PUBLIC_EXPONENT
|
|
13631
|
-
};
|
|
13779
|
+
var ModernBrowserCrypto = /** @class */ (function () {
|
|
13780
|
+
function ModernBrowserCrypto() {
|
|
13632
13781
|
}
|
|
13633
|
-
|
|
13634
|
-
|
|
13635
|
-
|
|
13636
|
-
|
|
13637
|
-
BrowserCrypto.prototype.sha256Digest = function (dataString) {
|
|
13782
|
+
ModernBrowserCrypto.prototype.getRandomValues = function (dataBuffer) {
|
|
13783
|
+
return window.crypto.getRandomValues(dataBuffer);
|
|
13784
|
+
};
|
|
13785
|
+
ModernBrowserCrypto.prototype.generateKey = function (algorithm, extractable, keyUsages) {
|
|
13638
13786
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13639
|
-
var data;
|
|
13640
13787
|
return __generator$1(this, function (_a) {
|
|
13641
|
-
|
|
13642
|
-
return [2 /*return*/, this.hasIECrypto() ? this.getMSCryptoDigest(S256_HASH_ALG, data) : this.getSubtleCryptoDigest(S256_HASH_ALG, data)];
|
|
13788
|
+
return [2 /*return*/, window.crypto.subtle.generateKey(algorithm, extractable, keyUsages)];
|
|
13643
13789
|
});
|
|
13644
13790
|
});
|
|
13645
13791
|
};
|
|
13646
|
-
|
|
13647
|
-
* Populates buffer with cryptographically random values.
|
|
13648
|
-
* @param dataBuffer
|
|
13649
|
-
*/
|
|
13650
|
-
BrowserCrypto.prototype.getRandomValues = function (dataBuffer) {
|
|
13651
|
-
var cryptoObj = window["msCrypto"] || window.crypto;
|
|
13652
|
-
if (!cryptoObj.getRandomValues) {
|
|
13653
|
-
throw BrowserAuthError.createCryptoNotAvailableError("getRandomValues does not exist.");
|
|
13654
|
-
}
|
|
13655
|
-
cryptoObj.getRandomValues(dataBuffer);
|
|
13656
|
-
};
|
|
13657
|
-
/**
|
|
13658
|
-
* Generates a keypair based on current keygen algorithm config.
|
|
13659
|
-
* @param extractable
|
|
13660
|
-
* @param usages
|
|
13661
|
-
*/
|
|
13662
|
-
BrowserCrypto.prototype.generateKeyPair = function (extractable, usages) {
|
|
13792
|
+
ModernBrowserCrypto.prototype.exportKey = function (key) {
|
|
13663
13793
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13664
13794
|
return __generator$1(this, function (_a) {
|
|
13665
|
-
return [2 /*return*/,
|
|
13666
|
-
this.msCryptoGenerateKey(extractable, usages)
|
|
13667
|
-
: window.crypto.subtle.generateKey(this._keygenAlgorithmOptions, extractable, usages))];
|
|
13795
|
+
return [2 /*return*/, window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key)];
|
|
13668
13796
|
});
|
|
13669
13797
|
});
|
|
13670
13798
|
};
|
|
13671
|
-
|
|
13672
|
-
* Export key as Json Web Key (JWK)
|
|
13673
|
-
* @param key
|
|
13674
|
-
* @param format
|
|
13675
|
-
*/
|
|
13676
|
-
BrowserCrypto.prototype.exportJwk = function (key) {
|
|
13799
|
+
ModernBrowserCrypto.prototype.importKey = function (keyData, algorithm, extractable, keyUsages) {
|
|
13677
13800
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13678
13801
|
return __generator$1(this, function (_a) {
|
|
13679
|
-
return [2 /*return*/,
|
|
13802
|
+
return [2 /*return*/, window.crypto.subtle.importKey(KEY_FORMAT_JWK, keyData, algorithm, extractable, keyUsages)];
|
|
13680
13803
|
});
|
|
13681
13804
|
});
|
|
13682
13805
|
};
|
|
13683
|
-
|
|
13684
|
-
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
13685
|
-
* @param key
|
|
13686
|
-
* @param format
|
|
13687
|
-
* @param extractable
|
|
13688
|
-
* @param usages
|
|
13689
|
-
*/
|
|
13690
|
-
BrowserCrypto.prototype.importJwk = function (key, extractable, usages) {
|
|
13806
|
+
ModernBrowserCrypto.prototype.sign = function (algorithm, key, data) {
|
|
13691
13807
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13692
|
-
var keyString, keyBuffer;
|
|
13693
13808
|
return __generator$1(this, function (_a) {
|
|
13694
|
-
|
|
13695
|
-
keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);
|
|
13696
|
-
return [2 /*return*/, this.hasIECrypto() ?
|
|
13697
|
-
this.msCryptoImportKey(keyBuffer, extractable, usages)
|
|
13698
|
-
: window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, this._keygenAlgorithmOptions, extractable, usages)];
|
|
13809
|
+
return [2 /*return*/, window.crypto.subtle.sign(algorithm, key, data)];
|
|
13699
13810
|
});
|
|
13700
13811
|
});
|
|
13701
13812
|
};
|
|
13702
|
-
|
|
13703
|
-
* Signs given data with given key
|
|
13704
|
-
* @param key
|
|
13705
|
-
* @param data
|
|
13706
|
-
*/
|
|
13707
|
-
BrowserCrypto.prototype.sign = function (key, data) {
|
|
13813
|
+
ModernBrowserCrypto.prototype.digest = function (algorithm, data) {
|
|
13708
13814
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13709
13815
|
return __generator$1(this, function (_a) {
|
|
13710
|
-
return [2 /*return*/,
|
|
13711
|
-
this.msCryptoSign(key, data)
|
|
13712
|
-
: window.crypto.subtle.sign(this._keygenAlgorithmOptions, key, data)];
|
|
13816
|
+
return [2 /*return*/, window.crypto.subtle.digest(algorithm, data)];
|
|
13713
13817
|
});
|
|
13714
13818
|
});
|
|
13715
13819
|
};
|
|
13716
|
-
|
|
13717
|
-
|
|
13718
|
-
|
|
13719
|
-
|
|
13720
|
-
|
|
13820
|
+
return ModernBrowserCrypto;
|
|
13821
|
+
}());
|
|
13822
|
+
|
|
13823
|
+
/*
|
|
13824
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13825
|
+
* Licensed under the MIT License.
|
|
13826
|
+
*/
|
|
13827
|
+
var MsrBrowserCrypto = /** @class */ (function () {
|
|
13828
|
+
function MsrBrowserCrypto() {
|
|
13829
|
+
}
|
|
13830
|
+
MsrBrowserCrypto.prototype.initPrng = function (entropy) {
|
|
13831
|
+
// Turn into array, as initPrng seems to not always like Uint8Array (even though it should support both)
|
|
13832
|
+
return window.msrCrypto.initPrng(__spread(entropy));
|
|
13721
13833
|
};
|
|
13722
|
-
|
|
13723
|
-
|
|
13724
|
-
*/
|
|
13725
|
-
BrowserCrypto.prototype.hasIECrypto = function () {
|
|
13726
|
-
return "msCrypto" in window;
|
|
13834
|
+
MsrBrowserCrypto.prototype.getRandomValues = function (dataBuffer) {
|
|
13835
|
+
return window.msrCrypto.getRandomValues(dataBuffer);
|
|
13727
13836
|
};
|
|
13728
|
-
|
|
13729
|
-
|
|
13730
|
-
|
|
13731
|
-
|
|
13732
|
-
|
|
13837
|
+
MsrBrowserCrypto.prototype.generateKey = function (algorithm, extractable, keyUsages) {
|
|
13838
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
13839
|
+
return __generator$1(this, function (_a) {
|
|
13840
|
+
return [2 /*return*/, window.msrCrypto.subtle.generateKey(algorithm, extractable, keyUsages)];
|
|
13841
|
+
});
|
|
13842
|
+
});
|
|
13733
13843
|
};
|
|
13734
|
-
|
|
13735
|
-
* Helper function for SHA digest.
|
|
13736
|
-
* @param algorithm
|
|
13737
|
-
* @param data
|
|
13738
|
-
*/
|
|
13739
|
-
BrowserCrypto.prototype.getSubtleCryptoDigest = function (algorithm, data) {
|
|
13844
|
+
MsrBrowserCrypto.prototype.exportKey = function (key) {
|
|
13740
13845
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13741
13846
|
return __generator$1(this, function (_a) {
|
|
13742
|
-
return [2 /*return*/, window.
|
|
13847
|
+
return [2 /*return*/, window.msrCrypto.subtle.exportKey(KEY_FORMAT_JWK, key)];
|
|
13743
13848
|
});
|
|
13744
13849
|
});
|
|
13745
13850
|
};
|
|
13746
|
-
|
|
13747
|
-
* IE Helper function for SHA digest.
|
|
13748
|
-
* @param algorithm
|
|
13749
|
-
* @param data
|
|
13750
|
-
*/
|
|
13751
|
-
BrowserCrypto.prototype.getMSCryptoDigest = function (algorithm, data) {
|
|
13851
|
+
MsrBrowserCrypto.prototype.importKey = function (keyData, algorithm, extractable, keyUsages) {
|
|
13752
13852
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13753
13853
|
return __generator$1(this, function (_a) {
|
|
13754
|
-
return [2 /*return*/,
|
|
13755
|
-
var digestOperation = window["msCrypto"].subtle.digest(algorithm, data.buffer);
|
|
13756
|
-
digestOperation.addEventListener("complete", function (e) {
|
|
13757
|
-
resolve(e.target.result);
|
|
13758
|
-
});
|
|
13759
|
-
digestOperation.addEventListener("error", function (error) {
|
|
13760
|
-
reject(error);
|
|
13761
|
-
});
|
|
13762
|
-
})];
|
|
13854
|
+
return [2 /*return*/, window.msrCrypto.subtle.importKey(KEY_FORMAT_JWK, keyData, algorithm, extractable, keyUsages)];
|
|
13763
13855
|
});
|
|
13764
13856
|
});
|
|
13765
13857
|
};
|
|
13766
|
-
|
|
13767
|
-
|
|
13768
|
-
|
|
13769
|
-
|
|
13770
|
-
|
|
13771
|
-
|
|
13858
|
+
MsrBrowserCrypto.prototype.sign = function (algorithm, key, data) {
|
|
13859
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
13860
|
+
return __generator$1(this, function (_a) {
|
|
13861
|
+
return [2 /*return*/, window.msrCrypto.subtle.sign(algorithm, key, data)];
|
|
13862
|
+
});
|
|
13863
|
+
});
|
|
13864
|
+
};
|
|
13865
|
+
MsrBrowserCrypto.prototype.digest = function (algorithm, data) {
|
|
13866
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
13867
|
+
return __generator$1(this, function (_a) {
|
|
13868
|
+
return [2 /*return*/, window.msrCrypto.subtle.digest(algorithm, data)];
|
|
13869
|
+
});
|
|
13870
|
+
});
|
|
13871
|
+
};
|
|
13872
|
+
return MsrBrowserCrypto;
|
|
13873
|
+
}());
|
|
13874
|
+
|
|
13875
|
+
/*
|
|
13876
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13877
|
+
* Licensed under the MIT License.
|
|
13878
|
+
*/
|
|
13879
|
+
var MsBrowserCrypto = /** @class */ (function () {
|
|
13880
|
+
function MsBrowserCrypto() {
|
|
13881
|
+
}
|
|
13882
|
+
MsBrowserCrypto.prototype.getRandomValues = function (dataBuffer) {
|
|
13883
|
+
return window["msCrypto"].getRandomValues(dataBuffer);
|
|
13884
|
+
};
|
|
13885
|
+
MsBrowserCrypto.prototype.generateKey = function (algorithm, extractable, keyUsages) {
|
|
13772
13886
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13773
|
-
var _this = this;
|
|
13774
13887
|
return __generator$1(this, function (_a) {
|
|
13775
13888
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
13776
|
-
var msGenerateKey = window["msCrypto"].subtle.generateKey(
|
|
13889
|
+
var msGenerateKey = window["msCrypto"].subtle.generateKey(algorithm, extractable, keyUsages);
|
|
13777
13890
|
msGenerateKey.addEventListener("complete", function (e) {
|
|
13778
13891
|
resolve(e.target.result);
|
|
13779
13892
|
});
|
|
@@ -13784,12 +13897,7 @@ var BrowserCrypto = /** @class */ (function () {
|
|
|
13784
13897
|
});
|
|
13785
13898
|
});
|
|
13786
13899
|
};
|
|
13787
|
-
|
|
13788
|
-
* IE Helper function for exportKey
|
|
13789
|
-
* @param key
|
|
13790
|
-
* @param format
|
|
13791
|
-
*/
|
|
13792
|
-
BrowserCrypto.prototype.msCryptoExportJwk = function (key) {
|
|
13900
|
+
MsBrowserCrypto.prototype.exportKey = function (key) {
|
|
13793
13901
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13794
13902
|
return __generator$1(this, function (_a) {
|
|
13795
13903
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
@@ -13816,19 +13924,14 @@ var BrowserCrypto = /** @class */ (function () {
|
|
|
13816
13924
|
});
|
|
13817
13925
|
});
|
|
13818
13926
|
};
|
|
13819
|
-
|
|
13820
|
-
* IE Helper function for importKey
|
|
13821
|
-
* @param key
|
|
13822
|
-
* @param format
|
|
13823
|
-
* @param extractable
|
|
13824
|
-
* @param usages
|
|
13825
|
-
*/
|
|
13826
|
-
BrowserCrypto.prototype.msCryptoImportKey = function (keyBuffer, extractable, usages) {
|
|
13927
|
+
MsBrowserCrypto.prototype.importKey = function (keyData, algorithm, extractable, keyUsages) {
|
|
13827
13928
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13828
|
-
var
|
|
13929
|
+
var keyString, keyBuffer;
|
|
13829
13930
|
return __generator$1(this, function (_a) {
|
|
13931
|
+
keyString = BrowserStringUtils.getSortedObjectString(keyData);
|
|
13932
|
+
keyBuffer = BrowserStringUtils.stringToArrayBuffer(keyString);
|
|
13830
13933
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
13831
|
-
var msImportKey = window["msCrypto"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer,
|
|
13934
|
+
var msImportKey = window["msCrypto"].subtle.importKey(KEY_FORMAT_JWK, keyBuffer, algorithm, extractable, keyUsages);
|
|
13832
13935
|
msImportKey.addEventListener("complete", function (e) {
|
|
13833
13936
|
resolve(e.target.result);
|
|
13834
13937
|
});
|
|
@@ -13839,17 +13942,11 @@ var BrowserCrypto = /** @class */ (function () {
|
|
|
13839
13942
|
});
|
|
13840
13943
|
});
|
|
13841
13944
|
};
|
|
13842
|
-
|
|
13843
|
-
* IE Helper function for sign JWT
|
|
13844
|
-
* @param key
|
|
13845
|
-
* @param data
|
|
13846
|
-
*/
|
|
13847
|
-
BrowserCrypto.prototype.msCryptoSign = function (key, data) {
|
|
13945
|
+
MsBrowserCrypto.prototype.sign = function (algorithm, key, data) {
|
|
13848
13946
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13849
|
-
var _this = this;
|
|
13850
13947
|
return __generator$1(this, function (_a) {
|
|
13851
13948
|
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
13852
|
-
var msSign = window["msCrypto"].subtle.sign(
|
|
13949
|
+
var msSign = window["msCrypto"].subtle.sign(algorithm, key, data);
|
|
13853
13950
|
msSign.addEventListener("complete", function (e) {
|
|
13854
13951
|
resolve(e.target.result);
|
|
13855
13952
|
});
|
|
@@ -13860,12 +13957,175 @@ var BrowserCrypto = /** @class */ (function () {
|
|
|
13860
13957
|
});
|
|
13861
13958
|
});
|
|
13862
13959
|
};
|
|
13960
|
+
MsBrowserCrypto.prototype.digest = function (algorithm, data) {
|
|
13961
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
13962
|
+
return __generator$1(this, function (_a) {
|
|
13963
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
13964
|
+
var digestOperation = window["msCrypto"].subtle.digest(algorithm, data.buffer);
|
|
13965
|
+
digestOperation.addEventListener("complete", function (e) {
|
|
13966
|
+
resolve(e.target.result);
|
|
13967
|
+
});
|
|
13968
|
+
digestOperation.addEventListener("error", function (error) {
|
|
13969
|
+
reject(error);
|
|
13970
|
+
});
|
|
13971
|
+
})];
|
|
13972
|
+
});
|
|
13973
|
+
});
|
|
13974
|
+
};
|
|
13975
|
+
return MsBrowserCrypto;
|
|
13976
|
+
}());
|
|
13977
|
+
|
|
13978
|
+
/*
|
|
13979
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13980
|
+
* Licensed under the MIT License.
|
|
13981
|
+
*/
|
|
13982
|
+
/**
|
|
13983
|
+
* See here for more info on RsaHashedKeyGenParams: https://developer.mozilla.org/en-US/docs/Web/API/RsaHashedKeyGenParams
|
|
13984
|
+
*/
|
|
13985
|
+
// RSA KeyGen Algorithm
|
|
13986
|
+
var PKCS1_V15_KEYGEN_ALG = "RSASSA-PKCS1-v1_5";
|
|
13987
|
+
// SHA-256 hashing algorithm
|
|
13988
|
+
var S256_HASH_ALG = "SHA-256";
|
|
13989
|
+
// MOD length for PoP tokens
|
|
13990
|
+
var MODULUS_LENGTH = 2048;
|
|
13991
|
+
// Public Exponent
|
|
13992
|
+
var PUBLIC_EXPONENT = new Uint8Array([0x01, 0x00, 0x01]);
|
|
13993
|
+
/**
|
|
13994
|
+
* This class implements functions used by the browser library to perform cryptography operations such as
|
|
13995
|
+
* hashing and encoding. It also has helper functions to validate the availability of specific APIs.
|
|
13996
|
+
*/
|
|
13997
|
+
var BrowserCrypto = /** @class */ (function () {
|
|
13998
|
+
function BrowserCrypto(logger, cryptoOptions) {
|
|
13999
|
+
var _a, _b;
|
|
14000
|
+
this.logger = logger;
|
|
14001
|
+
this.cryptoOptions = cryptoOptions;
|
|
14002
|
+
if (this.hasBrowserCrypto()) {
|
|
14003
|
+
// Use standard modern web crypto if available
|
|
14004
|
+
this.logger.verbose("BrowserCrypto: modern crypto interface available");
|
|
14005
|
+
this.subtleCrypto = new ModernBrowserCrypto();
|
|
14006
|
+
}
|
|
14007
|
+
else if (this.hasIECrypto()) {
|
|
14008
|
+
// For IE11, use msCrypto interface
|
|
14009
|
+
this.logger.verbose("BrowserCrypto: MS crypto interface available");
|
|
14010
|
+
this.subtleCrypto = new MsBrowserCrypto();
|
|
14011
|
+
}
|
|
14012
|
+
else if (this.hasMsrCrypto() && ((_a = this.cryptoOptions) === null || _a === void 0 ? void 0 : _a.useMsrCrypto)) {
|
|
14013
|
+
// For other browsers, use MSR Crypto if found
|
|
14014
|
+
this.logger.verbose("BrowserCrypto: MSR crypto interface available");
|
|
14015
|
+
this.subtleCrypto = new MsrBrowserCrypto();
|
|
14016
|
+
}
|
|
14017
|
+
else {
|
|
14018
|
+
if (this.hasMsrCrypto()) {
|
|
14019
|
+
this.logger.info("BrowserCrypto: MSR Crypto interface available but system.cryptoOptions.useMsrCrypto not enabled");
|
|
14020
|
+
}
|
|
14021
|
+
this.logger.error("BrowserCrypto: No crypto interfaces available.");
|
|
14022
|
+
throw BrowserAuthError.createCryptoNotAvailableError("Browser crypto, msCrypto, or msrCrypto interfaces not available.");
|
|
14023
|
+
}
|
|
14024
|
+
// Mainly needed for MSR Crypto: https://github.com/microsoft/MSR-JavaScript-Crypto#random-number-generator-prng
|
|
14025
|
+
if (this.subtleCrypto.initPrng) {
|
|
14026
|
+
this.logger.verbose("BrowserCrypto: Interface requires entropy");
|
|
14027
|
+
if (!((_b = this.cryptoOptions) === null || _b === void 0 ? void 0 : _b.entropy)) {
|
|
14028
|
+
this.logger.error("BrowserCrypto: Interface requires entropy but none provided.");
|
|
14029
|
+
throw BrowserConfigurationAuthError.createEntropyNotProvided();
|
|
14030
|
+
}
|
|
14031
|
+
this.logger.verbose("BrowserCrypto: Entropy provided");
|
|
14032
|
+
this.subtleCrypto.initPrng(this.cryptoOptions.entropy);
|
|
14033
|
+
}
|
|
14034
|
+
this.keygenAlgorithmOptions = {
|
|
14035
|
+
name: PKCS1_V15_KEYGEN_ALG,
|
|
14036
|
+
hash: S256_HASH_ALG,
|
|
14037
|
+
modulusLength: MODULUS_LENGTH,
|
|
14038
|
+
publicExponent: PUBLIC_EXPONENT
|
|
14039
|
+
};
|
|
14040
|
+
}
|
|
13863
14041
|
/**
|
|
13864
|
-
*
|
|
13865
|
-
|
|
14042
|
+
* Check whether IE crypto or other browser cryptography is available.
|
|
14043
|
+
*/
|
|
14044
|
+
BrowserCrypto.prototype.hasIECrypto = function () {
|
|
14045
|
+
return "msCrypto" in window;
|
|
14046
|
+
};
|
|
14047
|
+
/**
|
|
14048
|
+
* Check whether browser crypto is available.
|
|
13866
14049
|
*/
|
|
13867
|
-
BrowserCrypto.
|
|
13868
|
-
return
|
|
14050
|
+
BrowserCrypto.prototype.hasBrowserCrypto = function () {
|
|
14051
|
+
return "crypto" in window;
|
|
14052
|
+
};
|
|
14053
|
+
/**
|
|
14054
|
+
* Check whether MSR crypto polyfill is available
|
|
14055
|
+
*/
|
|
14056
|
+
BrowserCrypto.prototype.hasMsrCrypto = function () {
|
|
14057
|
+
return "msrCrypto" in window;
|
|
14058
|
+
};
|
|
14059
|
+
/**
|
|
14060
|
+
* Returns a sha-256 hash of the given dataString as an ArrayBuffer.
|
|
14061
|
+
* @param dataString
|
|
14062
|
+
*/
|
|
14063
|
+
BrowserCrypto.prototype.sha256Digest = function (dataString) {
|
|
14064
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
14065
|
+
var data;
|
|
14066
|
+
return __generator$1(this, function (_a) {
|
|
14067
|
+
data = BrowserStringUtils.stringToUtf8Arr(dataString);
|
|
14068
|
+
// MSR Crypto wants object with name property, instead of string
|
|
14069
|
+
return [2 /*return*/, this.subtleCrypto.digest({ name: S256_HASH_ALG }, data)];
|
|
14070
|
+
});
|
|
14071
|
+
});
|
|
14072
|
+
};
|
|
14073
|
+
/**
|
|
14074
|
+
* Populates buffer with cryptographically random values.
|
|
14075
|
+
* @param dataBuffer
|
|
14076
|
+
*/
|
|
14077
|
+
BrowserCrypto.prototype.getRandomValues = function (dataBuffer) {
|
|
14078
|
+
return this.subtleCrypto.getRandomValues(dataBuffer);
|
|
14079
|
+
};
|
|
14080
|
+
/**
|
|
14081
|
+
* Generates a keypair based on current keygen algorithm config.
|
|
14082
|
+
* @param extractable
|
|
14083
|
+
* @param usages
|
|
14084
|
+
*/
|
|
14085
|
+
BrowserCrypto.prototype.generateKeyPair = function (extractable, usages) {
|
|
14086
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
14087
|
+
return __generator$1(this, function (_a) {
|
|
14088
|
+
return [2 /*return*/, this.subtleCrypto.generateKey(this.keygenAlgorithmOptions, extractable, usages)];
|
|
14089
|
+
});
|
|
14090
|
+
});
|
|
14091
|
+
};
|
|
14092
|
+
/**
|
|
14093
|
+
* Export key as Json Web Key (JWK)
|
|
14094
|
+
* @param key
|
|
14095
|
+
* @param format
|
|
14096
|
+
*/
|
|
14097
|
+
BrowserCrypto.prototype.exportJwk = function (key) {
|
|
14098
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
14099
|
+
return __generator$1(this, function (_a) {
|
|
14100
|
+
return [2 /*return*/, this.subtleCrypto.exportKey(key)];
|
|
14101
|
+
});
|
|
14102
|
+
});
|
|
14103
|
+
};
|
|
14104
|
+
/**
|
|
14105
|
+
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
14106
|
+
* @param key
|
|
14107
|
+
* @param format
|
|
14108
|
+
* @param extractable
|
|
14109
|
+
* @param usages
|
|
14110
|
+
*/
|
|
14111
|
+
BrowserCrypto.prototype.importJwk = function (key, extractable, usages) {
|
|
14112
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
14113
|
+
return __generator$1(this, function (_a) {
|
|
14114
|
+
return [2 /*return*/, this.subtleCrypto.importKey(key, this.keygenAlgorithmOptions, extractable, usages)];
|
|
14115
|
+
});
|
|
14116
|
+
});
|
|
14117
|
+
};
|
|
14118
|
+
/**
|
|
14119
|
+
* Signs given data with given key
|
|
14120
|
+
* @param key
|
|
14121
|
+
* @param data
|
|
14122
|
+
*/
|
|
14123
|
+
BrowserCrypto.prototype.sign = function (key, data) {
|
|
14124
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
14125
|
+
return __generator$1(this, function (_a) {
|
|
14126
|
+
return [2 /*return*/, this.subtleCrypto.sign(this.keygenAlgorithmOptions, key, data)];
|
|
14127
|
+
});
|
|
14128
|
+
});
|
|
13869
14129
|
};
|
|
13870
14130
|
return BrowserCrypto;
|
|
13871
14131
|
}());
|
|
@@ -14107,29 +14367,17 @@ var DatabaseStorage = /** @class */ (function () {
|
|
|
14107
14367
|
*/
|
|
14108
14368
|
DatabaseStorage.prototype.deleteDatabase = function () {
|
|
14109
14369
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
14110
|
-
var existingDatabases, database;
|
|
14111
14370
|
return __generator$1(this, function (_a) {
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
if (this.db && this.dbOpen) {
|
|
14116
|
-
this.closeConnection();
|
|
14117
|
-
}
|
|
14118
|
-
return [4 /*yield*/, window.indexedDB.databases()];
|
|
14119
|
-
case 1:
|
|
14120
|
-
existingDatabases = _a.sent();
|
|
14121
|
-
database = existingDatabases.find(function (database) { return database.name === DB_NAME; });
|
|
14122
|
-
// If database exists, delete it
|
|
14123
|
-
if (database) {
|
|
14124
|
-
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
14125
|
-
var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
|
|
14126
|
-
deleteDbRequest.addEventListener("success", function () { return resolve(true); });
|
|
14127
|
-
deleteDbRequest.addEventListener("error", function () { return reject(false); });
|
|
14128
|
-
})];
|
|
14129
|
-
}
|
|
14130
|
-
// Database doesn't exist, return true
|
|
14131
|
-
return [2 /*return*/, true];
|
|
14371
|
+
// Check if database being deleted exists
|
|
14372
|
+
if (this.db && this.dbOpen) {
|
|
14373
|
+
this.closeConnection();
|
|
14132
14374
|
}
|
|
14375
|
+
return [2 /*return*/, new Promise(function (resolve, reject) {
|
|
14376
|
+
var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
|
|
14377
|
+
deleteDbRequest.addEventListener("success", function () { return resolve(true); });
|
|
14378
|
+
deleteDbRequest.addEventListener("blocked", function () { return resolve(true); });
|
|
14379
|
+
deleteDbRequest.addEventListener("error", function () { return reject(false); });
|
|
14380
|
+
})];
|
|
14133
14381
|
});
|
|
14134
14382
|
});
|
|
14135
14383
|
};
|
|
@@ -14298,34 +14546,38 @@ var AsyncMemoryStorage = /** @class */ (function () {
|
|
|
14298
14546
|
});
|
|
14299
14547
|
};
|
|
14300
14548
|
/**
|
|
14301
|
-
* Clears in-memory Map
|
|
14549
|
+
* Clears in-memory Map
|
|
14550
|
+
*/
|
|
14551
|
+
AsyncMemoryStorage.prototype.clearInMemory = function () {
|
|
14552
|
+
// InMemory cache is a Map instance, clear is straightforward
|
|
14553
|
+
this.logger.verbose("Deleting in-memory keystore " + this.storeName);
|
|
14554
|
+
this.inMemoryCache.clear();
|
|
14555
|
+
this.logger.verbose("In-memory keystore " + this.storeName + " deleted");
|
|
14556
|
+
};
|
|
14557
|
+
/**
|
|
14558
|
+
* Tries to delete the IndexedDB database
|
|
14559
|
+
* @returns
|
|
14302
14560
|
*/
|
|
14303
|
-
AsyncMemoryStorage.prototype.
|
|
14561
|
+
AsyncMemoryStorage.prototype.clearPersistent = function () {
|
|
14304
14562
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
14305
14563
|
var dbDeleted, e_6;
|
|
14306
14564
|
return __generator$1(this, function (_a) {
|
|
14307
14565
|
switch (_a.label) {
|
|
14308
14566
|
case 0:
|
|
14309
|
-
|
|
14310
|
-
this.logger.verbose("Deleting
|
|
14311
|
-
this.inMemoryCache.clear();
|
|
14312
|
-
this.logger.verbose("In-memory keystore " + this.storeName + " deleted");
|
|
14313
|
-
this.logger.verbose("Deleting persistent keystore " + this.storeName);
|
|
14314
|
-
_a.label = 1;
|
|
14315
|
-
case 1:
|
|
14316
|
-
_a.trys.push([1, 3, , 4]);
|
|
14567
|
+
_a.trys.push([0, 2, , 3]);
|
|
14568
|
+
this.logger.verbose("Deleting persistent keystore");
|
|
14317
14569
|
return [4 /*yield*/, this.indexedDBCache.deleteDatabase()];
|
|
14318
|
-
case
|
|
14570
|
+
case 1:
|
|
14319
14571
|
dbDeleted = _a.sent();
|
|
14320
14572
|
if (dbDeleted) {
|
|
14321
|
-
this.logger.verbose("Persistent keystore
|
|
14573
|
+
this.logger.verbose("Persistent keystore deleted");
|
|
14322
14574
|
}
|
|
14323
14575
|
return [2 /*return*/, dbDeleted];
|
|
14324
|
-
case
|
|
14576
|
+
case 2:
|
|
14325
14577
|
e_6 = _a.sent();
|
|
14326
14578
|
this.handleDatabaseAccessError(e_6);
|
|
14327
14579
|
return [2 /*return*/, false];
|
|
14328
|
-
case
|
|
14580
|
+
case 3: return [2 /*return*/];
|
|
14329
14581
|
}
|
|
14330
14582
|
});
|
|
14331
14583
|
});
|
|
@@ -14342,23 +14594,66 @@ var CryptoKeyStoreNames;
|
|
|
14342
14594
|
CryptoKeyStoreNames["asymmetricKeys"] = "asymmetricKeys";
|
|
14343
14595
|
CryptoKeyStoreNames["symmetricKeys"] = "symmetricKeys";
|
|
14344
14596
|
})(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));
|
|
14597
|
+
/**
|
|
14598
|
+
* MSAL CryptoKeyStore DB Version 2
|
|
14599
|
+
*/
|
|
14600
|
+
var CryptoKeyStore = /** @class */ (function () {
|
|
14601
|
+
function CryptoKeyStore(logger) {
|
|
14602
|
+
this.logger = logger;
|
|
14603
|
+
this.asymmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys);
|
|
14604
|
+
this.symmetricKeys = new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys);
|
|
14605
|
+
}
|
|
14606
|
+
CryptoKeyStore.prototype.clear = function () {
|
|
14607
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
14608
|
+
var e_1;
|
|
14609
|
+
return __generator$1(this, function (_a) {
|
|
14610
|
+
switch (_a.label) {
|
|
14611
|
+
case 0:
|
|
14612
|
+
// Delete in-memory keystores
|
|
14613
|
+
this.asymmetricKeys.clearInMemory();
|
|
14614
|
+
this.symmetricKeys.clearInMemory();
|
|
14615
|
+
_a.label = 1;
|
|
14616
|
+
case 1:
|
|
14617
|
+
_a.trys.push([1, 3, , 4]);
|
|
14618
|
+
return [4 /*yield*/, this.asymmetricKeys.clearPersistent()];
|
|
14619
|
+
case 2:
|
|
14620
|
+
_a.sent();
|
|
14621
|
+
return [2 /*return*/, true];
|
|
14622
|
+
case 3:
|
|
14623
|
+
e_1 = _a.sent();
|
|
14624
|
+
if (e_1 instanceof Error) {
|
|
14625
|
+
this.logger.error("Clearing keystore failed with error: " + e_1.message);
|
|
14626
|
+
}
|
|
14627
|
+
else {
|
|
14628
|
+
this.logger.error("Clearing keystore failed with unknown error");
|
|
14629
|
+
}
|
|
14630
|
+
return [2 /*return*/, false];
|
|
14631
|
+
case 4: return [2 /*return*/];
|
|
14632
|
+
}
|
|
14633
|
+
});
|
|
14634
|
+
});
|
|
14635
|
+
};
|
|
14636
|
+
return CryptoKeyStore;
|
|
14637
|
+
}());
|
|
14638
|
+
|
|
14639
|
+
/*
|
|
14640
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14641
|
+
* Licensed under the MIT License.
|
|
14642
|
+
*/
|
|
14345
14643
|
/**
|
|
14346
14644
|
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
14347
14645
|
* implementing Proof Key for Code Exchange specs for the OAuth Authorization Code Flow using PKCE (rfc here: https://tools.ietf.org/html/rfc7636).
|
|
14348
14646
|
*/
|
|
14349
14647
|
var CryptoOps = /** @class */ (function () {
|
|
14350
|
-
function CryptoOps(logger, performanceClient) {
|
|
14648
|
+
function CryptoOps(logger, performanceClient, cryptoConfig) {
|
|
14351
14649
|
this.logger = logger;
|
|
14352
14650
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
14353
|
-
this.browserCrypto = new BrowserCrypto(this.logger);
|
|
14651
|
+
this.browserCrypto = new BrowserCrypto(this.logger, cryptoConfig);
|
|
14354
14652
|
this.b64Encode = new Base64Encode();
|
|
14355
14653
|
this.b64Decode = new Base64Decode();
|
|
14356
14654
|
this.guidGenerator = new GuidGenerator(this.browserCrypto);
|
|
14357
14655
|
this.pkceGenerator = new PkceGenerator(this.browserCrypto);
|
|
14358
|
-
this.cache =
|
|
14359
|
-
asymmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys),
|
|
14360
|
-
symmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys)
|
|
14361
|
-
};
|
|
14656
|
+
this.cache = new CryptoKeyStore(this.logger);
|
|
14362
14657
|
this.performanceClient = performanceClient;
|
|
14363
14658
|
}
|
|
14364
14659
|
/**
|
|
@@ -14415,7 +14710,7 @@ var CryptoOps = /** @class */ (function () {
|
|
|
14415
14710
|
kty: publicKeyJwk.kty,
|
|
14416
14711
|
n: publicKeyJwk.n
|
|
14417
14712
|
};
|
|
14418
|
-
publicJwkString =
|
|
14713
|
+
publicJwkString = BrowserStringUtils.getSortedObjectString(pubKeyThumprintObj);
|
|
14419
14714
|
return [4 /*yield*/, this.hashString(publicJwkString)];
|
|
14420
14715
|
case 3:
|
|
14421
14716
|
publicJwkHash = _b.sent();
|
|
@@ -14470,32 +14765,10 @@ var CryptoOps = /** @class */ (function () {
|
|
|
14470
14765
|
*/
|
|
14471
14766
|
CryptoOps.prototype.clearKeystore = function () {
|
|
14472
14767
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
14473
|
-
var e_1;
|
|
14474
14768
|
return __generator$1(this, function (_a) {
|
|
14475
14769
|
switch (_a.label) {
|
|
14476
|
-
case 0:
|
|
14477
|
-
|
|
14478
|
-
this.logger.verbose("Deleting in-memory and persistent asymmetric key stores");
|
|
14479
|
-
return [4 /*yield*/, this.cache.asymmetricKeys.clear()];
|
|
14480
|
-
case 1:
|
|
14481
|
-
_a.sent();
|
|
14482
|
-
this.logger.verbose("Successfully deleted asymmetric key stores");
|
|
14483
|
-
this.logger.verbose("Deleting in-memory and persistent symmetric key stores");
|
|
14484
|
-
return [4 /*yield*/, this.cache.symmetricKeys.clear()];
|
|
14485
|
-
case 2:
|
|
14486
|
-
_a.sent();
|
|
14487
|
-
this.logger.verbose("Successfully deleted symmetric key stores");
|
|
14488
|
-
return [2 /*return*/, true];
|
|
14489
|
-
case 3:
|
|
14490
|
-
e_1 = _a.sent();
|
|
14491
|
-
if (e_1 instanceof Error) {
|
|
14492
|
-
this.logger.error("Clearing keystore failed with error: " + e_1.message);
|
|
14493
|
-
}
|
|
14494
|
-
else {
|
|
14495
|
-
this.logger.error("Clearing keystore failed with unknown error");
|
|
14496
|
-
}
|
|
14497
|
-
return [2 /*return*/, false];
|
|
14498
|
-
case 4: return [2 /*return*/];
|
|
14770
|
+
case 0: return [4 /*yield*/, this.cache.clear()];
|
|
14771
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
14499
14772
|
}
|
|
14500
14773
|
});
|
|
14501
14774
|
});
|
|
@@ -14522,7 +14795,7 @@ var CryptoOps = /** @class */ (function () {
|
|
|
14522
14795
|
return [4 /*yield*/, this.browserCrypto.exportJwk(cachedKeyPair.publicKey)];
|
|
14523
14796
|
case 2:
|
|
14524
14797
|
publicKeyJwk = _b.sent();
|
|
14525
|
-
publicKeyJwkString =
|
|
14798
|
+
publicKeyJwkString = BrowserStringUtils.getSortedObjectString(publicKeyJwk);
|
|
14526
14799
|
encodedKeyIdThumbprint = this.b64Encode.urlEncode(JSON.stringify({ kid: kid }));
|
|
14527
14800
|
shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });
|
|
14528
14801
|
encodedShrHeader = this.b64Encode.urlEncode(shrHeader);
|
|
@@ -14843,9 +15116,9 @@ var BrowserPerformanceMeasurement = /** @class */ (function () {
|
|
|
14843
15116
|
*/
|
|
14844
15117
|
var BrowserPerformanceClient = /** @class */ (function (_super) {
|
|
14845
15118
|
__extends$1(BrowserPerformanceClient, _super);
|
|
14846
|
-
function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) {
|
|
15119
|
+
function BrowserPerformanceClient(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, cryptoOptions) {
|
|
14847
15120
|
var _this = _super.call(this, clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry) || this;
|
|
14848
|
-
_this.browserCrypto = new BrowserCrypto(_this.logger);
|
|
15121
|
+
_this.browserCrypto = new BrowserCrypto(_this.logger, cryptoOptions);
|
|
14849
15122
|
_this.guidGenerator = new GuidGenerator(_this.browserCrypto);
|
|
14850
15123
|
return _this;
|
|
14851
15124
|
}
|
|
@@ -14927,10 +15200,10 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14927
15200
|
this.hybridAuthCodeResponses = new Map();
|
|
14928
15201
|
// Initialize performance client
|
|
14929
15202
|
this.performanceClient = this.isBrowserEnvironment ?
|
|
14930
|
-
new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application) :
|
|
15203
|
+
new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application, this.config.system.cryptoOptions) :
|
|
14931
15204
|
new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);
|
|
14932
15205
|
// Initialize the crypto class.
|
|
14933
|
-
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger, this.performanceClient) : DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
15206
|
+
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger, this.performanceClient, this.config.system.cryptoOptions) : DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
14934
15207
|
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
|
|
14935
15208
|
// Initialize the browser storage class.
|
|
14936
15209
|
this.browserStorage = this.isBrowserEnvironment ?
|
|
@@ -15152,6 +15425,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15152
15425
|
isNativeBroker: true,
|
|
15153
15426
|
accessTokenSize: response.accessToken.length,
|
|
15154
15427
|
idTokenSize: response.idToken.length,
|
|
15428
|
+
requestId: response.requestId
|
|
15155
15429
|
});
|
|
15156
15430
|
atPopupMeasurement.flushMeasurement();
|
|
15157
15431
|
return response;
|
|
@@ -15189,6 +15463,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15189
15463
|
success: true,
|
|
15190
15464
|
accessTokenSize: result.accessToken.length,
|
|
15191
15465
|
idTokenSize: result.idToken.length,
|
|
15466
|
+
requestId: result.requestId
|
|
15192
15467
|
});
|
|
15193
15468
|
atPopupMeasurement.flushMeasurement();
|
|
15194
15469
|
return result;
|
|
@@ -15232,7 +15507,9 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15232
15507
|
var _this = this;
|
|
15233
15508
|
return __generator$1(this, function (_a) {
|
|
15234
15509
|
correlationId = this.getRequestCorrelationId(request);
|
|
15235
|
-
validRequest = __assign$1(__assign$1({}, request), {
|
|
15510
|
+
validRequest = __assign$1(__assign$1({}, request), {
|
|
15511
|
+
// will be PromptValue.NONE or PromptValue.NO_SESSION
|
|
15512
|
+
prompt: request.prompt, correlationId: correlationId });
|
|
15236
15513
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
15237
15514
|
ssoSilentMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.SsoSilent, correlationId);
|
|
15238
15515
|
this.logger.verbose("ssoSilent called", correlationId);
|
|
@@ -15258,7 +15535,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15258
15535
|
success: true,
|
|
15259
15536
|
isNativeBroker: response.fromNativeBroker,
|
|
15260
15537
|
accessTokenSize: response.accessToken.length,
|
|
15261
|
-
idTokenSize: response.idToken.length
|
|
15538
|
+
idTokenSize: response.idToken.length,
|
|
15539
|
+
requestId: response.requestId
|
|
15262
15540
|
});
|
|
15263
15541
|
ssoSilentMeasurement.flushMeasurement();
|
|
15264
15542
|
return response;
|
|
@@ -15309,7 +15587,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15309
15587
|
success: true,
|
|
15310
15588
|
accessTokenSize: result.accessToken.length,
|
|
15311
15589
|
idTokenSize: result.idToken.length,
|
|
15312
|
-
isNativeBroker: result.fromNativeBroker
|
|
15590
|
+
isNativeBroker: result.fromNativeBroker,
|
|
15591
|
+
requestId: result.requestId
|
|
15313
15592
|
});
|
|
15314
15593
|
atbcMeasurement.flushMeasurement();
|
|
15315
15594
|
return result;
|
|
@@ -15389,67 +15668,62 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15389
15668
|
});
|
|
15390
15669
|
};
|
|
15391
15670
|
/**
|
|
15392
|
-
*
|
|
15393
|
-
*
|
|
15394
|
-
*
|
|
15395
|
-
*
|
|
15396
|
-
*
|
|
15397
|
-
* @param {@link SilentRequest}
|
|
15398
|
-
*
|
|
15399
|
-
* To renew idToken, please pass clientId as the only scope in the Authentication Parameters
|
|
15400
|
-
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
|
15671
|
+
* Attempt to acquire an access token from the cache
|
|
15672
|
+
* @param silentCacheClient SilentCacheClient
|
|
15673
|
+
* @param commonRequest CommonSilentFlowRequest
|
|
15674
|
+
* @param silentRequest SilentRequest
|
|
15675
|
+
* @returns A promise that, when resolved, returns the access token
|
|
15401
15676
|
*/
|
|
15402
|
-
ClientApplication.prototype.
|
|
15677
|
+
ClientApplication.prototype.acquireTokenFromCache = function (silentCacheClient, commonRequest, silentRequest) {
|
|
15403
15678
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15404
|
-
var atbrtMeasurement, silentRefreshClient;
|
|
15405
|
-
var _this = this;
|
|
15406
15679
|
return __generator$1(this, function (_a) {
|
|
15407
|
-
|
|
15408
|
-
|
|
15409
|
-
|
|
15410
|
-
|
|
15411
|
-
|
|
15412
|
-
|
|
15413
|
-
.
|
|
15414
|
-
|
|
15415
|
-
|
|
15416
|
-
|
|
15417
|
-
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15423
|
-
|
|
15424
|
-
|
|
15425
|
-
|
|
15426
|
-
|
|
15427
|
-
|
|
15428
|
-
|
|
15429
|
-
|
|
15430
|
-
|
|
15431
|
-
|
|
15432
|
-
|
|
15433
|
-
|
|
15434
|
-
|
|
15435
|
-
|
|
15436
|
-
|
|
15437
|
-
|
|
15438
|
-
|
|
15439
|
-
|
|
15440
|
-
|
|
15441
|
-
|
|
15442
|
-
|
|
15443
|
-
|
|
15444
|
-
|
|
15445
|
-
|
|
15446
|
-
|
|
15447
|
-
|
|
15448
|
-
|
|
15449
|
-
|
|
15450
|
-
|
|
15451
|
-
|
|
15452
|
-
|
|
15680
|
+
switch (silentRequest.cacheLookupPolicy) {
|
|
15681
|
+
case exports.CacheLookupPolicy.Default:
|
|
15682
|
+
case exports.CacheLookupPolicy.AccessToken:
|
|
15683
|
+
case exports.CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
15684
|
+
return [2 /*return*/, silentCacheClient.acquireToken(commonRequest)];
|
|
15685
|
+
default:
|
|
15686
|
+
throw ClientAuthError.createRefreshRequiredError();
|
|
15687
|
+
}
|
|
15688
|
+
return [2 /*return*/];
|
|
15689
|
+
});
|
|
15690
|
+
});
|
|
15691
|
+
};
|
|
15692
|
+
/**
|
|
15693
|
+
* Attempt to acquire an access token via a refresh token
|
|
15694
|
+
* @param commonRequest CommonSilentFlowRequest
|
|
15695
|
+
* @param silentRequest SilentRequest
|
|
15696
|
+
* @returns A promise that, when resolved, returns the access token
|
|
15697
|
+
*/
|
|
15698
|
+
ClientApplication.prototype.acquireTokenByRefreshToken = function (commonRequest, silentRequest) {
|
|
15699
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15700
|
+
var silentRefreshClient;
|
|
15701
|
+
return __generator$1(this, function (_a) {
|
|
15702
|
+
switch (silentRequest.cacheLookupPolicy) {
|
|
15703
|
+
case exports.CacheLookupPolicy.Default:
|
|
15704
|
+
case exports.CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
15705
|
+
case exports.CacheLookupPolicy.RefreshToken:
|
|
15706
|
+
case exports.CacheLookupPolicy.RefreshTokenAndNetwork:
|
|
15707
|
+
silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);
|
|
15708
|
+
return [2 /*return*/, silentRefreshClient.acquireToken(commonRequest)];
|
|
15709
|
+
default:
|
|
15710
|
+
throw ClientAuthError.createRefreshRequiredError();
|
|
15711
|
+
}
|
|
15712
|
+
return [2 /*return*/];
|
|
15713
|
+
});
|
|
15714
|
+
});
|
|
15715
|
+
};
|
|
15716
|
+
/**
|
|
15717
|
+
* Attempt to acquire an access token via an iframe
|
|
15718
|
+
* @param request CommonSilentFlowRequest
|
|
15719
|
+
* @returns A promise that, when resolved, returns the access token
|
|
15720
|
+
*/
|
|
15721
|
+
ClientApplication.prototype.acquireTokenBySilentIframe = function (request) {
|
|
15722
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
15723
|
+
var silentIframeClient;
|
|
15724
|
+
return __generator$1(this, function (_a) {
|
|
15725
|
+
silentIframeClient = this.createSilentIframeClient(request.correlationId);
|
|
15726
|
+
return [2 /*return*/, silentIframeClient.acquireToken(request)];
|
|
15453
15727
|
});
|
|
15454
15728
|
});
|
|
15455
15729
|
};
|
|
@@ -15943,7 +16217,9 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
15943
16217
|
fromCache: result.fromCache,
|
|
15944
16218
|
accessTokenSize: result.accessToken.length,
|
|
15945
16219
|
idTokenSize: result.idToken.length,
|
|
15946
|
-
isNativeBroker: result.fromNativeBroker
|
|
16220
|
+
isNativeBroker: result.fromNativeBroker,
|
|
16221
|
+
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
16222
|
+
requestId: result.requestId
|
|
15947
16223
|
});
|
|
15948
16224
|
atsMeasurement.flushMeasurement();
|
|
15949
16225
|
return result;
|
|
@@ -15951,6 +16227,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
15951
16227
|
.catch(function (error) {
|
|
15952
16228
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
15953
16229
|
atsMeasurement.endMeasurement({
|
|
16230
|
+
errorCode: error.errorCode,
|
|
16231
|
+
subErrorCode: error.subError,
|
|
15954
16232
|
success: false
|
|
15955
16233
|
});
|
|
15956
16234
|
atsMeasurement.flushMeasurement();
|
|
@@ -15979,7 +16257,7 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
15979
16257
|
*/
|
|
15980
16258
|
PublicClientApplication.prototype.acquireTokenSilentAsync = function (request, account) {
|
|
15981
16259
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
15982
|
-
var astsAsyncMeasurement, result, silentRequest, silentCacheClient, silentRequest_1;
|
|
16260
|
+
var astsAsyncMeasurement, result, silentRequest, silentCacheClient, silentRequest_1, requestWithCLP_1;
|
|
15983
16261
|
var _this = this;
|
|
15984
16262
|
return __generator$1(this, function (_a) {
|
|
15985
16263
|
switch (_a.label) {
|
|
@@ -16009,11 +16287,32 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16009
16287
|
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
|
|
16010
16288
|
case 2:
|
|
16011
16289
|
silentRequest_1 = _a.sent();
|
|
16012
|
-
|
|
16013
|
-
|
|
16014
|
-
|
|
16290
|
+
requestWithCLP_1 = __assign$1(__assign$1({}, request), {
|
|
16291
|
+
// set the request's CacheLookupPolicy to Default if it was not optionally passed in
|
|
16292
|
+
cacheLookupPolicy: request.cacheLookupPolicy || exports.CacheLookupPolicy.Default });
|
|
16293
|
+
result = this.acquireTokenFromCache(silentCacheClient, silentRequest_1, requestWithCLP_1).catch(function (cacheError) {
|
|
16294
|
+
if (requestWithCLP_1.cacheLookupPolicy === exports.CacheLookupPolicy.AccessToken) {
|
|
16295
|
+
throw cacheError;
|
|
16296
|
+
}
|
|
16297
|
+
// block the reload if it occurred inside a hidden iframe
|
|
16298
|
+
BrowserUtils.blockReloadInHiddenIframes();
|
|
16299
|
+
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_NETWORK_START, exports.InteractionType.Silent, silentRequest_1);
|
|
16300
|
+
return _this.acquireTokenByRefreshToken(silentRequest_1, requestWithCLP_1).catch(function (refreshTokenError) {
|
|
16301
|
+
var isServerError = refreshTokenError instanceof ServerError;
|
|
16302
|
+
var isInteractionRequiredError = refreshTokenError instanceof InteractionRequiredAuthError;
|
|
16303
|
+
var isInvalidGrantError = (refreshTokenError.errorCode === BrowserConstants.INVALID_GRANT_ERROR);
|
|
16304
|
+
if ((!isServerError ||
|
|
16305
|
+
!isInvalidGrantError ||
|
|
16306
|
+
isInteractionRequiredError ||
|
|
16307
|
+
requestWithCLP_1.cacheLookupPolicy === exports.CacheLookupPolicy.AccessTokenAndRefreshToken ||
|
|
16308
|
+
requestWithCLP_1.cacheLookupPolicy === exports.CacheLookupPolicy.RefreshToken)
|
|
16309
|
+
&& (requestWithCLP_1.cacheLookupPolicy !== exports.CacheLookupPolicy.Skip)) {
|
|
16310
|
+
throw refreshTokenError;
|
|
16311
|
+
}
|
|
16312
|
+
_this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", request.correlationId);
|
|
16313
|
+
return _this.acquireTokenBySilentIframe(silentRequest_1);
|
|
16015
16314
|
});
|
|
16016
|
-
});
|
|
16315
|
+
});
|
|
16017
16316
|
_a.label = 3;
|
|
16018
16317
|
case 3: return [2 /*return*/, result.then(function (response) {
|
|
16019
16318
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
@@ -16022,7 +16321,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
16022
16321
|
fromCache: response.fromCache,
|
|
16023
16322
|
accessTokenSize: response.accessToken.length,
|
|
16024
16323
|
idTokenSize: response.idToken.length,
|
|
16025
|
-
isNativeBroker: response.fromNativeBroker
|
|
16324
|
+
isNativeBroker: response.fromNativeBroker,
|
|
16325
|
+
requestId: response.requestId
|
|
16026
16326
|
});
|
|
16027
16327
|
return response;
|
|
16028
16328
|
}).catch(function (tokenRenewalError) {
|