@azure/msal-browser 2.33.0 → 2.34.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.map +1 -1
- package/dist/app/ClientApplication.js +15 -18
- 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 +1 -6
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +10 -7
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +18 -8
- package/dist/broker/nativeBroker/NativeMessageHandler.js.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.js +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/CryptoKeyStore.js +1 -1
- package/dist/cache/DatabaseStorage.js +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.js +1 -1
- package/dist/config/Configuration.js +1 -1
- package/dist/crypto/BrowserCrypto.js +1 -1
- package/dist/crypto/CryptoOps.js +1 -1
- package/dist/crypto/GuidGenerator.js +1 -1
- package/dist/crypto/ModernBrowserCrypto.js +1 -1
- package/dist/crypto/MsBrowserCrypto.js +1 -1
- package/dist/crypto/MsrBrowserCrypto.js +1 -1
- package/dist/crypto/PkceGenerator.js +1 -1
- package/dist/crypto/SignedHttpRequest.js +1 -1
- package/dist/encode/Base64Decode.js +1 -1
- package/dist/encode/Base64Encode.js +1 -1
- package/dist/error/BrowserAuthError.d.ts +8 -0
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.js +11 -1
- package/dist/error/BrowserAuthError.js.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +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 +475 -355
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +66 -3
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +174 -68
- 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.js +1 -1
- package/dist/interaction_client/SilentIframeClient.js +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +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.d.ts +3 -0
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +2 -1
- package/dist/internals.js.map +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.js +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.d.ts +5 -3
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +37 -16
- package/dist/telemetry/BrowserPerformanceClient.js.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +14 -5
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +36 -4
- package/dist/telemetry/BrowserPerformanceMeasurement.js.map +1 -1
- package/dist/utils/BrowserConstants.js +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.js +475 -355
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +33 -33
- package/package.json +2 -2
package/lib/msal-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.34.0 2023-03-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
return ar;
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
/*! @azure/msal-common
|
|
122
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
123
123
|
/*! *****************************************************************************
|
|
124
124
|
Copyright (c) Microsoft Corporation.
|
|
125
125
|
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
return r;
|
|
207
207
|
}
|
|
208
208
|
|
|
209
|
-
/*! @azure/msal-common
|
|
209
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
210
210
|
|
|
211
211
|
/*
|
|
212
212
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -588,9 +588,10 @@
|
|
|
588
588
|
(function (JsonTypes) {
|
|
589
589
|
JsonTypes["Jwt"] = "JWT";
|
|
590
590
|
JsonTypes["Jwk"] = "JWK";
|
|
591
|
+
JsonTypes["Pop"] = "pop";
|
|
591
592
|
})(JsonTypes || (JsonTypes = {}));
|
|
592
593
|
|
|
593
|
-
/*! @azure/msal-common
|
|
594
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
594
595
|
|
|
595
596
|
/*
|
|
596
597
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -646,7 +647,7 @@
|
|
|
646
647
|
return AuthError;
|
|
647
648
|
}(Error));
|
|
648
649
|
|
|
649
|
-
/*! @azure/msal-common
|
|
650
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
650
651
|
|
|
651
652
|
/*
|
|
652
653
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -721,7 +722,7 @@
|
|
|
721
722
|
}
|
|
722
723
|
};
|
|
723
724
|
|
|
724
|
-
/*! @azure/msal-common
|
|
725
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
725
726
|
|
|
726
727
|
/*
|
|
727
728
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -925,6 +926,14 @@
|
|
|
925
926
|
keyIdMissing: {
|
|
926
927
|
code: "key_id_missing",
|
|
927
928
|
desc: "A keyId value is missing from the requested bound token's cache record and is required to match the token to it's stored binding key."
|
|
929
|
+
},
|
|
930
|
+
noNetworkConnectivity: {
|
|
931
|
+
code: "no_network_connectivity",
|
|
932
|
+
desc: "No network connectivity. Check your internet connection."
|
|
933
|
+
},
|
|
934
|
+
userCanceledError: {
|
|
935
|
+
code: "user_canceled",
|
|
936
|
+
desc: "User canceled the flow."
|
|
928
937
|
}
|
|
929
938
|
};
|
|
930
939
|
/**
|
|
@@ -1213,10 +1222,22 @@
|
|
|
1213
1222
|
ClientAuthError.createKeyIdMissingError = function () {
|
|
1214
1223
|
return new ClientAuthError(ClientAuthErrorMessage.keyIdMissing.code, ClientAuthErrorMessage.keyIdMissing.desc);
|
|
1215
1224
|
};
|
|
1225
|
+
/**
|
|
1226
|
+
* Create an error when the client does not have network connectivity
|
|
1227
|
+
*/
|
|
1228
|
+
ClientAuthError.createNoNetworkConnectivityError = function () {
|
|
1229
|
+
return new ClientAuthError(ClientAuthErrorMessage.noNetworkConnectivity.code, ClientAuthErrorMessage.noNetworkConnectivity.desc);
|
|
1230
|
+
};
|
|
1231
|
+
/**
|
|
1232
|
+
* Create an error when the user cancels the flow
|
|
1233
|
+
*/
|
|
1234
|
+
ClientAuthError.createUserCanceledError = function () {
|
|
1235
|
+
return new ClientAuthError(ClientAuthErrorMessage.userCanceledError.code, ClientAuthErrorMessage.userCanceledError.desc);
|
|
1236
|
+
};
|
|
1216
1237
|
return ClientAuthError;
|
|
1217
1238
|
}(AuthError));
|
|
1218
1239
|
|
|
1219
|
-
/*! @azure/msal-common
|
|
1240
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
1220
1241
|
|
|
1221
1242
|
/*
|
|
1222
1243
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1341,7 +1362,7 @@
|
|
|
1341
1362
|
return StringUtils;
|
|
1342
1363
|
}());
|
|
1343
1364
|
|
|
1344
|
-
/*! @azure/msal-common
|
|
1365
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
1345
1366
|
|
|
1346
1367
|
/*
|
|
1347
1368
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1531,12 +1552,12 @@
|
|
|
1531
1552
|
return Logger;
|
|
1532
1553
|
}());
|
|
1533
1554
|
|
|
1534
|
-
/*! @azure/msal-common
|
|
1555
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
1535
1556
|
/* eslint-disable header/header */
|
|
1536
1557
|
var name$1 = "@azure/msal-common";
|
|
1537
|
-
var version$1 = "
|
|
1558
|
+
var version$1 = "11.0.0";
|
|
1538
1559
|
|
|
1539
|
-
/*! @azure/msal-common
|
|
1560
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
1540
1561
|
/*
|
|
1541
1562
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1542
1563
|
* Licensed under the MIT License.
|
|
@@ -1557,7 +1578,7 @@
|
|
|
1557
1578
|
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1558
1579
|
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1559
1580
|
|
|
1560
|
-
/*! @azure/msal-common
|
|
1581
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
1561
1582
|
|
|
1562
1583
|
/*
|
|
1563
1584
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1725,13 +1746,16 @@
|
|
|
1725
1746
|
*/
|
|
1726
1747
|
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : Constants.EMPTY_STRING;
|
|
1727
1748
|
};
|
|
1728
|
-
|
|
1729
|
-
|
|
1749
|
+
/*
|
|
1750
|
+
* Match host names like "login.microsoftonline.com", "https://accounts.google.com:4000", https://localhost:5000,
|
|
1751
|
+
* "login.microsoftonline.com/common", "login.microsoftonline.com:4000/common", etc
|
|
1752
|
+
*/
|
|
1753
|
+
CredentialEntity.credentialDomainRegex = "(https?:\\/\\/)?((([\\w-]+\\.)*([\\w-]{1,63})(\\.(\\w{2,63})))|(localhost))(\\:[0-9]{4,5})?(\\/[\\w-]+)?";
|
|
1730
1754
|
return CredentialEntity;
|
|
1731
1755
|
}());
|
|
1732
1756
|
CredentialEntity._initRegex();
|
|
1733
1757
|
|
|
1734
|
-
/*! @azure/msal-common
|
|
1758
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
1735
1759
|
|
|
1736
1760
|
/*
|
|
1737
1761
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1986,7 +2010,7 @@
|
|
|
1986
2010
|
return ClientConfigurationError;
|
|
1987
2011
|
}(ClientAuthError));
|
|
1988
2012
|
|
|
1989
|
-
/*! @azure/msal-common
|
|
2013
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
1990
2014
|
|
|
1991
2015
|
/*
|
|
1992
2016
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2170,7 +2194,7 @@
|
|
|
2170
2194
|
return ScopeSet;
|
|
2171
2195
|
}());
|
|
2172
2196
|
|
|
2173
|
-
/*! @azure/msal-common
|
|
2197
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
2174
2198
|
|
|
2175
2199
|
/*
|
|
2176
2200
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2208,7 +2232,7 @@
|
|
|
2208
2232
|
};
|
|
2209
2233
|
}
|
|
2210
2234
|
|
|
2211
|
-
/*! @azure/msal-common
|
|
2235
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
2212
2236
|
/*
|
|
2213
2237
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2214
2238
|
* Licensed under the MIT License.
|
|
@@ -2223,7 +2247,7 @@
|
|
|
2223
2247
|
AuthorityType[AuthorityType["Dsts"] = 2] = "Dsts";
|
|
2224
2248
|
})(AuthorityType || (AuthorityType = {}));
|
|
2225
2249
|
|
|
2226
|
-
/*! @azure/msal-common
|
|
2250
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
2227
2251
|
|
|
2228
2252
|
/*
|
|
2229
2253
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2462,7 +2486,7 @@
|
|
|
2462
2486
|
return AccountEntity;
|
|
2463
2487
|
}());
|
|
2464
2488
|
|
|
2465
|
-
/*! @azure/msal-common
|
|
2489
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
2466
2490
|
|
|
2467
2491
|
/*
|
|
2468
2492
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2514,7 +2538,7 @@
|
|
|
2514
2538
|
return AuthToken;
|
|
2515
2539
|
}());
|
|
2516
2540
|
|
|
2517
|
-
/*! @azure/msal-common
|
|
2541
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
2518
2542
|
|
|
2519
2543
|
/*
|
|
2520
2544
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3017,7 +3041,7 @@
|
|
|
3017
3041
|
else if (accounts.length > 1) {
|
|
3018
3042
|
throw ClientAuthError.createMultipleMatchingAccountsInCacheError();
|
|
3019
3043
|
}
|
|
3020
|
-
return
|
|
3044
|
+
return accounts[0];
|
|
3021
3045
|
};
|
|
3022
3046
|
/**
|
|
3023
3047
|
* Retrieve IdTokenEntity from cache
|
|
@@ -3393,7 +3417,7 @@
|
|
|
3393
3417
|
return DefaultStorageClass;
|
|
3394
3418
|
}(CacheManager));
|
|
3395
3419
|
|
|
3396
|
-
/*! @azure/msal-common
|
|
3420
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
3397
3421
|
|
|
3398
3422
|
/*
|
|
3399
3423
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3486,7 +3510,7 @@
|
|
|
3486
3510
|
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
|
|
3487
3511
|
}
|
|
3488
3512
|
|
|
3489
|
-
/*! @azure/msal-common
|
|
3513
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
3490
3514
|
|
|
3491
3515
|
/*
|
|
3492
3516
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3506,7 +3530,7 @@
|
|
|
3506
3530
|
return ServerError;
|
|
3507
3531
|
}(AuthError));
|
|
3508
3532
|
|
|
3509
|
-
/*! @azure/msal-common
|
|
3533
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
3510
3534
|
|
|
3511
3535
|
/*
|
|
3512
3536
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3602,7 +3626,7 @@
|
|
|
3602
3626
|
return ThrottlingUtils;
|
|
3603
3627
|
}());
|
|
3604
3628
|
|
|
3605
|
-
/*! @azure/msal-common
|
|
3629
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
3606
3630
|
|
|
3607
3631
|
/*
|
|
3608
3632
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3651,7 +3675,7 @@
|
|
|
3651
3675
|
return NetworkManager;
|
|
3652
3676
|
}());
|
|
3653
3677
|
|
|
3654
|
-
/*! @azure/msal-common
|
|
3678
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
3655
3679
|
/*
|
|
3656
3680
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3657
3681
|
* Licensed under the MIT License.
|
|
@@ -3662,7 +3686,7 @@
|
|
|
3662
3686
|
CcsCredentialType["UPN"] = "UPN";
|
|
3663
3687
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3664
3688
|
|
|
3665
|
-
/*! @azure/msal-common
|
|
3689
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
3666
3690
|
|
|
3667
3691
|
/*
|
|
3668
3692
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3753,7 +3777,7 @@
|
|
|
3753
3777
|
return RequestValidator;
|
|
3754
3778
|
}());
|
|
3755
3779
|
|
|
3756
|
-
/*! @azure/msal-common
|
|
3780
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
3757
3781
|
|
|
3758
3782
|
/*
|
|
3759
3783
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4131,7 +4155,7 @@
|
|
|
4131
4155
|
return RequestParameterBuilder;
|
|
4132
4156
|
}());
|
|
4133
4157
|
|
|
4134
|
-
/*! @azure/msal-common
|
|
4158
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4135
4159
|
|
|
4136
4160
|
/*
|
|
4137
4161
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4233,7 +4257,7 @@
|
|
|
4233
4257
|
return BaseClient;
|
|
4234
4258
|
}());
|
|
4235
4259
|
|
|
4236
|
-
/*! @azure/msal-common
|
|
4260
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4237
4261
|
|
|
4238
4262
|
/*
|
|
4239
4263
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4297,7 +4321,7 @@
|
|
|
4297
4321
|
return IdTokenEntity;
|
|
4298
4322
|
}(CredentialEntity));
|
|
4299
4323
|
|
|
4300
|
-
/*! @azure/msal-common
|
|
4324
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4301
4325
|
/*
|
|
4302
4326
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4303
4327
|
* Licensed under the MIT License.
|
|
@@ -4347,7 +4371,7 @@
|
|
|
4347
4371
|
return TimeUtils;
|
|
4348
4372
|
}());
|
|
4349
4373
|
|
|
4350
|
-
/*! @azure/msal-common
|
|
4374
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4351
4375
|
|
|
4352
4376
|
/*
|
|
4353
4377
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4461,7 +4485,7 @@
|
|
|
4461
4485
|
return AccessTokenEntity;
|
|
4462
4486
|
}(CredentialEntity));
|
|
4463
4487
|
|
|
4464
|
-
/*! @azure/msal-common
|
|
4488
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4465
4489
|
|
|
4466
4490
|
/*
|
|
4467
4491
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4528,7 +4552,7 @@
|
|
|
4528
4552
|
return RefreshTokenEntity;
|
|
4529
4553
|
}(CredentialEntity));
|
|
4530
4554
|
|
|
4531
|
-
/*! @azure/msal-common
|
|
4555
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4532
4556
|
|
|
4533
4557
|
/*
|
|
4534
4558
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4607,7 +4631,7 @@
|
|
|
4607
4631
|
return InteractionRequiredAuthError;
|
|
4608
4632
|
}(AuthError));
|
|
4609
4633
|
|
|
4610
|
-
/*! @azure/msal-common
|
|
4634
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4611
4635
|
/*
|
|
4612
4636
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4613
4637
|
* Licensed under the MIT License.
|
|
@@ -4623,7 +4647,7 @@
|
|
|
4623
4647
|
return CacheRecord;
|
|
4624
4648
|
}());
|
|
4625
4649
|
|
|
4626
|
-
/*! @azure/msal-common
|
|
4650
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4627
4651
|
|
|
4628
4652
|
/*
|
|
4629
4653
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4694,7 +4718,7 @@
|
|
|
4694
4718
|
return ProtocolUtils;
|
|
4695
4719
|
}());
|
|
4696
4720
|
|
|
4697
|
-
/*! @azure/msal-common
|
|
4721
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4698
4722
|
|
|
4699
4723
|
/*
|
|
4700
4724
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4928,7 +4952,7 @@
|
|
|
4928
4952
|
return UrlString;
|
|
4929
4953
|
}());
|
|
4930
4954
|
|
|
4931
|
-
/*! @azure/msal-common
|
|
4955
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
4932
4956
|
/*
|
|
4933
4957
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4934
4958
|
* Licensed under the MIT License.
|
|
@@ -5065,6 +5089,7 @@
|
|
|
5065
5089
|
* Internal API for initializing silent request in SilentCacheClient (msal-browser)
|
|
5066
5090
|
*/
|
|
5067
5091
|
PerformanceEvents["InitializeSilentRequest"] = "initializeSilentRequest";
|
|
5092
|
+
PerformanceEvents["InitializeClientApplication"] = "initializeClientApplication";
|
|
5068
5093
|
/**
|
|
5069
5094
|
* Helper function in SilentIframeClient class (msal-browser).
|
|
5070
5095
|
*/
|
|
@@ -5130,6 +5155,7 @@
|
|
|
5130
5155
|
PerformanceEvents["HandleRedirectPromiseMeasurement"] = "handleRedirectPromiseMeasurement";
|
|
5131
5156
|
PerformanceEvents["UpdateCloudDiscoveryMetadataMeasurement"] = "updateCloudDiscoveryMetadataMeasurement";
|
|
5132
5157
|
PerformanceEvents["UsernamePasswordClientAcquireToken"] = "usernamePasswordClientAcquireToken";
|
|
5158
|
+
PerformanceEvents["NativeMessageHandlerHandshake"] = "nativeMessageHandlerHandshake";
|
|
5133
5159
|
})(exports.PerformanceEvents || (exports.PerformanceEvents = {}));
|
|
5134
5160
|
/**
|
|
5135
5161
|
* State of the performance event.
|
|
@@ -5155,7 +5181,7 @@
|
|
|
5155
5181
|
"status",
|
|
5156
5182
|
]);
|
|
5157
5183
|
|
|
5158
|
-
/*! @azure/msal-common
|
|
5184
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
5159
5185
|
|
|
5160
5186
|
/*
|
|
5161
5187
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5264,7 +5290,7 @@
|
|
|
5264
5290
|
return PopTokenGenerator;
|
|
5265
5291
|
}());
|
|
5266
5292
|
|
|
5267
|
-
/*! @azure/msal-common
|
|
5293
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
5268
5294
|
|
|
5269
5295
|
/*
|
|
5270
5296
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5334,7 +5360,7 @@
|
|
|
5334
5360
|
return AppMetadataEntity;
|
|
5335
5361
|
}());
|
|
5336
5362
|
|
|
5337
|
-
/*! @azure/msal-common
|
|
5363
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
5338
5364
|
/*
|
|
5339
5365
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5340
5366
|
* Licensed under the MIT License.
|
|
@@ -5370,7 +5396,7 @@
|
|
|
5370
5396
|
return TokenCacheContext;
|
|
5371
5397
|
}());
|
|
5372
5398
|
|
|
5373
|
-
/*! @azure/msal-common
|
|
5399
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
5374
5400
|
|
|
5375
5401
|
/*
|
|
5376
5402
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5502,7 +5528,7 @@
|
|
|
5502
5528
|
_b.sent();
|
|
5503
5529
|
_b.label = 7;
|
|
5504
5530
|
case 7: return [7 /*endfinally*/];
|
|
5505
|
-
case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse
|
|
5531
|
+
case 8: return [2 /*return*/, ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, idTokenObj, requestStateObj, serverTokenResponse, serverRequestId)];
|
|
5506
5532
|
}
|
|
5507
5533
|
});
|
|
5508
5534
|
});
|
|
@@ -5588,7 +5614,7 @@
|
|
|
5588
5614
|
* @param fromTokenCache
|
|
5589
5615
|
* @param stateString
|
|
5590
5616
|
*/
|
|
5591
|
-
ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState,
|
|
5617
|
+
ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, serverTokenResponse, requestId) {
|
|
5592
5618
|
var _a, _b, _c;
|
|
5593
5619
|
return __awaiter(this, void 0, void 0, function () {
|
|
5594
5620
|
var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, _d, secret, keyId, uid, tid;
|
|
@@ -5624,6 +5650,10 @@
|
|
|
5624
5650
|
}
|
|
5625
5651
|
uid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.oid) || (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.sub) || Constants.EMPTY_STRING;
|
|
5626
5652
|
tid = (idTokenObj === null || idTokenObj === void 0 ? void 0 : idTokenObj.claims.tid) || Constants.EMPTY_STRING;
|
|
5653
|
+
// for hybrid + native bridge enablement, send back the native account Id
|
|
5654
|
+
if ((serverTokenResponse === null || serverTokenResponse === void 0 ? void 0 : serverTokenResponse.spa_accountid) && !!cacheRecord.account) {
|
|
5655
|
+
cacheRecord.account.nativeAccountId = serverTokenResponse === null || serverTokenResponse === void 0 ? void 0 : serverTokenResponse.spa_accountid;
|
|
5656
|
+
}
|
|
5627
5657
|
return [2 /*return*/, {
|
|
5628
5658
|
authority: authority.canonicalAuthority,
|
|
5629
5659
|
uniqueId: uid,
|
|
@@ -5643,7 +5673,7 @@
|
|
|
5643
5673
|
state: requestState ? requestState.userRequestState : Constants.EMPTY_STRING,
|
|
5644
5674
|
cloudGraphHostName: ((_b = cacheRecord.account) === null || _b === void 0 ? void 0 : _b.cloudGraphHostName) || Constants.EMPTY_STRING,
|
|
5645
5675
|
msGraphHost: ((_c = cacheRecord.account) === null || _c === void 0 ? void 0 : _c.msGraphHost) || Constants.EMPTY_STRING,
|
|
5646
|
-
code:
|
|
5676
|
+
code: serverTokenResponse === null || serverTokenResponse === void 0 ? void 0 : serverTokenResponse.spa_code,
|
|
5647
5677
|
fromNativeBroker: false,
|
|
5648
5678
|
}];
|
|
5649
5679
|
}
|
|
@@ -5653,7 +5683,7 @@
|
|
|
5653
5683
|
return ResponseHandler;
|
|
5654
5684
|
}());
|
|
5655
5685
|
|
|
5656
|
-
/*! @azure/msal-common
|
|
5686
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
5657
5687
|
|
|
5658
5688
|
/*
|
|
5659
5689
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6131,7 +6161,7 @@
|
|
|
6131
6161
|
return AuthorizationCodeClient;
|
|
6132
6162
|
}(BaseClient));
|
|
6133
6163
|
|
|
6134
|
-
/*! @azure/msal-common
|
|
6164
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6135
6165
|
|
|
6136
6166
|
/*
|
|
6137
6167
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6405,7 +6435,7 @@
|
|
|
6405
6435
|
return RefreshTokenClient;
|
|
6406
6436
|
}(BaseClient));
|
|
6407
6437
|
|
|
6408
|
-
/*! @azure/msal-common
|
|
6438
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6409
6439
|
|
|
6410
6440
|
/*
|
|
6411
6441
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6529,7 +6559,7 @@
|
|
|
6529
6559
|
return SilentFlowClient;
|
|
6530
6560
|
}(BaseClient));
|
|
6531
6561
|
|
|
6532
|
-
/*! @azure/msal-common
|
|
6562
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6533
6563
|
/*
|
|
6534
6564
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6535
6565
|
* Licensed under the MIT License.
|
|
@@ -6541,7 +6571,7 @@
|
|
|
6541
6571
|
response.hasOwnProperty("jwks_uri"));
|
|
6542
6572
|
}
|
|
6543
6573
|
|
|
6544
|
-
/*! @azure/msal-common
|
|
6574
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6545
6575
|
/*
|
|
6546
6576
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6547
6577
|
* Licensed under the MIT License.
|
|
@@ -6550,7 +6580,7 @@
|
|
|
6550
6580
|
var EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
6551
6581
|
var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
6552
6582
|
|
|
6553
|
-
/*! @azure/msal-common
|
|
6583
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6554
6584
|
/*
|
|
6555
6585
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6556
6586
|
* Licensed under the MIT License.
|
|
@@ -6564,7 +6594,7 @@
|
|
|
6564
6594
|
ProtocolMode["OIDC"] = "OIDC";
|
|
6565
6595
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
6566
6596
|
|
|
6567
|
-
/*! @azure/msal-common
|
|
6597
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6568
6598
|
|
|
6569
6599
|
/*
|
|
6570
6600
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6641,7 +6671,7 @@
|
|
|
6641
6671
|
return AuthorityMetadataEntity;
|
|
6642
6672
|
}());
|
|
6643
6673
|
|
|
6644
|
-
/*! @azure/msal-common
|
|
6674
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6645
6675
|
/*
|
|
6646
6676
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6647
6677
|
* Licensed under the MIT License.
|
|
@@ -6651,7 +6681,7 @@
|
|
|
6651
6681
|
response.hasOwnProperty("metadata"));
|
|
6652
6682
|
}
|
|
6653
6683
|
|
|
6654
|
-
/*! @azure/msal-common
|
|
6684
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6655
6685
|
/*
|
|
6656
6686
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6657
6687
|
* Licensed under the MIT License.
|
|
@@ -6661,7 +6691,7 @@
|
|
|
6661
6691
|
response.hasOwnProperty("error_description"));
|
|
6662
6692
|
}
|
|
6663
6693
|
|
|
6664
|
-
/*! @azure/msal-common
|
|
6694
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6665
6695
|
|
|
6666
6696
|
/*
|
|
6667
6697
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6793,7 +6823,7 @@
|
|
|
6793
6823
|
return RegionDiscovery;
|
|
6794
6824
|
}());
|
|
6795
6825
|
|
|
6796
|
-
/*! @azure/msal-common
|
|
6826
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
6797
6827
|
|
|
6798
6828
|
/*
|
|
6799
6829
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7528,7 +7558,7 @@
|
|
|
7528
7558
|
return Authority;
|
|
7529
7559
|
}());
|
|
7530
7560
|
|
|
7531
|
-
/*! @azure/msal-common
|
|
7561
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7532
7562
|
|
|
7533
7563
|
/*
|
|
7534
7564
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7591,7 +7621,7 @@
|
|
|
7591
7621
|
return AuthorityFactory;
|
|
7592
7622
|
}());
|
|
7593
7623
|
|
|
7594
|
-
/*! @azure/msal-common
|
|
7624
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7595
7625
|
|
|
7596
7626
|
/*
|
|
7597
7627
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7622,7 +7652,7 @@
|
|
|
7622
7652
|
return ServerTelemetryEntity;
|
|
7623
7653
|
}());
|
|
7624
7654
|
|
|
7625
|
-
/*! @azure/msal-common
|
|
7655
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7626
7656
|
|
|
7627
7657
|
/*
|
|
7628
7658
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7650,7 +7680,7 @@
|
|
|
7650
7680
|
return ThrottlingEntity;
|
|
7651
7681
|
}());
|
|
7652
7682
|
|
|
7653
|
-
/*! @azure/msal-common
|
|
7683
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7654
7684
|
|
|
7655
7685
|
/*
|
|
7656
7686
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7667,7 +7697,7 @@
|
|
|
7667
7697
|
}
|
|
7668
7698
|
};
|
|
7669
7699
|
|
|
7670
|
-
/*! @azure/msal-common
|
|
7700
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7671
7701
|
|
|
7672
7702
|
/*
|
|
7673
7703
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7712,7 +7742,7 @@
|
|
|
7712
7742
|
return JoseHeaderError;
|
|
7713
7743
|
}(AuthError));
|
|
7714
7744
|
|
|
7715
|
-
/*! @azure/msal-common
|
|
7745
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7716
7746
|
|
|
7717
7747
|
/*
|
|
7718
7748
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7742,8 +7772,8 @@
|
|
|
7742
7772
|
throw JoseHeaderError.createMissingAlgError();
|
|
7743
7773
|
}
|
|
7744
7774
|
var shrHeader = new JoseHeader({
|
|
7745
|
-
// Access Token PoP headers must have type
|
|
7746
|
-
typ: shrHeaderOptions.typ || JsonTypes.
|
|
7775
|
+
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
|
|
7776
|
+
typ: shrHeaderOptions.typ || JsonTypes.Pop,
|
|
7747
7777
|
kid: shrHeaderOptions.kid,
|
|
7748
7778
|
alg: shrHeaderOptions.alg
|
|
7749
7779
|
});
|
|
@@ -7752,7 +7782,7 @@
|
|
|
7752
7782
|
return JoseHeader;
|
|
7753
7783
|
}());
|
|
7754
7784
|
|
|
7755
|
-
/*! @azure/msal-common
|
|
7785
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7756
7786
|
|
|
7757
7787
|
/*
|
|
7758
7788
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7811,7 +7841,7 @@
|
|
|
7811
7841
|
return AuthenticationHeaderParser;
|
|
7812
7842
|
}());
|
|
7813
7843
|
|
|
7814
|
-
/*! @azure/msal-common
|
|
7844
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7815
7845
|
|
|
7816
7846
|
/*
|
|
7817
7847
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7973,7 +8003,7 @@
|
|
|
7973
8003
|
return ServerTelemetryManager;
|
|
7974
8004
|
}());
|
|
7975
8005
|
|
|
7976
|
-
/*! @azure/msal-common
|
|
8006
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
7977
8007
|
|
|
7978
8008
|
/*
|
|
7979
8009
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8000,11 +8030,8 @@
|
|
|
8000
8030
|
this.logger = logger;
|
|
8001
8031
|
this.callbacks = new Map();
|
|
8002
8032
|
this.eventsByCorrelationId = new Map();
|
|
8003
|
-
this.staticFieldsByCorrelationId = new Map();
|
|
8004
|
-
this.measurementsById = new Map();
|
|
8005
8033
|
this.queueMeasurements = new Map();
|
|
8006
8034
|
this.preQueueTimeByCorrelationId = new Map();
|
|
8007
|
-
this.countersByCorrelationId = new Map();
|
|
8008
8035
|
}
|
|
8009
8036
|
/**
|
|
8010
8037
|
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
|
|
@@ -8045,16 +8072,16 @@
|
|
|
8045
8072
|
* @returns {number}
|
|
8046
8073
|
*/
|
|
8047
8074
|
PerformanceClient.prototype.getPreQueueTime = function (eventName, correlationId) {
|
|
8048
|
-
var
|
|
8049
|
-
if (!
|
|
8075
|
+
var preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
8076
|
+
if (!preQueueEvent) {
|
|
8050
8077
|
this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: " + correlationId + ", unable to add queue measurement");
|
|
8051
8078
|
return;
|
|
8052
8079
|
}
|
|
8053
|
-
else if (
|
|
8080
|
+
else if (preQueueEvent.name !== eventName) {
|
|
8054
8081
|
this.logger.trace("PerformanceClient.getPreQueueTime: no pre-queue time found for " + eventName + ", unable to add queue measurement");
|
|
8055
8082
|
return;
|
|
8056
8083
|
}
|
|
8057
|
-
return
|
|
8084
|
+
return preQueueEvent.time;
|
|
8058
8085
|
};
|
|
8059
8086
|
/**
|
|
8060
8087
|
* Calculates the difference between current time and time when function was queued.
|
|
@@ -8082,12 +8109,13 @@
|
|
|
8082
8109
|
/**
|
|
8083
8110
|
* Adds queue measurement time to QueueMeasurements array for given correlation ID.
|
|
8084
8111
|
*
|
|
8085
|
-
* @param {PerformanceEvents}
|
|
8112
|
+
* @param {PerformanceEvents} eventName
|
|
8086
8113
|
* @param {?string} correlationId
|
|
8087
|
-
* @param {?number}
|
|
8114
|
+
* @param {?number} queueTime
|
|
8115
|
+
* @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements
|
|
8088
8116
|
* @returns
|
|
8089
8117
|
*/
|
|
8090
|
-
PerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime) {
|
|
8118
|
+
PerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime, manuallyCompleted) {
|
|
8091
8119
|
if (!correlationId) {
|
|
8092
8120
|
this.logger.trace("PerformanceClient.addQueueMeasurement: correlationId not provided for " + eventName + ", cannot add queue measurement");
|
|
8093
8121
|
return;
|
|
@@ -8100,7 +8128,7 @@
|
|
|
8100
8128
|
this.logger.trace("PerformanceClient.addQueueMeasurement: no queue time provided for " + eventName);
|
|
8101
8129
|
return;
|
|
8102
8130
|
}
|
|
8103
|
-
var queueMeasurement = { eventName: eventName, queueTime: queueTime };
|
|
8131
|
+
var queueMeasurement = { eventName: eventName, queueTime: queueTime, manuallyCompleted: manuallyCompleted };
|
|
8104
8132
|
// Adds to existing correlation Id if present in queueMeasurements
|
|
8105
8133
|
var existingMeasurements = this.queueMeasurements.get(correlationId);
|
|
8106
8134
|
if (existingMeasurements) {
|
|
@@ -8113,6 +8141,8 @@
|
|
|
8113
8141
|
var measurementArray = [queueMeasurement];
|
|
8114
8142
|
this.queueMeasurements.set(correlationId, measurementArray);
|
|
8115
8143
|
}
|
|
8144
|
+
// Delete processed pre-queue event.
|
|
8145
|
+
this.preQueueTimeByCorrelationId.delete(correlationId);
|
|
8116
8146
|
};
|
|
8117
8147
|
/**
|
|
8118
8148
|
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
|
|
@@ -8131,17 +8161,8 @@
|
|
|
8131
8161
|
}
|
|
8132
8162
|
// Duplicate code to address spelling error will be removed at the next major version bump.
|
|
8133
8163
|
this.logger.trace("PerformanceClient: Performance measurement started for " + measureName, eventCorrelationId);
|
|
8134
|
-
var
|
|
8135
|
-
|
|
8136
|
-
if (performanceMeasuremeant.startMeasurement) {
|
|
8137
|
-
performanceMeasuremeant.startMeasurement();
|
|
8138
|
-
validMeasurement = performanceMeasuremeant;
|
|
8139
|
-
}
|
|
8140
|
-
else {
|
|
8141
|
-
var performanceMeasurement = this.startPerformanceMeasurement(measureName, eventCorrelationId);
|
|
8142
|
-
performanceMeasurement.startMeasurement();
|
|
8143
|
-
validMeasurement = performanceMeasurement;
|
|
8144
|
-
}
|
|
8164
|
+
var performanceMeasurement = this.startPerformanceMeasuremeant(measureName, eventCorrelationId);
|
|
8165
|
+
performanceMeasurement.startMeasurement();
|
|
8145
8166
|
var inProgressEvent = {
|
|
8146
8167
|
eventId: this.generateId(),
|
|
8147
8168
|
status: PerformanceEventStatus.InProgress,
|
|
@@ -8152,27 +8173,15 @@
|
|
|
8152
8173
|
name: measureName,
|
|
8153
8174
|
startTimeMs: Date.now(),
|
|
8154
8175
|
correlationId: eventCorrelationId,
|
|
8155
|
-
};
|
|
8156
|
-
// Store in progress events so they can be discarded if not ended properly
|
|
8157
|
-
this.cacheEventByCorrelationId(inProgressEvent);
|
|
8158
|
-
var staticFields = {
|
|
8159
8176
|
appName: (_a = this.applicationTelemetry) === null || _a === void 0 ? void 0 : _a.appName,
|
|
8160
8177
|
appVersion: (_b = this.applicationTelemetry) === null || _b === void 0 ? void 0 : _b.appVersion,
|
|
8161
8178
|
};
|
|
8162
|
-
|
|
8163
|
-
this.
|
|
8179
|
+
// Store in progress events so they can be discarded if not ended properly
|
|
8180
|
+
this.cacheEventByCorrelationId(inProgressEvent);
|
|
8164
8181
|
// Return the event and functions the caller can use to properly end/flush the measurement
|
|
8165
8182
|
return {
|
|
8166
8183
|
endMeasurement: function (event) {
|
|
8167
|
-
|
|
8168
|
-
if (completedEvent) {
|
|
8169
|
-
// Cache event so that submeasurements can be added downstream
|
|
8170
|
-
_this.cacheEventByCorrelationId(completedEvent);
|
|
8171
|
-
}
|
|
8172
|
-
return completedEvent;
|
|
8173
|
-
},
|
|
8174
|
-
flushMeasurement: function () {
|
|
8175
|
-
return _this.flushMeasurements(inProgressEvent.name, inProgressEvent.correlationId);
|
|
8184
|
+
return _this.endMeasurement(__assign(__assign({}, inProgressEvent), event), performanceMeasurement);
|
|
8176
8185
|
},
|
|
8177
8186
|
discardMeasurement: function () {
|
|
8178
8187
|
return _this.discardMeasurements(inProgressEvent.correlationId);
|
|
@@ -8183,40 +8192,66 @@
|
|
|
8183
8192
|
increment: function (counters) {
|
|
8184
8193
|
return _this.increment(counters, inProgressEvent.correlationId);
|
|
8185
8194
|
},
|
|
8186
|
-
measurement:
|
|
8195
|
+
measurement: performanceMeasurement,
|
|
8187
8196
|
event: inProgressEvent
|
|
8188
8197
|
};
|
|
8189
8198
|
};
|
|
8190
8199
|
/**
|
|
8191
8200
|
* Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,
|
|
8192
8201
|
* as consumers should instead use the function returned by startMeasurement.
|
|
8202
|
+
* Adds a new field named as "[event name]DurationMs" for sub-measurements, completes and emits an event
|
|
8203
|
+
* otherwise.
|
|
8193
8204
|
*
|
|
8194
8205
|
* @param {PerformanceEvent} event
|
|
8206
|
+
* @param {IPerformanceMeasurement} measurement
|
|
8195
8207
|
* @returns {(PerformanceEvent | null)}
|
|
8196
8208
|
*/
|
|
8197
|
-
PerformanceClient.prototype.endMeasurement = function (event) {
|
|
8198
|
-
var
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8202
|
-
|
|
8203
|
-
|
|
8204
|
-
|
|
8205
|
-
|
|
8206
|
-
|
|
8207
|
-
|
|
8208
|
-
|
|
8209
|
-
|
|
8210
|
-
|
|
8211
|
-
|
|
8212
|
-
|
|
8213
|
-
|
|
8214
|
-
}
|
|
8209
|
+
PerformanceClient.prototype.endMeasurement = function (event, measurement) {
|
|
8210
|
+
var _this = this;
|
|
8211
|
+
var _a, _b;
|
|
8212
|
+
var rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
8213
|
+
if (!rootEvent) {
|
|
8214
|
+
this.logger.trace("PerformanceClient: Measurement not found for " + event.eventId, event.correlationId);
|
|
8215
|
+
return null;
|
|
8216
|
+
}
|
|
8217
|
+
var isRoot = event.eventId === rootEvent.eventId;
|
|
8218
|
+
var queueInfo = {
|
|
8219
|
+
totalQueueTime: 0,
|
|
8220
|
+
totalQueueCount: 0,
|
|
8221
|
+
manuallyCompletedCount: 0
|
|
8222
|
+
};
|
|
8223
|
+
if (isRoot) {
|
|
8224
|
+
queueInfo = this.getQueueInfo(event.correlationId);
|
|
8225
|
+
this.discardCache(rootEvent.correlationId);
|
|
8215
8226
|
}
|
|
8216
8227
|
else {
|
|
8217
|
-
|
|
8228
|
+
(_a = rootEvent.incompleteSubMeasurements) === null || _a === void 0 ? void 0 : _a.delete(event.eventId);
|
|
8218
8229
|
}
|
|
8219
|
-
|
|
8230
|
+
measurement === null || measurement === void 0 ? void 0 : measurement.endMeasurement();
|
|
8231
|
+
var durationMs = measurement === null || measurement === void 0 ? void 0 : measurement.flushMeasurement();
|
|
8232
|
+
// null indicates no measurement was taken (e.g. needed performance APIs not present)
|
|
8233
|
+
if (!durationMs) {
|
|
8234
|
+
this.logger.trace("PerformanceClient: Performance measurement not taken", rootEvent.correlationId);
|
|
8235
|
+
return null;
|
|
8236
|
+
}
|
|
8237
|
+
this.logger.trace("PerformanceClient: Performance measurement ended for " + event.name + ": " + durationMs + " ms", event.correlationId);
|
|
8238
|
+
// Add sub-measurement attribute to root event.
|
|
8239
|
+
if (!isRoot) {
|
|
8240
|
+
rootEvent[event.name + "DurationMs"] = Math.floor(durationMs);
|
|
8241
|
+
return __assign({}, rootEvent);
|
|
8242
|
+
}
|
|
8243
|
+
var finalEvent = __assign(__assign({}, rootEvent), event);
|
|
8244
|
+
var incompleteSubsCount = 0;
|
|
8245
|
+
// Incomplete sub-measurements are discarded. They are likely an instrumentation bug that should be fixed.
|
|
8246
|
+
(_b = finalEvent.incompleteSubMeasurements) === null || _b === void 0 ? void 0 : _b.forEach(function (subMeasurement) {
|
|
8247
|
+
_this.logger.trace("PerformanceClient: Incomplete submeasurement " + subMeasurement.name + " found for " + event.name, finalEvent.correlationId);
|
|
8248
|
+
incompleteSubsCount++;
|
|
8249
|
+
});
|
|
8250
|
+
finalEvent.incompleteSubMeasurements = undefined;
|
|
8251
|
+
finalEvent = __assign(__assign({}, finalEvent), { durationMs: Math.round(durationMs), queuedTimeMs: queueInfo.totalQueueTime, queuedCount: queueInfo.totalQueueCount, queuedManuallyCompletedCount: queueInfo.manuallyCompletedCount, status: PerformanceEventStatus.Completed, incompleteSubsCount: incompleteSubsCount });
|
|
8252
|
+
this.truncateIntegralFields(finalEvent, this.getIntFields());
|
|
8253
|
+
this.emitEvents([finalEvent], event.correlationId);
|
|
8254
|
+
return finalEvent;
|
|
8220
8255
|
};
|
|
8221
8256
|
/**
|
|
8222
8257
|
* Saves extra information to be emitted when the measurements are flushed
|
|
@@ -8224,14 +8259,13 @@
|
|
|
8224
8259
|
* @param correlationId
|
|
8225
8260
|
*/
|
|
8226
8261
|
PerformanceClient.prototype.addStaticFields = function (fields, correlationId) {
|
|
8227
|
-
|
|
8228
|
-
|
|
8229
|
-
|
|
8230
|
-
this.
|
|
8262
|
+
this.logger.trace("PerformanceClient: Updating static fields");
|
|
8263
|
+
var event = this.eventsByCorrelationId.get(correlationId);
|
|
8264
|
+
if (event) {
|
|
8265
|
+
this.eventsByCorrelationId.set(correlationId, __assign(__assign({}, event), fields));
|
|
8231
8266
|
}
|
|
8232
8267
|
else {
|
|
8233
|
-
this.logger.trace("PerformanceClient:
|
|
8234
|
-
this.staticFieldsByCorrelationId.set(correlationId, fields);
|
|
8268
|
+
this.logger.trace("PerformanceClient: Event not found for", correlationId);
|
|
8235
8269
|
}
|
|
8236
8270
|
};
|
|
8237
8271
|
/**
|
|
@@ -8240,18 +8274,18 @@
|
|
|
8240
8274
|
* @param correlationId {string} correlation identifier
|
|
8241
8275
|
*/
|
|
8242
8276
|
PerformanceClient.prototype.increment = function (counters, correlationId) {
|
|
8243
|
-
var existing = this.countersByCorrelationId.get(correlationId);
|
|
8244
|
-
if (!existing) {
|
|
8245
|
-
this.logger.trace("PerformanceClient: Setting counters");
|
|
8246
|
-
this.countersByCorrelationId.set(correlationId, __assign({}, counters));
|
|
8247
|
-
return;
|
|
8248
|
-
}
|
|
8249
8277
|
this.logger.trace("PerformanceClient: Updating counters");
|
|
8250
|
-
|
|
8251
|
-
|
|
8252
|
-
|
|
8278
|
+
var event = this.eventsByCorrelationId.get(correlationId);
|
|
8279
|
+
if (event) {
|
|
8280
|
+
for (var counter in counters) {
|
|
8281
|
+
if (!event.hasOwnProperty(counter)) {
|
|
8282
|
+
event[counter] = 0;
|
|
8283
|
+
}
|
|
8284
|
+
event[counter] += counters[counter];
|
|
8253
8285
|
}
|
|
8254
|
-
|
|
8286
|
+
}
|
|
8287
|
+
else {
|
|
8288
|
+
this.logger.trace("PerformanceClient: Event not found for", correlationId);
|
|
8255
8289
|
}
|
|
8256
8290
|
};
|
|
8257
8291
|
/**
|
|
@@ -8264,117 +8298,35 @@
|
|
|
8264
8298
|
* @param {PerformanceEvent} event
|
|
8265
8299
|
*/
|
|
8266
8300
|
PerformanceClient.prototype.cacheEventByCorrelationId = function (event) {
|
|
8267
|
-
var
|
|
8268
|
-
if (
|
|
8301
|
+
var rootEvent = this.eventsByCorrelationId.get(event.correlationId);
|
|
8302
|
+
if (rootEvent) {
|
|
8269
8303
|
this.logger.trace("PerformanceClient: Performance measurement for " + event.name + " added/updated", event.correlationId);
|
|
8270
|
-
|
|
8304
|
+
rootEvent.incompleteSubMeasurements = rootEvent.incompleteSubMeasurements || new Map();
|
|
8305
|
+
rootEvent.incompleteSubMeasurements.set(event.eventId, { name: event.name, startTimeMs: event.startTimeMs });
|
|
8271
8306
|
}
|
|
8272
8307
|
else {
|
|
8273
8308
|
this.logger.trace("PerformanceClient: Performance measurement for " + event.name + " started", event.correlationId);
|
|
8274
|
-
this.eventsByCorrelationId.set(event.correlationId,
|
|
8309
|
+
this.eventsByCorrelationId.set(event.correlationId, __assign({}, event));
|
|
8275
8310
|
}
|
|
8276
8311
|
};
|
|
8277
|
-
|
|
8278
|
-
* Cache measurements by their id.
|
|
8279
|
-
*
|
|
8280
|
-
* @private
|
|
8281
|
-
* @param {PerformanceEvent} event
|
|
8282
|
-
* @param {IPerformanceMeasurement} measurement
|
|
8283
|
-
*/
|
|
8284
|
-
PerformanceClient.prototype.cacheMeasurement = function (event, measurement) {
|
|
8285
|
-
this.measurementsById.set(event.eventId, measurement);
|
|
8286
|
-
};
|
|
8287
|
-
/**
|
|
8288
|
-
* Gathers and emits performance events for measurements taked for the given top-level API and correlation ID.
|
|
8289
|
-
*
|
|
8290
|
-
* @param {PerformanceEvents} measureName
|
|
8291
|
-
* @param {string} correlationId
|
|
8292
|
-
*/
|
|
8293
|
-
PerformanceClient.prototype.flushMeasurements = function (measureName, correlationId) {
|
|
8294
|
-
var _this = this;
|
|
8295
|
-
this.logger.trace("PerformanceClient: Performance measurements flushed for " + measureName, correlationId);
|
|
8296
|
-
/**
|
|
8297
|
-
* Adds all queue time and count measurements for given correlation ID
|
|
8298
|
-
* then deletes queue times for given correlation ID from queueMeasurements map.
|
|
8299
|
-
*/
|
|
8312
|
+
PerformanceClient.prototype.getQueueInfo = function (correlationId) {
|
|
8300
8313
|
var queueMeasurementForCorrelationId = this.queueMeasurements.get(correlationId);
|
|
8301
8314
|
if (!queueMeasurementForCorrelationId) {
|
|
8302
8315
|
this.logger.trace("PerformanceClient: no queue measurements found for for correlationId: " + correlationId);
|
|
8303
8316
|
}
|
|
8304
8317
|
var totalQueueTime = 0;
|
|
8305
8318
|
var totalQueueCount = 0;
|
|
8319
|
+
var manuallyCompletedCount = 0;
|
|
8306
8320
|
queueMeasurementForCorrelationId === null || queueMeasurementForCorrelationId === void 0 ? void 0 : queueMeasurementForCorrelationId.forEach(function (measurement) {
|
|
8307
8321
|
totalQueueTime += measurement.queueTime;
|
|
8308
8322
|
totalQueueCount++;
|
|
8323
|
+
manuallyCompletedCount += measurement.manuallyCompleted ? 1 : 0;
|
|
8309
8324
|
});
|
|
8310
|
-
|
|
8311
|
-
|
|
8312
|
-
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
/*
|
|
8316
|
-
* Manually end incomplete submeasurements to ensure there arent orphaned/never ending events.
|
|
8317
|
-
* Incomplete submeasurements are likely an instrumentation bug that should be fixed.
|
|
8318
|
-
* IE only supports Map.forEach.
|
|
8319
|
-
*/
|
|
8320
|
-
var completedEvents_1 = [];
|
|
8321
|
-
var incompleteSubsCount_1 = 0;
|
|
8322
|
-
eventsForCorrelationId.forEach(function (event) {
|
|
8323
|
-
if (event.name !== measureName && event.status !== PerformanceEventStatus.Completed) {
|
|
8324
|
-
_this.logger.trace("PerformanceClient: Incomplete submeasurement " + event.name + " found for " + measureName, correlationId);
|
|
8325
|
-
incompleteSubsCount_1++;
|
|
8326
|
-
var completedEvent = _this.endMeasurement(event);
|
|
8327
|
-
if (completedEvent) {
|
|
8328
|
-
completedEvents_1.push(completedEvent);
|
|
8329
|
-
}
|
|
8330
|
-
}
|
|
8331
|
-
completedEvents_1.push(event);
|
|
8332
|
-
});
|
|
8333
|
-
// Sort events by start time (earliest first)
|
|
8334
|
-
var sortedCompletedEvents = completedEvents_1.sort(function (eventA, eventB) { return eventA.startTimeMs - eventB.startTimeMs; });
|
|
8335
|
-
// Take completed top level event and add completed submeasurements durations as properties
|
|
8336
|
-
var topLevelEvents = sortedCompletedEvents.filter(function (event) { return event.name === measureName && event.status === PerformanceEventStatus.Completed; });
|
|
8337
|
-
if (topLevelEvents.length > 0) {
|
|
8338
|
-
/*
|
|
8339
|
-
* Only take the first top-level event if there are multiple events with the same correlation id.
|
|
8340
|
-
* This greatly simplifies logic for submeasurements.
|
|
8341
|
-
*/
|
|
8342
|
-
if (topLevelEvents.length > 1) {
|
|
8343
|
-
this.logger.verbose("PerformanceClient: Multiple distinct top-level performance events found, using the first", correlationId);
|
|
8344
|
-
}
|
|
8345
|
-
var topLevelEvent = topLevelEvents[0];
|
|
8346
|
-
this.logger.verbose("PerformanceClient: Measurement found for " + measureName, correlationId);
|
|
8347
|
-
// Build event object with top level and sub measurements
|
|
8348
|
-
var eventToEmit = sortedCompletedEvents.reduce(function (previous, current) {
|
|
8349
|
-
if (current.name !== measureName) {
|
|
8350
|
-
_this.logger.trace("PerformanceClient: Complete submeasurement found for " + current.name, correlationId);
|
|
8351
|
-
// TODO: Emit additional properties for each subMeasurement
|
|
8352
|
-
var subMeasurementName = current.name + "DurationMs";
|
|
8353
|
-
/*
|
|
8354
|
-
* Some code paths, such as resolving an authority, can occur multiple times.
|
|
8355
|
-
* Only take the first measurement, since the second could be read from the cache,
|
|
8356
|
-
* or due to the same correlation id being used for two distinct requests.
|
|
8357
|
-
*/
|
|
8358
|
-
if (!previous[subMeasurementName]) {
|
|
8359
|
-
previous[subMeasurementName] = current.durationMs;
|
|
8360
|
-
}
|
|
8361
|
-
else {
|
|
8362
|
-
_this.logger.verbose("PerformanceClient: Submeasurement for " + measureName + " already exists for " + current.name + ", ignoring", correlationId);
|
|
8363
|
-
}
|
|
8364
|
-
}
|
|
8365
|
-
return previous;
|
|
8366
|
-
}, topLevelEvent);
|
|
8367
|
-
var finalEvent = __assign(__assign(__assign(__assign({}, eventToEmit), staticFields), counters), { queuedTimeMs: totalQueueTime, queuedCount: totalQueueCount, incompleteSubsCount: incompleteSubsCount_1 });
|
|
8368
|
-
this.truncateIntegralFields(finalEvent, this.getIntFields());
|
|
8369
|
-
this.emitEvents([finalEvent], eventToEmit.correlationId);
|
|
8370
|
-
}
|
|
8371
|
-
else {
|
|
8372
|
-
this.logger.verbose("PerformanceClient: No completed top-level measurements found for " + measureName, correlationId);
|
|
8373
|
-
}
|
|
8374
|
-
}
|
|
8375
|
-
else {
|
|
8376
|
-
this.logger.verbose("PerformanceClient: No measurements found", correlationId);
|
|
8377
|
-
}
|
|
8325
|
+
return {
|
|
8326
|
+
totalQueueTime: totalQueueTime,
|
|
8327
|
+
totalQueueCount: totalQueueCount,
|
|
8328
|
+
manuallyCompletedCount: manuallyCompletedCount
|
|
8329
|
+
};
|
|
8378
8330
|
};
|
|
8379
8331
|
/**
|
|
8380
8332
|
* Removes measurements for a given correlation id.
|
|
@@ -8388,14 +8340,10 @@
|
|
|
8388
8340
|
/**
|
|
8389
8341
|
* Removes cache for a given correlation id.
|
|
8390
8342
|
*
|
|
8391
|
-
* @param {string} correlation identifier
|
|
8343
|
+
* @param {string} correlationId correlation identifier
|
|
8392
8344
|
*/
|
|
8393
8345
|
PerformanceClient.prototype.discardCache = function (correlationId) {
|
|
8394
8346
|
this.discardMeasurements(correlationId);
|
|
8395
|
-
this.logger.trace("PerformanceClient: Static fields discarded", correlationId);
|
|
8396
|
-
this.staticFieldsByCorrelationId.delete(correlationId);
|
|
8397
|
-
this.logger.trace("PerformanceClient: Counters discarded", correlationId);
|
|
8398
|
-
this.countersByCorrelationId.delete(correlationId);
|
|
8399
8347
|
this.logger.trace("PerformanceClient: QueueMeasurements discarded", correlationId);
|
|
8400
8348
|
this.queueMeasurements.delete(correlationId);
|
|
8401
8349
|
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
|
|
@@ -8458,7 +8406,7 @@
|
|
|
8458
8406
|
return PerformanceClient;
|
|
8459
8407
|
}());
|
|
8460
8408
|
|
|
8461
|
-
/*! @azure/msal-common
|
|
8409
|
+
/*! @azure/msal-common v11.0.0 2023-03-07 */
|
|
8462
8410
|
|
|
8463
8411
|
/*
|
|
8464
8412
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8661,6 +8609,10 @@
|
|
|
8661
8609
|
code: "auth_code_or_nativeAccountId_required",
|
|
8662
8610
|
desc: "An authorization code or nativeAccountId must be provided to this flow."
|
|
8663
8611
|
},
|
|
8612
|
+
spaCodeAndNativeAccountPresent: {
|
|
8613
|
+
code: "spa_code_and_nativeAccountId_present",
|
|
8614
|
+
desc: "Request cannot contain both spa code and native account id."
|
|
8615
|
+
},
|
|
8664
8616
|
databaseUnavailable: {
|
|
8665
8617
|
code: "database_unavailable",
|
|
8666
8618
|
desc: "IndexedDB, which is required for persistent cryptographic key storage, is unavailable. This may be caused by browser privacy features which block persistent storage in third-party contexts."
|
|
@@ -8933,6 +8885,12 @@
|
|
|
8933
8885
|
BrowserAuthError.createAuthCodeOrNativeAccountIdRequiredError = function () {
|
|
8934
8886
|
return new BrowserAuthError(BrowserAuthErrorMessage.authCodeOrNativeAccountRequired.code, BrowserAuthErrorMessage.authCodeOrNativeAccountRequired.desc);
|
|
8935
8887
|
};
|
|
8888
|
+
/**
|
|
8889
|
+
* Create an error when both authorization code and native account ID are provided
|
|
8890
|
+
*/
|
|
8891
|
+
BrowserAuthError.createSpaCodeAndNativeAccountIdPresentError = function () {
|
|
8892
|
+
return new BrowserAuthError(BrowserAuthErrorMessage.spaCodeAndNativeAccountPresent.code, BrowserAuthErrorMessage.spaCodeAndNativeAccountPresent.desc);
|
|
8893
|
+
};
|
|
8936
8894
|
/**
|
|
8937
8895
|
* Create an error when IndexedDB is unavailable
|
|
8938
8896
|
*/
|
|
@@ -10363,7 +10321,7 @@
|
|
|
10363
10321
|
|
|
10364
10322
|
/* eslint-disable header/header */
|
|
10365
10323
|
var name = "@azure/msal-browser";
|
|
10366
|
-
var version = "2.
|
|
10324
|
+
var version = "2.34.0";
|
|
10367
10325
|
|
|
10368
10326
|
/*
|
|
10369
10327
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11973,60 +11931,96 @@
|
|
|
11973
11931
|
*/
|
|
11974
11932
|
NativeInteractionClient.prototype.handleNativeResponse = function (response, request, reqTimestamp) {
|
|
11975
11933
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11976
|
-
var
|
|
11977
|
-
|
|
11978
|
-
|
|
11979
|
-
switch (_b.label) {
|
|
11934
|
+
var authority, authorityPreferredCache, idTokenObj, homeAccountIdentifier, accountEntity, result;
|
|
11935
|
+
return __generator$1(this, function (_a) {
|
|
11936
|
+
switch (_a.label) {
|
|
11980
11937
|
case 0:
|
|
11981
11938
|
this.logger.trace("NativeInteractionClient - handleNativeResponse called.");
|
|
11982
|
-
mats = this.getMATSFromResponse(response);
|
|
11983
|
-
this.performanceClient.addStaticFields({
|
|
11984
|
-
extensionId: this.nativeMessageHandler.getExtensionId(),
|
|
11985
|
-
extensionVersion: this.nativeMessageHandler.getExtensionVersion(),
|
|
11986
|
-
matsBrokerVersion: mats ? mats.broker_version : undefined,
|
|
11987
|
-
matsAccountJoinOnStart: mats ? mats.account_join_on_start : undefined,
|
|
11988
|
-
matsAccountJoinOnEnd: mats ? mats.account_join_on_end : undefined,
|
|
11989
|
-
matsDeviceJoin: mats ? mats.device_join : undefined,
|
|
11990
|
-
matsPromptBehavior: mats ? mats.prompt_behavior : undefined,
|
|
11991
|
-
matsApiErrorCode: mats ? mats.api_error_code : undefined,
|
|
11992
|
-
matsUiVisible: mats ? mats.ui_visible : undefined,
|
|
11993
|
-
matsSilentCode: mats ? mats.silent_code : undefined,
|
|
11994
|
-
matsSilentBiSubCode: mats ? mats.silent_bi_sub_code : undefined,
|
|
11995
|
-
matsSilentMessage: mats ? mats.silent_message : undefined,
|
|
11996
|
-
matsSilentStatus: mats ? mats.silent_status : undefined,
|
|
11997
|
-
matsHttpStatus: mats ? mats.http_status : undefined,
|
|
11998
|
-
matsHttpEventCount: mats ? mats.http_event_count : undefined
|
|
11999
|
-
}, this.correlationId);
|
|
12000
11939
|
if (response.account.id !== request.accountId) {
|
|
12001
11940
|
// User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync
|
|
12002
11941
|
throw NativeAuthError.createUserSwitchError();
|
|
12003
11942
|
}
|
|
12004
|
-
|
|
11943
|
+
if (response.account.id !== request.accountId) {
|
|
11944
|
+
// User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync
|
|
11945
|
+
throw NativeAuthError.createUserSwitchError();
|
|
11946
|
+
}
|
|
12005
11947
|
return [4 /*yield*/, this.getDiscoveredAuthority(request.authority)];
|
|
12006
11948
|
case 1:
|
|
12007
|
-
authority =
|
|
11949
|
+
authority = _a.sent();
|
|
12008
11950
|
authorityPreferredCache = authority.getPreferredCache();
|
|
12009
|
-
|
|
12010
|
-
|
|
12011
|
-
this.
|
|
12012
|
-
|
|
12013
|
-
accountProperties = response.account.properties || {};
|
|
12014
|
-
uid = accountProperties["UID"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;
|
|
12015
|
-
tid = accountProperties["TenantId"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;
|
|
12016
|
-
responseTokenType = exports.AuthenticationScheme.BEARER;
|
|
12017
|
-
_a = request.tokenType;
|
|
12018
|
-
switch (_a) {
|
|
12019
|
-
case exports.AuthenticationScheme.POP: return [3 /*break*/, 2];
|
|
12020
|
-
}
|
|
12021
|
-
return [3 /*break*/, 4];
|
|
11951
|
+
idTokenObj = this.createIdTokenObj(response);
|
|
11952
|
+
homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenObj);
|
|
11953
|
+
accountEntity = this.createAccountEntity(response, homeAccountIdentifier, idTokenObj, authorityPreferredCache);
|
|
11954
|
+
return [4 /*yield*/, this.generateAuthenticationResult(response, request, idTokenObj, accountEntity, authority.canonicalAuthority, reqTimestamp)];
|
|
12022
11955
|
case 2:
|
|
12023
|
-
|
|
12024
|
-
|
|
11956
|
+
result = _a.sent();
|
|
11957
|
+
// cache accounts and tokens in the appropriate storage
|
|
11958
|
+
this.cacheAccount(accountEntity);
|
|
11959
|
+
this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenObj, result.accessToken, result.tenantId, reqTimestamp);
|
|
11960
|
+
return [2 /*return*/, result];
|
|
11961
|
+
}
|
|
11962
|
+
});
|
|
11963
|
+
});
|
|
11964
|
+
};
|
|
11965
|
+
/**
|
|
11966
|
+
* Create an idToken Object (not entity)
|
|
11967
|
+
* @param response
|
|
11968
|
+
* @returns
|
|
11969
|
+
*/
|
|
11970
|
+
NativeInteractionClient.prototype.createIdTokenObj = function (response) {
|
|
11971
|
+
return new AuthToken(response.id_token || Constants.EMPTY_STRING, this.browserCrypto);
|
|
11972
|
+
};
|
|
11973
|
+
/**
|
|
11974
|
+
* creates an homeAccountIdentifier for the account
|
|
11975
|
+
* @param response
|
|
11976
|
+
* @param idTokenObj
|
|
11977
|
+
* @returns
|
|
11978
|
+
*/
|
|
11979
|
+
NativeInteractionClient.prototype.createHomeAccountIdentifier = function (response, idTokenObj) {
|
|
11980
|
+
// Save account in browser storage
|
|
11981
|
+
var homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);
|
|
11982
|
+
return homeAccountIdentifier;
|
|
11983
|
+
};
|
|
11984
|
+
/**
|
|
11985
|
+
* Creates account entity
|
|
11986
|
+
* @param response
|
|
11987
|
+
* @param homeAccountIdentifier
|
|
11988
|
+
* @param idTokenObj
|
|
11989
|
+
* @param authority
|
|
11990
|
+
* @returns
|
|
11991
|
+
*/
|
|
11992
|
+
NativeInteractionClient.prototype.createAccountEntity = function (response, homeAccountIdentifier, idTokenObj, authority) {
|
|
11993
|
+
return AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authority, response.account.id);
|
|
11994
|
+
};
|
|
11995
|
+
/**
|
|
11996
|
+
* Helper to generate scopes
|
|
11997
|
+
* @param response
|
|
11998
|
+
* @param request
|
|
11999
|
+
* @returns
|
|
12000
|
+
*/
|
|
12001
|
+
NativeInteractionClient.prototype.generateScopes = function (response, request) {
|
|
12002
|
+
return response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);
|
|
12003
|
+
};
|
|
12004
|
+
/**
|
|
12005
|
+
* If PoP token is requesred, records the PoP token if returned from the WAM, else generates one in the browser
|
|
12006
|
+
* @param request
|
|
12007
|
+
* @param response
|
|
12008
|
+
*/
|
|
12009
|
+
NativeInteractionClient.prototype.generatePopAccessToken = function (response, request) {
|
|
12010
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
12011
|
+
var popTokenGenerator, shrParameters;
|
|
12012
|
+
return __generator$1(this, function (_a) {
|
|
12013
|
+
switch (_a.label) {
|
|
12014
|
+
case 0:
|
|
12015
|
+
if (!(request.tokenType === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
12016
|
+
/**
|
|
12017
|
+
* This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
|
|
12018
|
+
* is still received, SHR is calculated locally
|
|
12019
|
+
*/
|
|
12025
12020
|
// Check if native layer returned an SHR token
|
|
12026
12021
|
if (response.shr) {
|
|
12027
12022
|
this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer");
|
|
12028
|
-
|
|
12029
|
-
return [3 /*break*/, 5];
|
|
12023
|
+
return [2 /*return*/, response.shr];
|
|
12030
12024
|
}
|
|
12031
12025
|
popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
|
|
12032
12026
|
shrParameters = {
|
|
@@ -12043,17 +12037,39 @@
|
|
|
12043
12037
|
throw ClientAuthError.createKeyIdMissingError();
|
|
12044
12038
|
}
|
|
12045
12039
|
return [4 /*yield*/, popTokenGenerator.signPopToken(response.access_token, request.keyId, shrParameters)];
|
|
12046
|
-
case
|
|
12047
|
-
|
|
12048
|
-
|
|
12049
|
-
|
|
12050
|
-
|
|
12051
|
-
|
|
12052
|
-
|
|
12053
|
-
|
|
12054
|
-
|
|
12040
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
12041
|
+
case 2: return [2 /*return*/, response.access_token];
|
|
12042
|
+
}
|
|
12043
|
+
});
|
|
12044
|
+
});
|
|
12045
|
+
};
|
|
12046
|
+
/**
|
|
12047
|
+
* Generates authentication result
|
|
12048
|
+
* @param response
|
|
12049
|
+
* @param request
|
|
12050
|
+
* @param idTokenObj
|
|
12051
|
+
* @param accountEntity
|
|
12052
|
+
* @param authority
|
|
12053
|
+
* @param reqTimestamp
|
|
12054
|
+
* @returns
|
|
12055
|
+
*/
|
|
12056
|
+
NativeInteractionClient.prototype.generateAuthenticationResult = function (response, request, idTokenObj, accountEntity, authority, reqTimestamp) {
|
|
12057
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
12058
|
+
var mats, responseScopes, accountProperties, uid, tid, responseAccessToken, tokenType, result;
|
|
12059
|
+
return __generator$1(this, function (_a) {
|
|
12060
|
+
switch (_a.label) {
|
|
12061
|
+
case 0:
|
|
12062
|
+
mats = this.addTelemetryFromNativeResponse(response);
|
|
12063
|
+
responseScopes = response.scope ? ScopeSet.fromString(response.scope) : ScopeSet.fromString(request.scope);
|
|
12064
|
+
accountProperties = response.account.properties || {};
|
|
12065
|
+
uid = accountProperties["UID"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;
|
|
12066
|
+
tid = accountProperties["TenantId"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;
|
|
12067
|
+
return [4 /*yield*/, this.generatePopAccessToken(response, request)];
|
|
12068
|
+
case 1:
|
|
12069
|
+
responseAccessToken = _a.sent();
|
|
12070
|
+
tokenType = (request.tokenType === exports.AuthenticationScheme.POP) ? exports.AuthenticationScheme.POP : exports.AuthenticationScheme.BEARER;
|
|
12055
12071
|
result = {
|
|
12056
|
-
authority: authority
|
|
12072
|
+
authority: authority,
|
|
12057
12073
|
uniqueId: uid,
|
|
12058
12074
|
tenantId: tid,
|
|
12059
12075
|
scopes: responseScopes.asArray(),
|
|
@@ -12063,30 +12079,78 @@
|
|
|
12063
12079
|
accessToken: responseAccessToken,
|
|
12064
12080
|
fromCache: mats ? this.isResponseFromCache(mats) : false,
|
|
12065
12081
|
expiresOn: new Date(Number(reqTimestamp + response.expires_in) * 1000),
|
|
12066
|
-
tokenType:
|
|
12082
|
+
tokenType: tokenType,
|
|
12067
12083
|
correlationId: this.correlationId,
|
|
12068
12084
|
state: response.state,
|
|
12069
12085
|
fromNativeBroker: true
|
|
12070
12086
|
};
|
|
12071
|
-
idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
12072
|
-
this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
|
|
12073
|
-
expiresIn = (responseTokenType === exports.AuthenticationScheme.POP)
|
|
12074
|
-
? Constants.SHR_NONCE_VALIDITY
|
|
12075
|
-
: (typeof response.expires_in === "string"
|
|
12076
|
-
? parseInt(response.expires_in, 10)
|
|
12077
|
-
: response.expires_in) || 0;
|
|
12078
|
-
tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
12079
|
-
accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, tid, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
|
|
12080
|
-
this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);
|
|
12081
|
-
// Remove any existing cached tokens for this account in browser storage
|
|
12082
|
-
this.browserStorage.removeAccountContext(accountEntity).catch(function (e) {
|
|
12083
|
-
_this.logger.error("Error occurred while removing account context from browser storage. " + e);
|
|
12084
|
-
});
|
|
12085
12087
|
return [2 /*return*/, result];
|
|
12086
12088
|
}
|
|
12087
12089
|
});
|
|
12088
12090
|
});
|
|
12089
12091
|
};
|
|
12092
|
+
/**
|
|
12093
|
+
* cache the account entity in browser storage
|
|
12094
|
+
* @param accountEntity
|
|
12095
|
+
*/
|
|
12096
|
+
NativeInteractionClient.prototype.cacheAccount = function (accountEntity) {
|
|
12097
|
+
var _this = this;
|
|
12098
|
+
// Store the account info and hence `nativeAccountId` in browser cache
|
|
12099
|
+
this.browserStorage.setAccount(accountEntity);
|
|
12100
|
+
// Remove any existing cached tokens for this account in browser storage
|
|
12101
|
+
this.browserStorage.removeAccountContext(accountEntity).catch(function (e) {
|
|
12102
|
+
_this.logger.error("Error occurred while removing account context from browser storage. " + e);
|
|
12103
|
+
});
|
|
12104
|
+
};
|
|
12105
|
+
/**
|
|
12106
|
+
* Stores the access_token and id_token in inmemory storage
|
|
12107
|
+
* @param response
|
|
12108
|
+
* @param request
|
|
12109
|
+
* @param homeAccountIdentifier
|
|
12110
|
+
* @param idTokenObj
|
|
12111
|
+
* @param responseAccessToken
|
|
12112
|
+
* @param tenantId
|
|
12113
|
+
* @param reqTimestamp
|
|
12114
|
+
*/
|
|
12115
|
+
NativeInteractionClient.prototype.cacheNativeTokens = function (response, request, homeAccountIdentifier, idTokenObj, responseAccessToken, tenantId, reqTimestamp) {
|
|
12116
|
+
// cache idToken in inmemory storage
|
|
12117
|
+
var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || Constants.EMPTY_STRING, request.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
12118
|
+
this.nativeStorageManager.setIdTokenCredential(idTokenEntity);
|
|
12119
|
+
// cache accessToken in inmemory storage
|
|
12120
|
+
var expiresIn = (request.tokenType === exports.AuthenticationScheme.POP)
|
|
12121
|
+
? Constants.SHR_NONCE_VALIDITY
|
|
12122
|
+
: (typeof response.expires_in === "string"
|
|
12123
|
+
? parseInt(response.expires_in, 10)
|
|
12124
|
+
: response.expires_in) || 0;
|
|
12125
|
+
var tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
12126
|
+
var responseScopes = this.generateScopes(response, request);
|
|
12127
|
+
var accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, this.browserCrypto);
|
|
12128
|
+
this.nativeStorageManager.setAccessTokenCredential(accessTokenEntity);
|
|
12129
|
+
};
|
|
12130
|
+
NativeInteractionClient.prototype.addTelemetryFromNativeResponse = function (response) {
|
|
12131
|
+
var mats = this.getMATSFromResponse(response);
|
|
12132
|
+
if (!mats) {
|
|
12133
|
+
return null;
|
|
12134
|
+
}
|
|
12135
|
+
this.performanceClient.addStaticFields({
|
|
12136
|
+
extensionId: this.nativeMessageHandler.getExtensionId(),
|
|
12137
|
+
extensionVersion: this.nativeMessageHandler.getExtensionVersion(),
|
|
12138
|
+
matsBrokerVersion: mats.broker_version,
|
|
12139
|
+
matsAccountJoinOnStart: mats.account_join_on_start,
|
|
12140
|
+
matsAccountJoinOnEnd: mats.account_join_on_end,
|
|
12141
|
+
matsDeviceJoin: mats.device_join,
|
|
12142
|
+
matsPromptBehavior: mats.prompt_behavior,
|
|
12143
|
+
matsApiErrorCode: mats.api_error_code,
|
|
12144
|
+
matsUiVisible: mats.ui_visible,
|
|
12145
|
+
matsSilentCode: mats.silent_code,
|
|
12146
|
+
matsSilentBiSubCode: mats.silent_bi_sub_code,
|
|
12147
|
+
matsSilentMessage: mats.silent_message,
|
|
12148
|
+
matsSilentStatus: mats.silent_status,
|
|
12149
|
+
matsHttpStatus: mats.http_status,
|
|
12150
|
+
matsHttpEventCount: mats.http_event_count
|
|
12151
|
+
}, this.correlationId);
|
|
12152
|
+
return mats;
|
|
12153
|
+
};
|
|
12090
12154
|
/**
|
|
12091
12155
|
* Validates native platform response before processing
|
|
12092
12156
|
* @param response
|
|
@@ -12205,7 +12269,7 @@
|
|
|
12205
12269
|
* Licensed under the MIT License.
|
|
12206
12270
|
*/
|
|
12207
12271
|
var NativeMessageHandler = /** @class */ (function () {
|
|
12208
|
-
function NativeMessageHandler(logger, handshakeTimeoutMs, extensionId) {
|
|
12272
|
+
function NativeMessageHandler(logger, handshakeTimeoutMs, performanceClient, extensionId) {
|
|
12209
12273
|
this.logger = logger;
|
|
12210
12274
|
this.handshakeTimeoutMs = handshakeTimeoutMs;
|
|
12211
12275
|
this.extensionId = extensionId;
|
|
@@ -12214,6 +12278,8 @@
|
|
|
12214
12278
|
this.responseId = 0;
|
|
12215
12279
|
this.messageChannel = new MessageChannel();
|
|
12216
12280
|
this.windowListener = this.onWindowMessage.bind(this); // Window event callback doesn't have access to 'this' unless it's bound
|
|
12281
|
+
this.performanceClient = performanceClient;
|
|
12282
|
+
this.handshakeEvent = performanceClient.startMeasurement(exports.PerformanceEvents.NativeMessageHandlerHandshake);
|
|
12217
12283
|
}
|
|
12218
12284
|
/**
|
|
12219
12285
|
* Sends a given message to the extension and resolves with the extension response
|
|
@@ -12242,10 +12308,11 @@
|
|
|
12242
12308
|
};
|
|
12243
12309
|
/**
|
|
12244
12310
|
* Returns an instance of the MessageHandler that has successfully established a connection with an extension
|
|
12245
|
-
* @param logger
|
|
12246
|
-
* @param handshakeTimeoutMs
|
|
12311
|
+
* @param {Logger} logger
|
|
12312
|
+
* @param {number} handshakeTimeoutMs
|
|
12313
|
+
* @param {IPerformanceClient} performanceClient
|
|
12247
12314
|
*/
|
|
12248
|
-
NativeMessageHandler.createProvider = function (logger, handshakeTimeoutMs) {
|
|
12315
|
+
NativeMessageHandler.createProvider = function (logger, handshakeTimeoutMs, performanceClient) {
|
|
12249
12316
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12250
12317
|
var preferredProvider, backupProvider;
|
|
12251
12318
|
return __generator$1(this, function (_a) {
|
|
@@ -12255,14 +12322,14 @@
|
|
|
12255
12322
|
_a.label = 1;
|
|
12256
12323
|
case 1:
|
|
12257
12324
|
_a.trys.push([1, 3, , 5]);
|
|
12258
|
-
preferredProvider = new NativeMessageHandler(logger, handshakeTimeoutMs, NativeConstants.PREFERRED_EXTENSION_ID);
|
|
12325
|
+
preferredProvider = new NativeMessageHandler(logger, handshakeTimeoutMs, performanceClient, NativeConstants.PREFERRED_EXTENSION_ID);
|
|
12259
12326
|
return [4 /*yield*/, preferredProvider.sendHandshakeRequest()];
|
|
12260
12327
|
case 2:
|
|
12261
12328
|
_a.sent();
|
|
12262
12329
|
return [2 /*return*/, preferredProvider];
|
|
12263
12330
|
case 3:
|
|
12264
12331
|
_a.sent();
|
|
12265
|
-
backupProvider = new NativeMessageHandler(logger, handshakeTimeoutMs);
|
|
12332
|
+
backupProvider = new NativeMessageHandler(logger, handshakeTimeoutMs, performanceClient);
|
|
12266
12333
|
return [4 /*yield*/, backupProvider.sendHandshakeRequest()];
|
|
12267
12334
|
case 4:
|
|
12268
12335
|
_a.sent();
|
|
@@ -12291,6 +12358,10 @@
|
|
|
12291
12358
|
method: NativeExtensionMethod.HandshakeRequest
|
|
12292
12359
|
}
|
|
12293
12360
|
};
|
|
12361
|
+
this.handshakeEvent.addStaticFields({
|
|
12362
|
+
extensionId: this.extensionId,
|
|
12363
|
+
extensionHandshakeTimeoutMs: this.handshakeTimeoutMs
|
|
12364
|
+
});
|
|
12294
12365
|
this.messageChannel.port1.onmessage = function (event) {
|
|
12295
12366
|
_this.onChannelMessage(event);
|
|
12296
12367
|
};
|
|
@@ -12305,6 +12376,7 @@
|
|
|
12305
12376
|
window.removeEventListener("message", _this.windowListener, false);
|
|
12306
12377
|
_this.messageChannel.port1.close();
|
|
12307
12378
|
_this.messageChannel.port2.close();
|
|
12379
|
+
_this.handshakeEvent.endMeasurement({ extensionHandshakeTimedOut: true, success: false });
|
|
12308
12380
|
reject(BrowserAuthError.createNativeHandshakeTimeoutError());
|
|
12309
12381
|
_this.handshakeResolvers.delete(req.responseId);
|
|
12310
12382
|
}, _this.handshakeTimeoutMs); // Use a reasonable timeout in milliseconds here
|
|
@@ -12338,6 +12410,7 @@
|
|
|
12338
12410
|
window.removeEventListener("message", this.windowListener, false);
|
|
12339
12411
|
var handshakeResolver = this.handshakeResolvers.get(request.responseId);
|
|
12340
12412
|
if (handshakeResolver) {
|
|
12413
|
+
this.handshakeEvent.endMeasurement({ success: false, extensionInstalled: false });
|
|
12341
12414
|
handshakeResolver.reject(BrowserAuthError.createNativeExtensionNotInstalledError());
|
|
12342
12415
|
}
|
|
12343
12416
|
}
|
|
@@ -12385,6 +12458,7 @@
|
|
|
12385
12458
|
this.extensionId = request.extensionId;
|
|
12386
12459
|
this.extensionVersion = request.body.version;
|
|
12387
12460
|
this.logger.verbose("NativeMessageHandler - Received HandshakeResponse from extension: " + this.extensionId);
|
|
12461
|
+
this.handshakeEvent.endMeasurement({ extensionInstalled: true, success: true });
|
|
12388
12462
|
handshakeResolver.resolve();
|
|
12389
12463
|
this.handshakeResolvers.delete(request.responseId);
|
|
12390
12464
|
}
|
|
@@ -15454,10 +15528,19 @@
|
|
|
15454
15528
|
var BrowserPerformanceMeasurement = /** @class */ (function () {
|
|
15455
15529
|
function BrowserPerformanceMeasurement(name, correlationId) {
|
|
15456
15530
|
this.correlationId = correlationId;
|
|
15457
|
-
this.measureName =
|
|
15458
|
-
this.startMark =
|
|
15459
|
-
this.endMark =
|
|
15531
|
+
this.measureName = BrowserPerformanceMeasurement.makeMeasureName(name, correlationId);
|
|
15532
|
+
this.startMark = BrowserPerformanceMeasurement.makeStartMark(name, correlationId);
|
|
15533
|
+
this.endMark = BrowserPerformanceMeasurement.makeEndMark(name, correlationId);
|
|
15460
15534
|
}
|
|
15535
|
+
BrowserPerformanceMeasurement.makeMeasureName = function (name, correlationId) {
|
|
15536
|
+
return "msal.measure." + name + "." + correlationId;
|
|
15537
|
+
};
|
|
15538
|
+
BrowserPerformanceMeasurement.makeStartMark = function (name, correlationId) {
|
|
15539
|
+
return "msal.start." + name + "." + correlationId;
|
|
15540
|
+
};
|
|
15541
|
+
BrowserPerformanceMeasurement.makeEndMark = function (name, correlationId) {
|
|
15542
|
+
return "msal.end." + name + "." + correlationId;
|
|
15543
|
+
};
|
|
15461
15544
|
BrowserPerformanceMeasurement.supportsBrowserPerformance = function () {
|
|
15462
15545
|
return typeof window !== "undefined" &&
|
|
15463
15546
|
typeof window.performance !== "undefined" &&
|
|
@@ -15467,6 +15550,29 @@
|
|
|
15467
15550
|
typeof window.performance.clearMeasures === "function" &&
|
|
15468
15551
|
typeof window.performance.getEntriesByName === "function";
|
|
15469
15552
|
};
|
|
15553
|
+
/**
|
|
15554
|
+
* Flush browser marks and measurements.
|
|
15555
|
+
* @param {string} correlationId
|
|
15556
|
+
* @param {SubMeasurement} measurements
|
|
15557
|
+
*/
|
|
15558
|
+
BrowserPerformanceMeasurement.flushMeasurements = function (correlationId, measurements) {
|
|
15559
|
+
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15560
|
+
try {
|
|
15561
|
+
measurements.forEach(function (measurement) {
|
|
15562
|
+
var measureName = BrowserPerformanceMeasurement.makeMeasureName(measurement.name, correlationId);
|
|
15563
|
+
var entriesForMeasurement = window.performance.getEntriesByName(measureName, "measure");
|
|
15564
|
+
if (entriesForMeasurement.length > 0) {
|
|
15565
|
+
window.performance.clearMeasures(measureName);
|
|
15566
|
+
window.performance.clearMarks(BrowserPerformanceMeasurement.makeStartMark(measureName, correlationId));
|
|
15567
|
+
window.performance.clearMarks(BrowserPerformanceMeasurement.makeEndMark(measureName, correlationId));
|
|
15568
|
+
}
|
|
15569
|
+
});
|
|
15570
|
+
}
|
|
15571
|
+
catch (e) {
|
|
15572
|
+
// Silently catch and return null
|
|
15573
|
+
}
|
|
15574
|
+
}
|
|
15575
|
+
};
|
|
15470
15576
|
BrowserPerformanceMeasurement.prototype.startMeasurement = function () {
|
|
15471
15577
|
if (BrowserPerformanceMeasurement.supportsBrowserPerformance()) {
|
|
15472
15578
|
try {
|
|
@@ -15531,6 +15637,20 @@
|
|
|
15531
15637
|
var _a;
|
|
15532
15638
|
return ((_a = document.visibilityState) === null || _a === void 0 ? void 0 : _a.toString()) || null;
|
|
15533
15639
|
};
|
|
15640
|
+
BrowserPerformanceClient.prototype.deleteIncompleteSubMeasurements = function (inProgressEvent) {
|
|
15641
|
+
var rootEvent = this.eventsByCorrelationId.get(inProgressEvent.event.correlationId);
|
|
15642
|
+
var isRootEvent = rootEvent && rootEvent.eventId === inProgressEvent.event.eventId;
|
|
15643
|
+
var incompleteMeasurements = [];
|
|
15644
|
+
if (isRootEvent && (rootEvent === null || rootEvent === void 0 ? void 0 : rootEvent.incompleteSubMeasurements)) {
|
|
15645
|
+
rootEvent.incompleteSubMeasurements.forEach(function (subMeasurement) {
|
|
15646
|
+
incompleteMeasurements.push(__assign$1({}, subMeasurement));
|
|
15647
|
+
});
|
|
15648
|
+
}
|
|
15649
|
+
// Clean up remaining marks for incomplete sub-measurements
|
|
15650
|
+
if (incompleteMeasurements.length > 0) {
|
|
15651
|
+
BrowserPerformanceMeasurement.flushMeasurements(inProgressEvent.event.correlationId, incompleteMeasurements);
|
|
15652
|
+
}
|
|
15653
|
+
};
|
|
15534
15654
|
BrowserPerformanceClient.prototype.supportsBrowserPerformanceNow = function () {
|
|
15535
15655
|
return typeof window !== "undefined" &&
|
|
15536
15656
|
typeof window.performance !== "undefined" &&
|
|
@@ -15550,7 +15670,13 @@
|
|
|
15550
15670
|
var startPageVisibility = this.getPageVisibility();
|
|
15551
15671
|
var inProgressEvent = _super.prototype.startMeasurement.call(this, measureName, correlationId);
|
|
15552
15672
|
return __assign$1(__assign$1({}, inProgressEvent), { endMeasurement: function (event) {
|
|
15553
|
-
|
|
15673
|
+
var res = inProgressEvent.endMeasurement(__assign$1({ startPageVisibility: startPageVisibility, endPageVisibility: _this.getPageVisibility() }, event));
|
|
15674
|
+
_this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
15675
|
+
return res;
|
|
15676
|
+
}, discardMeasurement: function () {
|
|
15677
|
+
inProgressEvent.discardMeasurement();
|
|
15678
|
+
_this.deleteIncompleteSubMeasurements(inProgressEvent);
|
|
15679
|
+
inProgressEvent.measurement.flushMeasurement();
|
|
15554
15680
|
} });
|
|
15555
15681
|
};
|
|
15556
15682
|
/**
|
|
@@ -15568,26 +15694,27 @@
|
|
|
15568
15694
|
this.logger.trace("BrowserPerformanceClient: correlationId for " + eventName + " not provided, unable to set telemetry queue time");
|
|
15569
15695
|
return;
|
|
15570
15696
|
}
|
|
15571
|
-
var
|
|
15572
|
-
|
|
15573
|
-
|
|
15574
|
-
|
|
15575
|
-
|
|
15576
|
-
|
|
15577
|
-
|
|
15578
|
-
|
|
15579
|
-
this.preQueueTimeByCorrelationId.set(correlationId, preQueueTimes);
|
|
15697
|
+
var preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);
|
|
15698
|
+
/**
|
|
15699
|
+
* Manually complete queue measurement if there is an incomplete pre-queue event.
|
|
15700
|
+
* Incomplete pre-queue events are instrumentation bugs that should be fixed.
|
|
15701
|
+
*/
|
|
15702
|
+
if (preQueueEvent) {
|
|
15703
|
+
this.logger.trace("BrowserPerformanceClient: Incomplete pre-queue " + preQueueEvent.name + " found", correlationId);
|
|
15704
|
+
this.addQueueMeasurement(preQueueEvent.name, correlationId, undefined, true);
|
|
15580
15705
|
}
|
|
15706
|
+
this.preQueueTimeByCorrelationId.set(eventName, { name: eventName, time: window.performance.now() });
|
|
15581
15707
|
};
|
|
15582
15708
|
/**
|
|
15583
15709
|
* Calculates and adds queue time measurement for given performance event.
|
|
15584
15710
|
*
|
|
15585
|
-
* @param {PerformanceEvents}
|
|
15711
|
+
* @param {PerformanceEvents} eventName
|
|
15586
15712
|
* @param {?string} correlationId
|
|
15587
|
-
* @param {?number}
|
|
15713
|
+
* @param {?number} queueTime
|
|
15714
|
+
* @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements
|
|
15588
15715
|
* @returns
|
|
15589
15716
|
*/
|
|
15590
|
-
BrowserPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId) {
|
|
15717
|
+
BrowserPerformanceClient.prototype.addQueueMeasurement = function (eventName, correlationId, queueTime, manuallyCompleted) {
|
|
15591
15718
|
if (!this.supportsBrowserPerformanceNow()) {
|
|
15592
15719
|
this.logger.trace("BrowserPerformanceClient: window performance API not available, unable to add queue measurement for " + eventName);
|
|
15593
15720
|
return;
|
|
@@ -15601,8 +15728,8 @@
|
|
|
15601
15728
|
return;
|
|
15602
15729
|
}
|
|
15603
15730
|
var currentTime = window.performance.now();
|
|
15604
|
-
var
|
|
15605
|
-
return _super.prototype.addQueueMeasurement.call(this, eventName, correlationId,
|
|
15731
|
+
var resQueueTime = queueTime || _super.prototype.calculateQueuedTime.call(this, preQueueTime, currentTime);
|
|
15732
|
+
return _super.prototype.addQueueMeasurement.call(this, eventName, correlationId, resQueueTime, manuallyCompleted);
|
|
15606
15733
|
};
|
|
15607
15734
|
return BrowserPerformanceClient;
|
|
15608
15735
|
}(PerformanceClient));
|
|
@@ -15621,6 +15748,7 @@
|
|
|
15621
15748
|
SilentIframeClient: SilentIframeClient,
|
|
15622
15749
|
SilentCacheClient: SilentCacheClient,
|
|
15623
15750
|
SilentRefreshClient: SilentRefreshClient,
|
|
15751
|
+
NativeInteractionClient: NativeInteractionClient,
|
|
15624
15752
|
RedirectHandler: RedirectHandler,
|
|
15625
15753
|
EventHandler: EventHandler,
|
|
15626
15754
|
NativeMessageHandler: NativeMessageHandler,
|
|
@@ -16015,7 +16143,7 @@
|
|
|
16015
16143
|
*/
|
|
16016
16144
|
ClientApplication.prototype.initialize = function () {
|
|
16017
16145
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
16018
|
-
var _a, e_1;
|
|
16146
|
+
var allowNativeBroker, initMeasurement, _a, e_1;
|
|
16019
16147
|
return __generator$1(this, function (_b) {
|
|
16020
16148
|
switch (_b.label) {
|
|
16021
16149
|
case 0:
|
|
@@ -16024,13 +16152,15 @@
|
|
|
16024
16152
|
this.logger.info("initialize has already been called, exiting early.");
|
|
16025
16153
|
return [2 /*return*/];
|
|
16026
16154
|
}
|
|
16155
|
+
allowNativeBroker = this.config.system.allowNativeBroker;
|
|
16156
|
+
initMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.InitializeClientApplication);
|
|
16027
16157
|
this.eventHandler.emitEvent(exports.EventType.INITIALIZE_START);
|
|
16028
|
-
if (!
|
|
16158
|
+
if (!allowNativeBroker) return [3 /*break*/, 4];
|
|
16029
16159
|
_b.label = 1;
|
|
16030
16160
|
case 1:
|
|
16031
16161
|
_b.trys.push([1, 3, , 4]);
|
|
16032
16162
|
_a = this;
|
|
16033
|
-
return [4 /*yield*/, NativeMessageHandler.createProvider(this.logger, this.config.system.nativeBrokerHandshakeTimeout)];
|
|
16163
|
+
return [4 /*yield*/, NativeMessageHandler.createProvider(this.logger, this.config.system.nativeBrokerHandshakeTimeout, this.performanceClient)];
|
|
16034
16164
|
case 2:
|
|
16035
16165
|
_a.nativeExtensionProvider = _b.sent();
|
|
16036
16166
|
return [3 /*break*/, 4];
|
|
@@ -16041,6 +16171,7 @@
|
|
|
16041
16171
|
case 4:
|
|
16042
16172
|
this.initialized = true;
|
|
16043
16173
|
this.eventHandler.emitEvent(exports.EventType.INITIALIZE_END);
|
|
16174
|
+
initMeasurement.endMeasurement({ allowNativeBroker: allowNativeBroker, success: true });
|
|
16044
16175
|
return [2 /*return*/];
|
|
16045
16176
|
}
|
|
16046
16177
|
});
|
|
@@ -16216,7 +16347,6 @@
|
|
|
16216
16347
|
isNativeBroker: true,
|
|
16217
16348
|
requestId: response.requestId
|
|
16218
16349
|
});
|
|
16219
|
-
atPopupMeasurement.flushMeasurement();
|
|
16220
16350
|
return response;
|
|
16221
16351
|
}).catch(function (e) {
|
|
16222
16352
|
if (e instanceof NativeAuthError && e.isFatal()) {
|
|
@@ -16256,7 +16386,6 @@
|
|
|
16256
16386
|
success: true,
|
|
16257
16387
|
requestId: result.requestId
|
|
16258
16388
|
});
|
|
16259
|
-
atPopupMeasurement.flushMeasurement();
|
|
16260
16389
|
return result;
|
|
16261
16390
|
}).catch(function (e) {
|
|
16262
16391
|
if (loggedInAccounts.length > 0) {
|
|
@@ -16270,7 +16399,6 @@
|
|
|
16270
16399
|
subErrorCode: e.subError,
|
|
16271
16400
|
success: false
|
|
16272
16401
|
});
|
|
16273
|
-
atPopupMeasurement.flushMeasurement();
|
|
16274
16402
|
// Since this function is syncronous we need to reject
|
|
16275
16403
|
return Promise.reject(e);
|
|
16276
16404
|
});
|
|
@@ -16336,7 +16464,7 @@
|
|
|
16336
16464
|
result = silentIframeClient.acquireToken(validRequest);
|
|
16337
16465
|
}
|
|
16338
16466
|
return [2 /*return*/, result.then(function (response) {
|
|
16339
|
-
var _a, _b
|
|
16467
|
+
var _a, _b;
|
|
16340
16468
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
16341
16469
|
(_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.addStaticFields({
|
|
16342
16470
|
accessTokenSize: response.accessToken.length,
|
|
@@ -16347,17 +16475,15 @@
|
|
|
16347
16475
|
isNativeBroker: response.fromNativeBroker,
|
|
16348
16476
|
requestId: response.requestId
|
|
16349
16477
|
});
|
|
16350
|
-
(_c = _this.ssoSilentMeasurement) === null || _c === void 0 ? void 0 : _c.flushMeasurement();
|
|
16351
16478
|
return response;
|
|
16352
16479
|
}).catch(function (e) {
|
|
16353
|
-
var _a
|
|
16480
|
+
var _a;
|
|
16354
16481
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
16355
16482
|
(_a = _this.ssoSilentMeasurement) === null || _a === void 0 ? void 0 : _a.endMeasurement({
|
|
16356
16483
|
errorCode: e.errorCode,
|
|
16357
16484
|
subErrorCode: e.subError,
|
|
16358
16485
|
success: false
|
|
16359
16486
|
});
|
|
16360
|
-
(_b = _this.ssoSilentMeasurement) === null || _b === void 0 ? void 0 : _b.flushMeasurement();
|
|
16361
16487
|
throw e;
|
|
16362
16488
|
}).finally(function () {
|
|
16363
16489
|
document.removeEventListener("visibilitychange", _this.trackPageVisibilityWithMeasurement);
|
|
@@ -16386,7 +16512,11 @@
|
|
|
16386
16512
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
16387
16513
|
atbcMeasurement = this.performanceClient.startMeasurement(exports.PerformanceEvents.AcquireTokenByCode, request.correlationId);
|
|
16388
16514
|
try {
|
|
16389
|
-
if (request.code) {
|
|
16515
|
+
if (request.code && request.nativeAccountId) {
|
|
16516
|
+
// Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.
|
|
16517
|
+
throw BrowserAuthError.createSpaCodeAndNativeAccountIdPresentError();
|
|
16518
|
+
}
|
|
16519
|
+
else if (request.code) {
|
|
16390
16520
|
hybridAuthCode_1 = request.code;
|
|
16391
16521
|
response = this.hybridAuthCodeResponses.get(hybridAuthCode_1);
|
|
16392
16522
|
if (!response) {
|
|
@@ -16404,7 +16534,6 @@
|
|
|
16404
16534
|
isNativeBroker: result.fromNativeBroker,
|
|
16405
16535
|
requestId: result.requestId
|
|
16406
16536
|
});
|
|
16407
|
-
atbcMeasurement.flushMeasurement();
|
|
16408
16537
|
return result;
|
|
16409
16538
|
})
|
|
16410
16539
|
.catch(function (error) {
|
|
@@ -16415,16 +16544,12 @@
|
|
|
16415
16544
|
subErrorCode: error.subError,
|
|
16416
16545
|
success: false
|
|
16417
16546
|
});
|
|
16418
|
-
atbcMeasurement.flushMeasurement();
|
|
16419
16547
|
throw error;
|
|
16420
16548
|
});
|
|
16421
16549
|
this.hybridAuthCodeResponses.set(hybridAuthCode_1, response);
|
|
16422
16550
|
}
|
|
16423
16551
|
else {
|
|
16424
16552
|
this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
|
|
16425
|
-
atbcMeasurement.endMeasurement({
|
|
16426
|
-
success: true
|
|
16427
|
-
});
|
|
16428
16553
|
atbcMeasurement.discardMeasurement();
|
|
16429
16554
|
}
|
|
16430
16555
|
return [2 /*return*/, response];
|
|
@@ -17075,7 +17200,6 @@
|
|
|
17075
17200
|
cacheLookupPolicy: request.cacheLookupPolicy,
|
|
17076
17201
|
requestId: result.requestId,
|
|
17077
17202
|
});
|
|
17078
|
-
atsMeasurement.flushMeasurement();
|
|
17079
17203
|
return result;
|
|
17080
17204
|
})
|
|
17081
17205
|
.catch(function (error) {
|
|
@@ -17085,7 +17209,6 @@
|
|
|
17085
17209
|
subErrorCode: error.subError,
|
|
17086
17210
|
success: false
|
|
17087
17211
|
});
|
|
17088
|
-
atsMeasurement.flushMeasurement();
|
|
17089
17212
|
throw error;
|
|
17090
17213
|
});
|
|
17091
17214
|
this.activeSilentTokenRequests.set(silentRequestKey, response);
|
|
@@ -17093,9 +17216,6 @@
|
|
|
17093
17216
|
}
|
|
17094
17217
|
else {
|
|
17095
17218
|
this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call", correlationId);
|
|
17096
|
-
atsMeasurement.endMeasurement({
|
|
17097
|
-
success: true
|
|
17098
|
-
});
|
|
17099
17219
|
// Discard measurements for memoized calls, as they are usually only a couple of ms and will artificially deflate metrics
|
|
17100
17220
|
atsMeasurement.discardMeasurement();
|
|
17101
17221
|
return [2 /*return*/, cachedResponse];
|