@azure/msal-browser 2.24.0 → 2.27.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 +11 -7
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +46 -14
- 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 +9 -3
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.js +1 -1
- package/dist/broker/nativeBroker/NativeRequest.d.ts +3 -3
- package/dist/broker/nativeBroker/NativeRequest.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeResponse.d.ts +26 -1
- package/dist/broker/nativeBroker/NativeResponse.d.ts.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.js +2 -2
- package/dist/cache/BrowserCacheManager.js.map +1 -1
- package/dist/cache/BrowserStorage.js +1 -1
- package/dist/cache/DatabaseStorage.js +1 -1
- package/dist/cache/MemoryStorage.js +1 -1
- package/dist/cache/TokenCache.d.ts +1 -0
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.js +5 -4
- package/dist/cache/TokenCache.js.map +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +2 -1
- package/dist/config/Configuration.js.map +1 -1
- package/dist/crypto/BrowserCrypto.js +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +7 -10
- package/dist/crypto/CryptoOps.js.map +1 -1
- package/dist/crypto/GuidGenerator.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 +1 -1
- package/dist/error/BrowserAuthError.js +5 -5
- package/dist/error/BrowserAuthError.js.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/error/NativeAuthError.d.ts +3 -1
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.js +6 -2
- package/dist/error/NativeAuthError.js.map +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 +841 -549
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +3 -2
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +12 -0
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.js +76 -31
- package/dist/interaction_client/NativeInteractionClient.js.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +75 -2
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +281 -41
- package/dist/interaction_client/PopupClient.js.map +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 +4 -2
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +3 -1
- 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 -1
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +4 -1
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +3 -8
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +5 -5
- package/dist/interaction_handler/InteractionHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +12 -12
- package/dist/interaction_handler/RedirectHandler.js.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.js +5 -5
- package/dist/interaction_handler/SilentHandler.js.map +1 -1
- package/dist/internals.d.ts +0 -1
- package/dist/internals.d.ts.map +1 -1
- package/dist/internals.js +1 -2
- 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/request/EndSessionPopupRequest.d.ts +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
- package/dist/request/PopupRequest.d.ts +1 -1
- package/dist/request/PopupRequest.d.ts.map +1 -1
- package/dist/request/PopupWindowAttributes.d.ts +16 -0
- package/dist/request/PopupWindowAttributes.d.ts.map +1 -0
- package/dist/request/SsoSilentRequest.d.ts +1 -1
- package/dist/telemetry/BrowserPerformanceClient.js +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.js +1 -1
- package/dist/utils/BrowserConstants.d.ts +1 -0
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +3 -2
- package/dist/utils/BrowserConstants.js.map +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/lib/msal-browser.js +841 -549
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +43 -41
- package/package.json +2 -2
- package/dist/interaction_handler/PopupHandler.d.ts +0 -29
- package/dist/interaction_handler/PopupHandler.d.ts.map +0 -1
- package/dist/interaction_handler/PopupHandler.js +0 -69
- package/dist/interaction_handler/PopupHandler.js.map +0 -1
- package/dist/utils/PopupUtils.d.ts +0 -73
- package/dist/utils/PopupUtils.d.ts.map +0 -1
- package/dist/utils/PopupUtils.js +0 -185
- package/dist/utils/PopupUtils.js.map +0 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.27.0 2022-07-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -105,7 +105,7 @@ function __spread() {
|
|
|
105
105
|
return ar;
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
/*! @azure/msal-common
|
|
108
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
109
109
|
/*! *****************************************************************************
|
|
110
110
|
Copyright (c) Microsoft Corporation.
|
|
111
111
|
|
|
@@ -192,7 +192,7 @@ function __spreadArrays() {
|
|
|
192
192
|
return r;
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
/*! @azure/msal-common
|
|
195
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
196
196
|
|
|
197
197
|
/*
|
|
198
198
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -476,6 +476,7 @@ var AuthorityMetadataSource;
|
|
|
476
476
|
AuthorityMetadataSource["CONFIG"] = "config";
|
|
477
477
|
AuthorityMetadataSource["CACHE"] = "cache";
|
|
478
478
|
AuthorityMetadataSource["NETWORK"] = "network";
|
|
479
|
+
AuthorityMetadataSource["HARDCODED_VALUES"] = "hardcoded_values";
|
|
479
480
|
})(AuthorityMetadataSource || (AuthorityMetadataSource = {}));
|
|
480
481
|
var SERVER_TELEM_CONSTANTS = {
|
|
481
482
|
SCHEMA_VERSION: 5,
|
|
@@ -559,9 +560,14 @@ var CacheOutcome;
|
|
|
559
560
|
CacheOutcome["NO_CACHED_ACCESS_TOKEN"] = "2";
|
|
560
561
|
CacheOutcome["CACHED_ACCESS_TOKEN_EXPIRED"] = "3";
|
|
561
562
|
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
562
|
-
})(CacheOutcome || (CacheOutcome = {}));
|
|
563
|
+
})(CacheOutcome || (CacheOutcome = {}));
|
|
564
|
+
var JsonTypes;
|
|
565
|
+
(function (JsonTypes) {
|
|
566
|
+
JsonTypes["Jwt"] = "JWT";
|
|
567
|
+
JsonTypes["Jwk"] = "JWK";
|
|
568
|
+
})(JsonTypes || (JsonTypes = {}));
|
|
563
569
|
|
|
564
|
-
/*! @azure/msal-common
|
|
570
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
565
571
|
|
|
566
572
|
/*
|
|
567
573
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -605,7 +611,7 @@ var AuthError = /** @class */ (function (_super) {
|
|
|
605
611
|
return AuthError;
|
|
606
612
|
}(Error));
|
|
607
613
|
|
|
608
|
-
/*! @azure/msal-common
|
|
614
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
609
615
|
|
|
610
616
|
/*
|
|
611
617
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -680,7 +686,7 @@ var DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
680
686
|
}
|
|
681
687
|
};
|
|
682
688
|
|
|
683
|
-
/*! @azure/msal-common
|
|
689
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
684
690
|
|
|
685
691
|
/*
|
|
686
692
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -870,6 +876,10 @@ var ClientAuthErrorMessage = {
|
|
|
870
876
|
logoutNotSupported: {
|
|
871
877
|
code: "end_session_endpoint_not_supported",
|
|
872
878
|
desc: "Provided authority does not support logout."
|
|
879
|
+
},
|
|
880
|
+
keyIdMissing: {
|
|
881
|
+
code: "key_id_missing",
|
|
882
|
+
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."
|
|
873
883
|
}
|
|
874
884
|
};
|
|
875
885
|
/**
|
|
@@ -1139,10 +1149,16 @@ var ClientAuthError = /** @class */ (function (_super) {
|
|
|
1139
1149
|
ClientAuthError.createLogoutNotSupportedError = function () {
|
|
1140
1150
|
return new ClientAuthError(ClientAuthErrorMessage.logoutNotSupported.code, ClientAuthErrorMessage.logoutNotSupported.desc);
|
|
1141
1151
|
};
|
|
1152
|
+
/**
|
|
1153
|
+
* Create an error when kid attribute is missing from a PoP token's cache record
|
|
1154
|
+
*/
|
|
1155
|
+
ClientAuthError.createKeyIdMissingError = function () {
|
|
1156
|
+
return new ClientAuthError(ClientAuthErrorMessage.keyIdMissing.code, ClientAuthErrorMessage.keyIdMissing.desc);
|
|
1157
|
+
};
|
|
1142
1158
|
return ClientAuthError;
|
|
1143
1159
|
}(AuthError));
|
|
1144
1160
|
|
|
1145
|
-
/*! @azure/msal-common
|
|
1161
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
1146
1162
|
|
|
1147
1163
|
/*
|
|
1148
1164
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1267,7 +1283,7 @@ var StringUtils = /** @class */ (function () {
|
|
|
1267
1283
|
return StringUtils;
|
|
1268
1284
|
}());
|
|
1269
1285
|
|
|
1270
|
-
/*! @azure/msal-common
|
|
1286
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
1271
1287
|
|
|
1272
1288
|
/*
|
|
1273
1289
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1447,12 +1463,12 @@ var Logger = /** @class */ (function () {
|
|
|
1447
1463
|
return Logger;
|
|
1448
1464
|
}());
|
|
1449
1465
|
|
|
1450
|
-
/*! @azure/msal-common
|
|
1466
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
1451
1467
|
/* eslint-disable header/header */
|
|
1452
1468
|
var name$1 = "@azure/msal-common";
|
|
1453
|
-
var version$1 = "
|
|
1469
|
+
var version$1 = "7.1.0";
|
|
1454
1470
|
|
|
1455
|
-
/*! @azure/msal-common
|
|
1471
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
1456
1472
|
/*
|
|
1457
1473
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1458
1474
|
* Licensed under the MIT License.
|
|
@@ -1473,7 +1489,7 @@ exports.AzureCloudInstance = void 0;
|
|
|
1473
1489
|
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1474
1490
|
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1475
1491
|
|
|
1476
|
-
/*! @azure/msal-common
|
|
1492
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
1477
1493
|
|
|
1478
1494
|
/*
|
|
1479
1495
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1496,9 +1512,9 @@ exports.AzureCloudInstance = void 0;
|
|
|
1496
1512
|
* familyId: Family ID identifier, usually only used for refresh tokens
|
|
1497
1513
|
* realm: Full tenant or organizational identifier that the account belongs to
|
|
1498
1514
|
* target: Permissions that are included in the token, or for refresh tokens, the resource identifier.
|
|
1499
|
-
* oboAssertion: access token passed in as part of OBO request
|
|
1500
1515
|
* tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)
|
|
1501
1516
|
* requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request
|
|
1517
|
+
* userAssertionHash: Matches the SHA 256 hash of the obo_assertion for the OBO flow
|
|
1502
1518
|
* }
|
|
1503
1519
|
*/
|
|
1504
1520
|
var CredentialEntity = /** @class */ (function () {
|
|
@@ -1632,7 +1648,7 @@ var CredentialEntity = /** @class */ (function () {
|
|
|
1632
1648
|
return CredentialEntity;
|
|
1633
1649
|
}());
|
|
1634
1650
|
|
|
1635
|
-
/*! @azure/msal-common
|
|
1651
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
1636
1652
|
|
|
1637
1653
|
/*
|
|
1638
1654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1887,7 +1903,7 @@ var ClientConfigurationError = /** @class */ (function (_super) {
|
|
|
1887
1903
|
return ClientConfigurationError;
|
|
1888
1904
|
}(ClientAuthError));
|
|
1889
1905
|
|
|
1890
|
-
/*! @azure/msal-common
|
|
1906
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
1891
1907
|
|
|
1892
1908
|
/*
|
|
1893
1909
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2071,7 +2087,7 @@ var ScopeSet = /** @class */ (function () {
|
|
|
2071
2087
|
return ScopeSet;
|
|
2072
2088
|
}());
|
|
2073
2089
|
|
|
2074
|
-
/*! @azure/msal-common
|
|
2090
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
2075
2091
|
|
|
2076
2092
|
/*
|
|
2077
2093
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2109,7 +2125,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
2109
2125
|
};
|
|
2110
2126
|
}
|
|
2111
2127
|
|
|
2112
|
-
/*! @azure/msal-common
|
|
2128
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
2113
2129
|
/*
|
|
2114
2130
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2115
2131
|
* Licensed under the MIT License.
|
|
@@ -2123,7 +2139,7 @@ var AuthorityType;
|
|
|
2123
2139
|
AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
|
|
2124
2140
|
})(AuthorityType || (AuthorityType = {}));
|
|
2125
2141
|
|
|
2126
|
-
/*! @azure/msal-common
|
|
2142
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
2127
2143
|
|
|
2128
2144
|
/*
|
|
2129
2145
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2148,7 +2164,6 @@ var AuthorityType;
|
|
|
2148
2164
|
* clientInfo: Full base64 encoded client info received from ESTS
|
|
2149
2165
|
* lastModificationTime: last time this entity was modified in the cache
|
|
2150
2166
|
* lastModificationApp:
|
|
2151
|
-
* oboAssertion: access token passed in as part of OBO request
|
|
2152
2167
|
* idTokenClaims: Object containing claims parsed from ID token
|
|
2153
2168
|
* nativeAccountId: Account identifier on the native device
|
|
2154
2169
|
* }
|
|
@@ -2227,7 +2242,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2227
2242
|
* @param idToken
|
|
2228
2243
|
* @param policy
|
|
2229
2244
|
*/
|
|
2230
|
-
AccountEntity.createAccount = function (clientInfo, homeAccountId, idToken, authority,
|
|
2245
|
+
AccountEntity.createAccount = function (clientInfo, homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment, nativeAccountId) {
|
|
2231
2246
|
var _a, _b, _c, _d, _e, _f;
|
|
2232
2247
|
var account = new AccountEntity();
|
|
2233
2248
|
account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;
|
|
@@ -2241,7 +2256,6 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2241
2256
|
account.environment = env;
|
|
2242
2257
|
// non AAD scenarios can have empty realm
|
|
2243
2258
|
account.realm = ((_a = idToken === null || idToken === void 0 ? void 0 : idToken.claims) === null || _a === void 0 ? void 0 : _a.tid) || Constants.EMPTY_STRING;
|
|
2244
|
-
account.oboAssertion = oboAssertion;
|
|
2245
2259
|
if (idToken) {
|
|
2246
2260
|
account.idTokenClaims = idToken.claims;
|
|
2247
2261
|
// How do you account for MSA CID here?
|
|
@@ -2262,14 +2276,13 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2262
2276
|
* @param authority
|
|
2263
2277
|
* @param idToken
|
|
2264
2278
|
*/
|
|
2265
|
-
AccountEntity.createGenericAccount = function (homeAccountId, idToken, authority,
|
|
2279
|
+
AccountEntity.createGenericAccount = function (homeAccountId, idToken, authority, cloudGraphHostName, msGraphHost, environment) {
|
|
2266
2280
|
var _a, _b, _c, _d;
|
|
2267
2281
|
var account = new AccountEntity();
|
|
2268
2282
|
account.authorityType = (authority && authority.authorityType === AuthorityType.Adfs) ? CacheAccountType.ADFS_ACCOUNT_TYPE : CacheAccountType.GENERIC_ACCOUNT_TYPE;
|
|
2269
2283
|
account.homeAccountId = homeAccountId;
|
|
2270
2284
|
// non AAD scenarios can have empty realm
|
|
2271
2285
|
account.realm = Constants.EMPTY_STRING;
|
|
2272
|
-
account.oboAssertion = oboAssertion;
|
|
2273
2286
|
var env = environment || authority && authority.getPreferredCache();
|
|
2274
2287
|
if (!env) {
|
|
2275
2288
|
throw ClientAuthError.createInvalidCacheEnvironmentError();
|
|
@@ -2361,7 +2374,7 @@ var AccountEntity = /** @class */ (function () {
|
|
|
2361
2374
|
return AccountEntity;
|
|
2362
2375
|
}());
|
|
2363
2376
|
|
|
2364
|
-
/*! @azure/msal-common
|
|
2377
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
2365
2378
|
|
|
2366
2379
|
/*
|
|
2367
2380
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2399,7 +2412,7 @@ var AuthToken = /** @class */ (function () {
|
|
|
2399
2412
|
return AuthToken;
|
|
2400
2413
|
}());
|
|
2401
2414
|
|
|
2402
|
-
/*! @azure/msal-common
|
|
2415
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
2403
2416
|
|
|
2404
2417
|
/*
|
|
2405
2418
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2562,7 +2575,7 @@ var CacheManager = /** @class */ (function () {
|
|
|
2562
2575
|
* @param target
|
|
2563
2576
|
*/
|
|
2564
2577
|
CacheManager.prototype.getCredentialsFilteredBy = function (filter) {
|
|
2565
|
-
return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.
|
|
2578
|
+
return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.userAssertionHash, filter.tokenType, filter.keyId, filter.requestedClaimsHash);
|
|
2566
2579
|
};
|
|
2567
2580
|
/**
|
|
2568
2581
|
* Support function to help match credentials
|
|
@@ -2572,10 +2585,10 @@ var CacheManager = /** @class */ (function () {
|
|
|
2572
2585
|
* @param clientId
|
|
2573
2586
|
* @param realm
|
|
2574
2587
|
* @param target
|
|
2575
|
-
* @param
|
|
2588
|
+
* @param userAssertionHash
|
|
2576
2589
|
* @param tokenType
|
|
2577
2590
|
*/
|
|
2578
|
-
CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target,
|
|
2591
|
+
CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, userAssertionHash, tokenType, keyId, requestedClaimsHash) {
|
|
2579
2592
|
var _this = this;
|
|
2580
2593
|
var allCacheKeys = this.getKeys();
|
|
2581
2594
|
var matchingCredentials = {
|
|
@@ -2594,7 +2607,7 @@ var CacheManager = /** @class */ (function () {
|
|
|
2594
2607
|
if (!entity) {
|
|
2595
2608
|
return;
|
|
2596
2609
|
}
|
|
2597
|
-
if (!!
|
|
2610
|
+
if (!!userAssertionHash && !_this.matchUserAssertionHash(entity, userAssertionHash)) {
|
|
2598
2611
|
return;
|
|
2599
2612
|
}
|
|
2600
2613
|
if (!!homeAccountId && !_this.matchHomeAccountId(entity, homeAccountId)) {
|
|
@@ -2925,7 +2938,7 @@ var CacheManager = /** @class */ (function () {
|
|
|
2925
2938
|
target: scopes.printScopesLowerCase(),
|
|
2926
2939
|
tokenType: authScheme,
|
|
2927
2940
|
keyId: request.sshKid,
|
|
2928
|
-
requestedClaimsHash: request.requestedClaimsHash
|
|
2941
|
+
requestedClaimsHash: request.requestedClaimsHash,
|
|
2929
2942
|
};
|
|
2930
2943
|
var credentialCache = this.getCredentialsFilteredBy(accessTokenFilter);
|
|
2931
2944
|
var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
|
|
@@ -2951,7 +2964,7 @@ var CacheManager = /** @class */ (function () {
|
|
|
2951
2964
|
environment: account.environment,
|
|
2952
2965
|
credentialType: CredentialType.REFRESH_TOKEN,
|
|
2953
2966
|
clientId: clientId,
|
|
2954
|
-
familyId: id
|
|
2967
|
+
familyId: id,
|
|
2955
2968
|
};
|
|
2956
2969
|
var credentialCache = this.getCredentialsFilteredBy(refreshTokenFilter);
|
|
2957
2970
|
var refreshTokens = Object.keys(credentialCache.refreshTokens).map(function (key) { return credentialCache.refreshTokens[key]; });
|
|
@@ -3003,8 +3016,8 @@ var CacheManager = /** @class */ (function () {
|
|
|
3003
3016
|
* @param value
|
|
3004
3017
|
* @param oboAssertion
|
|
3005
3018
|
*/
|
|
3006
|
-
CacheManager.prototype.
|
|
3007
|
-
return !!(entity.
|
|
3019
|
+
CacheManager.prototype.matchUserAssertionHash = function (entity, userAssertionHash) {
|
|
3020
|
+
return !!(entity.userAssertionHash && userAssertionHash === entity.userAssertionHash);
|
|
3008
3021
|
};
|
|
3009
3022
|
/**
|
|
3010
3023
|
* helper to match environment
|
|
@@ -3241,7 +3254,7 @@ var DefaultStorageClass = /** @class */ (function (_super) {
|
|
|
3241
3254
|
return DefaultStorageClass;
|
|
3242
3255
|
}(CacheManager));
|
|
3243
3256
|
|
|
3244
|
-
/*! @azure/msal-common
|
|
3257
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3245
3258
|
|
|
3246
3259
|
/*
|
|
3247
3260
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3332,10 +3345,10 @@ function buildClientConfiguration(_a) {
|
|
|
3332
3345
|
* @param authOptions
|
|
3333
3346
|
*/
|
|
3334
3347
|
function buildAuthOptions(authOptions) {
|
|
3335
|
-
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
|
|
3348
|
+
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS, skipAuthorityMetadataCache: false }, authOptions);
|
|
3336
3349
|
}
|
|
3337
3350
|
|
|
3338
|
-
/*! @azure/msal-common
|
|
3351
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3339
3352
|
|
|
3340
3353
|
/*
|
|
3341
3354
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3355,7 +3368,7 @@ var ServerError = /** @class */ (function (_super) {
|
|
|
3355
3368
|
return ServerError;
|
|
3356
3369
|
}(AuthError));
|
|
3357
3370
|
|
|
3358
|
-
/*! @azure/msal-common
|
|
3371
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3359
3372
|
|
|
3360
3373
|
/*
|
|
3361
3374
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3451,7 +3464,7 @@ var ThrottlingUtils = /** @class */ (function () {
|
|
|
3451
3464
|
return ThrottlingUtils;
|
|
3452
3465
|
}());
|
|
3453
3466
|
|
|
3454
|
-
/*! @azure/msal-common
|
|
3467
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3455
3468
|
|
|
3456
3469
|
/*
|
|
3457
3470
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3500,7 +3513,7 @@ var NetworkManager = /** @class */ (function () {
|
|
|
3500
3513
|
return NetworkManager;
|
|
3501
3514
|
}());
|
|
3502
3515
|
|
|
3503
|
-
/*! @azure/msal-common
|
|
3516
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3504
3517
|
/*
|
|
3505
3518
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3506
3519
|
* Licensed under the MIT License.
|
|
@@ -3511,7 +3524,7 @@ var CcsCredentialType;
|
|
|
3511
3524
|
CcsCredentialType["UPN"] = "UPN";
|
|
3512
3525
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3513
3526
|
|
|
3514
|
-
/*! @azure/msal-common
|
|
3527
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3515
3528
|
|
|
3516
3529
|
/*
|
|
3517
3530
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3600,7 +3613,7 @@ var BaseClient = /** @class */ (function () {
|
|
|
3600
3613
|
return BaseClient;
|
|
3601
3614
|
}());
|
|
3602
3615
|
|
|
3603
|
-
/*! @azure/msal-common
|
|
3616
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3604
3617
|
|
|
3605
3618
|
/*
|
|
3606
3619
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3686,7 +3699,7 @@ var RequestValidator = /** @class */ (function () {
|
|
|
3686
3699
|
return RequestValidator;
|
|
3687
3700
|
}());
|
|
3688
3701
|
|
|
3689
|
-
/*! @azure/msal-common
|
|
3702
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
3690
3703
|
|
|
3691
3704
|
/*
|
|
3692
3705
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3920,14 +3933,18 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3920
3933
|
* @param clientAssertion
|
|
3921
3934
|
*/
|
|
3922
3935
|
RequestParameterBuilder.prototype.addClientAssertion = function (clientAssertion) {
|
|
3923
|
-
|
|
3936
|
+
if (!StringUtils.isEmpty(clientAssertion)) {
|
|
3937
|
+
this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION, encodeURIComponent(clientAssertion));
|
|
3938
|
+
}
|
|
3924
3939
|
};
|
|
3925
3940
|
/**
|
|
3926
3941
|
* add clientAssertionType for confidential client flows
|
|
3927
3942
|
* @param clientAssertionType
|
|
3928
3943
|
*/
|
|
3929
3944
|
RequestParameterBuilder.prototype.addClientAssertionType = function (clientAssertionType) {
|
|
3930
|
-
|
|
3945
|
+
if (!StringUtils.isEmpty(clientAssertionType)) {
|
|
3946
|
+
this.parameters.set(AADServerParamKeys.CLIENT_ASSERTION_TYPE, encodeURIComponent(clientAssertionType));
|
|
3947
|
+
}
|
|
3931
3948
|
};
|
|
3932
3949
|
/**
|
|
3933
3950
|
* add OBO assertion for confidential client flows
|
|
@@ -3999,14 +4016,14 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
3999
4016
|
* @param username
|
|
4000
4017
|
*/
|
|
4001
4018
|
RequestParameterBuilder.prototype.addUsername = function (username) {
|
|
4002
|
-
this.parameters.set(PasswordGrantConstants.username, username);
|
|
4019
|
+
this.parameters.set(PasswordGrantConstants.username, encodeURIComponent(username));
|
|
4003
4020
|
};
|
|
4004
4021
|
/**
|
|
4005
4022
|
* adds `password` for Password Grant flow
|
|
4006
4023
|
* @param password
|
|
4007
4024
|
*/
|
|
4008
4025
|
RequestParameterBuilder.prototype.addPassword = function (password) {
|
|
4009
|
-
this.parameters.set(PasswordGrantConstants.password, password);
|
|
4026
|
+
this.parameters.set(PasswordGrantConstants.password, encodeURIComponent(password));
|
|
4010
4027
|
};
|
|
4011
4028
|
/**
|
|
4012
4029
|
* add pop_jwk to query params
|
|
@@ -4060,7 +4077,7 @@ var RequestParameterBuilder = /** @class */ (function () {
|
|
|
4060
4077
|
return RequestParameterBuilder;
|
|
4061
4078
|
}());
|
|
4062
4079
|
|
|
4063
|
-
/*! @azure/msal-common
|
|
4080
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4064
4081
|
|
|
4065
4082
|
/*
|
|
4066
4083
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4095,7 +4112,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4095
4112
|
* @param clientId
|
|
4096
4113
|
* @param authority
|
|
4097
4114
|
*/
|
|
4098
|
-
IdTokenEntity.createIdTokenEntity = function (homeAccountId, environment, idToken, clientId, tenantId
|
|
4115
|
+
IdTokenEntity.createIdTokenEntity = function (homeAccountId, environment, idToken, clientId, tenantId) {
|
|
4099
4116
|
var idTokenEntity = new IdTokenEntity();
|
|
4100
4117
|
idTokenEntity.credentialType = CredentialType.ID_TOKEN;
|
|
4101
4118
|
idTokenEntity.homeAccountId = homeAccountId;
|
|
@@ -4103,7 +4120,6 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4103
4120
|
idTokenEntity.clientId = clientId;
|
|
4104
4121
|
idTokenEntity.secret = idToken;
|
|
4105
4122
|
idTokenEntity.realm = tenantId;
|
|
4106
|
-
idTokenEntity.oboAssertion = oboAssertion;
|
|
4107
4123
|
return idTokenEntity;
|
|
4108
4124
|
};
|
|
4109
4125
|
/**
|
|
@@ -4125,7 +4141,7 @@ var IdTokenEntity = /** @class */ (function (_super) {
|
|
|
4125
4141
|
return IdTokenEntity;
|
|
4126
4142
|
}(CredentialEntity));
|
|
4127
4143
|
|
|
4128
|
-
/*! @azure/msal-common
|
|
4144
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4129
4145
|
/*
|
|
4130
4146
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4131
4147
|
* Licensed under the MIT License.
|
|
@@ -4175,7 +4191,7 @@ var TimeUtils = /** @class */ (function () {
|
|
|
4175
4191
|
return TimeUtils;
|
|
4176
4192
|
}());
|
|
4177
4193
|
|
|
4178
|
-
/*! @azure/msal-common
|
|
4194
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4179
4195
|
|
|
4180
4196
|
/*
|
|
4181
4197
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4221,7 +4237,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4221
4237
|
* @param expiresOn
|
|
4222
4238
|
* @param extExpiresOn
|
|
4223
4239
|
*/
|
|
4224
|
-
AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType,
|
|
4240
|
+
AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, userAssertionHash, keyId, requestedClaims, requestedClaimsHash) {
|
|
4225
4241
|
var _a, _b;
|
|
4226
4242
|
var atEntity = new AccessTokenEntity();
|
|
4227
4243
|
atEntity.homeAccountId = homeAccountId;
|
|
@@ -4242,7 +4258,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4242
4258
|
atEntity.clientId = clientId;
|
|
4243
4259
|
atEntity.realm = tenantId;
|
|
4244
4260
|
atEntity.target = scopes;
|
|
4245
|
-
atEntity.
|
|
4261
|
+
atEntity.userAssertionHash = userAssertionHash;
|
|
4246
4262
|
atEntity.tokenType = StringUtils.isEmpty(tokenType) ? exports.AuthenticationScheme.BEARER : tokenType;
|
|
4247
4263
|
if (requestedClaims) {
|
|
4248
4264
|
atEntity.requestedClaims = requestedClaims;
|
|
@@ -4289,7 +4305,7 @@ var AccessTokenEntity = /** @class */ (function (_super) {
|
|
|
4289
4305
|
return AccessTokenEntity;
|
|
4290
4306
|
}(CredentialEntity));
|
|
4291
4307
|
|
|
4292
|
-
/*! @azure/msal-common
|
|
4308
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4293
4309
|
|
|
4294
4310
|
/*
|
|
4295
4311
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4326,14 +4342,14 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
|
|
|
4326
4342
|
* @param clientId
|
|
4327
4343
|
* @param authority
|
|
4328
4344
|
*/
|
|
4329
|
-
RefreshTokenEntity.createRefreshTokenEntity = function (homeAccountId, environment, refreshToken, clientId, familyId,
|
|
4345
|
+
RefreshTokenEntity.createRefreshTokenEntity = function (homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash) {
|
|
4330
4346
|
var rtEntity = new RefreshTokenEntity();
|
|
4331
4347
|
rtEntity.clientId = clientId;
|
|
4332
4348
|
rtEntity.credentialType = CredentialType.REFRESH_TOKEN;
|
|
4333
4349
|
rtEntity.environment = environment;
|
|
4334
4350
|
rtEntity.homeAccountId = homeAccountId;
|
|
4335
4351
|
rtEntity.secret = refreshToken;
|
|
4336
|
-
rtEntity.
|
|
4352
|
+
rtEntity.userAssertionHash = userAssertionHash;
|
|
4337
4353
|
if (familyId)
|
|
4338
4354
|
rtEntity.familyId = familyId;
|
|
4339
4355
|
return rtEntity;
|
|
@@ -4356,7 +4372,7 @@ var RefreshTokenEntity = /** @class */ (function (_super) {
|
|
|
4356
4372
|
return RefreshTokenEntity;
|
|
4357
4373
|
}(CredentialEntity));
|
|
4358
4374
|
|
|
4359
|
-
/*! @azure/msal-common
|
|
4375
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4360
4376
|
|
|
4361
4377
|
/*
|
|
4362
4378
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4384,6 +4400,10 @@ var InteractionRequiredAuthErrorMessage = {
|
|
|
4384
4400
|
noTokensFoundError: {
|
|
4385
4401
|
code: "no_tokens_found",
|
|
4386
4402
|
desc: "No refresh token found in the cache. Please sign-in."
|
|
4403
|
+
},
|
|
4404
|
+
native_account_unavailable: {
|
|
4405
|
+
code: "native_account_unavailable",
|
|
4406
|
+
desc: "The requested account is not available in the native broker. It may have been deleted or logged out. Please sign-in again using an interactive API."
|
|
4387
4407
|
}
|
|
4388
4408
|
};
|
|
4389
4409
|
/**
|
|
@@ -4417,10 +4437,17 @@ var InteractionRequiredAuthError = /** @class */ (function (_super) {
|
|
|
4417
4437
|
InteractionRequiredAuthError.createNoTokensFoundError = function () {
|
|
4418
4438
|
return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.noTokensFoundError.code, InteractionRequiredAuthErrorMessage.noTokensFoundError.desc);
|
|
4419
4439
|
};
|
|
4440
|
+
/**
|
|
4441
|
+
* Creates an error thrown when the native broker returns ACCOUNT_UNAVAILABLE status, indicating that the account was removed and interactive sign-in is required
|
|
4442
|
+
* @returns
|
|
4443
|
+
*/
|
|
4444
|
+
InteractionRequiredAuthError.createNativeAccountUnavailableError = function () {
|
|
4445
|
+
return new InteractionRequiredAuthError(InteractionRequiredAuthErrorMessage.native_account_unavailable.code, InteractionRequiredAuthErrorMessage.native_account_unavailable.desc);
|
|
4446
|
+
};
|
|
4420
4447
|
return InteractionRequiredAuthError;
|
|
4421
4448
|
}(AuthError));
|
|
4422
4449
|
|
|
4423
|
-
/*! @azure/msal-common
|
|
4450
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4424
4451
|
/*
|
|
4425
4452
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4426
4453
|
* Licensed under the MIT License.
|
|
@@ -4436,7 +4463,7 @@ var CacheRecord = /** @class */ (function () {
|
|
|
4436
4463
|
return CacheRecord;
|
|
4437
4464
|
}());
|
|
4438
4465
|
|
|
4439
|
-
/*! @azure/msal-common
|
|
4466
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4440
4467
|
|
|
4441
4468
|
/*
|
|
4442
4469
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4507,7 +4534,7 @@ var ProtocolUtils = /** @class */ (function () {
|
|
|
4507
4534
|
return ProtocolUtils;
|
|
4508
4535
|
}());
|
|
4509
4536
|
|
|
4510
|
-
/*! @azure/msal-common
|
|
4537
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4511
4538
|
|
|
4512
4539
|
/*
|
|
4513
4540
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4708,7 +4735,7 @@ var UrlString = /** @class */ (function () {
|
|
|
4708
4735
|
return UrlString;
|
|
4709
4736
|
}());
|
|
4710
4737
|
|
|
4711
|
-
/*! @azure/msal-common
|
|
4738
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4712
4739
|
|
|
4713
4740
|
/*
|
|
4714
4741
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4725,34 +4752,30 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4725
4752
|
}
|
|
4726
4753
|
/**
|
|
4727
4754
|
* Generates the req_cnf validated at the RP in the POP protocol for SHR parameters
|
|
4755
|
+
* and returns an object containing the keyid, the full req_cnf string and the req_cnf string hash
|
|
4728
4756
|
* @param request
|
|
4729
4757
|
* @returns
|
|
4730
4758
|
*/
|
|
4731
4759
|
PopTokenGenerator.prototype.generateCnf = function (request) {
|
|
4732
4760
|
return __awaiter(this, void 0, void 0, function () {
|
|
4733
|
-
var reqCnf;
|
|
4734
|
-
return __generator(this, function (
|
|
4735
|
-
switch (
|
|
4761
|
+
var reqCnf, reqCnfString, _a;
|
|
4762
|
+
return __generator(this, function (_b) {
|
|
4763
|
+
switch (_b.label) {
|
|
4736
4764
|
case 0: return [4 /*yield*/, this.generateKid(request)];
|
|
4737
4765
|
case 1:
|
|
4738
|
-
reqCnf =
|
|
4739
|
-
|
|
4766
|
+
reqCnf = _b.sent();
|
|
4767
|
+
reqCnfString = this.cryptoUtils.base64Encode(JSON.stringify(reqCnf));
|
|
4768
|
+
_a = {
|
|
4769
|
+
kid: reqCnf.kid,
|
|
4770
|
+
reqCnfString: reqCnfString
|
|
4771
|
+
};
|
|
4772
|
+
return [4 /*yield*/, this.cryptoUtils.hashString(reqCnfString)];
|
|
4773
|
+
case 2: return [2 /*return*/, (_a.reqCnfHash = _b.sent(),
|
|
4774
|
+
_a)];
|
|
4740
4775
|
}
|
|
4741
4776
|
});
|
|
4742
4777
|
});
|
|
4743
4778
|
};
|
|
4744
|
-
/**
|
|
4745
|
-
* Generates the hash of the req_cnf
|
|
4746
|
-
* @param cnf
|
|
4747
|
-
* @returns
|
|
4748
|
-
*/
|
|
4749
|
-
PopTokenGenerator.prototype.generateCnfHash = function (cnf) {
|
|
4750
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
4751
|
-
return __generator(this, function (_a) {
|
|
4752
|
-
return [2 /*return*/, this.cryptoUtils.hashString(cnf)];
|
|
4753
|
-
});
|
|
4754
|
-
});
|
|
4755
|
-
};
|
|
4756
4779
|
/**
|
|
4757
4780
|
* Generates key_id for a SHR token request
|
|
4758
4781
|
* @param request
|
|
@@ -4780,16 +4803,10 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4780
4803
|
* @param request
|
|
4781
4804
|
* @returns
|
|
4782
4805
|
*/
|
|
4783
|
-
PopTokenGenerator.prototype.signPopToken = function (accessToken, request) {
|
|
4784
|
-
var _a;
|
|
4806
|
+
PopTokenGenerator.prototype.signPopToken = function (accessToken, keyId, request) {
|
|
4785
4807
|
return __awaiter(this, void 0, void 0, function () {
|
|
4786
|
-
|
|
4787
|
-
|
|
4788
|
-
tokenClaims = AuthToken.extractTokenClaims(accessToken, this.cryptoUtils);
|
|
4789
|
-
if (!((_a = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _a === void 0 ? void 0 : _a.kid)) {
|
|
4790
|
-
throw ClientAuthError.createTokenClaimsRequiredError();
|
|
4791
|
-
}
|
|
4792
|
-
return [2 /*return*/, this.signPayload(accessToken, tokenClaims.cnf.kid, request)];
|
|
4808
|
+
return __generator(this, function (_a) {
|
|
4809
|
+
return [2 /*return*/, this.signPayload(accessToken, keyId, request)];
|
|
4793
4810
|
});
|
|
4794
4811
|
});
|
|
4795
4812
|
};
|
|
@@ -4801,7 +4818,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4801
4818
|
* @param claims
|
|
4802
4819
|
* @returns
|
|
4803
4820
|
*/
|
|
4804
|
-
PopTokenGenerator.prototype.signPayload = function (payload,
|
|
4821
|
+
PopTokenGenerator.prototype.signPayload = function (payload, keyId, request, claims) {
|
|
4805
4822
|
return __awaiter(this, void 0, void 0, function () {
|
|
4806
4823
|
var resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, resourceUrlString, resourceUrlComponents;
|
|
4807
4824
|
return __generator(this, function (_a) {
|
|
@@ -4810,7 +4827,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4810
4827
|
resourceRequestMethod = request.resourceRequestMethod, resourceRequestUri = request.resourceRequestUri, shrClaims = request.shrClaims, shrNonce = request.shrNonce;
|
|
4811
4828
|
resourceUrlString = (resourceRequestUri) ? new UrlString(resourceRequestUri) : undefined;
|
|
4812
4829
|
resourceUrlComponents = resourceUrlString === null || resourceUrlString === void 0 ? void 0 : resourceUrlString.getUrlComponents();
|
|
4813
|
-
return [4 /*yield*/, this.cryptoUtils.signJwt(__assign({ at: payload, ts: TimeUtils.nowSeconds(), m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(), u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort, nonce: shrNonce || this.cryptoUtils.createNewGuid(), p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath, q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined, client_claims: shrClaims || undefined }, claims),
|
|
4830
|
+
return [4 /*yield*/, this.cryptoUtils.signJwt(__assign({ at: payload, ts: TimeUtils.nowSeconds(), m: resourceRequestMethod === null || resourceRequestMethod === void 0 ? void 0 : resourceRequestMethod.toUpperCase(), u: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.HostNameAndPort, nonce: shrNonce || this.cryptoUtils.createNewGuid(), p: resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.AbsolutePath, q: (resourceUrlComponents === null || resourceUrlComponents === void 0 ? void 0 : resourceUrlComponents.QueryString) ? [[], resourceUrlComponents.QueryString] : undefined, client_claims: shrClaims || undefined }, claims), keyId, request.correlationId)];
|
|
4814
4831
|
case 1: return [2 /*return*/, _a.sent()];
|
|
4815
4832
|
}
|
|
4816
4833
|
});
|
|
@@ -4819,7 +4836,7 @@ var PopTokenGenerator = /** @class */ (function () {
|
|
|
4819
4836
|
return PopTokenGenerator;
|
|
4820
4837
|
}());
|
|
4821
4838
|
|
|
4822
|
-
/*! @azure/msal-common
|
|
4839
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4823
4840
|
|
|
4824
4841
|
/*
|
|
4825
4842
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4889,7 +4906,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
4889
4906
|
return AppMetadataEntity;
|
|
4890
4907
|
}());
|
|
4891
4908
|
|
|
4892
|
-
/*! @azure/msal-common
|
|
4909
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4893
4910
|
/*
|
|
4894
4911
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4895
4912
|
* Licensed under the MIT License.
|
|
@@ -4925,7 +4942,7 @@ var AppMetadataEntity = /** @class */ (function () {
|
|
|
4925
4942
|
return TokenCacheContext;
|
|
4926
4943
|
}());
|
|
4927
4944
|
|
|
4928
|
-
/*! @azure/msal-common
|
|
4945
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
4929
4946
|
|
|
4930
4947
|
/*
|
|
4931
4948
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4986,7 +5003,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
4986
5003
|
* @param serverTokenResponse
|
|
4987
5004
|
* @param authority
|
|
4988
5005
|
*/
|
|
4989
|
-
ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload,
|
|
5006
|
+
ResponseHandler.prototype.handleServerTokenResponse = function (serverTokenResponse, authority, reqTimestamp, request, authCodePayload, userAssertionHash, handlingRefreshTokenResponse) {
|
|
4990
5007
|
return __awaiter(this, void 0, void 0, function () {
|
|
4991
5008
|
var idTokenObj, requestStateObj, cacheRecord, cacheContext, key, account;
|
|
4992
5009
|
return __generator(this, function (_a) {
|
|
@@ -5008,7 +5025,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5008
5025
|
}
|
|
5009
5026
|
// Add keyId from request to serverTokenResponse if defined
|
|
5010
5027
|
serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;
|
|
5011
|
-
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj,
|
|
5028
|
+
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload);
|
|
5012
5029
|
_a.label = 1;
|
|
5013
5030
|
case 1:
|
|
5014
5031
|
_a.trys.push([1, , 5, 8]);
|
|
@@ -5056,7 +5073,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5056
5073
|
* @param idTokenObj
|
|
5057
5074
|
* @param authority
|
|
5058
5075
|
*/
|
|
5059
|
-
ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, request, idTokenObj,
|
|
5076
|
+
ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, request, idTokenObj, userAssertionHash, authCodePayload) {
|
|
5060
5077
|
var env = authority.getPreferredCache();
|
|
5061
5078
|
if (StringUtils.isEmpty(env)) {
|
|
5062
5079
|
throw ClientAuthError.createInvalidCacheEnvironmentError();
|
|
@@ -5065,8 +5082,8 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5065
5082
|
var cachedIdToken;
|
|
5066
5083
|
var cachedAccount;
|
|
5067
5084
|
if (!StringUtils.isEmpty(serverTokenResponse.id_token) && !!idTokenObj) {
|
|
5068
|
-
cachedIdToken = IdTokenEntity.createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token || Constants.EMPTY_STRING, this.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING
|
|
5069
|
-
cachedAccount = this.generateAccountEntity(serverTokenResponse, idTokenObj, authority,
|
|
5085
|
+
cachedIdToken = IdTokenEntity.createIdTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.id_token || Constants.EMPTY_STRING, this.clientId, idTokenObj.claims.tid || Constants.EMPTY_STRING);
|
|
5086
|
+
cachedAccount = this.generateAccountEntity(serverTokenResponse, idTokenObj, authority, authCodePayload);
|
|
5070
5087
|
}
|
|
5071
5088
|
// AccessToken
|
|
5072
5089
|
var cachedAccessToken = null;
|
|
@@ -5084,12 +5101,12 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5084
5101
|
var extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;
|
|
5085
5102
|
var refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;
|
|
5086
5103
|
// non AAD scenarios can have empty realm
|
|
5087
|
-
cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token || Constants.EMPTY_STRING, this.clientId, idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj, refreshOnSeconds, serverTokenResponse.token_type,
|
|
5104
|
+
cachedAccessToken = AccessTokenEntity.createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token || Constants.EMPTY_STRING, this.clientId, idTokenObj ? idTokenObj.claims.tid || Constants.EMPTY_STRING : authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);
|
|
5088
5105
|
}
|
|
5089
5106
|
// refreshToken
|
|
5090
5107
|
var cachedRefreshToken = null;
|
|
5091
5108
|
if (!StringUtils.isEmpty(serverTokenResponse.refresh_token)) {
|
|
5092
|
-
cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.refresh_token || Constants.EMPTY_STRING, this.clientId, serverTokenResponse.foci,
|
|
5109
|
+
cachedRefreshToken = RefreshTokenEntity.createRefreshTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.refresh_token || Constants.EMPTY_STRING, this.clientId, serverTokenResponse.foci, userAssertionHash);
|
|
5093
5110
|
}
|
|
5094
5111
|
// appMetadata
|
|
5095
5112
|
var cachedAppMetadata = null;
|
|
@@ -5104,22 +5121,22 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5104
5121
|
* @param idToken
|
|
5105
5122
|
* @param authority
|
|
5106
5123
|
*/
|
|
5107
|
-
ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority,
|
|
5124
|
+
ResponseHandler.prototype.generateAccountEntity = function (serverTokenResponse, idToken, authority, authCodePayload) {
|
|
5108
5125
|
var authorityType = authority.authorityType;
|
|
5109
5126
|
var cloudGraphHostName = authCodePayload ? authCodePayload.cloud_graph_host_name : Constants.EMPTY_STRING;
|
|
5110
5127
|
var msGraphhost = authCodePayload ? authCodePayload.msgraph_host : Constants.EMPTY_STRING;
|
|
5111
5128
|
// ADFS does not require client_info in the response
|
|
5112
5129
|
if (authorityType === AuthorityType.Adfs) {
|
|
5113
5130
|
this.logger.verbose("Authority type is ADFS, creating ADFS account");
|
|
5114
|
-
return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority,
|
|
5131
|
+
return AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);
|
|
5115
5132
|
}
|
|
5116
5133
|
// This fallback applies to B2C as well as they fall under an AAD account type.
|
|
5117
5134
|
if (StringUtils.isEmpty(serverTokenResponse.client_info) && authority.protocolMode === "AAD") {
|
|
5118
5135
|
throw ClientAuthError.createClientInfoEmptyError();
|
|
5119
5136
|
}
|
|
5120
5137
|
return serverTokenResponse.client_info ?
|
|
5121
|
-
AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority,
|
|
5122
|
-
AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority,
|
|
5138
|
+
AccountEntity.createAccount(serverTokenResponse.client_info, this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost) :
|
|
5139
|
+
AccountEntity.createGenericAccount(this.homeAccountIdentifier, idToken, authority, cloudGraphHostName, msGraphhost);
|
|
5123
5140
|
};
|
|
5124
5141
|
/**
|
|
5125
5142
|
* Creates an @AuthenticationResult from @CacheRecord , @IdToken , and a boolean that states whether or not the result is from cache.
|
|
@@ -5134,9 +5151,9 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5134
5151
|
ResponseHandler.generateAuthenticationResult = function (cryptoObj, authority, cacheRecord, fromTokenCache, request, idTokenObj, requestState, code) {
|
|
5135
5152
|
var _a, _b, _c;
|
|
5136
5153
|
return __awaiter(this, void 0, void 0, function () {
|
|
5137
|
-
var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, uid, tid;
|
|
5138
|
-
return __generator(this, function (
|
|
5139
|
-
switch (
|
|
5154
|
+
var accessToken, responseScopes, expiresOn, extExpiresOn, familyId, popTokenGenerator, _d, secret, keyId, uid, tid;
|
|
5155
|
+
return __generator(this, function (_e) {
|
|
5156
|
+
switch (_e.label) {
|
|
5140
5157
|
case 0:
|
|
5141
5158
|
accessToken = Constants.EMPTY_STRING;
|
|
5142
5159
|
responseScopes = [];
|
|
@@ -5145,18 +5162,22 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5145
5162
|
if (!cacheRecord.accessToken) return [3 /*break*/, 4];
|
|
5146
5163
|
if (!(cacheRecord.accessToken.tokenType === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
5147
5164
|
popTokenGenerator = new PopTokenGenerator(cryptoObj);
|
|
5148
|
-
|
|
5165
|
+
_d = cacheRecord.accessToken, secret = _d.secret, keyId = _d.keyId;
|
|
5166
|
+
if (!keyId) {
|
|
5167
|
+
throw ClientAuthError.createKeyIdMissingError();
|
|
5168
|
+
}
|
|
5169
|
+
return [4 /*yield*/, popTokenGenerator.signPopToken(secret, keyId, request)];
|
|
5149
5170
|
case 1:
|
|
5150
|
-
accessToken =
|
|
5171
|
+
accessToken = _e.sent();
|
|
5151
5172
|
return [3 /*break*/, 3];
|
|
5152
5173
|
case 2:
|
|
5153
5174
|
accessToken = cacheRecord.accessToken.secret;
|
|
5154
|
-
|
|
5175
|
+
_e.label = 3;
|
|
5155
5176
|
case 3:
|
|
5156
5177
|
responseScopes = ScopeSet.fromString(cacheRecord.accessToken.target).asArray();
|
|
5157
5178
|
expiresOn = new Date(Number(cacheRecord.accessToken.expiresOn) * 1000);
|
|
5158
5179
|
extExpiresOn = new Date(Number(cacheRecord.accessToken.extendedExpiresOn) * 1000);
|
|
5159
|
-
|
|
5180
|
+
_e.label = 4;
|
|
5160
5181
|
case 4:
|
|
5161
5182
|
if (cacheRecord.appMetadata) {
|
|
5162
5183
|
familyId = cacheRecord.appMetadata.familyId === THE_FAMILY_ID ? THE_FAMILY_ID : Constants.EMPTY_STRING;
|
|
@@ -5191,7 +5212,7 @@ var ResponseHandler = /** @class */ (function () {
|
|
|
5191
5212
|
return ResponseHandler;
|
|
5192
5213
|
}());
|
|
5193
5214
|
|
|
5194
|
-
/*! @azure/msal-common
|
|
5215
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
5195
5216
|
|
|
5196
5217
|
/*
|
|
5197
5218
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5358,7 +5379,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5358
5379
|
*/
|
|
5359
5380
|
AuthorizationCodeClient.prototype.createTokenRequestBody = function (request) {
|
|
5360
5381
|
return __awaiter(this, void 0, void 0, function () {
|
|
5361
|
-
var parameterBuilder, clientAssertion, popTokenGenerator,
|
|
5382
|
+
var parameterBuilder, clientAssertion, popTokenGenerator, reqCnfData, correlationId, ccsCred, clientInfo, clientInfo;
|
|
5362
5383
|
var _a;
|
|
5363
5384
|
return __generator(this, function (_b) {
|
|
5364
5385
|
switch (_b.label) {
|
|
@@ -5406,8 +5427,9 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5406
5427
|
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5407
5428
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5408
5429
|
case 1:
|
|
5409
|
-
|
|
5410
|
-
|
|
5430
|
+
reqCnfData = _b.sent();
|
|
5431
|
+
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5432
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5411
5433
|
return [3 /*break*/, 3];
|
|
5412
5434
|
case 2:
|
|
5413
5435
|
if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
|
|
@@ -5478,7 +5500,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5478
5500
|
*/
|
|
5479
5501
|
AuthorizationCodeClient.prototype.createAuthCodeUrlQueryString = function (request) {
|
|
5480
5502
|
return __awaiter(this, void 0, void 0, function () {
|
|
5481
|
-
var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator,
|
|
5503
|
+
var parameterBuilder, requestScopes, correlationId, accountSid, clientInfo, clientInfo, popTokenGenerator, reqCnfData;
|
|
5482
5504
|
return __generator(this, function (_a) {
|
|
5483
5505
|
switch (_a.label) {
|
|
5484
5506
|
case 0:
|
|
@@ -5570,20 +5592,17 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5570
5592
|
if (request.extraQueryParameters) {
|
|
5571
5593
|
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5572
5594
|
}
|
|
5573
|
-
if (!request.nativeBroker) return [3 /*break*/,
|
|
5595
|
+
if (!request.nativeBroker) return [3 /*break*/, 2];
|
|
5574
5596
|
// signal ests that this is a WAM call
|
|
5575
5597
|
parameterBuilder.addNativeBroker();
|
|
5576
|
-
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/,
|
|
5598
|
+
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
5577
5599
|
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5578
5600
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5579
5601
|
case 1:
|
|
5580
|
-
|
|
5581
|
-
|
|
5582
|
-
|
|
5583
|
-
|
|
5584
|
-
parameterBuilder.addPopToken(cnfHash);
|
|
5585
|
-
_a.label = 3;
|
|
5586
|
-
case 3: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
5602
|
+
reqCnfData = _a.sent();
|
|
5603
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfHash);
|
|
5604
|
+
_a.label = 2;
|
|
5605
|
+
case 2: return [2 /*return*/, parameterBuilder.createQueryString()];
|
|
5587
5606
|
}
|
|
5588
5607
|
});
|
|
5589
5608
|
});
|
|
@@ -5628,7 +5647,7 @@ var AuthorizationCodeClient = /** @class */ (function (_super) {
|
|
|
5628
5647
|
return AuthorizationCodeClient;
|
|
5629
5648
|
}(BaseClient));
|
|
5630
5649
|
|
|
5631
|
-
/*! @azure/msal-common
|
|
5650
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
5632
5651
|
|
|
5633
5652
|
/*
|
|
5634
5653
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5769,7 +5788,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5769
5788
|
*/
|
|
5770
5789
|
RefreshTokenClient.prototype.createTokenRequestBody = function (request) {
|
|
5771
5790
|
return __awaiter(this, void 0, void 0, function () {
|
|
5772
|
-
var parameterBuilder, correlationId, clientAssertion, popTokenGenerator,
|
|
5791
|
+
var parameterBuilder, correlationId, clientAssertion, popTokenGenerator, reqCnfData, clientInfo;
|
|
5773
5792
|
return __generator(this, function (_a) {
|
|
5774
5793
|
switch (_a.label) {
|
|
5775
5794
|
case 0:
|
|
@@ -5799,8 +5818,9 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5799
5818
|
popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);
|
|
5800
5819
|
return [4 /*yield*/, popTokenGenerator.generateCnf(request)];
|
|
5801
5820
|
case 1:
|
|
5802
|
-
|
|
5803
|
-
|
|
5821
|
+
reqCnfData = _a.sent();
|
|
5822
|
+
// SPA PoP requires full Base64Url encoded req_cnf string (unhashed)
|
|
5823
|
+
parameterBuilder.addPopToken(reqCnfData.reqCnfString);
|
|
5804
5824
|
return [3 /*break*/, 3];
|
|
5805
5825
|
case 2:
|
|
5806
5826
|
if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
|
|
@@ -5840,7 +5860,7 @@ var RefreshTokenClient = /** @class */ (function (_super) {
|
|
|
5840
5860
|
return RefreshTokenClient;
|
|
5841
5861
|
}(BaseClient));
|
|
5842
5862
|
|
|
5843
|
-
/*! @azure/msal-common
|
|
5863
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
5844
5864
|
|
|
5845
5865
|
/*
|
|
5846
5866
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5956,7 +5976,7 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
5956
5976
|
return SilentFlowClient;
|
|
5957
5977
|
}(BaseClient));
|
|
5958
5978
|
|
|
5959
|
-
/*! @azure/msal-common
|
|
5979
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
5960
5980
|
/*
|
|
5961
5981
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5962
5982
|
* Licensed under the MIT License.
|
|
@@ -5964,10 +5984,20 @@ var SilentFlowClient = /** @class */ (function (_super) {
|
|
|
5964
5984
|
function isOpenIdConfigResponse(response) {
|
|
5965
5985
|
return (response.hasOwnProperty("authorization_endpoint") &&
|
|
5966
5986
|
response.hasOwnProperty("token_endpoint") &&
|
|
5967
|
-
response.hasOwnProperty("issuer")
|
|
5987
|
+
response.hasOwnProperty("issuer") &&
|
|
5988
|
+
response.hasOwnProperty("jwks_uri"));
|
|
5968
5989
|
}
|
|
5969
5990
|
|
|
5970
|
-
/*! @azure/msal-common
|
|
5991
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
5992
|
+
/*
|
|
5993
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5994
|
+
* Licensed under the MIT License.
|
|
5995
|
+
*/
|
|
5996
|
+
var rawMetdataJSON = { "endpointMetadata": { "https://login.microsoftonline.com/common/": { "token_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/common/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/common/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/common/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, "https://login.chinacloudapi.cn/common/": { "token_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.chinacloudapi.cn/common/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.partner.microsoftonline.cn/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo", "authorization_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.chinacloudapi.cn/common/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.chinacloudapi.cn/common/kerberos", "tenant_region_scope": null, "cloud_instance_name": "partner.microsoftonline.cn", "cloud_graph_host_name": "graph.chinacloudapi.cn", "msgraph_host": "microsoftgraph.chinacloudapi.cn", "rbac_url": "https://pas.chinacloudapi.cn" }, "https://login.microsoftonline.us/common/": { "token_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.us/common/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.us/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.us/common/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.us/common/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.us", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pasff.usgovcloudapi.net" }, "https://login.microsoftonline.com/consumers/": { "token_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/consumers/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/consumers/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/consumers/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, "https://login.chinacloudapi.cn/consumers/": { "token_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo", "authorization_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.chinacloudapi.cn/consumers/kerberos", "tenant_region_scope": null, "cloud_instance_name": "partner.microsoftonline.cn", "cloud_graph_host_name": "graph.chinacloudapi.cn", "msgraph_host": "microsoftgraph.chinacloudapi.cn", "rbac_url": "https://pas.chinacloudapi.cn" }, "https://login.microsoftonline.us/consumers/": { "token_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.us/consumers/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.us/consumers/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.us/consumers/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.us", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pasff.usgovcloudapi.net" }, "https://login.microsoftonline.com/organizations/": { "token_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.com/organizations/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.com/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.com/organizations/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.com/organizations/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.com", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pas.windows.net" }, "https://login.chinacloudapi.cn/organizations/": { "token_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.partner.microsoftonline.cn/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo", "authorization_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.chinacloudapi.cn/organizations/kerberos", "tenant_region_scope": null, "cloud_instance_name": "partner.microsoftonline.cn", "cloud_graph_host_name": "graph.chinacloudapi.cn", "msgraph_host": "microsoftgraph.chinacloudapi.cn", "rbac_url": "https://pas.chinacloudapi.cn" }, "https://login.microsoftonline.us/organizations/": { "token_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/token", "token_endpoint_auth_methods_supported": ["client_secret_post", "private_key_jwt", "client_secret_basic"], "jwks_uri": "https://login.microsoftonline.us/organizations/discovery/v2.0/keys", "response_modes_supported": ["query", "fragment", "form_post"], "subject_types_supported": ["pairwise"], "id_token_signing_alg_values_supported": ["RS256"], "response_types_supported": ["code", "id_token", "code id_token", "id_token token"], "scopes_supported": ["openid", "profile", "email", "offline_access"], "issuer": "https://login.microsoftonline.us/{tenantid}/v2.0", "request_uri_parameter_supported": false, "userinfo_endpoint": "https://graph.microsoft.com/oidc/userinfo", "authorization_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize", "device_authorization_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode", "http_logout_supported": true, "frontchannel_logout_supported": true, "end_session_endpoint": "https://login.microsoftonline.us/organizations/oauth2/v2.0/logout", "claims_supported": ["sub", "iss", "cloud_instance_name", "cloud_instance_host_name", "cloud_graph_host_name", "msgraph_host", "aud", "exp", "iat", "auth_time", "acr", "nonce", "preferred_username", "name", "tid", "ver", "at_hash", "c_hash", "email"], "kerberos_endpoint": "https://login.microsoftonline.us/organizations/kerberos", "tenant_region_scope": null, "cloud_instance_name": "microsoftonline.us", "cloud_graph_host_name": "graph.windows.net", "msgraph_host": "graph.microsoft.com", "rbac_url": "https://pasff.usgovcloudapi.net" } }, "instanceDiscoveryMetadata": { "https://login.microsoftonline.com/common/": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.chinacloudapi.cn/common/": { "tenant_discovery_endpoint": "https://login.chinacloudapi.cn/common/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.us/common/": { "tenant_discovery_endpoint": "https://login.microsoftonline.us/common/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.com/consumers/": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/consumers/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.chinacloudapi.cn/consumers/": { "tenant_discovery_endpoint": "https://login.chinacloudapi.cn/consumers/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.us/consumers/": { "tenant_discovery_endpoint": "https://login.microsoftonline.us/consumers/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.com/organizations/": { "tenant_discovery_endpoint": "https://login.microsoftonline.com/organizations/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.chinacloudapi.cn/organizations/": { "tenant_discovery_endpoint": "https://login.chinacloudapi.cn/organizations/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] }, "https://login.microsoftonline.us/organizations/": { "tenant_discovery_endpoint": "https://login.microsoftonline.us/organizations/v2.0/.well-known/openid-configuration", "api-version": "1.1", "metadata": [{ "preferred_network": "login.microsoftonline.com", "preferred_cache": "login.windows.net", "aliases": ["login.microsoftonline.com", "login.windows.net", "login.microsoft.com", "sts.windows.net"] }, { "preferred_network": "login.partner.microsoftonline.cn", "preferred_cache": "login.partner.microsoftonline.cn", "aliases": ["login.partner.microsoftonline.cn", "login.chinacloudapi.cn"] }, { "preferred_network": "login.microsoftonline.de", "preferred_cache": "login.microsoftonline.de", "aliases": ["login.microsoftonline.de"] }, { "preferred_network": "login.microsoftonline.us", "preferred_cache": "login.microsoftonline.us", "aliases": ["login.microsoftonline.us", "login.usgovcloudapi.net"] }, { "preferred_network": "login-us.microsoftonline.com", "preferred_cache": "login-us.microsoftonline.com", "aliases": ["login-us.microsoftonline.com"] }] } } };
|
|
5997
|
+
var EndpointMetadata = rawMetdataJSON.endpointMetadata;
|
|
5998
|
+
var InstanceDiscoveryMetadata = rawMetdataJSON.instanceDiscoveryMetadata;
|
|
5999
|
+
|
|
6000
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
5971
6001
|
/*
|
|
5972
6002
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5973
6003
|
* Licensed under the MIT License.
|
|
@@ -5981,7 +6011,7 @@ exports.ProtocolMode = void 0;
|
|
|
5981
6011
|
ProtocolMode["OIDC"] = "OIDC";
|
|
5982
6012
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
5983
6013
|
|
|
5984
|
-
/*! @azure/msal-common
|
|
6014
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
5985
6015
|
|
|
5986
6016
|
/*
|
|
5987
6017
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6013,6 +6043,7 @@ var AuthorityMetadataEntity = /** @class */ (function () {
|
|
|
6013
6043
|
this.end_session_endpoint = metadata.end_session_endpoint;
|
|
6014
6044
|
this.issuer = metadata.issuer;
|
|
6015
6045
|
this.endpointsFromNetwork = fromNetwork;
|
|
6046
|
+
this.jwks_uri = metadata.jwks_uri;
|
|
6016
6047
|
};
|
|
6017
6048
|
/**
|
|
6018
6049
|
* Save the authority that was used to create this cache entry
|
|
@@ -6051,12 +6082,13 @@ var AuthorityMetadataEntity = /** @class */ (function () {
|
|
|
6051
6082
|
entity.hasOwnProperty("issuer") &&
|
|
6052
6083
|
entity.hasOwnProperty("aliasesFromNetwork") &&
|
|
6053
6084
|
entity.hasOwnProperty("endpointsFromNetwork") &&
|
|
6054
|
-
entity.hasOwnProperty("expiresAt")
|
|
6085
|
+
entity.hasOwnProperty("expiresAt") &&
|
|
6086
|
+
entity.hasOwnProperty("jwks_uri"));
|
|
6055
6087
|
};
|
|
6056
6088
|
return AuthorityMetadataEntity;
|
|
6057
6089
|
}());
|
|
6058
6090
|
|
|
6059
|
-
/*! @azure/msal-common
|
|
6091
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6060
6092
|
/*
|
|
6061
6093
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6062
6094
|
* Licensed under the MIT License.
|
|
@@ -6066,7 +6098,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
6066
6098
|
response.hasOwnProperty("metadata"));
|
|
6067
6099
|
}
|
|
6068
6100
|
|
|
6069
|
-
/*! @azure/msal-common
|
|
6101
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6070
6102
|
|
|
6071
6103
|
/*
|
|
6072
6104
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6188,7 +6220,7 @@ var RegionDiscovery = /** @class */ (function () {
|
|
|
6188
6220
|
return RegionDiscovery;
|
|
6189
6221
|
}());
|
|
6190
6222
|
|
|
6191
|
-
/*! @azure/msal-common
|
|
6223
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6192
6224
|
|
|
6193
6225
|
/*
|
|
6194
6226
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6373,6 +6405,22 @@ var Authority = /** @class */ (function () {
|
|
|
6373
6405
|
enumerable: false,
|
|
6374
6406
|
configurable: true
|
|
6375
6407
|
});
|
|
6408
|
+
Object.defineProperty(Authority.prototype, "jwksUri", {
|
|
6409
|
+
/**
|
|
6410
|
+
* Jwks_uri for token signing keys
|
|
6411
|
+
*/
|
|
6412
|
+
get: function () {
|
|
6413
|
+
if (this.discoveryComplete()) {
|
|
6414
|
+
var endpoint = this.replacePath(this.metadata.jwks_uri);
|
|
6415
|
+
return this.replaceTenant(endpoint);
|
|
6416
|
+
}
|
|
6417
|
+
else {
|
|
6418
|
+
throw ClientAuthError.createEndpointDiscoveryIncompleteError("Discovery incomplete.");
|
|
6419
|
+
}
|
|
6420
|
+
},
|
|
6421
|
+
enumerable: false,
|
|
6422
|
+
configurable: true
|
|
6423
|
+
});
|
|
6376
6424
|
/**
|
|
6377
6425
|
* Replaces tenant in url path with current tenant. Defaults to common.
|
|
6378
6426
|
* @param urlString
|
|
@@ -6456,11 +6504,11 @@ var Authority = /** @class */ (function () {
|
|
|
6456
6504
|
* @param metadataEntity
|
|
6457
6505
|
*/
|
|
6458
6506
|
Authority.prototype.updateEndpointMetadata = function (metadataEntity) {
|
|
6459
|
-
var _a;
|
|
6507
|
+
var _a, _b;
|
|
6460
6508
|
return __awaiter(this, void 0, void 0, function () {
|
|
6461
|
-
var metadata,
|
|
6462
|
-
return __generator(this, function (
|
|
6463
|
-
switch (
|
|
6509
|
+
var metadata, harcodedMetadata;
|
|
6510
|
+
return __generator(this, function (_c) {
|
|
6511
|
+
switch (_c.label) {
|
|
6464
6512
|
case 0:
|
|
6465
6513
|
metadata = this.getEndpointMetadataFromConfig();
|
|
6466
6514
|
if (metadata) {
|
|
@@ -6471,41 +6519,30 @@ var Authority = /** @class */ (function () {
|
|
|
6471
6519
|
// No need to update
|
|
6472
6520
|
return [2 /*return*/, AuthorityMetadataSource.CACHE];
|
|
6473
6521
|
}
|
|
6522
|
+
harcodedMetadata = this.getEndpointMetadataFromHardcodedValues();
|
|
6474
6523
|
return [4 /*yield*/, this.getEndpointMetadataFromNetwork()];
|
|
6475
6524
|
case 1:
|
|
6476
|
-
metadata =
|
|
6525
|
+
metadata = _c.sent();
|
|
6477
6526
|
if (!metadata) return [3 /*break*/, 4];
|
|
6478
6527
|
if (!((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.azureRegion)) return [3 /*break*/, 3];
|
|
6479
|
-
return [4 /*yield*/, this.
|
|
6528
|
+
return [4 /*yield*/, this.updateMetadataWithRegionalInformation(metadata)];
|
|
6480
6529
|
case 2:
|
|
6481
|
-
|
|
6482
|
-
|
|
6483
|
-
? autodetectedRegionName
|
|
6484
|
-
: this.authorityOptions.azureRegionConfiguration.azureRegion;
|
|
6485
|
-
if (this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
|
|
6486
|
-
this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
|
|
6487
|
-
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
|
|
6488
|
-
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
|
|
6489
|
-
}
|
|
6490
|
-
else {
|
|
6491
|
-
if (autodetectedRegionName) {
|
|
6492
|
-
this.regionDiscoveryMetadata.region_outcome = (this.authorityOptions.azureRegionConfiguration.azureRegion === autodetectedRegionName) ?
|
|
6493
|
-
RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :
|
|
6494
|
-
RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
|
|
6495
|
-
}
|
|
6496
|
-
else {
|
|
6497
|
-
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
|
|
6498
|
-
}
|
|
6499
|
-
}
|
|
6500
|
-
if (azureRegion) {
|
|
6501
|
-
this.regionDiscoveryMetadata.region_used = azureRegion;
|
|
6502
|
-
metadata = Authority.replaceWithRegionalInformation(metadata, azureRegion);
|
|
6503
|
-
}
|
|
6504
|
-
_b.label = 3;
|
|
6530
|
+
metadata = _c.sent();
|
|
6531
|
+
_c.label = 3;
|
|
6505
6532
|
case 3:
|
|
6506
6533
|
metadataEntity.updateEndpointMetadata(metadata, true);
|
|
6507
6534
|
return [2 /*return*/, AuthorityMetadataSource.NETWORK];
|
|
6508
|
-
case 4:
|
|
6535
|
+
case 4:
|
|
6536
|
+
if (!(harcodedMetadata && !this.authorityOptions.skipAuthorityMetadataCache)) return [3 /*break*/, 7];
|
|
6537
|
+
if (!((_b = this.authorityOptions.azureRegionConfiguration) === null || _b === void 0 ? void 0 : _b.azureRegion)) return [3 /*break*/, 6];
|
|
6538
|
+
return [4 /*yield*/, this.updateMetadataWithRegionalInformation(harcodedMetadata)];
|
|
6539
|
+
case 5:
|
|
6540
|
+
harcodedMetadata = _c.sent();
|
|
6541
|
+
_c.label = 6;
|
|
6542
|
+
case 6:
|
|
6543
|
+
metadataEntity.updateEndpointMetadata(harcodedMetadata, false);
|
|
6544
|
+
return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
|
|
6545
|
+
case 7: throw ClientAuthError.createUnableToGetOpenidConfigError(this.defaultOpenIdConfigurationEndpoint);
|
|
6509
6546
|
}
|
|
6510
6547
|
});
|
|
6511
6548
|
});
|
|
@@ -6536,6 +6573,8 @@ var Authority = /** @class */ (function () {
|
|
|
6536
6573
|
};
|
|
6537
6574
|
/**
|
|
6538
6575
|
* Gets OAuth endpoints from the given OpenID configuration endpoint.
|
|
6576
|
+
*
|
|
6577
|
+
* @param hasHardcodedMetadata boolean
|
|
6539
6578
|
*/
|
|
6540
6579
|
Authority.prototype.getEndpointMetadataFromNetwork = function () {
|
|
6541
6580
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -6562,6 +6601,54 @@ var Authority = /** @class */ (function () {
|
|
|
6562
6601
|
});
|
|
6563
6602
|
});
|
|
6564
6603
|
};
|
|
6604
|
+
/**
|
|
6605
|
+
* Get OAuth endpoints for common authorities.
|
|
6606
|
+
*/
|
|
6607
|
+
Authority.prototype.getEndpointMetadataFromHardcodedValues = function () {
|
|
6608
|
+
if (this.canonicalAuthority in EndpointMetadata) {
|
|
6609
|
+
return EndpointMetadata[this.canonicalAuthority];
|
|
6610
|
+
}
|
|
6611
|
+
return null;
|
|
6612
|
+
};
|
|
6613
|
+
/**
|
|
6614
|
+
* Update the retrieved metadata with regional information.
|
|
6615
|
+
*/
|
|
6616
|
+
Authority.prototype.updateMetadataWithRegionalInformation = function (metadata) {
|
|
6617
|
+
var _a, _b, _c, _d, _e;
|
|
6618
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
6619
|
+
var autodetectedRegionName, azureRegion;
|
|
6620
|
+
return __generator(this, function (_f) {
|
|
6621
|
+
switch (_f.label) {
|
|
6622
|
+
case 0: return [4 /*yield*/, this.regionDiscovery.detectRegion((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.environmentRegion, this.regionDiscoveryMetadata, this.proxyUrl)];
|
|
6623
|
+
case 1:
|
|
6624
|
+
autodetectedRegionName = _f.sent();
|
|
6625
|
+
azureRegion = ((_b = this.authorityOptions.azureRegionConfiguration) === null || _b === void 0 ? void 0 : _b.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
|
|
6626
|
+
? autodetectedRegionName
|
|
6627
|
+
: (_c = this.authorityOptions.azureRegionConfiguration) === null || _c === void 0 ? void 0 : _c.azureRegion;
|
|
6628
|
+
if (((_d = this.authorityOptions.azureRegionConfiguration) === null || _d === void 0 ? void 0 : _d.azureRegion) === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG) {
|
|
6629
|
+
this.regionDiscoveryMetadata.region_outcome = autodetectedRegionName ?
|
|
6630
|
+
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_SUCCESSFUL :
|
|
6631
|
+
RegionDiscoveryOutcomes.AUTO_DETECTION_REQUESTED_FAILED;
|
|
6632
|
+
}
|
|
6633
|
+
else {
|
|
6634
|
+
if (autodetectedRegionName) {
|
|
6635
|
+
this.regionDiscoveryMetadata.region_outcome = (((_e = this.authorityOptions.azureRegionConfiguration) === null || _e === void 0 ? void 0 : _e.azureRegion) === autodetectedRegionName) ?
|
|
6636
|
+
RegionDiscoveryOutcomes.CONFIGURED_MATCHES_DETECTED :
|
|
6637
|
+
RegionDiscoveryOutcomes.CONFIGURED_NOT_DETECTED;
|
|
6638
|
+
}
|
|
6639
|
+
else {
|
|
6640
|
+
this.regionDiscoveryMetadata.region_outcome = RegionDiscoveryOutcomes.CONFIGURED_NO_AUTO_DETECTION;
|
|
6641
|
+
}
|
|
6642
|
+
}
|
|
6643
|
+
if (azureRegion) {
|
|
6644
|
+
this.regionDiscoveryMetadata.region_used = azureRegion;
|
|
6645
|
+
return [2 /*return*/, Authority.replaceWithRegionalInformation(metadata, azureRegion)];
|
|
6646
|
+
}
|
|
6647
|
+
return [2 /*return*/, metadata];
|
|
6648
|
+
}
|
|
6649
|
+
});
|
|
6650
|
+
});
|
|
6651
|
+
};
|
|
6565
6652
|
/**
|
|
6566
6653
|
* Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache and returns where the information was retrived from
|
|
6567
6654
|
* @param cachedMetadata
|
|
@@ -6569,7 +6656,7 @@ var Authority = /** @class */ (function () {
|
|
|
6569
6656
|
*/
|
|
6570
6657
|
Authority.prototype.updateCloudDiscoveryMetadata = function (metadataEntity) {
|
|
6571
6658
|
return __awaiter(this, void 0, void 0, function () {
|
|
6572
|
-
var metadata;
|
|
6659
|
+
var metadata, harcodedMetadata;
|
|
6573
6660
|
return __generator(this, function (_a) {
|
|
6574
6661
|
switch (_a.label) {
|
|
6575
6662
|
case 0:
|
|
@@ -6583,6 +6670,7 @@ var Authority = /** @class */ (function () {
|
|
|
6583
6670
|
// No need to update
|
|
6584
6671
|
return [2 /*return*/, AuthorityMetadataSource.CACHE];
|
|
6585
6672
|
}
|
|
6673
|
+
harcodedMetadata = this.getCloudDiscoveryMetadataFromHarcodedValues();
|
|
6586
6674
|
return [4 /*yield*/, this.getCloudDiscoveryMetadataFromNetwork()];
|
|
6587
6675
|
case 1:
|
|
6588
6676
|
metadata = _a.sent();
|
|
@@ -6590,6 +6678,10 @@ var Authority = /** @class */ (function () {
|
|
|
6590
6678
|
metadataEntity.updateCloudDiscoveryMetadata(metadata, true);
|
|
6591
6679
|
return [2 /*return*/, AuthorityMetadataSource.NETWORK];
|
|
6592
6680
|
}
|
|
6681
|
+
if (harcodedMetadata && !this.options.skipAuthorityMetadataCache) {
|
|
6682
|
+
metadataEntity.updateCloudDiscoveryMetadata(harcodedMetadata, false);
|
|
6683
|
+
return [2 /*return*/, AuthorityMetadataSource.HARDCODED_VALUES];
|
|
6684
|
+
}
|
|
6593
6685
|
else {
|
|
6594
6686
|
// Metadata could not be obtained from config, cache or network
|
|
6595
6687
|
throw ClientConfigurationError.createUntrustedAuthorityError();
|
|
@@ -6623,7 +6715,8 @@ var Authority = /** @class */ (function () {
|
|
|
6623
6715
|
};
|
|
6624
6716
|
/**
|
|
6625
6717
|
* Called to get metadata from network if CloudDiscoveryMetadata was not populated by config
|
|
6626
|
-
*
|
|
6718
|
+
*
|
|
6719
|
+
* @param hasHardcodedMetadata boolean
|
|
6627
6720
|
*/
|
|
6628
6721
|
Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
|
|
6629
6722
|
return __awaiter(this, void 0, void 0, function () {
|
|
@@ -6643,7 +6736,9 @@ var Authority = /** @class */ (function () {
|
|
|
6643
6736
|
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
|
|
6644
6737
|
case 2:
|
|
6645
6738
|
response = _a.sent();
|
|
6646
|
-
metadata = isCloudInstanceDiscoveryResponse(response.body)
|
|
6739
|
+
metadata = isCloudInstanceDiscoveryResponse(response.body)
|
|
6740
|
+
? response.body.metadata
|
|
6741
|
+
: [];
|
|
6647
6742
|
if (metadata.length === 0) {
|
|
6648
6743
|
// If no metadata is returned, authority is untrusted
|
|
6649
6744
|
return [2 /*return*/, null];
|
|
@@ -6663,6 +6758,15 @@ var Authority = /** @class */ (function () {
|
|
|
6663
6758
|
});
|
|
6664
6759
|
});
|
|
6665
6760
|
};
|
|
6761
|
+
/**
|
|
6762
|
+
* Get cloud discovery metadata for common authorities
|
|
6763
|
+
*/
|
|
6764
|
+
Authority.prototype.getCloudDiscoveryMetadataFromHarcodedValues = function () {
|
|
6765
|
+
if (this.canonicalAuthority in InstanceDiscoveryMetadata) {
|
|
6766
|
+
return InstanceDiscoveryMetadata[this.canonicalAuthority];
|
|
6767
|
+
}
|
|
6768
|
+
return null;
|
|
6769
|
+
};
|
|
6666
6770
|
/**
|
|
6667
6771
|
* Helper function to determine if this host is included in the knownAuthorities config option
|
|
6668
6772
|
*/
|
|
@@ -6778,7 +6882,7 @@ var Authority = /** @class */ (function () {
|
|
|
6778
6882
|
return Authority;
|
|
6779
6883
|
}());
|
|
6780
6884
|
|
|
6781
|
-
/*! @azure/msal-common
|
|
6885
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6782
6886
|
|
|
6783
6887
|
/*
|
|
6784
6888
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6839,7 +6943,7 @@ var AuthorityFactory = /** @class */ (function () {
|
|
|
6839
6943
|
return AuthorityFactory;
|
|
6840
6944
|
}());
|
|
6841
6945
|
|
|
6842
|
-
/*! @azure/msal-common
|
|
6946
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6843
6947
|
|
|
6844
6948
|
/*
|
|
6845
6949
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6870,7 +6974,7 @@ var ServerTelemetryEntity = /** @class */ (function () {
|
|
|
6870
6974
|
return ServerTelemetryEntity;
|
|
6871
6975
|
}());
|
|
6872
6976
|
|
|
6873
|
-
/*! @azure/msal-common
|
|
6977
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6874
6978
|
|
|
6875
6979
|
/*
|
|
6876
6980
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6898,7 +7002,7 @@ var ThrottlingEntity = /** @class */ (function () {
|
|
|
6898
7002
|
return ThrottlingEntity;
|
|
6899
7003
|
}());
|
|
6900
7004
|
|
|
6901
|
-
/*! @azure/msal-common
|
|
7005
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6902
7006
|
|
|
6903
7007
|
/*
|
|
6904
7008
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6915,7 +7019,92 @@ var StubbedNetworkModule = {
|
|
|
6915
7019
|
}
|
|
6916
7020
|
};
|
|
6917
7021
|
|
|
6918
|
-
/*! @azure/msal-common
|
|
7022
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
7023
|
+
|
|
7024
|
+
/*
|
|
7025
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7026
|
+
* Licensed under the MIT License.
|
|
7027
|
+
*/
|
|
7028
|
+
/**
|
|
7029
|
+
* ClientAuthErrorMessage class containing string constants used by error codes and messages.
|
|
7030
|
+
*/
|
|
7031
|
+
var JoseHeaderErrorMessage = {
|
|
7032
|
+
missingKidError: {
|
|
7033
|
+
code: "missing_kid_error",
|
|
7034
|
+
desc: "The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided."
|
|
7035
|
+
},
|
|
7036
|
+
missingAlgError: {
|
|
7037
|
+
code: "missing_alg_error",
|
|
7038
|
+
desc: "The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided."
|
|
7039
|
+
},
|
|
7040
|
+
};
|
|
7041
|
+
/**
|
|
7042
|
+
* Error thrown when there is an error in the client code running on the browser.
|
|
7043
|
+
*/
|
|
7044
|
+
var JoseHeaderError = /** @class */ (function (_super) {
|
|
7045
|
+
__extends(JoseHeaderError, _super);
|
|
7046
|
+
function JoseHeaderError(errorCode, errorMessage) {
|
|
7047
|
+
var _this = _super.call(this, errorCode, errorMessage) || this;
|
|
7048
|
+
_this.name = "JoseHeaderError";
|
|
7049
|
+
Object.setPrototypeOf(_this, JoseHeaderError.prototype);
|
|
7050
|
+
return _this;
|
|
7051
|
+
}
|
|
7052
|
+
/**
|
|
7053
|
+
* Creates an error thrown when keyId isn't set on JOSE header.
|
|
7054
|
+
*/
|
|
7055
|
+
JoseHeaderError.createMissingKidError = function () {
|
|
7056
|
+
return new JoseHeaderError(JoseHeaderErrorMessage.missingKidError.code, JoseHeaderErrorMessage.missingKidError.desc);
|
|
7057
|
+
};
|
|
7058
|
+
/**
|
|
7059
|
+
* Creates an error thrown when algorithm isn't set on JOSE header.
|
|
7060
|
+
*/
|
|
7061
|
+
JoseHeaderError.createMissingAlgError = function () {
|
|
7062
|
+
return new JoseHeaderError(JoseHeaderErrorMessage.missingAlgError.code, JoseHeaderErrorMessage.missingAlgError.desc);
|
|
7063
|
+
};
|
|
7064
|
+
return JoseHeaderError;
|
|
7065
|
+
}(AuthError));
|
|
7066
|
+
|
|
7067
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
7068
|
+
|
|
7069
|
+
/*
|
|
7070
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7071
|
+
* Licensed under the MIT License.
|
|
7072
|
+
*/
|
|
7073
|
+
var JoseHeader = /** @class */ (function () {
|
|
7074
|
+
function JoseHeader(options) {
|
|
7075
|
+
this.typ = options.typ;
|
|
7076
|
+
this.alg = options.alg;
|
|
7077
|
+
this.kid = options.kid;
|
|
7078
|
+
}
|
|
7079
|
+
/**
|
|
7080
|
+
* Builds SignedHttpRequest formatted JOSE Header from the
|
|
7081
|
+
* JOSE Header options provided or previously set on the object and returns
|
|
7082
|
+
* the stringified header object.
|
|
7083
|
+
* Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
|
|
7084
|
+
* @param shrHeaderOptions
|
|
7085
|
+
* @returns
|
|
7086
|
+
*/
|
|
7087
|
+
JoseHeader.getShrHeaderString = function (shrHeaderOptions) {
|
|
7088
|
+
// KeyID is required on the SHR header
|
|
7089
|
+
if (!shrHeaderOptions.kid) {
|
|
7090
|
+
throw JoseHeaderError.createMissingKidError();
|
|
7091
|
+
}
|
|
7092
|
+
// Alg is required on the SHR header
|
|
7093
|
+
if (!shrHeaderOptions.alg) {
|
|
7094
|
+
throw JoseHeaderError.createMissingAlgError();
|
|
7095
|
+
}
|
|
7096
|
+
var shrHeader = new JoseHeader({
|
|
7097
|
+
// Access Token PoP headers must have type JWT, but the type header can be overriden for special cases
|
|
7098
|
+
typ: shrHeaderOptions.typ || JsonTypes.Jwt,
|
|
7099
|
+
kid: shrHeaderOptions.kid,
|
|
7100
|
+
alg: shrHeaderOptions.alg
|
|
7101
|
+
});
|
|
7102
|
+
return JSON.stringify(shrHeader);
|
|
7103
|
+
};
|
|
7104
|
+
return JoseHeader;
|
|
7105
|
+
}());
|
|
7106
|
+
|
|
7107
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6919
7108
|
|
|
6920
7109
|
/*
|
|
6921
7110
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6974,7 +7163,7 @@ var AuthenticationHeaderParser = /** @class */ (function () {
|
|
|
6974
7163
|
return AuthenticationHeaderParser;
|
|
6975
7164
|
}());
|
|
6976
7165
|
|
|
6977
|
-
/*! @azure/msal-common
|
|
7166
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
6978
7167
|
|
|
6979
7168
|
/*
|
|
6980
7169
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7136,7 +7325,7 @@ var ServerTelemetryManager = /** @class */ (function () {
|
|
|
7136
7325
|
return ServerTelemetryManager;
|
|
7137
7326
|
}());
|
|
7138
7327
|
|
|
7139
|
-
/*! @azure/msal-common
|
|
7328
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
7140
7329
|
/*
|
|
7141
7330
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7142
7331
|
* Licensed under the MIT License.
|
|
@@ -7233,7 +7422,7 @@ var PerformanceEventStatus;
|
|
|
7233
7422
|
PerformanceEventStatus[PerformanceEventStatus["Completed"] = 2] = "Completed";
|
|
7234
7423
|
})(PerformanceEventStatus || (PerformanceEventStatus = {}));
|
|
7235
7424
|
|
|
7236
|
-
/*! @azure/msal-common
|
|
7425
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
7237
7426
|
|
|
7238
7427
|
/*
|
|
7239
7428
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7503,7 +7692,7 @@ var PerformanceClient = /** @class */ (function () {
|
|
|
7503
7692
|
return PerformanceClient;
|
|
7504
7693
|
}());
|
|
7505
7694
|
|
|
7506
|
-
/*! @azure/msal-common
|
|
7695
|
+
/*! @azure/msal-common v7.1.0 2022-07-05 */
|
|
7507
7696
|
|
|
7508
7697
|
/*
|
|
7509
7698
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7561,7 +7750,7 @@ var BrowserAuthErrorMessage = {
|
|
|
7561
7750
|
},
|
|
7562
7751
|
hashEmptyError: {
|
|
7563
7752
|
code: "hash_empty_error",
|
|
7564
|
-
desc: "Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash."
|
|
7753
|
+
desc: "Hash value cannot be processed because it is empty. Please verify that your redirectUri is not clearing the hash. For more visit: aka.ms/msaljs/browser-errors."
|
|
7565
7754
|
},
|
|
7566
7755
|
hashDoesNotContainStateError: {
|
|
7567
7756
|
code: "no_state_in_hash",
|
|
@@ -7569,7 +7758,7 @@ var BrowserAuthErrorMessage = {
|
|
|
7569
7758
|
},
|
|
7570
7759
|
hashDoesNotContainKnownPropertiesError: {
|
|
7571
7760
|
code: "hash_does_not_contain_known_properties",
|
|
7572
|
-
desc: "Hash does not contain known properites. Please verify that your redirectUri is not changing the hash."
|
|
7761
|
+
desc: "Hash does not contain known properites. Please verify that your redirectUri is not changing the hash. For more visit: aka.ms/msaljs/browser-errors."
|
|
7573
7762
|
},
|
|
7574
7763
|
unableToParseStateError: {
|
|
7575
7764
|
code: "unable_to_parse_state",
|
|
@@ -7605,7 +7794,7 @@ var BrowserAuthErrorMessage = {
|
|
|
7605
7794
|
},
|
|
7606
7795
|
redirectInIframeError: {
|
|
7607
7796
|
code: "redirect_in_iframe",
|
|
7608
|
-
desc: "
|
|
7797
|
+
desc: "Redirects are not supported for iframed or brokered applications. Please ensure you are using MSAL.js in a top frame of the window if using the redirect APIs, or use the popup APIs."
|
|
7609
7798
|
},
|
|
7610
7799
|
blockTokenRequestsInHiddenIframeError: {
|
|
7611
7800
|
code: "block_iframe_reload",
|
|
@@ -7830,7 +8019,7 @@ var BrowserAuthError = /** @class */ (function (_super) {
|
|
|
7830
8019
|
return new BrowserAuthError(BrowserAuthErrorMessage.monitorIframeTimeoutError.code, BrowserAuthErrorMessage.monitorIframeTimeoutError.desc);
|
|
7831
8020
|
};
|
|
7832
8021
|
/**
|
|
7833
|
-
* Creates an error thrown when navigateWindow is called inside an iframe.
|
|
8022
|
+
* Creates an error thrown when navigateWindow is called inside an iframe or brokered applications.
|
|
7834
8023
|
* @param windowParentCheck
|
|
7835
8024
|
*/
|
|
7836
8025
|
BrowserAuthError.createRedirectInIframeError = function (windowParentCheck) {
|
|
@@ -8049,7 +8238,8 @@ var BrowserConstants = {
|
|
|
8049
8238
|
};
|
|
8050
8239
|
var NativeConstants = {
|
|
8051
8240
|
CHANNEL_ID: "53ee284d-920a-4b59-9d30-a60315b26836",
|
|
8052
|
-
PREFERRED_EXTENSION_ID: "ppnbnpeolgkicgegkbkbjmhlideopiji"
|
|
8241
|
+
PREFERRED_EXTENSION_ID: "ppnbnpeolgkicgegkbkbjmhlideopiji",
|
|
8242
|
+
MATS_TELEMETRY: "MATS"
|
|
8053
8243
|
};
|
|
8054
8244
|
var NativeExtensionMethod;
|
|
8055
8245
|
(function (NativeExtensionMethod) {
|
|
@@ -8927,7 +9117,7 @@ var BrowserCacheManager = /** @class */ (function (_super) {
|
|
|
8927
9117
|
* @param expires
|
|
8928
9118
|
*/
|
|
8929
9119
|
BrowserCacheManager.prototype.setItemCookie = function (cookieName, cookieValue, expires) {
|
|
8930
|
-
var cookieStr = encodeURIComponent(cookieName) + "=" + encodeURIComponent(cookieValue) + ";path=/;";
|
|
9120
|
+
var cookieStr = encodeURIComponent(cookieName) + "=" + encodeURIComponent(cookieValue) + ";path=/;SameSite=Lax;";
|
|
8931
9121
|
if (expires) {
|
|
8932
9122
|
var expireTime = this.getCookieExpirationTime(expires);
|
|
8933
9123
|
cookieStr += "expires=" + expireTime + ";";
|
|
@@ -9299,7 +9489,7 @@ var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
|
|
|
9299
9489
|
|
|
9300
9490
|
/* eslint-disable header/header */
|
|
9301
9491
|
var name = "@azure/msal-browser";
|
|
9302
|
-
var version = "2.
|
|
9492
|
+
var version = "2.27.0";
|
|
9303
9493
|
|
|
9304
9494
|
/*
|
|
9305
9495
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9848,7 +10038,8 @@ var BaseInteractionClient = /** @class */ (function () {
|
|
|
9848
10038
|
protocolMode: this.config.auth.protocolMode,
|
|
9849
10039
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
9850
10040
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
9851
|
-
authorityMetadata: this.config.auth.authorityMetadata
|
|
10041
|
+
authorityMetadata: this.config.auth.authorityMetadata,
|
|
10042
|
+
skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
|
|
9852
10043
|
};
|
|
9853
10044
|
if (!requestAuthority) return [3 /*break*/, 2];
|
|
9854
10045
|
this.logger.verbose("Creating discovered authority with request authority");
|
|
@@ -10080,6 +10271,7 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10080
10271
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
10081
10272
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
10082
10273
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
10274
|
+
skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache
|
|
10083
10275
|
};
|
|
10084
10276
|
userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
|
|
10085
10277
|
builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
@@ -10093,6 +10285,8 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10093
10285
|
})
|
|
10094
10286
|
.catch(function (error) {
|
|
10095
10287
|
getAuthorityMeasurement.endMeasurement({
|
|
10288
|
+
errorCode: error.errorCode,
|
|
10289
|
+
subErrorCode: error.subError,
|
|
10096
10290
|
success: false
|
|
10097
10291
|
});
|
|
10098
10292
|
throw error;
|
|
@@ -10152,11 +10346,11 @@ var StandardInteractionClient = /** @class */ (function (_super) {
|
|
|
10152
10346
|
* Abstract class which defines operations for a browser interaction handling class.
|
|
10153
10347
|
*/
|
|
10154
10348
|
var InteractionHandler = /** @class */ (function () {
|
|
10155
|
-
function InteractionHandler(authCodeModule, storageImpl, authCodeRequest,
|
|
10349
|
+
function InteractionHandler(authCodeModule, storageImpl, authCodeRequest, logger) {
|
|
10156
10350
|
this.authModule = authCodeModule;
|
|
10157
10351
|
this.browserStorage = storageImpl;
|
|
10158
10352
|
this.authCodeRequest = authCodeRequest;
|
|
10159
|
-
this.
|
|
10353
|
+
this.logger = logger;
|
|
10160
10354
|
}
|
|
10161
10355
|
/**
|
|
10162
10356
|
* Function to handle response parameters from hash.
|
|
@@ -10166,7 +10360,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10166
10360
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10167
10361
|
var stateKey, requestState, authCodeResponse;
|
|
10168
10362
|
return __generator$1(this, function (_a) {
|
|
10169
|
-
this.
|
|
10363
|
+
this.logger.verbose("InteractionHandler.handleCodeResponse called");
|
|
10170
10364
|
// Check that location hash isn't empty.
|
|
10171
10365
|
if (StringUtils.isEmpty(locationHash)) {
|
|
10172
10366
|
throw BrowserAuthError.createEmptyHashError(locationHash);
|
|
@@ -10207,7 +10401,7 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10207
10401
|
return __generator$1(this, function (_a) {
|
|
10208
10402
|
switch (_a.label) {
|
|
10209
10403
|
case 0:
|
|
10210
|
-
this.
|
|
10404
|
+
this.logger.trace("InteractionHandler.handleCodeResponseFromServer called");
|
|
10211
10405
|
stateKey = this.browserStorage.generateStateKey(state);
|
|
10212
10406
|
requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
10213
10407
|
if (!requestState) {
|
|
@@ -10295,8 +10489,8 @@ var InteractionHandler = /** @class */ (function () {
|
|
|
10295
10489
|
*/
|
|
10296
10490
|
var RedirectHandler = /** @class */ (function (_super) {
|
|
10297
10491
|
__extends$1(RedirectHandler, _super);
|
|
10298
|
-
function RedirectHandler(authCodeModule, storageImpl, authCodeRequest,
|
|
10299
|
-
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest,
|
|
10492
|
+
function RedirectHandler(authCodeModule, storageImpl, authCodeRequest, logger, browserCrypto) {
|
|
10493
|
+
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger) || this;
|
|
10300
10494
|
_this.browserCrypto = browserCrypto;
|
|
10301
10495
|
return _this;
|
|
10302
10496
|
}
|
|
@@ -10310,38 +10504,38 @@ var RedirectHandler = /** @class */ (function (_super) {
|
|
|
10310
10504
|
return __generator$1(this, function (_a) {
|
|
10311
10505
|
switch (_a.label) {
|
|
10312
10506
|
case 0:
|
|
10313
|
-
this.
|
|
10507
|
+
this.logger.verbose("RedirectHandler.initiateAuthRequest called");
|
|
10314
10508
|
if (!!StringUtils.isEmpty(requestUrl)) return [3 /*break*/, 7];
|
|
10315
10509
|
// Cache start page, returns to this page after redirectUri if navigateToLoginRequestUrl is true
|
|
10316
10510
|
if (params.redirectStartPage) {
|
|
10317
|
-
this.
|
|
10511
|
+
this.logger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page");
|
|
10318
10512
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
|
|
10319
10513
|
}
|
|
10320
10514
|
// Set interaction status in the library.
|
|
10321
10515
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
|
|
10322
10516
|
this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);
|
|
10323
|
-
this.
|
|
10517
|
+
this.logger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: " + requestUrl);
|
|
10324
10518
|
navigationOptions = {
|
|
10325
10519
|
apiId: exports.ApiId.acquireTokenRedirect,
|
|
10326
10520
|
timeout: params.redirectTimeout,
|
|
10327
10521
|
noHistory: false
|
|
10328
10522
|
};
|
|
10329
10523
|
if (!(typeof params.onRedirectNavigate === "function")) return [3 /*break*/, 4];
|
|
10330
|
-
this.
|
|
10524
|
+
this.logger.verbose("RedirectHandler.initiateAuthRequest: Invoking onRedirectNavigate callback");
|
|
10331
10525
|
navigate = params.onRedirectNavigate(requestUrl);
|
|
10332
10526
|
if (!(navigate !== false)) return [3 /*break*/, 2];
|
|
10333
|
-
this.
|
|
10527
|
+
this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate did not return false, navigating");
|
|
10334
10528
|
return [4 /*yield*/, params.navigationClient.navigateExternal(requestUrl, navigationOptions)];
|
|
10335
10529
|
case 1:
|
|
10336
10530
|
_a.sent();
|
|
10337
10531
|
return [2 /*return*/];
|
|
10338
10532
|
case 2:
|
|
10339
|
-
this.
|
|
10533
|
+
this.logger.verbose("RedirectHandler.initiateAuthRequest: onRedirectNavigate returned false, stopping navigation");
|
|
10340
10534
|
return [2 /*return*/];
|
|
10341
10535
|
case 3: return [3 /*break*/, 6];
|
|
10342
10536
|
case 4:
|
|
10343
10537
|
// Navigate window to request URL
|
|
10344
|
-
this.
|
|
10538
|
+
this.logger.verbose("RedirectHandler.initiateAuthRequest: Navigating window to navigate url");
|
|
10345
10539
|
return [4 /*yield*/, params.navigationClient.navigateExternal(requestUrl, navigationOptions)];
|
|
10346
10540
|
case 5:
|
|
10347
10541
|
_a.sent();
|
|
@@ -10349,7 +10543,7 @@ var RedirectHandler = /** @class */ (function (_super) {
|
|
|
10349
10543
|
case 6: return [3 /*break*/, 8];
|
|
10350
10544
|
case 7:
|
|
10351
10545
|
// Throw error if request URL is empty.
|
|
10352
|
-
this.
|
|
10546
|
+
this.logger.info("RedirectHandler.initiateAuthRequest: Navigate url is empty");
|
|
10353
10547
|
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
10354
10548
|
case 8: return [2 /*return*/];
|
|
10355
10549
|
}
|
|
@@ -10366,7 +10560,7 @@ var RedirectHandler = /** @class */ (function (_super) {
|
|
|
10366
10560
|
return __generator$1(this, function (_a) {
|
|
10367
10561
|
switch (_a.label) {
|
|
10368
10562
|
case 0:
|
|
10369
|
-
this.
|
|
10563
|
+
this.logger.verbose("RedirectHandler.handleCodeResponse called");
|
|
10370
10564
|
// Check that location hash isn't empty.
|
|
10371
10565
|
if (StringUtils.isEmpty(locationHash)) {
|
|
10372
10566
|
throw BrowserAuthError.createEmptyHashError(locationHash);
|
|
@@ -10467,6 +10661,8 @@ var NativeStatusCode;
|
|
|
10467
10661
|
NativeStatusCode["NO_NETWORK"] = "NO_NETWORK";
|
|
10468
10662
|
NativeStatusCode["TRANSIENT_ERROR"] = "TRANSIENT_ERROR";
|
|
10469
10663
|
NativeStatusCode["PERSISTENT_ERROR"] = "PERSISTENT_ERROR";
|
|
10664
|
+
NativeStatusCode["DISABLED"] = "DISABLED";
|
|
10665
|
+
NativeStatusCode["ACCOUNT_UNAVAILABLE"] = "ACCOUNT_UNAVAILABLE";
|
|
10470
10666
|
})(NativeStatusCode || (NativeStatusCode = {}));
|
|
10471
10667
|
var NativeAuthErrorMessage = {
|
|
10472
10668
|
extensionError: {
|
|
@@ -10490,7 +10686,7 @@ var NativeAuthError = /** @class */ (function (_super) {
|
|
|
10490
10686
|
* These errors should result in a fallback to the 'standard' browser based auth flow.
|
|
10491
10687
|
*/
|
|
10492
10688
|
NativeAuthError.prototype.isFatal = function () {
|
|
10493
|
-
if (this.ext && this.ext.status && this.ext.status === NativeStatusCode.PERSISTENT_ERROR) {
|
|
10689
|
+
if (this.ext && this.ext.status && (this.ext.status === NativeStatusCode.PERSISTENT_ERROR || this.ext.status === NativeStatusCode.DISABLED)) {
|
|
10494
10690
|
return true;
|
|
10495
10691
|
}
|
|
10496
10692
|
switch (this.errorCode) {
|
|
@@ -10510,6 +10706,8 @@ var NativeAuthError = /** @class */ (function (_super) {
|
|
|
10510
10706
|
NativeAuthError.createError = function (code, description, ext) {
|
|
10511
10707
|
if (ext && ext.status) {
|
|
10512
10708
|
switch (ext.status) {
|
|
10709
|
+
case NativeStatusCode.ACCOUNT_UNAVAILABLE:
|
|
10710
|
+
return InteractionRequiredAuthError.createNativeAccountUnavailableError();
|
|
10513
10711
|
case NativeStatusCode.USER_INTERACTION_REQUIRED:
|
|
10514
10712
|
return new InteractionRequiredAuthError(code, description);
|
|
10515
10713
|
case NativeStatusCode.USER_CANCEL:
|
|
@@ -10578,6 +10776,8 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10578
10776
|
.catch(function (error) {
|
|
10579
10777
|
nativeATMeasurement.endMeasurement({
|
|
10580
10778
|
success: false,
|
|
10779
|
+
errorCode: error.errorCode,
|
|
10780
|
+
subErrorCode: error.subError,
|
|
10581
10781
|
isNativeBroker: true
|
|
10582
10782
|
});
|
|
10583
10783
|
throw error;
|
|
@@ -10696,7 +10896,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10696
10896
|
*/
|
|
10697
10897
|
NativeInteractionClient.prototype.handleNativeResponse = function (response, request, reqTimestamp) {
|
|
10698
10898
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10699
|
-
var idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, result;
|
|
10899
|
+
var idTokenObj, authority, authorityPreferredCache, homeAccountIdentifier, accountEntity, responseScopes, accountProperties, uid, tid, responseAccessToken, responseTokenType, _a, popTokenGenerator, shrParameters, mats, result;
|
|
10700
10900
|
var _this = this;
|
|
10701
10901
|
return __generator$1(this, function (_b) {
|
|
10702
10902
|
switch (_b.label) {
|
|
@@ -10712,14 +10912,14 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10712
10912
|
authority = _b.sent();
|
|
10713
10913
|
authorityPreferredCache = authority.getPreferredCache();
|
|
10714
10914
|
homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenObj);
|
|
10715
|
-
accountEntity = AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined,
|
|
10915
|
+
accountEntity = AccountEntity.createAccount(response.client_info, homeAccountIdentifier, idTokenObj, undefined, undefined, undefined, authorityPreferredCache, response.account.id);
|
|
10716
10916
|
this.browserStorage.setAccount(accountEntity);
|
|
10717
10917
|
responseScopes = response.scopes ? ScopeSet.fromString(response.scopes) : ScopeSet.fromString(request.scopes);
|
|
10718
10918
|
accountProperties = response.account.properties || {};
|
|
10719
10919
|
uid = accountProperties["UID"] || idTokenObj.claims.oid || idTokenObj.claims.sub || Constants.EMPTY_STRING;
|
|
10720
10920
|
tid = accountProperties["TenantId"] || idTokenObj.claims.tid || Constants.EMPTY_STRING;
|
|
10721
10921
|
responseTokenType = exports.AuthenticationScheme.BEARER;
|
|
10722
|
-
_a = request.
|
|
10922
|
+
_a = request.tokenType;
|
|
10723
10923
|
switch (_a) {
|
|
10724
10924
|
case exports.AuthenticationScheme.POP: return [3 /*break*/, 2];
|
|
10725
10925
|
}
|
|
@@ -10740,7 +10940,14 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10740
10940
|
shrClaims: request.shrClaims,
|
|
10741
10941
|
shrNonce: request.shrNonce
|
|
10742
10942
|
};
|
|
10743
|
-
|
|
10943
|
+
/**
|
|
10944
|
+
* KeyID must be present in the native request from when the PoP key was generated in order for
|
|
10945
|
+
* PopTokenGenerator to query the full key for signing
|
|
10946
|
+
*/
|
|
10947
|
+
if (!request.keyId) {
|
|
10948
|
+
throw ClientAuthError.createKeyIdMissingError();
|
|
10949
|
+
}
|
|
10950
|
+
return [4 /*yield*/, popTokenGenerator.signPopToken(response.access_token, request.keyId, shrParameters)];
|
|
10744
10951
|
case 3:
|
|
10745
10952
|
responseAccessToken = _b.sent();
|
|
10746
10953
|
return [3 /*break*/, 5];
|
|
@@ -10750,6 +10957,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10750
10957
|
}
|
|
10751
10958
|
_b.label = 5;
|
|
10752
10959
|
case 5:
|
|
10960
|
+
mats = this.getMATSFromResponse(response);
|
|
10753
10961
|
result = {
|
|
10754
10962
|
authority: authority.canonicalAuthority,
|
|
10755
10963
|
uniqueId: uid,
|
|
@@ -10759,7 +10967,7 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10759
10967
|
idToken: response.id_token,
|
|
10760
10968
|
idTokenClaims: idTokenObj.claims,
|
|
10761
10969
|
accessToken: responseAccessToken,
|
|
10762
|
-
fromCache: false,
|
|
10970
|
+
fromCache: mats ? this.isResponseFromCache(mats) : false,
|
|
10763
10971
|
expiresOn: new Date(Number(reqTimestamp + response.expires_in) * 1000),
|
|
10764
10972
|
tokenType: responseTokenType,
|
|
10765
10973
|
correlationId: this.correlationId,
|
|
@@ -10792,15 +11000,44 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10792
11000
|
throw NativeAuthError.createUnexpectedError("Response missing expected properties.");
|
|
10793
11001
|
}
|
|
10794
11002
|
};
|
|
11003
|
+
/**
|
|
11004
|
+
* Gets MATS telemetry from native response
|
|
11005
|
+
* @param response
|
|
11006
|
+
* @returns
|
|
11007
|
+
*/
|
|
11008
|
+
NativeInteractionClient.prototype.getMATSFromResponse = function (response) {
|
|
11009
|
+
if (response.properties.MATS) {
|
|
11010
|
+
try {
|
|
11011
|
+
return JSON.parse(response.properties.MATS);
|
|
11012
|
+
}
|
|
11013
|
+
catch (e) {
|
|
11014
|
+
this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead");
|
|
11015
|
+
}
|
|
11016
|
+
}
|
|
11017
|
+
return null;
|
|
11018
|
+
};
|
|
11019
|
+
/**
|
|
11020
|
+
* Returns whether or not response came from native cache
|
|
11021
|
+
* @param response
|
|
11022
|
+
* @returns
|
|
11023
|
+
*/
|
|
11024
|
+
NativeInteractionClient.prototype.isResponseFromCache = function (mats) {
|
|
11025
|
+
if (typeof mats.is_cached === "undefined") {
|
|
11026
|
+
this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false.");
|
|
11027
|
+
return false;
|
|
11028
|
+
}
|
|
11029
|
+
return !!mats.is_cached;
|
|
11030
|
+
};
|
|
10795
11031
|
/**
|
|
10796
11032
|
* Translates developer provided request object into NativeRequest object
|
|
10797
11033
|
* @param request
|
|
10798
11034
|
*/
|
|
10799
11035
|
NativeInteractionClient.prototype.initializeNativeRequest = function (request) {
|
|
10800
11036
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10801
|
-
var authority, canonicalAuthority, scopes, scopeSet,
|
|
10802
|
-
|
|
10803
|
-
|
|
11037
|
+
var authority, canonicalAuthority, scopes, scopeSet, getPrompt, validatedRequest, shrParameters, popTokenGenerator, reqCnfData;
|
|
11038
|
+
var _this = this;
|
|
11039
|
+
return __generator$1(this, function (_a) {
|
|
11040
|
+
switch (_a.label) {
|
|
10804
11041
|
case 0:
|
|
10805
11042
|
this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
|
|
10806
11043
|
authority = request.authority || this.config.auth.authority;
|
|
@@ -10809,21 +11046,34 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10809
11046
|
scopes = request && request.scopes || [];
|
|
10810
11047
|
scopeSet = new ScopeSet(scopes);
|
|
10811
11048
|
scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
|
|
10812
|
-
|
|
11049
|
+
getPrompt = function () {
|
|
11050
|
+
// If request is silent, prompt is always none
|
|
11051
|
+
switch (_this.apiId) {
|
|
11052
|
+
case exports.ApiId.ssoSilent:
|
|
11053
|
+
case exports.ApiId.acquireTokenSilent_silentFlow:
|
|
11054
|
+
_this.logger.trace("initializeNativeRequest: silent request sets prompt to none");
|
|
11055
|
+
return PromptValue.NONE;
|
|
11056
|
+
}
|
|
11057
|
+
// Prompt not provided, request may proceed and native broker decides if it needs to prompt
|
|
11058
|
+
if (!request.prompt) {
|
|
11059
|
+
_this.logger.trace("initializeNativeRequest: prompt was not provided");
|
|
11060
|
+
return undefined;
|
|
11061
|
+
}
|
|
11062
|
+
// If request is interactive, check if prompt provided is allowed to go directly to native broker
|
|
10813
11063
|
switch (request.prompt) {
|
|
10814
11064
|
case PromptValue.NONE:
|
|
10815
11065
|
case PromptValue.CONSENT:
|
|
10816
|
-
|
|
10817
|
-
|
|
11066
|
+
case PromptValue.LOGIN:
|
|
11067
|
+
_this.logger.trace("initializeNativeRequest: prompt is compatible with native flow");
|
|
11068
|
+
return request.prompt;
|
|
10818
11069
|
default:
|
|
10819
|
-
|
|
11070
|
+
_this.logger.trace("initializeNativeRequest: prompt = " + request.prompt + " is not compatible with native flow");
|
|
10820
11071
|
throw BrowserAuthError.createNativePromptParameterNotSupportedError();
|
|
10821
11072
|
}
|
|
10822
|
-
}
|
|
10823
|
-
|
|
10824
|
-
validatedRequest = __assign$1(__assign$1({}, request), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scopes: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), correlationId: this.correlationId, instance_aware: instanceAware, token_type: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign$1(__assign$1({}, request.extraQueryParameters), request.tokenQueryParameters), extendedExpiryToken: false // Make this configurable?
|
|
11073
|
+
};
|
|
11074
|
+
validatedRequest = __assign$1(__assign$1({}, request), { accountId: this.accountId, clientId: this.config.auth.clientId, authority: canonicalAuthority.urlString, scopes: scopeSet.printScopes(), redirectUri: this.getRedirectUri(request.redirectUri), prompt: getPrompt(), correlationId: this.correlationId, tokenType: request.authenticationScheme, windowTitleSubstring: document.title, extraParameters: __assign$1(__assign$1(__assign$1({}, request.extraQueryParameters), request.tokenQueryParameters), { telemetry: NativeConstants.MATS_TELEMETRY }), extendedExpiryToken: false // Make this configurable?
|
|
10825
11075
|
});
|
|
10826
|
-
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/,
|
|
11076
|
+
if (!(request.authenticationScheme === exports.AuthenticationScheme.POP)) return [3 /*break*/, 2];
|
|
10827
11077
|
shrParameters = {
|
|
10828
11078
|
resourceRequestUri: request.resourceRequestUri,
|
|
10829
11079
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
@@ -10833,19 +11083,12 @@ var NativeInteractionClient = /** @class */ (function (_super) {
|
|
|
10833
11083
|
popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
|
|
10834
11084
|
return [4 /*yield*/, popTokenGenerator.generateCnf(shrParameters)];
|
|
10835
11085
|
case 1:
|
|
10836
|
-
|
|
10837
|
-
// to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
|
|
10838
|
-
_a = validatedRequest;
|
|
10839
|
-
return [4 /*yield*/, popTokenGenerator.generateCnfHash(cnf)];
|
|
10840
|
-
case 2:
|
|
11086
|
+
reqCnfData = _a.sent();
|
|
10841
11087
|
// to reduce the URL length, it is recommended to send the hash of the req_cnf instead of the whole string
|
|
10842
|
-
|
|
10843
|
-
|
|
10844
|
-
|
|
10845
|
-
|
|
10846
|
-
validatedRequest.prompt = PromptValue.NONE;
|
|
10847
|
-
}
|
|
10848
|
-
return [2 /*return*/, validatedRequest];
|
|
11088
|
+
validatedRequest.reqCnf = reqCnfData.reqCnfHash;
|
|
11089
|
+
validatedRequest.keyId = reqCnfData.kid;
|
|
11090
|
+
_a.label = 2;
|
|
11091
|
+
case 2: return [2 /*return*/, validatedRequest];
|
|
10849
11092
|
}
|
|
10850
11093
|
});
|
|
10851
11094
|
});
|
|
@@ -11421,269 +11664,37 @@ var RedirectClient = /** @class */ (function (_super) {
|
|
|
11421
11664
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11422
11665
|
* Licensed under the MIT License.
|
|
11423
11666
|
*/
|
|
11424
|
-
var
|
|
11425
|
-
|
|
11426
|
-
|
|
11427
|
-
this
|
|
11667
|
+
var PopupClient = /** @class */ (function (_super) {
|
|
11668
|
+
__extends$1(PopupClient, _super);
|
|
11669
|
+
function PopupClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) {
|
|
11670
|
+
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) || this;
|
|
11428
11671
|
// Properly sets this reference for the unload event.
|
|
11429
|
-
|
|
11672
|
+
_this.unloadWindow = _this.unloadWindow.bind(_this);
|
|
11673
|
+
return _this;
|
|
11430
11674
|
}
|
|
11431
11675
|
/**
|
|
11432
|
-
*
|
|
11433
|
-
*
|
|
11434
|
-
* Configures popup window for login.
|
|
11435
|
-
*
|
|
11436
|
-
* @param urlNavigate
|
|
11437
|
-
* @param title
|
|
11438
|
-
* @param popUpWidth
|
|
11439
|
-
* @param popUpHeight
|
|
11440
|
-
* @param popupWindowAttributes
|
|
11441
|
-
* @ignore
|
|
11442
|
-
* @hidden
|
|
11676
|
+
* Acquires tokens by opening a popup window to the /authorize endpoint of the authority
|
|
11677
|
+
* @param request
|
|
11443
11678
|
*/
|
|
11444
|
-
|
|
11679
|
+
PopupClient.prototype.acquireToken = function (request) {
|
|
11445
11680
|
try {
|
|
11446
|
-
var
|
|
11447
|
-
|
|
11448
|
-
|
|
11449
|
-
|
|
11450
|
-
this.logger.
|
|
11451
|
-
|
|
11452
|
-
|
|
11453
|
-
else if (typeof popupParams.popup === "undefined") {
|
|
11454
|
-
// Popup will be undefined if it was not passed in
|
|
11455
|
-
this.logger.verbosePii("Opening popup window to: " + urlNavigate);
|
|
11456
|
-
popupWindow = PopupUtils.openSizedPopup(urlNavigate, popupParams.popupName, popupParams.popupWindowAttributes, this.logger);
|
|
11457
|
-
}
|
|
11458
|
-
// Popup will be null if popups are blocked
|
|
11459
|
-
if (!popupWindow) {
|
|
11460
|
-
throw BrowserAuthError.createEmptyWindowCreatedError();
|
|
11681
|
+
var popupName = this.generatePopupName(request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority);
|
|
11682
|
+
var popupWindowAttributes = request.popupWindowAttributes || {};
|
|
11683
|
+
// asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
|
11684
|
+
if (this.config.system.asyncPopups) {
|
|
11685
|
+
this.logger.verbose("asyncPopups set to true, acquiring token");
|
|
11686
|
+
// Passes on popup position and dimensions if in request
|
|
11687
|
+
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);
|
|
11461
11688
|
}
|
|
11462
|
-
|
|
11463
|
-
|
|
11689
|
+
else {
|
|
11690
|
+
// asyncPopups flag is set to false. Opens popup before acquiring token.
|
|
11691
|
+
this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
|
|
11692
|
+
var popup = this.openSizedPopup("about:blank", popupName, popupWindowAttributes);
|
|
11693
|
+
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
|
|
11464
11694
|
}
|
|
11465
|
-
this.currentWindow = popupWindow;
|
|
11466
|
-
window.addEventListener("beforeunload", this.unloadWindow);
|
|
11467
|
-
return popupWindow;
|
|
11468
11695
|
}
|
|
11469
11696
|
catch (e) {
|
|
11470
|
-
|
|
11471
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
11472
|
-
throw BrowserAuthError.createPopupWindowError(e.toString());
|
|
11473
|
-
}
|
|
11474
|
-
};
|
|
11475
|
-
/**
|
|
11476
|
-
* Helper function to set popup window dimensions and position
|
|
11477
|
-
* @param urlNavigate
|
|
11478
|
-
* @param popupName
|
|
11479
|
-
* @param popupWindowAttributes
|
|
11480
|
-
* @returns
|
|
11481
|
-
*/
|
|
11482
|
-
PopupUtils.openSizedPopup = function (urlNavigate, popupName, popupWindowAttributes, logger) {
|
|
11483
|
-
var _a, _b, _c, _d;
|
|
11484
|
-
/**
|
|
11485
|
-
* adding winLeft and winTop to account for dual monitor
|
|
11486
|
-
* using screenLeft and screenTop for IE8 and earlier
|
|
11487
|
-
*/
|
|
11488
|
-
var winLeft = window.screenLeft ? window.screenLeft : window.screenX;
|
|
11489
|
-
var winTop = window.screenTop ? window.screenTop : window.screenY;
|
|
11490
|
-
/**
|
|
11491
|
-
* window.innerWidth displays browser window"s height and width excluding toolbars
|
|
11492
|
-
* using document.documentElement.clientWidth for IE8 and earlier
|
|
11493
|
-
*/
|
|
11494
|
-
var winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
11495
|
-
var winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
11496
|
-
var width = (_a = popupWindowAttributes.popupSize) === null || _a === void 0 ? void 0 : _a.width;
|
|
11497
|
-
var height = (_b = popupWindowAttributes.popupSize) === null || _b === void 0 ? void 0 : _b.height;
|
|
11498
|
-
var top = (_c = popupWindowAttributes.popupPosition) === null || _c === void 0 ? void 0 : _c.top;
|
|
11499
|
-
var left = (_d = popupWindowAttributes.popupPosition) === null || _d === void 0 ? void 0 : _d.left;
|
|
11500
|
-
if (!width || width < 0 || width > winWidth) {
|
|
11501
|
-
logger.verbose("Default popup window width used. Window width not configured or invalid.");
|
|
11502
|
-
width = BrowserConstants.POPUP_WIDTH;
|
|
11503
|
-
}
|
|
11504
|
-
if (!height || height < 0 || height > winHeight) {
|
|
11505
|
-
logger.verbose("Default popup window height used. Window height not configured or invalid.");
|
|
11506
|
-
height = BrowserConstants.POPUP_HEIGHT;
|
|
11507
|
-
}
|
|
11508
|
-
if (!top || top < 0 || top > winHeight) {
|
|
11509
|
-
logger.verbose("Default popup window top position used. Window top not configured or invalid.");
|
|
11510
|
-
top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);
|
|
11511
|
-
}
|
|
11512
|
-
if (!left || left < 0 || left > winWidth) {
|
|
11513
|
-
logger.verbose("Default popup window left position used. Window left not configured or invalid.");
|
|
11514
|
-
left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);
|
|
11515
|
-
}
|
|
11516
|
-
return window.open(urlNavigate, popupName, "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left + ", scrollbars=yes");
|
|
11517
|
-
};
|
|
11518
|
-
/**
|
|
11519
|
-
* Event callback to unload main window.
|
|
11520
|
-
*/
|
|
11521
|
-
PopupUtils.prototype.unloadWindow = function (e) {
|
|
11522
|
-
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Popup);
|
|
11523
|
-
if (this.currentWindow) {
|
|
11524
|
-
this.currentWindow.close();
|
|
11525
|
-
}
|
|
11526
|
-
// Guarantees browser unload will happen, so no other errors will be thrown.
|
|
11527
|
-
e.preventDefault();
|
|
11528
|
-
};
|
|
11529
|
-
/**
|
|
11530
|
-
* Closes popup, removes any state vars created during popup calls.
|
|
11531
|
-
* @param popupWindow
|
|
11532
|
-
*/
|
|
11533
|
-
PopupUtils.prototype.cleanPopup = function (popupWindow) {
|
|
11534
|
-
if (popupWindow) {
|
|
11535
|
-
// Close window.
|
|
11536
|
-
popupWindow.close();
|
|
11537
|
-
}
|
|
11538
|
-
// Remove window unload function
|
|
11539
|
-
window.removeEventListener("beforeunload", this.unloadWindow);
|
|
11540
|
-
// Interaction is completed - remove interaction status.
|
|
11541
|
-
this.browserStorage.setInteractionInProgress(false);
|
|
11542
|
-
};
|
|
11543
|
-
/**
|
|
11544
|
-
* Monitors a window until it loads a url with the same origin.
|
|
11545
|
-
* @param popupWindow - window that is being monitored
|
|
11546
|
-
*/
|
|
11547
|
-
PopupUtils.prototype.monitorPopupForSameOrigin = function (popupWindow) {
|
|
11548
|
-
var _this = this;
|
|
11549
|
-
return new Promise(function (resolve, reject) {
|
|
11550
|
-
var intervalId = setInterval(function () {
|
|
11551
|
-
if (popupWindow.closed) {
|
|
11552
|
-
// Window is closed
|
|
11553
|
-
_this.cleanPopup();
|
|
11554
|
-
clearInterval(intervalId);
|
|
11555
|
-
reject(BrowserAuthError.createUserCancelledError());
|
|
11556
|
-
return;
|
|
11557
|
-
}
|
|
11558
|
-
var href = Constants.EMPTY_STRING;
|
|
11559
|
-
try {
|
|
11560
|
-
/*
|
|
11561
|
-
* Will throw if cross origin,
|
|
11562
|
-
* which should be caught and ignored
|
|
11563
|
-
* since we need the interval to keep running while on STS UI.
|
|
11564
|
-
*/
|
|
11565
|
-
href = popupWindow.location.href;
|
|
11566
|
-
}
|
|
11567
|
-
catch (e) { }
|
|
11568
|
-
// Don't process blank pages or cross domain
|
|
11569
|
-
if (StringUtils.isEmpty(href) || href === "about:blank") {
|
|
11570
|
-
return;
|
|
11571
|
-
}
|
|
11572
|
-
clearInterval(intervalId);
|
|
11573
|
-
resolve();
|
|
11574
|
-
}, BrowserConstants.POLL_INTERVAL_MS);
|
|
11575
|
-
});
|
|
11576
|
-
};
|
|
11577
|
-
/**
|
|
11578
|
-
* Generates the name for the popup based on the client id and request
|
|
11579
|
-
* @param clientId
|
|
11580
|
-
* @param request
|
|
11581
|
-
*/
|
|
11582
|
-
PopupUtils.generatePopupName = function (clientId, scopes, authority, correlationId) {
|
|
11583
|
-
return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + scopes.join("-") + "." + authority + "." + correlationId;
|
|
11584
|
-
};
|
|
11585
|
-
/**
|
|
11586
|
-
* Generates the name for the popup based on the client id and request for logouts
|
|
11587
|
-
* @param clientId
|
|
11588
|
-
* @param request
|
|
11589
|
-
*/
|
|
11590
|
-
PopupUtils.generateLogoutPopupName = function (clientId, request) {
|
|
11591
|
-
var homeAccountId = request.account && request.account.homeAccountId;
|
|
11592
|
-
return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + homeAccountId + "." + request.correlationId;
|
|
11593
|
-
};
|
|
11594
|
-
return PopupUtils;
|
|
11595
|
-
}());
|
|
11596
|
-
|
|
11597
|
-
/*
|
|
11598
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11599
|
-
* Licensed under the MIT License.
|
|
11600
|
-
*/
|
|
11601
|
-
/**
|
|
11602
|
-
* This class implements the interaction handler base class for browsers. It is written specifically for handling
|
|
11603
|
-
* popup window scenarios. It includes functions for monitoring the popup window for a hash.
|
|
11604
|
-
*/
|
|
11605
|
-
var PopupHandler = /** @class */ (function (_super) {
|
|
11606
|
-
__extends$1(PopupHandler, _super);
|
|
11607
|
-
function PopupHandler(authCodeModule, storageImpl, authCodeRequest, browserRequestLogger) {
|
|
11608
|
-
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, browserRequestLogger) || this;
|
|
11609
|
-
// Properly sets this reference for the unload event.
|
|
11610
|
-
_this.popupUtils = new PopupUtils(storageImpl, browserRequestLogger);
|
|
11611
|
-
return _this;
|
|
11612
|
-
}
|
|
11613
|
-
/**
|
|
11614
|
-
* Opens a popup window with given request Url.
|
|
11615
|
-
* @param requestUrl
|
|
11616
|
-
*/
|
|
11617
|
-
PopupHandler.prototype.initiateAuthRequest = function (requestUrl, params) {
|
|
11618
|
-
// Check that request url is not empty.
|
|
11619
|
-
if (!StringUtils.isEmpty(requestUrl)) {
|
|
11620
|
-
this.browserRequestLogger.infoPii("Navigate to: " + requestUrl);
|
|
11621
|
-
// Open the popup window to requestUrl.
|
|
11622
|
-
return this.popupUtils.openPopup(requestUrl, params);
|
|
11623
|
-
}
|
|
11624
|
-
else {
|
|
11625
|
-
// Throw error if request URL is empty.
|
|
11626
|
-
this.browserRequestLogger.error("Navigate url is empty");
|
|
11627
|
-
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
11628
|
-
}
|
|
11629
|
-
};
|
|
11630
|
-
/**
|
|
11631
|
-
* Monitors a window until it loads a url with a known hash, or hits a specified timeout.
|
|
11632
|
-
* @param popupWindow - window that is being monitored
|
|
11633
|
-
* @param timeout - milliseconds until timeout
|
|
11634
|
-
*/
|
|
11635
|
-
PopupHandler.prototype.monitorPopupForHash = function (popupWindow) {
|
|
11636
|
-
var _this = this;
|
|
11637
|
-
return this.popupUtils.monitorPopupForSameOrigin(popupWindow).then(function () {
|
|
11638
|
-
var contentHash = popupWindow.location.hash;
|
|
11639
|
-
BrowserUtils.clearHash(popupWindow);
|
|
11640
|
-
_this.popupUtils.cleanPopup(popupWindow);
|
|
11641
|
-
if (!contentHash) {
|
|
11642
|
-
throw BrowserAuthError.createEmptyHashError(popupWindow.location.href);
|
|
11643
|
-
}
|
|
11644
|
-
if (UrlString.hashContainsKnownProperties(contentHash)) {
|
|
11645
|
-
return contentHash;
|
|
11646
|
-
}
|
|
11647
|
-
else {
|
|
11648
|
-
throw BrowserAuthError.createHashDoesNotContainKnownPropertiesError();
|
|
11649
|
-
}
|
|
11650
|
-
});
|
|
11651
|
-
};
|
|
11652
|
-
return PopupHandler;
|
|
11653
|
-
}(InteractionHandler));
|
|
11654
|
-
|
|
11655
|
-
/*
|
|
11656
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11657
|
-
* Licensed under the MIT License.
|
|
11658
|
-
*/
|
|
11659
|
-
var PopupClient = /** @class */ (function (_super) {
|
|
11660
|
-
__extends$1(PopupClient, _super);
|
|
11661
|
-
function PopupClient() {
|
|
11662
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
11663
|
-
}
|
|
11664
|
-
/**
|
|
11665
|
-
* Acquires tokens by opening a popup window to the /authorize endpoint of the authority
|
|
11666
|
-
* @param request
|
|
11667
|
-
*/
|
|
11668
|
-
PopupClient.prototype.acquireToken = function (request) {
|
|
11669
|
-
try {
|
|
11670
|
-
var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);
|
|
11671
|
-
var popupWindowAttributes = request.popupWindowAttributes || {};
|
|
11672
|
-
// asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
|
11673
|
-
if (this.config.system.asyncPopups) {
|
|
11674
|
-
this.logger.verbose("asyncPopups set to true, acquiring token");
|
|
11675
|
-
// Passes on popup position and dimensions if in request
|
|
11676
|
-
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);
|
|
11677
|
-
}
|
|
11678
|
-
else {
|
|
11679
|
-
// asyncPopups flag is set to false. Opens popup before acquiring token.
|
|
11680
|
-
this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
|
|
11681
|
-
var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
|
|
11682
|
-
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
|
|
11683
|
-
}
|
|
11684
|
-
}
|
|
11685
|
-
catch (e) {
|
|
11686
|
-
return Promise.reject(e);
|
|
11697
|
+
return Promise.reject(e);
|
|
11687
11698
|
}
|
|
11688
11699
|
};
|
|
11689
11700
|
/**
|
|
@@ -11694,7 +11705,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11694
11705
|
try {
|
|
11695
11706
|
this.logger.verbose("logoutPopup called");
|
|
11696
11707
|
var validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
|
11697
|
-
var popupName =
|
|
11708
|
+
var popupName = this.generateLogoutPopupName(validLogoutRequest);
|
|
11698
11709
|
var authority = logoutRequest && logoutRequest.authority;
|
|
11699
11710
|
var mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;
|
|
11700
11711
|
var popupWindowAttributes = (logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.popupWindowAttributes) || {};
|
|
@@ -11707,7 +11718,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11707
11718
|
else {
|
|
11708
11719
|
// asyncPopups flag is set to false. Opens popup before logging out.
|
|
11709
11720
|
this.logger.verbose("asyncPopup set to false, opening popup");
|
|
11710
|
-
var popup =
|
|
11721
|
+
var popup = this.openSizedPopup("about:blank", popupName, popupWindowAttributes);
|
|
11711
11722
|
return this.logoutPopupAsync(validLogoutRequest, popupName, popupWindowAttributes, authority, popup, mainWindowRedirectUri);
|
|
11712
11723
|
}
|
|
11713
11724
|
}
|
|
@@ -11756,15 +11767,15 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11756
11767
|
return [4 /*yield*/, authClient.getAuthCodeUrl(__assign$1(__assign$1({}, validRequest), { nativeBroker: isNativeBroker }))];
|
|
11757
11768
|
case 5:
|
|
11758
11769
|
navigateUrl = _a.sent();
|
|
11759
|
-
interactionHandler = new
|
|
11770
|
+
interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
|
|
11760
11771
|
popupParameters = {
|
|
11761
11772
|
popup: popup,
|
|
11762
11773
|
popupName: popupName,
|
|
11763
11774
|
popupWindowAttributes: popupWindowAttributes
|
|
11764
11775
|
};
|
|
11765
|
-
popupWindow =
|
|
11776
|
+
popupWindow = this.initiateAuthRequest(navigateUrl, popupParameters);
|
|
11766
11777
|
this.eventHandler.emitEvent(exports.EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow: popupWindow }, null);
|
|
11767
|
-
return [4 /*yield*/,
|
|
11778
|
+
return [4 /*yield*/, this.monitorPopupForHash(popupWindow)];
|
|
11768
11779
|
case 6:
|
|
11769
11780
|
hash = _a.sent();
|
|
11770
11781
|
serverParams = UrlString.getDeserializedHash(hash);
|
|
@@ -11822,7 +11833,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11822
11833
|
*/
|
|
11823
11834
|
PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
|
|
11824
11835
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11825
|
-
var serverTelemetryManager, authClient, logoutUri,
|
|
11836
|
+
var serverTelemetryManager, authClient, logoutUri, popupWindow, navigationOptions, absoluteUrl, e_2;
|
|
11826
11837
|
return __generator$1(this, function (_a) {
|
|
11827
11838
|
switch (_a.label) {
|
|
11828
11839
|
case 0:
|
|
@@ -11831,7 +11842,7 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11831
11842
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.logoutPopup);
|
|
11832
11843
|
_a.label = 1;
|
|
11833
11844
|
case 1:
|
|
11834
|
-
_a.trys.push([1,
|
|
11845
|
+
_a.trys.push([1, 5, , 6]);
|
|
11835
11846
|
// Clear cache on logout
|
|
11836
11847
|
return [4 /*yield*/, this.clearCacheOnLogout(validRequest.account)];
|
|
11837
11848
|
case 2:
|
|
@@ -11843,25 +11854,11 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11843
11854
|
this.logger.verbose("Auth code client created");
|
|
11844
11855
|
logoutUri = authClient.getLogoutUri(validRequest);
|
|
11845
11856
|
this.eventHandler.emitEvent(exports.EventType.LOGOUT_SUCCESS, exports.InteractionType.Popup, validRequest);
|
|
11846
|
-
|
|
11847
|
-
popupWindow = popupUtils.openPopup(logoutUri, { popupName: popupName, popupWindowAttributes: popupWindowAttributes, popup: popup });
|
|
11857
|
+
popupWindow = this.openPopup(logoutUri, { popupName: popupName, popupWindowAttributes: popupWindowAttributes, popup: popup });
|
|
11848
11858
|
this.eventHandler.emitEvent(exports.EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow: popupWindow }, null);
|
|
11849
|
-
|
|
11859
|
+
return [4 /*yield*/, this.waitForLogoutPopup(popupWindow)];
|
|
11850
11860
|
case 4:
|
|
11851
|
-
_a.trys.push([4, 6, , 7]);
|
|
11852
|
-
// Don't care if this throws an error (User Cancelled)
|
|
11853
|
-
return [4 /*yield*/, popupUtils.monitorPopupForSameOrigin(popupWindow)];
|
|
11854
|
-
case 5:
|
|
11855
|
-
// Don't care if this throws an error (User Cancelled)
|
|
11856
11861
|
_a.sent();
|
|
11857
|
-
this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri");
|
|
11858
|
-
return [3 /*break*/, 7];
|
|
11859
|
-
case 6:
|
|
11860
|
-
e_2 = _a.sent();
|
|
11861
|
-
this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_2);
|
|
11862
|
-
return [3 /*break*/, 7];
|
|
11863
|
-
case 7:
|
|
11864
|
-
popupUtils.cleanPopup(popupWindow);
|
|
11865
11862
|
if (mainWindowRedirectUri) {
|
|
11866
11863
|
navigationOptions = {
|
|
11867
11864
|
apiId: exports.ApiId.logoutPopup,
|
|
@@ -11876,28 +11873,280 @@ var PopupClient = /** @class */ (function (_super) {
|
|
|
11876
11873
|
else {
|
|
11877
11874
|
this.logger.verbose("No main window navigation requested");
|
|
11878
11875
|
}
|
|
11879
|
-
return [3 /*break*/,
|
|
11880
|
-
case
|
|
11881
|
-
|
|
11876
|
+
return [3 /*break*/, 6];
|
|
11877
|
+
case 5:
|
|
11878
|
+
e_2 = _a.sent();
|
|
11882
11879
|
if (popup) {
|
|
11883
11880
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
11884
11881
|
popup.close();
|
|
11885
11882
|
}
|
|
11886
|
-
if (
|
|
11887
|
-
|
|
11883
|
+
if (e_2 instanceof AuthError) {
|
|
11884
|
+
e_2.setCorrelationId(this.correlationId);
|
|
11888
11885
|
}
|
|
11889
11886
|
this.browserStorage.setInteractionInProgress(false);
|
|
11890
|
-
this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null,
|
|
11887
|
+
this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null, e_2);
|
|
11891
11888
|
this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
11892
|
-
serverTelemetryManager.cacheFailedRequest(
|
|
11893
|
-
throw
|
|
11894
|
-
case
|
|
11889
|
+
serverTelemetryManager.cacheFailedRequest(e_2);
|
|
11890
|
+
throw e_2;
|
|
11891
|
+
case 6:
|
|
11895
11892
|
this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
11896
11893
|
return [2 /*return*/];
|
|
11897
11894
|
}
|
|
11898
11895
|
});
|
|
11899
11896
|
});
|
|
11900
11897
|
};
|
|
11898
|
+
/**
|
|
11899
|
+
* Opens a popup window with given request Url.
|
|
11900
|
+
* @param requestUrl
|
|
11901
|
+
*/
|
|
11902
|
+
PopupClient.prototype.initiateAuthRequest = function (requestUrl, params) {
|
|
11903
|
+
// Check that request url is not empty.
|
|
11904
|
+
if (!StringUtils.isEmpty(requestUrl)) {
|
|
11905
|
+
this.logger.infoPii("Navigate to: " + requestUrl);
|
|
11906
|
+
// Open the popup window to requestUrl.
|
|
11907
|
+
return this.openPopup(requestUrl, params);
|
|
11908
|
+
}
|
|
11909
|
+
else {
|
|
11910
|
+
// Throw error if request URL is empty.
|
|
11911
|
+
this.logger.error("Navigate url is empty");
|
|
11912
|
+
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
11913
|
+
}
|
|
11914
|
+
};
|
|
11915
|
+
/**
|
|
11916
|
+
* Monitors a window until it loads a url with the same origin.
|
|
11917
|
+
* @param popupWindow - window that is being monitored
|
|
11918
|
+
* @param timeout - timeout for processing hash once popup is redirected back to application
|
|
11919
|
+
*/
|
|
11920
|
+
PopupClient.prototype.monitorPopupForHash = function (popupWindow) {
|
|
11921
|
+
var _this = this;
|
|
11922
|
+
return new Promise(function (resolve, reject) {
|
|
11923
|
+
/*
|
|
11924
|
+
* Polling for popups needs to be tick-based,
|
|
11925
|
+
* since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).
|
|
11926
|
+
*/
|
|
11927
|
+
var maxTicks = _this.config.system.windowHashTimeout / BrowserConstants.POLL_INTERVAL_MS;
|
|
11928
|
+
var ticks = 0;
|
|
11929
|
+
_this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");
|
|
11930
|
+
var intervalId = setInterval(function () {
|
|
11931
|
+
// Window is closed
|
|
11932
|
+
if (popupWindow.closed) {
|
|
11933
|
+
_this.logger.error("PopupHandler.monitorPopupForHash - window closed");
|
|
11934
|
+
_this.cleanPopup();
|
|
11935
|
+
clearInterval(intervalId);
|
|
11936
|
+
reject(BrowserAuthError.createUserCancelledError());
|
|
11937
|
+
return;
|
|
11938
|
+
}
|
|
11939
|
+
var href = Constants.EMPTY_STRING;
|
|
11940
|
+
var hash = Constants.EMPTY_STRING;
|
|
11941
|
+
try {
|
|
11942
|
+
/*
|
|
11943
|
+
* Will throw if cross origin,
|
|
11944
|
+
* which should be caught and ignored
|
|
11945
|
+
* since we need the interval to keep running while on STS UI.
|
|
11946
|
+
*/
|
|
11947
|
+
href = popupWindow.location.href;
|
|
11948
|
+
hash = popupWindow.location.hash;
|
|
11949
|
+
}
|
|
11950
|
+
catch (e) { }
|
|
11951
|
+
// Don't process blank pages or cross domain
|
|
11952
|
+
if (StringUtils.isEmpty(href) || href === "about:blank") {
|
|
11953
|
+
return;
|
|
11954
|
+
}
|
|
11955
|
+
_this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller");
|
|
11956
|
+
/*
|
|
11957
|
+
* Only run clock when we are on same domain for popups
|
|
11958
|
+
* as popup operations can take a long time.
|
|
11959
|
+
*/
|
|
11960
|
+
ticks++;
|
|
11961
|
+
if (hash) {
|
|
11962
|
+
_this.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url");
|
|
11963
|
+
clearInterval(intervalId);
|
|
11964
|
+
_this.cleanPopup(popupWindow);
|
|
11965
|
+
if (UrlString.hashContainsKnownProperties(hash)) {
|
|
11966
|
+
_this.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning.");
|
|
11967
|
+
resolve(hash);
|
|
11968
|
+
}
|
|
11969
|
+
else {
|
|
11970
|
+
_this.logger.error("PopupHandler.monitorPopupForHash - found hash in url but it does not contain known properties. Check that your router is not changing the hash prematurely.");
|
|
11971
|
+
_this.logger.errorPii("PopupHandler.monitorPopupForHash - hash found: " + hash);
|
|
11972
|
+
reject(BrowserAuthError.createHashDoesNotContainKnownPropertiesError());
|
|
11973
|
+
}
|
|
11974
|
+
}
|
|
11975
|
+
else if (ticks > maxTicks) {
|
|
11976
|
+
_this.logger.error("PopupHandler.monitorPopupForHash - unable to find hash in url, timing out");
|
|
11977
|
+
clearInterval(intervalId);
|
|
11978
|
+
reject(BrowserAuthError.createMonitorPopupTimeoutError());
|
|
11979
|
+
}
|
|
11980
|
+
}, BrowserConstants.POLL_INTERVAL_MS);
|
|
11981
|
+
});
|
|
11982
|
+
};
|
|
11983
|
+
/**
|
|
11984
|
+
* Waits for user interaction in logout popup window
|
|
11985
|
+
* @param popupWindow
|
|
11986
|
+
* @returns
|
|
11987
|
+
*/
|
|
11988
|
+
PopupClient.prototype.waitForLogoutPopup = function (popupWindow) {
|
|
11989
|
+
var _this = this;
|
|
11990
|
+
return new Promise(function (resolve) {
|
|
11991
|
+
_this.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");
|
|
11992
|
+
var intervalId = setInterval(function () {
|
|
11993
|
+
// Window is closed
|
|
11994
|
+
if (popupWindow.closed) {
|
|
11995
|
+
_this.logger.error("PopupHandler.waitForLogoutPopup - window closed");
|
|
11996
|
+
_this.cleanPopup();
|
|
11997
|
+
clearInterval(intervalId);
|
|
11998
|
+
resolve();
|
|
11999
|
+
}
|
|
12000
|
+
var href = Constants.EMPTY_STRING;
|
|
12001
|
+
try {
|
|
12002
|
+
/*
|
|
12003
|
+
* Will throw if cross origin,
|
|
12004
|
+
* which should be caught and ignored
|
|
12005
|
+
* since we need the interval to keep running while on STS UI.
|
|
12006
|
+
*/
|
|
12007
|
+
href = popupWindow.location.href;
|
|
12008
|
+
}
|
|
12009
|
+
catch (e) { }
|
|
12010
|
+
// Don't process blank pages or cross domain
|
|
12011
|
+
if (StringUtils.isEmpty(href) || href === "about:blank") {
|
|
12012
|
+
return;
|
|
12013
|
+
}
|
|
12014
|
+
_this.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing.");
|
|
12015
|
+
clearInterval(intervalId);
|
|
12016
|
+
_this.cleanPopup(popupWindow);
|
|
12017
|
+
resolve();
|
|
12018
|
+
}, BrowserConstants.POLL_INTERVAL_MS);
|
|
12019
|
+
});
|
|
12020
|
+
};
|
|
12021
|
+
/**
|
|
12022
|
+
* @hidden
|
|
12023
|
+
*
|
|
12024
|
+
* Configures popup window for login.
|
|
12025
|
+
*
|
|
12026
|
+
* @param urlNavigate
|
|
12027
|
+
* @param title
|
|
12028
|
+
* @param popUpWidth
|
|
12029
|
+
* @param popUpHeight
|
|
12030
|
+
* @param popupWindowAttributes
|
|
12031
|
+
* @ignore
|
|
12032
|
+
* @hidden
|
|
12033
|
+
*/
|
|
12034
|
+
PopupClient.prototype.openPopup = function (urlNavigate, popupParams) {
|
|
12035
|
+
try {
|
|
12036
|
+
var popupWindow = void 0;
|
|
12037
|
+
// Popup window passed in, setting url to navigate to
|
|
12038
|
+
if (popupParams.popup) {
|
|
12039
|
+
popupWindow = popupParams.popup;
|
|
12040
|
+
this.logger.verbosePii("Navigating popup window to: " + urlNavigate);
|
|
12041
|
+
popupWindow.location.assign(urlNavigate);
|
|
12042
|
+
}
|
|
12043
|
+
else if (typeof popupParams.popup === "undefined") {
|
|
12044
|
+
// Popup will be undefined if it was not passed in
|
|
12045
|
+
this.logger.verbosePii("Opening popup window to: " + urlNavigate);
|
|
12046
|
+
popupWindow = this.openSizedPopup(urlNavigate, popupParams.popupName, popupParams.popupWindowAttributes);
|
|
12047
|
+
}
|
|
12048
|
+
// Popup will be null if popups are blocked
|
|
12049
|
+
if (!popupWindow) {
|
|
12050
|
+
throw BrowserAuthError.createEmptyWindowCreatedError();
|
|
12051
|
+
}
|
|
12052
|
+
if (popupWindow.focus) {
|
|
12053
|
+
popupWindow.focus();
|
|
12054
|
+
}
|
|
12055
|
+
this.currentWindow = popupWindow;
|
|
12056
|
+
window.addEventListener("beforeunload", this.unloadWindow);
|
|
12057
|
+
return popupWindow;
|
|
12058
|
+
}
|
|
12059
|
+
catch (e) {
|
|
12060
|
+
this.logger.error("error opening popup " + e.message);
|
|
12061
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
12062
|
+
throw BrowserAuthError.createPopupWindowError(e.toString());
|
|
12063
|
+
}
|
|
12064
|
+
};
|
|
12065
|
+
/**
|
|
12066
|
+
* Helper function to set popup window dimensions and position
|
|
12067
|
+
* @param urlNavigate
|
|
12068
|
+
* @param popupName
|
|
12069
|
+
* @param popupWindowAttributes
|
|
12070
|
+
* @returns
|
|
12071
|
+
*/
|
|
12072
|
+
PopupClient.prototype.openSizedPopup = function (urlNavigate, popupName, popupWindowAttributes) {
|
|
12073
|
+
var _a, _b, _c, _d;
|
|
12074
|
+
/**
|
|
12075
|
+
* adding winLeft and winTop to account for dual monitor
|
|
12076
|
+
* using screenLeft and screenTop for IE8 and earlier
|
|
12077
|
+
*/
|
|
12078
|
+
var winLeft = window.screenLeft ? window.screenLeft : window.screenX;
|
|
12079
|
+
var winTop = window.screenTop ? window.screenTop : window.screenY;
|
|
12080
|
+
/**
|
|
12081
|
+
* window.innerWidth displays browser window"s height and width excluding toolbars
|
|
12082
|
+
* using document.documentElement.clientWidth for IE8 and earlier
|
|
12083
|
+
*/
|
|
12084
|
+
var winWidth = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
|
|
12085
|
+
var winHeight = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
|
|
12086
|
+
var width = (_a = popupWindowAttributes.popupSize) === null || _a === void 0 ? void 0 : _a.width;
|
|
12087
|
+
var height = (_b = popupWindowAttributes.popupSize) === null || _b === void 0 ? void 0 : _b.height;
|
|
12088
|
+
var top = (_c = popupWindowAttributes.popupPosition) === null || _c === void 0 ? void 0 : _c.top;
|
|
12089
|
+
var left = (_d = popupWindowAttributes.popupPosition) === null || _d === void 0 ? void 0 : _d.left;
|
|
12090
|
+
if (!width || width < 0 || width > winWidth) {
|
|
12091
|
+
this.logger.verbose("Default popup window width used. Window width not configured or invalid.");
|
|
12092
|
+
width = BrowserConstants.POPUP_WIDTH;
|
|
12093
|
+
}
|
|
12094
|
+
if (!height || height < 0 || height > winHeight) {
|
|
12095
|
+
this.logger.verbose("Default popup window height used. Window height not configured or invalid.");
|
|
12096
|
+
height = BrowserConstants.POPUP_HEIGHT;
|
|
12097
|
+
}
|
|
12098
|
+
if (!top || top < 0 || top > winHeight) {
|
|
12099
|
+
this.logger.verbose("Default popup window top position used. Window top not configured or invalid.");
|
|
12100
|
+
top = Math.max(0, ((winHeight / 2) - (BrowserConstants.POPUP_HEIGHT / 2)) + winTop);
|
|
12101
|
+
}
|
|
12102
|
+
if (!left || left < 0 || left > winWidth) {
|
|
12103
|
+
this.logger.verbose("Default popup window left position used. Window left not configured or invalid.");
|
|
12104
|
+
left = Math.max(0, ((winWidth / 2) - (BrowserConstants.POPUP_WIDTH / 2)) + winLeft);
|
|
12105
|
+
}
|
|
12106
|
+
return window.open(urlNavigate, popupName, "width=" + width + ", height=" + height + ", top=" + top + ", left=" + left + ", scrollbars=yes");
|
|
12107
|
+
};
|
|
12108
|
+
/**
|
|
12109
|
+
* Event callback to unload main window.
|
|
12110
|
+
*/
|
|
12111
|
+
PopupClient.prototype.unloadWindow = function (e) {
|
|
12112
|
+
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Popup);
|
|
12113
|
+
if (this.currentWindow) {
|
|
12114
|
+
this.currentWindow.close();
|
|
12115
|
+
}
|
|
12116
|
+
// Guarantees browser unload will happen, so no other errors will be thrown.
|
|
12117
|
+
e.preventDefault();
|
|
12118
|
+
};
|
|
12119
|
+
/**
|
|
12120
|
+
* Closes popup, removes any state vars created during popup calls.
|
|
12121
|
+
* @param popupWindow
|
|
12122
|
+
*/
|
|
12123
|
+
PopupClient.prototype.cleanPopup = function (popupWindow) {
|
|
12124
|
+
if (popupWindow) {
|
|
12125
|
+
// Close window.
|
|
12126
|
+
popupWindow.close();
|
|
12127
|
+
}
|
|
12128
|
+
// Remove window unload function
|
|
12129
|
+
window.removeEventListener("beforeunload", this.unloadWindow);
|
|
12130
|
+
// Interaction is completed - remove interaction status.
|
|
12131
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
12132
|
+
};
|
|
12133
|
+
/**
|
|
12134
|
+
* Generates the name for the popup based on the client id and request
|
|
12135
|
+
* @param clientId
|
|
12136
|
+
* @param request
|
|
12137
|
+
*/
|
|
12138
|
+
PopupClient.prototype.generatePopupName = function (scopes, authority) {
|
|
12139
|
+
return BrowserConstants.POPUP_NAME_PREFIX + "." + this.config.auth.clientId + "." + scopes.join("-") + "." + authority + "." + this.correlationId;
|
|
12140
|
+
};
|
|
12141
|
+
/**
|
|
12142
|
+
* Generates the name for the popup based on the client id and request for logouts
|
|
12143
|
+
* @param clientId
|
|
12144
|
+
* @param request
|
|
12145
|
+
*/
|
|
12146
|
+
PopupClient.prototype.generateLogoutPopupName = function (request) {
|
|
12147
|
+
var homeAccountId = request.account && request.account.homeAccountId;
|
|
12148
|
+
return BrowserConstants.POPUP_NAME_PREFIX + "." + this.config.auth.clientId + "." + homeAccountId + "." + this.correlationId;
|
|
12149
|
+
};
|
|
11901
12150
|
return PopupClient;
|
|
11902
12151
|
}(StandardInteractionClient));
|
|
11903
12152
|
|
|
@@ -11981,6 +12230,7 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
11981
12230
|
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
11982
12231
|
tenant: Constants.EMPTY_STRING
|
|
11983
12232
|
},
|
|
12233
|
+
skipAuthorityMetadataCache: false,
|
|
11984
12234
|
};
|
|
11985
12235
|
// Default cache options for browser
|
|
11986
12236
|
var DEFAULT_CACHE_OPTIONS = {
|
|
@@ -12020,8 +12270,8 @@ function buildConfiguration(_a, isBrowserEnvironment) {
|
|
|
12020
12270
|
*/
|
|
12021
12271
|
var SilentHandler = /** @class */ (function (_super) {
|
|
12022
12272
|
__extends$1(SilentHandler, _super);
|
|
12023
|
-
function SilentHandler(authCodeModule, storageImpl, authCodeRequest,
|
|
12024
|
-
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest,
|
|
12273
|
+
function SilentHandler(authCodeModule, storageImpl, authCodeRequest, logger, navigateFrameWait) {
|
|
12274
|
+
var _this = _super.call(this, authCodeModule, storageImpl, authCodeRequest, logger) || this;
|
|
12025
12275
|
_this.navigateFrameWait = navigateFrameWait;
|
|
12026
12276
|
return _this;
|
|
12027
12277
|
}
|
|
@@ -12038,7 +12288,7 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
12038
12288
|
case 0:
|
|
12039
12289
|
if (StringUtils.isEmpty(requestUrl)) {
|
|
12040
12290
|
// Throw error if request URL is empty.
|
|
12041
|
-
this.
|
|
12291
|
+
this.logger.info("Navigate url is empty");
|
|
12042
12292
|
throw BrowserAuthError.createEmptyNavigationUriError();
|
|
12043
12293
|
}
|
|
12044
12294
|
if (!this.navigateFrameWait) return [3 /*break*/, 2];
|
|
@@ -12063,7 +12313,7 @@ var SilentHandler = /** @class */ (function (_super) {
|
|
|
12063
12313
|
var _this = this;
|
|
12064
12314
|
return new Promise(function (resolve, reject) {
|
|
12065
12315
|
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
12066
|
-
_this.
|
|
12316
|
+
_this.logger.warning("system.loadFrameTimeout or system.iframeHashTimeout set to lower (" + timeout + "ms) than the default (" + DEFAULT_IFRAME_TIMEOUT_MS + "ms). This may result in timeouts.");
|
|
12067
12317
|
}
|
|
12068
12318
|
/*
|
|
12069
12319
|
* Polling for iframes can be purely timing based,
|
|
@@ -12228,6 +12478,8 @@ var SilentIframeClient = /** @class */ (function (_super) {
|
|
|
12228
12478
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
12229
12479
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
12230
12480
|
acquireTokenMeasurement.endMeasurement({
|
|
12481
|
+
errorCode: e_1 instanceof AuthError && e_1.errorCode || undefined,
|
|
12482
|
+
subErrorCode: e_1 instanceof AuthError && e_1.subError || undefined,
|
|
12231
12483
|
success: false
|
|
12232
12484
|
});
|
|
12233
12485
|
throw e_1;
|
|
@@ -12332,6 +12584,8 @@ var SilentCacheClient = /** @class */ (function (_super) {
|
|
|
12332
12584
|
this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
|
|
12333
12585
|
}
|
|
12334
12586
|
acquireTokenMeasurement.endMeasurement({
|
|
12587
|
+
errorCode: error_1 instanceof AuthError && error_1.errorCode || undefined,
|
|
12588
|
+
subErrorCode: error_1 instanceof AuthError && error_1.subError || undefined,
|
|
12335
12589
|
success: false
|
|
12336
12590
|
});
|
|
12337
12591
|
throw error_1;
|
|
@@ -12426,6 +12680,8 @@ var SilentRefreshClient = /** @class */ (function (_super) {
|
|
|
12426
12680
|
}
|
|
12427
12681
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
12428
12682
|
acquireTokenMeasurement.endMeasurement({
|
|
12683
|
+
errorCode: e.errorCode,
|
|
12684
|
+
subErrorCode: e.subError,
|
|
12429
12685
|
success: false
|
|
12430
12686
|
});
|
|
12431
12687
|
throw e;
|
|
@@ -12600,8 +12856,7 @@ var internals = /*#__PURE__*/Object.freeze({
|
|
|
12600
12856
|
EventHandler: EventHandler,
|
|
12601
12857
|
NativeMessageHandler: NativeMessageHandler,
|
|
12602
12858
|
BrowserConstants: BrowserConstants,
|
|
12603
|
-
get TemporaryCacheKeys () { return TemporaryCacheKeys; }
|
|
12604
|
-
PopupUtils: PopupUtils
|
|
12859
|
+
get TemporaryCacheKeys () { return TemporaryCacheKeys; }
|
|
12605
12860
|
});
|
|
12606
12861
|
|
|
12607
12862
|
/*
|
|
@@ -13969,7 +14224,7 @@ var CryptoOps = /** @class */ (function () {
|
|
|
13969
14224
|
CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {
|
|
13970
14225
|
var _a;
|
|
13971
14226
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
13972
|
-
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString,
|
|
14227
|
+
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString, encodedKeyIdThumbprint, shrHeader, encodedShrHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature, signedJwt;
|
|
13973
14228
|
return __generator$1(this, function (_b) {
|
|
13974
14229
|
switch (_b.label) {
|
|
13975
14230
|
case 0:
|
|
@@ -13984,17 +14239,15 @@ var CryptoOps = /** @class */ (function () {
|
|
|
13984
14239
|
case 2:
|
|
13985
14240
|
publicKeyJwk = _b.sent();
|
|
13986
14241
|
publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);
|
|
13987
|
-
|
|
13988
|
-
|
|
13989
|
-
|
|
13990
|
-
};
|
|
13991
|
-
encodedHeader = this.b64Encode.urlEncode(JSON.stringify(header));
|
|
14242
|
+
encodedKeyIdThumbprint = this.b64Encode.urlEncode(JSON.stringify({ kid: kid }));
|
|
14243
|
+
shrHeader = JoseHeader.getShrHeaderString({ kid: encodedKeyIdThumbprint, alg: publicKeyJwk.alg });
|
|
14244
|
+
encodedShrHeader = this.b64Encode.urlEncode(shrHeader);
|
|
13992
14245
|
// Generate payload
|
|
13993
14246
|
payload.cnf = {
|
|
13994
14247
|
jwk: JSON.parse(publicKeyJwkString)
|
|
13995
14248
|
};
|
|
13996
14249
|
encodedPayload = this.b64Encode.urlEncode(JSON.stringify(payload));
|
|
13997
|
-
tokenString =
|
|
14250
|
+
tokenString = encodedShrHeader + "." + encodedPayload;
|
|
13998
14251
|
tokenBuffer = BrowserStringUtils.stringToArrayBuffer(tokenString);
|
|
13999
14252
|
return [4 /*yield*/, this.browserCrypto.sign(cachedKeyPair.privateKey, tokenBuffer)];
|
|
14000
14253
|
case 3:
|
|
@@ -14072,6 +14325,7 @@ var TokenCache = /** @class */ (function () {
|
|
|
14072
14325
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
14073
14326
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
14074
14327
|
authorityMetadata: this.config.auth.authorityMetadata,
|
|
14328
|
+
skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
|
|
14075
14329
|
};
|
|
14076
14330
|
var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
|
|
14077
14331
|
// "clientInfo" from options takes precedence over "clientInfo" in response
|
|
@@ -14105,8 +14359,8 @@ var TokenCache = /** @class */ (function () {
|
|
|
14105
14359
|
var idTokenEntity = IdTokenEntity.createIdTokenEntity(homeAccountId, environment, idToken, this.config.auth.clientId, tenantId);
|
|
14106
14360
|
var idAuthToken = new AuthToken(idToken, this.cryptoObj);
|
|
14107
14361
|
var accountEntity = options.clientInfo ?
|
|
14108
|
-
AccountEntity.createAccount(options.clientInfo, homeAccountId, idAuthToken, undefined, undefined, undefined,
|
|
14109
|
-
AccountEntity.createGenericAccount(homeAccountId, idAuthToken, undefined, undefined, undefined,
|
|
14362
|
+
AccountEntity.createAccount(options.clientInfo, homeAccountId, idAuthToken, undefined, undefined, undefined, environment) :
|
|
14363
|
+
AccountEntity.createGenericAccount(homeAccountId, idAuthToken, undefined, undefined, undefined, environment);
|
|
14110
14364
|
if (this.isBrowserEnvironment) {
|
|
14111
14365
|
this.logger.verbose("TokenCache - loading id token");
|
|
14112
14366
|
this.storage.setAccount(accountEntity);
|
|
@@ -14138,7 +14392,7 @@ var TokenCache = /** @class */ (function () {
|
|
|
14138
14392
|
throw BrowserAuthError.createUnableToLoadTokenError("Please provide an extendedExpiresOn value in the options.");
|
|
14139
14393
|
}
|
|
14140
14394
|
var scopes = new ScopeSet(request.scopes).printScopes();
|
|
14141
|
-
var expiresOn = response.expires_in;
|
|
14395
|
+
var expiresOn = options.expiresOn || (response.expires_in + new Date().getTime() / 1000);
|
|
14142
14396
|
var extendedExpiresOn = options.extendedExpiresOn;
|
|
14143
14397
|
var accessTokenEntity = AccessTokenEntity.createAccessTokenEntity(homeAccountId, environment, response.access_token, this.config.auth.clientId, tenantId, scopes, expiresOn, extendedExpiresOn, this.cryptoObj);
|
|
14144
14398
|
if (this.isBrowserEnvironment) {
|
|
@@ -14412,7 +14666,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14412
14666
|
case 0:
|
|
14413
14667
|
this.logger.trace("initialize called");
|
|
14414
14668
|
if (this.initialized) {
|
|
14415
|
-
this.logger.
|
|
14669
|
+
this.logger.info("initialize has already been called, exiting early.");
|
|
14416
14670
|
return [2 /*return*/];
|
|
14417
14671
|
}
|
|
14418
14672
|
this.eventHandler.emitEvent(exports.EventType.INITIALIZE_START);
|
|
@@ -14543,6 +14797,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14543
14797
|
var redirectClient = _this.createRedirectClient(request.correlationId);
|
|
14544
14798
|
return redirectClient.acquireToken(request);
|
|
14545
14799
|
}
|
|
14800
|
+
else if (e instanceof InteractionRequiredAuthError) {
|
|
14801
|
+
_this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
|
|
14802
|
+
var redirectClient = _this.createRedirectClient(request.correlationId);
|
|
14803
|
+
return redirectClient.acquireToken(request);
|
|
14804
|
+
}
|
|
14805
|
+
_this.browserStorage.setInteractionInProgress(false);
|
|
14546
14806
|
throw e;
|
|
14547
14807
|
});
|
|
14548
14808
|
}
|
|
@@ -14608,6 +14868,12 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14608
14868
|
var popupClient = _this.createPopupClient(request.correlationId);
|
|
14609
14869
|
return popupClient.acquireToken(request);
|
|
14610
14870
|
}
|
|
14871
|
+
else if (e instanceof InteractionRequiredAuthError) {
|
|
14872
|
+
_this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");
|
|
14873
|
+
var popupClient = _this.createPopupClient(request.correlationId);
|
|
14874
|
+
return popupClient.acquireToken(request);
|
|
14875
|
+
}
|
|
14876
|
+
_this.browserStorage.setInteractionInProgress(false);
|
|
14611
14877
|
throw e;
|
|
14612
14878
|
});
|
|
14613
14879
|
}
|
|
@@ -14637,6 +14903,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14637
14903
|
_this.eventHandler.emitEvent(exports.EventType.LOGIN_FAILURE, exports.InteractionType.Popup, null, e);
|
|
14638
14904
|
}
|
|
14639
14905
|
atPopupMeasurement.endMeasurement({
|
|
14906
|
+
errorCode: e.errorCode,
|
|
14907
|
+
subErrorCode: e.subError,
|
|
14640
14908
|
success: false
|
|
14641
14909
|
});
|
|
14642
14910
|
atPopupMeasurement.flushMeasurement();
|
|
@@ -14690,13 +14958,16 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14690
14958
|
return [2 /*return*/, result.then(function (response) {
|
|
14691
14959
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_SUCCESS, exports.InteractionType.Silent, response);
|
|
14692
14960
|
ssoSilentMeasurement.endMeasurement({
|
|
14693
|
-
success: true
|
|
14961
|
+
success: true,
|
|
14962
|
+
isNativeBroker: response.fromNativeBroker
|
|
14694
14963
|
});
|
|
14695
14964
|
ssoSilentMeasurement.flushMeasurement();
|
|
14696
14965
|
return response;
|
|
14697
14966
|
}).catch(function (e) {
|
|
14698
14967
|
_this.eventHandler.emitEvent(exports.EventType.SSO_SILENT_FAILURE, exports.InteractionType.Silent, null, e);
|
|
14699
14968
|
ssoSilentMeasurement.endMeasurement({
|
|
14969
|
+
errorCode: e.errorCode,
|
|
14970
|
+
subErrorCode: e.subError,
|
|
14700
14971
|
success: false
|
|
14701
14972
|
});
|
|
14702
14973
|
ssoSilentMeasurement.flushMeasurement();
|
|
@@ -14736,7 +15007,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14736
15007
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, exports.InteractionType.Silent, result);
|
|
14737
15008
|
_this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
|
|
14738
15009
|
atbcMeasurement.endMeasurement({
|
|
14739
|
-
success: true
|
|
15010
|
+
success: true,
|
|
15011
|
+
isNativeBroker: result.fromNativeBroker
|
|
14740
15012
|
});
|
|
14741
15013
|
atbcMeasurement.flushMeasurement();
|
|
14742
15014
|
return result;
|
|
@@ -14745,6 +15017,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14745
15017
|
_this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
|
|
14746
15018
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, error);
|
|
14747
15019
|
atbcMeasurement.endMeasurement({
|
|
15020
|
+
errorCode: error.errorCode,
|
|
15021
|
+
subErrorCode: error.subError,
|
|
14748
15022
|
success: false
|
|
14749
15023
|
});
|
|
14750
15024
|
atbcMeasurement.flushMeasurement();
|
|
@@ -14782,6 +15056,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14782
15056
|
catch (e) {
|
|
14783
15057
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, exports.InteractionType.Silent, null, e);
|
|
14784
15058
|
atbcMeasurement.endMeasurement({
|
|
15059
|
+
errorCode: e instanceof AuthError && e.errorCode || undefined,
|
|
15060
|
+
subErrorCode: e instanceof AuthError && e.subError || undefined,
|
|
14785
15061
|
success: false
|
|
14786
15062
|
});
|
|
14787
15063
|
throw e;
|
|
@@ -14857,6 +15133,8 @@ var ClientApplication = /** @class */ (function () {
|
|
|
14857
15133
|
})
|
|
14858
15134
|
.catch(function (error) {
|
|
14859
15135
|
atbrtMeasurement.endMeasurement({
|
|
15136
|
+
errorCode: error.errorCode,
|
|
15137
|
+
subErrorCode: error.subError,
|
|
14860
15138
|
success: false
|
|
14861
15139
|
});
|
|
14862
15140
|
throw error;
|
|
@@ -15006,9 +15284,13 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15006
15284
|
// #region Helpers
|
|
15007
15285
|
/**
|
|
15008
15286
|
* Helper to validate app environment before making an auth request
|
|
15009
|
-
*
|
|
15287
|
+
*
|
|
15288
|
+
* @protected
|
|
15289
|
+
* @param {InteractionType} interactionType What kind of interaction is being used
|
|
15290
|
+
* @param {boolean} [setInteractionInProgress=true] Whether to set interaction in progress temp cache flag
|
|
15010
15291
|
*/
|
|
15011
|
-
ClientApplication.prototype.preflightBrowserEnvironmentCheck = function (interactionType) {
|
|
15292
|
+
ClientApplication.prototype.preflightBrowserEnvironmentCheck = function (interactionType, setInteractionInProgress) {
|
|
15293
|
+
if (setInteractionInProgress === void 0) { setInteractionInProgress = true; }
|
|
15012
15294
|
this.logger.verbose("preflightBrowserEnvironmentCheck started");
|
|
15013
15295
|
// Block request if not in browser environment
|
|
15014
15296
|
BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);
|
|
@@ -15027,20 +15309,23 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15027
15309
|
throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
|
|
15028
15310
|
}
|
|
15029
15311
|
if (interactionType === exports.InteractionType.Redirect || interactionType === exports.InteractionType.Popup) {
|
|
15030
|
-
this.preflightInteractiveRequest();
|
|
15312
|
+
this.preflightInteractiveRequest(setInteractionInProgress);
|
|
15031
15313
|
}
|
|
15032
15314
|
};
|
|
15033
15315
|
/**
|
|
15034
|
-
*
|
|
15035
|
-
*
|
|
15036
|
-
* @
|
|
15316
|
+
* Preflight check for interactive requests
|
|
15317
|
+
*
|
|
15318
|
+
* @protected
|
|
15319
|
+
* @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag
|
|
15037
15320
|
*/
|
|
15038
|
-
ClientApplication.prototype.preflightInteractiveRequest = function () {
|
|
15321
|
+
ClientApplication.prototype.preflightInteractiveRequest = function (setInteractionInProgress) {
|
|
15039
15322
|
this.logger.verbose("preflightInteractiveRequest called, validating app environment");
|
|
15040
15323
|
// block the reload if it occurred inside a hidden iframe
|
|
15041
15324
|
BrowserUtils.blockReloadInHiddenIframes();
|
|
15042
15325
|
// Set interaction in progress temporary cache or throw if alread set.
|
|
15043
|
-
|
|
15326
|
+
if (setInteractionInProgress) {
|
|
15327
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
15328
|
+
}
|
|
15044
15329
|
};
|
|
15045
15330
|
/**
|
|
15046
15331
|
* Acquire a token from native device (e.g. WAM)
|
|
@@ -15073,6 +15358,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15073
15358
|
switch (request.prompt) {
|
|
15074
15359
|
case PromptValue.NONE:
|
|
15075
15360
|
case PromptValue.CONSENT:
|
|
15361
|
+
case PromptValue.LOGIN:
|
|
15076
15362
|
this.logger.trace("canUseNative: prompt is compatible with native flow");
|
|
15077
15363
|
break;
|
|
15078
15364
|
default:
|
|
@@ -15103,7 +15389,7 @@ var ClientApplication = /** @class */ (function () {
|
|
|
15103
15389
|
return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
|
|
15104
15390
|
};
|
|
15105
15391
|
/**
|
|
15106
|
-
* Returns new instance of the
|
|
15392
|
+
* Returns new instance of the Redirect Interaction Client
|
|
15107
15393
|
* @param correlationId
|
|
15108
15394
|
*/
|
|
15109
15395
|
ClientApplication.prototype.createRedirectClient = function (correlationId) {
|
|
@@ -15349,7 +15635,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
15349
15635
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
15350
15636
|
atsMeasurement.endMeasurement({
|
|
15351
15637
|
success: true,
|
|
15352
|
-
fromCache: result.fromCache
|
|
15638
|
+
fromCache: result.fromCache,
|
|
15639
|
+
isNativeBroker: result.fromNativeBroker
|
|
15353
15640
|
});
|
|
15354
15641
|
atsMeasurement.flushMeasurement();
|
|
15355
15642
|
return result;
|
|
@@ -15357,6 +15644,8 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
15357
15644
|
.catch(function (error) {
|
|
15358
15645
|
_this.activeSilentTokenRequests.delete(silentRequestKey);
|
|
15359
15646
|
atsMeasurement.endMeasurement({
|
|
15647
|
+
errorCode: error.errorCode,
|
|
15648
|
+
subErrorCode: error.subError,
|
|
15360
15649
|
success: false
|
|
15361
15650
|
});
|
|
15362
15651
|
atsMeasurement.flushMeasurement();
|
|
@@ -15425,12 +15714,15 @@ var PublicClientApplication = /** @class */ (function (_super) {
|
|
|
15425
15714
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, response);
|
|
15426
15715
|
astsAsyncMeasurement.endMeasurement({
|
|
15427
15716
|
success: true,
|
|
15428
|
-
fromCache: response.fromCache
|
|
15717
|
+
fromCache: response.fromCache,
|
|
15718
|
+
isNativeBroker: response.fromNativeBroker
|
|
15429
15719
|
});
|
|
15430
15720
|
return response;
|
|
15431
15721
|
}).catch(function (tokenRenewalError) {
|
|
15432
15722
|
_this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError);
|
|
15433
15723
|
astsAsyncMeasurement.endMeasurement({
|
|
15724
|
+
errorCode: tokenRenewalError.errorCode,
|
|
15725
|
+
subErrorCode: tokenRenewalError.subError,
|
|
15434
15726
|
success: false
|
|
15435
15727
|
});
|
|
15436
15728
|
throw tokenRenewalError;
|