@azure/msal-browser 2.20.0 → 2.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.d.ts +7 -1
- package/dist/app/ClientApplication.d.ts.map +1 -1
- package/dist/app/ClientApplication.js +18 -3
- package/dist/app/ClientApplication.js.map +1 -1
- package/dist/app/IPublicClientApplication.js +1 -1
- package/dist/app/PublicClientApplication.d.ts +2 -2
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.js +29 -24
- package/dist/app/PublicClientApplication.js.map +1 -1
- package/dist/cache/AsyncMemoryStorage.js +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +19 -13
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +31 -7
- 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.map +1 -1
- package/dist/cache/TokenCache.js +4 -3
- package/dist/cache/TokenCache.js.map +1 -1
- package/dist/config/Configuration.d.ts +10 -9
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.js +7 -3
- package/dist/config/Configuration.js.map +1 -1
- package/dist/crypto/BrowserCrypto.js +1 -1
- package/dist/crypto/CryptoOps.d.ts +5 -0
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.js +22 -5
- 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.js +1 -1
- package/dist/error/BrowserConfigurationAuthError.js +1 -1
- package/dist/event/EventHandler.js +1 -1
- package/dist/event/EventMessage.js +1 -1
- package/dist/event/EventType.js +1 -1
- package/dist/index.cjs.js +615 -346
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +14 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +14 -3
- package/dist/index.js.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +2 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +37 -23
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/PopupClient.d.ts +4 -3
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +22 -20
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +3 -3
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.js +32 -19
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +11 -8
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +3 -3
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +15 -5
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts +3 -3
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +15 -12
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts +2 -2
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +13 -10
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +11 -11
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +90 -57
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/PopupHandler.d.ts.map +1 -1
- package/dist/interaction_handler/PopupHandler.js +1 -3
- package/dist/interaction_handler/PopupHandler.js.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.js +1 -2
- package/dist/interaction_handler/RedirectHandler.js.map +1 -1
- package/dist/interaction_handler/SilentHandler.js +1 -1
- package/dist/navigation/NavigationClient.js +1 -1
- package/dist/network/FetchClient.js +1 -1
- package/dist/network/XhrClient.js +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.js +2 -2
- package/dist/packageMetadata.js.map +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts +1 -1
- package/dist/request/AuthorizationCodeRequest.d.ts.map +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts +1 -1
- package/dist/request/AuthorizationUrlRequest.d.ts.map +1 -1
- package/dist/request/EndSessionPopupRequest.d.ts +1 -0
- package/dist/request/EndSessionPopupRequest.d.ts.map +1 -1
- package/dist/request/EndSessionRequest.d.ts +1 -0
- package/dist/request/EndSessionRequest.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/RedirectRequest.d.ts +1 -1
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/SilentRequest.d.ts +1 -1
- package/dist/request/SilentRequest.d.ts.map +1 -1
- package/dist/request/SsoSilentRequest.d.ts +1 -1
- package/dist/request/SsoSilentRequest.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.d.ts +2 -1
- package/dist/utils/BrowserConstants.d.ts.map +1 -1
- package/dist/utils/BrowserConstants.js +2 -1
- 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/dist/utils/PopupUtils.d.ts +1 -2
- package/dist/utils/PopupUtils.d.ts.map +1 -1
- package/dist/utils/PopupUtils.js +3 -3
- package/dist/utils/PopupUtils.js.map +1 -1
- package/lib/msal-browser.js +615 -346
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +34 -29
- package/package.json +2 -2
- package/CHANGELOG.json +0 -1656
- package/CHANGELOG.md +0 -523
package/lib/msal-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.22.1 2022-03-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
return ar;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
/*! @azure/msal-common
|
|
110
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
111
111
|
/*! *****************************************************************************
|
|
112
112
|
Copyright (c) Microsoft Corporation.
|
|
113
113
|
|
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
return r;
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
/*! @azure/msal-common
|
|
197
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -208,6 +208,7 @@
|
|
|
208
208
|
// default authority
|
|
209
209
|
DEFAULT_AUTHORITY: "https://login.microsoftonline.com/common/",
|
|
210
210
|
DEFAULT_AUTHORITY_HOST: "login.microsoftonline.com",
|
|
211
|
+
DEFAULT_COMMON_TENANT: "common",
|
|
211
212
|
// ADFS String
|
|
212
213
|
ADFS: "adfs",
|
|
213
214
|
// Default AAD Instance Discovery Endpoint
|
|
@@ -332,6 +333,7 @@
|
|
|
332
333
|
AADServerParamKeys["FOCI"] = "foci";
|
|
333
334
|
AADServerParamKeys["CCS_HEADER"] = "X-AnchorMailbox";
|
|
334
335
|
AADServerParamKeys["RETURN_SPA_CODE"] = "return_spa_code";
|
|
336
|
+
AADServerParamKeys["LOGOUT_HINT"] = "logout_hint";
|
|
335
337
|
})(AADServerParamKeys || (AADServerParamKeys = {}));
|
|
336
338
|
/**
|
|
337
339
|
* Claims request keys
|
|
@@ -556,7 +558,7 @@
|
|
|
556
558
|
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
557
559
|
})(CacheOutcome || (CacheOutcome = {}));
|
|
558
560
|
|
|
559
|
-
/*! @azure/msal-common
|
|
561
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
560
562
|
|
|
561
563
|
/*
|
|
562
564
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -600,7 +602,7 @@
|
|
|
600
602
|
return AuthError;
|
|
601
603
|
}(Error));
|
|
602
604
|
|
|
603
|
-
/*! @azure/msal-common
|
|
605
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
604
606
|
|
|
605
607
|
/*
|
|
606
608
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -663,10 +665,19 @@
|
|
|
663
665
|
throw AuthError.createUnexpectedError(notImplErr);
|
|
664
666
|
});
|
|
665
667
|
});
|
|
668
|
+
},
|
|
669
|
+
hashString: function () {
|
|
670
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
671
|
+
var notImplErr;
|
|
672
|
+
return __generator(this, function (_a) {
|
|
673
|
+
notImplErr = "Crypto interface - hashString() has not been implemented";
|
|
674
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
675
|
+
});
|
|
676
|
+
});
|
|
666
677
|
}
|
|
667
678
|
};
|
|
668
679
|
|
|
669
|
-
/*! @azure/msal-common
|
|
680
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
670
681
|
|
|
671
682
|
/*
|
|
672
683
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1128,7 +1139,7 @@
|
|
|
1128
1139
|
return ClientAuthError;
|
|
1129
1140
|
}(AuthError));
|
|
1130
1141
|
|
|
1131
|
-
/*! @azure/msal-common
|
|
1142
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
1132
1143
|
|
|
1133
1144
|
/*
|
|
1134
1145
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1253,7 +1264,7 @@
|
|
|
1253
1264
|
return StringUtils;
|
|
1254
1265
|
}());
|
|
1255
1266
|
|
|
1256
|
-
/*! @azure/msal-common
|
|
1267
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
1257
1268
|
|
|
1258
1269
|
/*
|
|
1259
1270
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1433,12 +1444,31 @@
|
|
|
1433
1444
|
return Logger;
|
|
1434
1445
|
}());
|
|
1435
1446
|
|
|
1436
|
-
/*! @azure/msal-common
|
|
1447
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
1437
1448
|
/* eslint-disable header/header */
|
|
1438
1449
|
var name$1 = "@azure/msal-common";
|
|
1439
|
-
var version$1 = "
|
|
1450
|
+
var version$1 = "6.1.0";
|
|
1440
1451
|
|
|
1441
|
-
/*! @azure/msal-common
|
|
1452
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
1453
|
+
/*
|
|
1454
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1455
|
+
* Licensed under the MIT License.
|
|
1456
|
+
*/
|
|
1457
|
+
exports.AzureCloudInstance = void 0;
|
|
1458
|
+
(function (AzureCloudInstance) {
|
|
1459
|
+
// AzureCloudInstance is not specified.
|
|
1460
|
+
AzureCloudInstance[AzureCloudInstance["None"] = 0] = "None";
|
|
1461
|
+
// Microsoft Azure public cloud
|
|
1462
|
+
AzureCloudInstance["AzurePublic"] = "https://login.microsoftonline.com";
|
|
1463
|
+
// Microsoft Chinese national cloud
|
|
1464
|
+
AzureCloudInstance["AzureChina"] = "https://login.chinacloudapi.cn";
|
|
1465
|
+
// Microsoft German national cloud ("Black Forest")
|
|
1466
|
+
AzureCloudInstance["AzureGermany"] = "https://login.microsoftonline.de";
|
|
1467
|
+
// US Government cloud
|
|
1468
|
+
AzureCloudInstance["AzureUsGovernment"] = "https://login.microsoftonline.us";
|
|
1469
|
+
})(exports.AzureCloudInstance || (exports.AzureCloudInstance = {}));
|
|
1470
|
+
|
|
1471
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
1442
1472
|
|
|
1443
1473
|
/*
|
|
1444
1474
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1449,7 +1479,7 @@
|
|
|
1449
1479
|
*
|
|
1450
1480
|
* Key:Value Schema:
|
|
1451
1481
|
*
|
|
1452
|
-
* Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<scheme
|
|
1482
|
+
* Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<requestedClaims*>-<scheme*>
|
|
1453
1483
|
*
|
|
1454
1484
|
* Value Schema:
|
|
1455
1485
|
* {
|
|
@@ -1463,6 +1493,7 @@
|
|
|
1463
1493
|
* target: Permissions that are included in the token, or for refresh tokens, the resource identifier.
|
|
1464
1494
|
* oboAssertion: access token passed in as part of OBO request
|
|
1465
1495
|
* tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)
|
|
1496
|
+
* requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request
|
|
1466
1497
|
* }
|
|
1467
1498
|
*/
|
|
1468
1499
|
var CredentialEntity = /** @class */ (function () {
|
|
@@ -1490,7 +1521,7 @@
|
|
|
1490
1521
|
* generates credential key
|
|
1491
1522
|
*/
|
|
1492
1523
|
CredentialEntity.prototype.generateCredentialKey = function () {
|
|
1493
|
-
return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType);
|
|
1524
|
+
return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType, this.requestedClaimsHash);
|
|
1494
1525
|
};
|
|
1495
1526
|
/**
|
|
1496
1527
|
* returns the type of the cache (in this case credential)
|
|
@@ -1534,16 +1565,14 @@
|
|
|
1534
1565
|
* generates credential key
|
|
1535
1566
|
* <home_account_id*>-\<environment>-<credential_type>-<client_id>-<realm\*>-<target\*>-<scheme\*>
|
|
1536
1567
|
*/
|
|
1537
|
-
CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType) {
|
|
1568
|
+
CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType, requestedClaimsHash) {
|
|
1538
1569
|
var credentialKey = [
|
|
1539
1570
|
this.generateAccountIdForCacheKey(homeAccountId, environment),
|
|
1540
1571
|
this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),
|
|
1541
|
-
this.generateTargetForCacheKey(target)
|
|
1572
|
+
this.generateTargetForCacheKey(target),
|
|
1573
|
+
this.generateClaimsHashForCacheKey(requestedClaimsHash),
|
|
1574
|
+
this.generateSchemeForCacheKey(tokenType)
|
|
1542
1575
|
];
|
|
1543
|
-
// PoP Tokens and SSH certs include scheme in cache key
|
|
1544
|
-
if (tokenType && tokenType !== exports.AuthenticationScheme.BEARER) {
|
|
1545
|
-
credentialKey.push(tokenType.toLowerCase());
|
|
1546
|
-
}
|
|
1547
1576
|
return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
1548
1577
|
};
|
|
1549
1578
|
/**
|
|
@@ -1579,10 +1608,26 @@
|
|
|
1579
1608
|
CredentialEntity.generateTargetForCacheKey = function (scopes) {
|
|
1580
1609
|
return (scopes || "").toLowerCase();
|
|
1581
1610
|
};
|
|
1611
|
+
/**
|
|
1612
|
+
* Generate requested claims key component as per schema: <requestedClaims>
|
|
1613
|
+
*/
|
|
1614
|
+
CredentialEntity.generateClaimsHashForCacheKey = function (requestedClaimsHash) {
|
|
1615
|
+
return (requestedClaimsHash || "").toLowerCase();
|
|
1616
|
+
};
|
|
1617
|
+
/**
|
|
1618
|
+
* Generate scheme key componenet as per schema: <scheme>
|
|
1619
|
+
*/
|
|
1620
|
+
CredentialEntity.generateSchemeForCacheKey = function (tokenType) {
|
|
1621
|
+
/*
|
|
1622
|
+
* PoP Tokens and SSH certs include scheme in cache key
|
|
1623
|
+
* Cast to lowercase to handle "bearer" from ADFS
|
|
1624
|
+
*/
|
|
1625
|
+
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : "";
|
|
1626
|
+
};
|
|
1582
1627
|
return CredentialEntity;
|
|
1583
1628
|
}());
|
|
1584
1629
|
|
|
1585
|
-
/*! @azure/msal-common
|
|
1630
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
1586
1631
|
|
|
1587
1632
|
/*
|
|
1588
1633
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1664,6 +1709,10 @@
|
|
|
1664
1709
|
code: "untrusted_authority",
|
|
1665
1710
|
desc: "The provided authority is not a trusted authority. Please include this authority in the knownAuthorities config parameter."
|
|
1666
1711
|
},
|
|
1712
|
+
invalidAzureCloudInstance: {
|
|
1713
|
+
code: "invalid_azure_cloud_instance",
|
|
1714
|
+
desc: "Invalid AzureCloudInstance provided. Please refer MSAL JS docs: aks.ms/msaljs/azure_cloud_instance for valid values"
|
|
1715
|
+
},
|
|
1667
1716
|
missingSshJwk: {
|
|
1668
1717
|
code: "missing_ssh_jwk",
|
|
1669
1718
|
desc: "Missing sshJwk in SSH certificate request. A stringified JSON Web Key is required when using the SSH authentication scheme."
|
|
@@ -1800,7 +1849,13 @@
|
|
|
1800
1849
|
ClientConfigurationError.createUntrustedAuthorityError = function () {
|
|
1801
1850
|
return new ClientConfigurationError(ClientConfigurationErrorMessage.untrustedAuthority.code, ClientConfigurationErrorMessage.untrustedAuthority.desc);
|
|
1802
1851
|
};
|
|
1803
|
-
|
|
1852
|
+
/**
|
|
1853
|
+
* Throws error when the AzureCloudInstance is set to an invalid value
|
|
1854
|
+
*/
|
|
1855
|
+
ClientConfigurationError.createInvalidAzureCloudInstanceError = function () {
|
|
1856
|
+
return new ClientConfigurationError(ClientConfigurationErrorMessage.invalidAzureCloudInstance.code, ClientConfigurationErrorMessage.invalidAzureCloudInstance.desc);
|
|
1857
|
+
};
|
|
1858
|
+
/**
|
|
1804
1859
|
* Throws an error when the authentication scheme is set to SSH but the SSH public key is omitted from the request
|
|
1805
1860
|
*/
|
|
1806
1861
|
ClientConfigurationError.createMissingSshJwkError = function () {
|
|
@@ -1827,7 +1882,7 @@
|
|
|
1827
1882
|
return ClientConfigurationError;
|
|
1828
1883
|
}(ClientAuthError));
|
|
1829
1884
|
|
|
1830
|
-
/*! @azure/msal-common
|
|
1885
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
1831
1886
|
|
|
1832
1887
|
/*
|
|
1833
1888
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2011,7 +2066,7 @@
|
|
|
2011
2066
|
return ScopeSet;
|
|
2012
2067
|
}());
|
|
2013
2068
|
|
|
2014
|
-
/*! @azure/msal-common
|
|
2069
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
2015
2070
|
|
|
2016
2071
|
/*
|
|
2017
2072
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2049,7 +2104,7 @@
|
|
|
2049
2104
|
};
|
|
2050
2105
|
}
|
|
2051
2106
|
|
|
2052
|
-
/*! @azure/msal-common
|
|
2107
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
2053
2108
|
/*
|
|
2054
2109
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2055
2110
|
* Licensed under the MIT License.
|
|
@@ -2063,7 +2118,7 @@
|
|
|
2063
2118
|
AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
|
|
2064
2119
|
})(AuthorityType || (AuthorityType = {}));
|
|
2065
2120
|
|
|
2066
|
-
/*! @azure/msal-common
|
|
2121
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
2067
2122
|
|
|
2068
2123
|
/*
|
|
2069
2124
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2297,7 +2352,7 @@
|
|
|
2297
2352
|
return AccountEntity;
|
|
2298
2353
|
}());
|
|
2299
2354
|
|
|
2300
|
-
/*! @azure/msal-common
|
|
2355
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
2301
2356
|
|
|
2302
2357
|
/*
|
|
2303
2358
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2335,7 +2390,7 @@
|
|
|
2335
2390
|
return AuthToken;
|
|
2336
2391
|
}());
|
|
2337
2392
|
|
|
2338
|
-
/*! @azure/msal-common
|
|
2393
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
2339
2394
|
|
|
2340
2395
|
/*
|
|
2341
2396
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2425,7 +2480,8 @@
|
|
|
2425
2480
|
environment: credential.environment,
|
|
2426
2481
|
homeAccountId: credential.homeAccountId,
|
|
2427
2482
|
realm: credential.realm,
|
|
2428
|
-
tokenType: credential.tokenType
|
|
2483
|
+
tokenType: credential.tokenType,
|
|
2484
|
+
requestedClaimsHash: credential.requestedClaimsHash
|
|
2429
2485
|
});
|
|
2430
2486
|
currentScopes = ScopeSet.fromString(credential.target);
|
|
2431
2487
|
currentAccessTokens = Object.keys(currentTokenCache.accessTokens).map(function (key) { return currentTokenCache.accessTokens[key]; });
|
|
@@ -2497,7 +2553,7 @@
|
|
|
2497
2553
|
* @param target
|
|
2498
2554
|
*/
|
|
2499
2555
|
CacheManager.prototype.getCredentialsFilteredBy = function (filter) {
|
|
2500
|
-
return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.oboAssertion, filter.tokenType, filter.keyId);
|
|
2556
|
+
return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.oboAssertion, filter.tokenType, filter.keyId, filter.requestedClaimsHash);
|
|
2501
2557
|
};
|
|
2502
2558
|
/**
|
|
2503
2559
|
* Support function to help match credentials
|
|
@@ -2510,7 +2566,7 @@
|
|
|
2510
2566
|
* @param oboAssertion
|
|
2511
2567
|
* @param tokenType
|
|
2512
2568
|
*/
|
|
2513
|
-
CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType, keyId) {
|
|
2569
|
+
CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType, keyId, requestedClaimsHash) {
|
|
2514
2570
|
var _this = this;
|
|
2515
2571
|
var allCacheKeys = this.getKeys();
|
|
2516
2572
|
var matchingCredentials = {
|
|
@@ -2557,38 +2613,37 @@
|
|
|
2557
2613
|
if (!!target && !_this.matchTarget(entity, target)) {
|
|
2558
2614
|
return;
|
|
2559
2615
|
}
|
|
2616
|
+
// If request OR cached entity has requested Claims Hash, check if they match
|
|
2617
|
+
if (requestedClaimsHash || entity.requestedClaimsHash) {
|
|
2618
|
+
// Don't match if either is undefined or they are different
|
|
2619
|
+
if (entity.requestedClaimsHash !== requestedClaimsHash) {
|
|
2620
|
+
return;
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2560
2623
|
// Access Token with Auth Scheme specific matching
|
|
2561
2624
|
if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
|
|
2562
2625
|
if (!!tokenType && !_this.matchTokenType(entity, tokenType)) {
|
|
2563
2626
|
return;
|
|
2564
2627
|
}
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
_this.removeItem(cacheKey, CacheSchemaType.CREDENTIAL);
|
|
2571
|
-
return;
|
|
2572
|
-
}
|
|
2573
|
-
break;
|
|
2574
|
-
case exports.AuthenticationScheme.SSH:
|
|
2575
|
-
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
|
|
2576
|
-
if (keyId && !_this.matchKeyId(entity, keyId)) {
|
|
2577
|
-
return;
|
|
2578
|
-
}
|
|
2579
|
-
break;
|
|
2628
|
+
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
|
|
2629
|
+
if (tokenType === exports.AuthenticationScheme.SSH) {
|
|
2630
|
+
if (keyId && !_this.matchKeyId(entity, keyId)) {
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2580
2633
|
}
|
|
2581
2634
|
}
|
|
2635
|
+
// At this point, the entity matches the request, update cache key if key schema has changed
|
|
2636
|
+
var updatedCacheKey = _this.updateCredentialCacheKey(cacheKey, entity);
|
|
2582
2637
|
switch (credType) {
|
|
2583
2638
|
case CredentialType.ID_TOKEN:
|
|
2584
|
-
matchingCredentials.idTokens[
|
|
2639
|
+
matchingCredentials.idTokens[updatedCacheKey] = entity;
|
|
2585
2640
|
break;
|
|
2586
2641
|
case CredentialType.ACCESS_TOKEN:
|
|
2587
2642
|
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
|
|
2588
|
-
matchingCredentials.accessTokens[
|
|
2643
|
+
matchingCredentials.accessTokens[updatedCacheKey] = entity;
|
|
2589
2644
|
break;
|
|
2590
2645
|
case CredentialType.REFRESH_TOKEN:
|
|
2591
|
-
matchingCredentials.refreshTokens[
|
|
2646
|
+
matchingCredentials.refreshTokens[updatedCacheKey] = entity;
|
|
2592
2647
|
break;
|
|
2593
2648
|
}
|
|
2594
2649
|
});
|
|
@@ -2787,10 +2842,10 @@
|
|
|
2787
2842
|
* @param environment
|
|
2788
2843
|
* @param authScheme
|
|
2789
2844
|
*/
|
|
2790
|
-
CacheManager.prototype.readCacheRecord = function (account, clientId,
|
|
2845
|
+
CacheManager.prototype.readCacheRecord = function (account, clientId, request, environment) {
|
|
2791
2846
|
var cachedAccount = this.readAccountFromCache(account);
|
|
2792
2847
|
var cachedIdToken = this.readIdTokenFromCache(clientId, account);
|
|
2793
|
-
var cachedAccessToken = this.readAccessTokenFromCache(clientId, account,
|
|
2848
|
+
var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, request);
|
|
2794
2849
|
var cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);
|
|
2795
2850
|
var cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);
|
|
2796
2851
|
if (cachedAccount && cachedIdToken) {
|
|
@@ -2844,9 +2899,14 @@
|
|
|
2844
2899
|
* @param scopes
|
|
2845
2900
|
* @param authScheme
|
|
2846
2901
|
*/
|
|
2847
|
-
CacheManager.prototype.readAccessTokenFromCache = function (clientId, account,
|
|
2848
|
-
|
|
2849
|
-
var
|
|
2902
|
+
CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, request) {
|
|
2903
|
+
var scopes = new ScopeSet(request.scopes || []);
|
|
2904
|
+
var authScheme = request.authenticationScheme || exports.AuthenticationScheme.BEARER;
|
|
2905
|
+
/*
|
|
2906
|
+
* Distinguish between Bearer and PoP/SSH token cache types
|
|
2907
|
+
* Cast to lowercase to handle "bearer" from ADFS
|
|
2908
|
+
*/
|
|
2909
|
+
var credentialType = (authScheme && authScheme.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
|
|
2850
2910
|
var accessTokenFilter = {
|
|
2851
2911
|
homeAccountId: account.homeAccountId,
|
|
2852
2912
|
environment: account.environment,
|
|
@@ -2855,7 +2915,8 @@
|
|
|
2855
2915
|
realm: account.tenantId,
|
|
2856
2916
|
target: scopes.printScopesLowerCase(),
|
|
2857
2917
|
tokenType: authScheme,
|
|
2858
|
-
keyId:
|
|
2918
|
+
keyId: request.sshKid,
|
|
2919
|
+
requestedClaimsHash: request.requestedClaimsHash
|
|
2859
2920
|
};
|
|
2860
2921
|
var credentialCache = this.getCredentialsFilteredBy(accessTokenFilter);
|
|
2861
2922
|
var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
|
|
@@ -3164,10 +3225,14 @@
|
|
|
3164
3225
|
});
|
|
3165
3226
|
});
|
|
3166
3227
|
};
|
|
3228
|
+
DefaultStorageClass.prototype.updateCredentialCacheKey = function () {
|
|
3229
|
+
var notImplErr = "Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.";
|
|
3230
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
3231
|
+
};
|
|
3167
3232
|
return DefaultStorageClass;
|
|
3168
3233
|
}(CacheManager));
|
|
3169
3234
|
|
|
3170
|
-
/*! @azure/msal-common
|
|
3235
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3171
3236
|
|
|
3172
3237
|
/*
|
|
3173
3238
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3177,7 +3242,8 @@
|
|
|
3177
3242
|
var DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
3178
3243
|
var DEFAULT_SYSTEM_OPTIONS = {
|
|
3179
3244
|
tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
3180
|
-
preventCorsPreflight: false
|
|
3245
|
+
preventCorsPreflight: false,
|
|
3246
|
+
proxyUrl: "",
|
|
3181
3247
|
};
|
|
3182
3248
|
var DEFAULT_LOGGER_IMPLEMENTATION = {
|
|
3183
3249
|
loggerCallback: function () {
|
|
@@ -3217,6 +3283,10 @@
|
|
|
3217
3283
|
clientSecret: "",
|
|
3218
3284
|
clientAssertion: undefined
|
|
3219
3285
|
};
|
|
3286
|
+
var DEFAULT_AZURE_CLOUD_OPTIONS = {
|
|
3287
|
+
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
3288
|
+
tenant: "" + Constants.DEFAULT_COMMON_TENANT
|
|
3289
|
+
};
|
|
3220
3290
|
/**
|
|
3221
3291
|
* Function that sets the default options when not explicitly configured from app developer
|
|
3222
3292
|
*
|
|
@@ -3246,10 +3316,10 @@
|
|
|
3246
3316
|
* @param authOptions
|
|
3247
3317
|
*/
|
|
3248
3318
|
function buildAuthOptions(authOptions) {
|
|
3249
|
-
return __assign({ clientCapabilities: [] }, authOptions);
|
|
3319
|
+
return __assign({ clientCapabilities: [], azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS }, authOptions);
|
|
3250
3320
|
}
|
|
3251
3321
|
|
|
3252
|
-
/*! @azure/msal-common
|
|
3322
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3253
3323
|
|
|
3254
3324
|
/*
|
|
3255
3325
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3269,7 +3339,7 @@
|
|
|
3269
3339
|
return ServerError;
|
|
3270
3340
|
}(AuthError));
|
|
3271
3341
|
|
|
3272
|
-
/*! @azure/msal-common
|
|
3342
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3273
3343
|
|
|
3274
3344
|
/*
|
|
3275
3345
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3352,11 +3422,11 @@
|
|
|
3352
3422
|
authority: request.authority,
|
|
3353
3423
|
scopes: request.scopes,
|
|
3354
3424
|
homeAccountIdentifier: homeAccountIdentifier,
|
|
3425
|
+
claims: request.claims,
|
|
3355
3426
|
authenticationScheme: request.authenticationScheme,
|
|
3356
3427
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
3357
3428
|
resourceRequestUri: request.resourceRequestUri,
|
|
3358
3429
|
shrClaims: request.shrClaims,
|
|
3359
|
-
sshJwk: request.sshJwk,
|
|
3360
3430
|
sshKid: request.sshKid
|
|
3361
3431
|
};
|
|
3362
3432
|
var key = this.generateThrottlingStorageKey(thumbprint);
|
|
@@ -3365,7 +3435,7 @@
|
|
|
3365
3435
|
return ThrottlingUtils;
|
|
3366
3436
|
}());
|
|
3367
3437
|
|
|
3368
|
-
/*! @azure/msal-common
|
|
3438
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3369
3439
|
|
|
3370
3440
|
/*
|
|
3371
3441
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3414,7 +3484,7 @@
|
|
|
3414
3484
|
return NetworkManager;
|
|
3415
3485
|
}());
|
|
3416
3486
|
|
|
3417
|
-
/*! @azure/msal-common
|
|
3487
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3418
3488
|
/*
|
|
3419
3489
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3420
3490
|
* Licensed under the MIT License.
|
|
@@ -3425,7 +3495,7 @@
|
|
|
3425
3495
|
CcsCredentialType["UPN"] = "UPN";
|
|
3426
3496
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3427
3497
|
|
|
3428
|
-
/*! @azure/msal-common
|
|
3498
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3429
3499
|
|
|
3430
3500
|
/*
|
|
3431
3501
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3489,7 +3559,7 @@
|
|
|
3489
3559
|
var response;
|
|
3490
3560
|
return __generator(this, function (_a) {
|
|
3491
3561
|
switch (_a.label) {
|
|
3492
|
-
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers })];
|
|
3562
|
+
case 0: return [4 /*yield*/, this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers, proxyUrl: this.config.systemOptions.proxyUrl })];
|
|
3493
3563
|
case 1:
|
|
3494
3564
|
response = _a.sent();
|
|
3495
3565
|
if (this.config.serverTelemetryManager && response.status < 500 && response.status !== 429) {
|
|
@@ -3514,7 +3584,7 @@
|
|
|
3514
3584
|
return BaseClient;
|
|
3515
3585
|
}());
|
|
3516
3586
|
|
|
3517
|
-
/*! @azure/msal-common
|
|
3587
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3518
3588
|
|
|
3519
3589
|
/*
|
|
3520
3590
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3600,7 +3670,7 @@
|
|
|
3600
3670
|
return RequestValidator;
|
|
3601
3671
|
}());
|
|
3602
3672
|
|
|
3603
|
-
/*! @azure/msal-common
|
|
3673
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3604
3674
|
|
|
3605
3675
|
/*
|
|
3606
3676
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3927,6 +3997,12 @@
|
|
|
3927
3997
|
RequestParameterBuilder.prototype.addThrottling = function () {
|
|
3928
3998
|
this.parameters.set(AADServerParamKeys.X_MS_LIB_CAPABILITY, ThrottlingConstants.X_MS_LIB_CAPABILITY_VALUE);
|
|
3929
3999
|
};
|
|
4000
|
+
/**
|
|
4001
|
+
* Adds logout_hint parameter for "silent" logout which prevent server account picker
|
|
4002
|
+
*/
|
|
4003
|
+
RequestParameterBuilder.prototype.addLogoutHint = function (logoutHint) {
|
|
4004
|
+
this.parameters.set(AADServerParamKeys.LOGOUT_HINT, encodeURIComponent(logoutHint));
|
|
4005
|
+
};
|
|
3930
4006
|
/**
|
|
3931
4007
|
* Utility to create a URL from the params map
|
|
3932
4008
|
*/
|
|
@@ -3940,7 +4016,7 @@
|
|
|
3940
4016
|
return RequestParameterBuilder;
|
|
3941
4017
|
}());
|
|
3942
4018
|
|
|
3943
|
-
/*! @azure/msal-common
|
|
4019
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
3944
4020
|
|
|
3945
4021
|
/*
|
|
3946
4022
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4005,7 +4081,7 @@
|
|
|
4005
4081
|
return IdTokenEntity;
|
|
4006
4082
|
}(CredentialEntity));
|
|
4007
4083
|
|
|
4008
|
-
/*! @azure/msal-common
|
|
4084
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4009
4085
|
/*
|
|
4010
4086
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4011
4087
|
* Licensed under the MIT License.
|
|
@@ -4055,7 +4131,7 @@
|
|
|
4055
4131
|
return TimeUtils;
|
|
4056
4132
|
}());
|
|
4057
4133
|
|
|
4058
|
-
/*! @azure/msal-common
|
|
4134
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4059
4135
|
|
|
4060
4136
|
/*
|
|
4061
4137
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4101,8 +4177,8 @@
|
|
|
4101
4177
|
* @param expiresOn
|
|
4102
4178
|
* @param extExpiresOn
|
|
4103
4179
|
*/
|
|
4104
|
-
AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion, keyId) {
|
|
4105
|
-
var _a;
|
|
4180
|
+
AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion, keyId, requestedClaims, requestedClaimsHash) {
|
|
4181
|
+
var _a, _b;
|
|
4106
4182
|
var atEntity = new AccessTokenEntity();
|
|
4107
4183
|
atEntity.homeAccountId = homeAccountId;
|
|
4108
4184
|
atEntity.credentialType = CredentialType.ACCESS_TOKEN;
|
|
@@ -4124,14 +4200,21 @@
|
|
|
4124
4200
|
atEntity.target = scopes;
|
|
4125
4201
|
atEntity.oboAssertion = oboAssertion;
|
|
4126
4202
|
atEntity.tokenType = StringUtils.isEmpty(tokenType) ? exports.AuthenticationScheme.BEARER : tokenType;
|
|
4127
|
-
|
|
4128
|
-
|
|
4203
|
+
if (requestedClaims) {
|
|
4204
|
+
atEntity.requestedClaims = requestedClaims;
|
|
4205
|
+
atEntity.requestedClaimsHash = requestedClaimsHash;
|
|
4206
|
+
}
|
|
4207
|
+
/*
|
|
4208
|
+
* Create Access Token With Auth Scheme instead of regular access token
|
|
4209
|
+
* Cast to lower to handle "bearer" from ADFS
|
|
4210
|
+
*/
|
|
4211
|
+
if (((_a = atEntity.tokenType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== exports.AuthenticationScheme.BEARER.toLowerCase()) {
|
|
4129
4212
|
atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
4130
4213
|
switch (atEntity.tokenType) {
|
|
4131
4214
|
case exports.AuthenticationScheme.POP:
|
|
4132
4215
|
// Make sure keyId is present and add it to credential
|
|
4133
4216
|
var tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
|
|
4134
|
-
if (!((
|
|
4217
|
+
if (!((_b = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _b === void 0 ? void 0 : _b.kid)) {
|
|
4135
4218
|
throw ClientAuthError.createTokenClaimsRequiredError();
|
|
4136
4219
|
}
|
|
4137
4220
|
atEntity.keyId = tokenClaims.cnf.kid;
|
|
@@ -4162,7 +4245,7 @@
|
|
|
4162
4245
|
return AccessTokenEntity;
|
|
4163
4246
|
}(CredentialEntity));
|
|
4164
4247
|
|
|
4165
|
-
/*! @azure/msal-common
|
|
4248
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4166
4249
|
|
|
4167
4250
|
/*
|
|
4168
4251
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4229,7 +4312,7 @@
|
|
|
4229
4312
|
return RefreshTokenEntity;
|
|
4230
4313
|
}(CredentialEntity));
|
|
4231
4314
|
|
|
4232
|
-
/*! @azure/msal-common
|
|
4315
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4233
4316
|
|
|
4234
4317
|
/*
|
|
4235
4318
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4293,7 +4376,7 @@
|
|
|
4293
4376
|
return InteractionRequiredAuthError;
|
|
4294
4377
|
}(AuthError));
|
|
4295
4378
|
|
|
4296
|
-
/*! @azure/msal-common
|
|
4379
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4297
4380
|
/*
|
|
4298
4381
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4299
4382
|
* Licensed under the MIT License.
|
|
@@ -4309,7 +4392,7 @@
|
|
|
4309
4392
|
return CacheRecord;
|
|
4310
4393
|
}());
|
|
4311
4394
|
|
|
4312
|
-
/*! @azure/msal-common
|
|
4395
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4313
4396
|
|
|
4314
4397
|
/*
|
|
4315
4398
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4380,7 +4463,7 @@
|
|
|
4380
4463
|
return ProtocolUtils;
|
|
4381
4464
|
}());
|
|
4382
4465
|
|
|
4383
|
-
/*! @azure/msal-common
|
|
4466
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4384
4467
|
|
|
4385
4468
|
/*
|
|
4386
4469
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4581,7 +4664,7 @@
|
|
|
4581
4664
|
return UrlString;
|
|
4582
4665
|
}());
|
|
4583
4666
|
|
|
4584
|
-
/*! @azure/msal-common
|
|
4667
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4585
4668
|
|
|
4586
4669
|
/*
|
|
4587
4670
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4656,7 +4739,7 @@
|
|
|
4656
4739
|
return PopTokenGenerator;
|
|
4657
4740
|
}());
|
|
4658
4741
|
|
|
4659
|
-
/*! @azure/msal-common
|
|
4742
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4660
4743
|
|
|
4661
4744
|
/*
|
|
4662
4745
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4726,7 +4809,7 @@
|
|
|
4726
4809
|
return AppMetadataEntity;
|
|
4727
4810
|
}());
|
|
4728
4811
|
|
|
4729
|
-
/*! @azure/msal-common
|
|
4812
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4730
4813
|
/*
|
|
4731
4814
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4732
4815
|
* Licensed under the MIT License.
|
|
@@ -4762,7 +4845,7 @@
|
|
|
4762
4845
|
return TokenCacheContext;
|
|
4763
4846
|
}());
|
|
4764
4847
|
|
|
4765
|
-
/*! @azure/msal-common
|
|
4848
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
4766
4849
|
|
|
4767
4850
|
/*
|
|
4768
4851
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4845,7 +4928,7 @@
|
|
|
4845
4928
|
}
|
|
4846
4929
|
// Add keyId from request to serverTokenResponse if defined
|
|
4847
4930
|
serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;
|
|
4848
|
-
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp,
|
|
4931
|
+
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, oboAssertion, authCodePayload);
|
|
4849
4932
|
_a.label = 1;
|
|
4850
4933
|
case 1:
|
|
4851
4934
|
_a.trys.push([1, , 5, 8]);
|
|
@@ -4893,7 +4976,7 @@
|
|
|
4893
4976
|
* @param idTokenObj
|
|
4894
4977
|
* @param authority
|
|
4895
4978
|
*/
|
|
4896
|
-
ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp,
|
|
4979
|
+
ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, request, idTokenObj, oboAssertion, authCodePayload) {
|
|
4897
4980
|
var env = authority.getPreferredCache();
|
|
4898
4981
|
if (StringUtils.isEmpty(env)) {
|
|
4899
4982
|
throw ClientAuthError.createInvalidCacheEnvironmentError();
|
|
@@ -4909,7 +4992,7 @@
|
|
|
4909
4992
|
var cachedAccessToken = null;
|
|
4910
4993
|
if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {
|
|
4911
4994
|
// If scopes not returned in server response, use request scopes
|
|
4912
|
-
var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(
|
|
4995
|
+
var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);
|
|
4913
4996
|
/*
|
|
4914
4997
|
* Use timestamp calculated before request
|
|
4915
4998
|
* Server may return timestamps as strings, parse to numbers if so.
|
|
@@ -4921,7 +5004,7 @@
|
|
|
4921
5004
|
var extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;
|
|
4922
5005
|
var refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;
|
|
4923
5006
|
// non AAD scenarios can have empty realm
|
|
4924
|
-
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, oboAssertion, serverTokenResponse.key_id);
|
|
5007
|
+
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, oboAssertion, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);
|
|
4925
5008
|
}
|
|
4926
5009
|
// refreshToken
|
|
4927
5010
|
var cachedRefreshToken = null;
|
|
@@ -5027,7 +5110,7 @@
|
|
|
5027
5110
|
return ResponseHandler;
|
|
5028
5111
|
}());
|
|
5029
5112
|
|
|
5030
|
-
/*! @azure/msal-common
|
|
5113
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5031
5114
|
|
|
5032
5115
|
/*
|
|
5033
5116
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5142,11 +5225,11 @@
|
|
|
5142
5225
|
clientId: this.config.authOptions.clientId,
|
|
5143
5226
|
authority: authority.canonicalAuthority,
|
|
5144
5227
|
scopes: request.scopes,
|
|
5228
|
+
claims: request.claims,
|
|
5145
5229
|
authenticationScheme: request.authenticationScheme,
|
|
5146
5230
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
5147
5231
|
resourceRequestUri: request.resourceRequestUri,
|
|
5148
5232
|
shrClaims: request.shrClaims,
|
|
5149
|
-
sshJwk: request.sshJwk,
|
|
5150
5233
|
sshKid: request.sshKid
|
|
5151
5234
|
};
|
|
5152
5235
|
return [4 /*yield*/, this.createTokenRequestBody(request)];
|
|
@@ -5416,6 +5499,9 @@
|
|
|
5416
5499
|
if (request.state) {
|
|
5417
5500
|
parameterBuilder.addState(request.state);
|
|
5418
5501
|
}
|
|
5502
|
+
if (request.logoutHint) {
|
|
5503
|
+
parameterBuilder.addLogoutHint(request.logoutHint);
|
|
5504
|
+
}
|
|
5419
5505
|
if (request.extraQueryParameters) {
|
|
5420
5506
|
parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);
|
|
5421
5507
|
}
|
|
@@ -5435,7 +5521,7 @@
|
|
|
5435
5521
|
return AuthorizationCodeClient;
|
|
5436
5522
|
}(BaseClient));
|
|
5437
5523
|
|
|
5438
|
-
/*! @azure/msal-common
|
|
5524
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5439
5525
|
|
|
5440
5526
|
/*
|
|
5441
5527
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5546,11 +5632,11 @@
|
|
|
5546
5632
|
clientId: this.config.authOptions.clientId,
|
|
5547
5633
|
authority: authority.canonicalAuthority,
|
|
5548
5634
|
scopes: request.scopes,
|
|
5635
|
+
claims: request.claims,
|
|
5549
5636
|
authenticationScheme: request.authenticationScheme,
|
|
5550
5637
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
5551
5638
|
resourceRequestUri: request.resourceRequestUri,
|
|
5552
5639
|
shrClaims: request.shrClaims,
|
|
5553
|
-
sshJwk: request.sshJwk,
|
|
5554
5640
|
sshKid: request.sshKid
|
|
5555
5641
|
};
|
|
5556
5642
|
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
|
|
@@ -5646,7 +5732,7 @@
|
|
|
5646
5732
|
return RefreshTokenClient;
|
|
5647
5733
|
}(BaseClient));
|
|
5648
5734
|
|
|
5649
|
-
/*! @azure/msal-common
|
|
5735
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5650
5736
|
|
|
5651
5737
|
/*
|
|
5652
5738
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5692,7 +5778,7 @@
|
|
|
5692
5778
|
SilentFlowClient.prototype.acquireCachedToken = function (request) {
|
|
5693
5779
|
var _a, _b, _c, _d;
|
|
5694
5780
|
return __awaiter(this, void 0, void 0, function () {
|
|
5695
|
-
var
|
|
5781
|
+
var environment, cacheRecord;
|
|
5696
5782
|
return __generator(this, function (_e) {
|
|
5697
5783
|
switch (_e.label) {
|
|
5698
5784
|
case 0:
|
|
@@ -5706,19 +5792,12 @@
|
|
|
5706
5792
|
this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
|
|
5707
5793
|
throw ClientAuthError.createRefreshRequiredError();
|
|
5708
5794
|
}
|
|
5709
|
-
else if (!StringUtils.isEmptyObj(request.claims)) {
|
|
5710
|
-
// Must refresh due to request parameters.
|
|
5711
|
-
this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because claims are requested.");
|
|
5712
|
-
throw ClientAuthError.createRefreshRequiredError();
|
|
5713
|
-
}
|
|
5714
5795
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
5715
5796
|
if (!request.account) {
|
|
5716
5797
|
throw ClientAuthError.createNoAccountInSilentRequestError();
|
|
5717
5798
|
}
|
|
5718
|
-
requestScopes = new ScopeSet(request.scopes || []);
|
|
5719
5799
|
environment = request.authority || this.authority.getPreferredCache();
|
|
5720
|
-
|
|
5721
|
-
cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme, request.sshKid);
|
|
5800
|
+
cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, request, environment);
|
|
5722
5801
|
if (!cacheRecord.accessToken) {
|
|
5723
5802
|
// Must refresh due to non-existent access_token.
|
|
5724
5803
|
(_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
|
|
@@ -5769,7 +5848,7 @@
|
|
|
5769
5848
|
return SilentFlowClient;
|
|
5770
5849
|
}(BaseClient));
|
|
5771
5850
|
|
|
5772
|
-
/*! @azure/msal-common
|
|
5851
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5773
5852
|
/*
|
|
5774
5853
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5775
5854
|
* Licensed under the MIT License.
|
|
@@ -5780,7 +5859,7 @@
|
|
|
5780
5859
|
response.hasOwnProperty("issuer"));
|
|
5781
5860
|
}
|
|
5782
5861
|
|
|
5783
|
-
/*! @azure/msal-common
|
|
5862
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5784
5863
|
/*
|
|
5785
5864
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5786
5865
|
* Licensed under the MIT License.
|
|
@@ -5794,7 +5873,7 @@
|
|
|
5794
5873
|
ProtocolMode["OIDC"] = "OIDC";
|
|
5795
5874
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
5796
5875
|
|
|
5797
|
-
/*! @azure/msal-common
|
|
5876
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5798
5877
|
|
|
5799
5878
|
/*
|
|
5800
5879
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5869,7 +5948,7 @@
|
|
|
5869
5948
|
return AuthorityMetadataEntity;
|
|
5870
5949
|
}());
|
|
5871
5950
|
|
|
5872
|
-
/*! @azure/msal-common
|
|
5951
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5873
5952
|
/*
|
|
5874
5953
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5875
5954
|
* Licensed under the MIT License.
|
|
@@ -5879,7 +5958,7 @@
|
|
|
5879
5958
|
response.hasOwnProperty("metadata"));
|
|
5880
5959
|
}
|
|
5881
5960
|
|
|
5882
|
-
/*! @azure/msal-common
|
|
5961
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5883
5962
|
|
|
5884
5963
|
/*
|
|
5885
5964
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5894,18 +5973,22 @@
|
|
|
5894
5973
|
*
|
|
5895
5974
|
* @returns Promise<string | null>
|
|
5896
5975
|
*/
|
|
5897
|
-
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata) {
|
|
5976
|
+
RegionDiscovery.prototype.detectRegion = function (environmentRegion, regionDiscoveryMetadata, proxyUrl) {
|
|
5898
5977
|
return __awaiter(this, void 0, void 0, function () {
|
|
5899
|
-
var autodetectedRegionName, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
5978
|
+
var autodetectedRegionName, options, localIMDSVersionResponse, currentIMDSVersion, currentIMDSVersionResponse;
|
|
5900
5979
|
return __generator(this, function (_a) {
|
|
5901
5980
|
switch (_a.label) {
|
|
5902
5981
|
case 0:
|
|
5903
5982
|
autodetectedRegionName = environmentRegion;
|
|
5904
5983
|
if (!!autodetectedRegionName) return [3 /*break*/, 8];
|
|
5984
|
+
options = RegionDiscovery.IMDS_OPTIONS;
|
|
5985
|
+
if (proxyUrl) {
|
|
5986
|
+
options.proxyUrl = proxyUrl;
|
|
5987
|
+
}
|
|
5905
5988
|
_a.label = 1;
|
|
5906
5989
|
case 1:
|
|
5907
5990
|
_a.trys.push([1, 6, , 7]);
|
|
5908
|
-
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION)];
|
|
5991
|
+
return [4 /*yield*/, this.getRegionFromIMDS(Constants.IMDS_VERSION, options)];
|
|
5909
5992
|
case 2:
|
|
5910
5993
|
localIMDSVersionResponse = _a.sent();
|
|
5911
5994
|
if (localIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
@@ -5913,14 +5996,14 @@
|
|
|
5913
5996
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.IMDS;
|
|
5914
5997
|
}
|
|
5915
5998
|
if (!(localIMDSVersionResponse.status === ResponseCodes.httpBadRequest)) return [3 /*break*/, 5];
|
|
5916
|
-
return [4 /*yield*/, this.getCurrentVersion()];
|
|
5999
|
+
return [4 /*yield*/, this.getCurrentVersion(options)];
|
|
5917
6000
|
case 3:
|
|
5918
6001
|
currentIMDSVersion = _a.sent();
|
|
5919
6002
|
if (!currentIMDSVersion) {
|
|
5920
6003
|
regionDiscoveryMetadata.region_source = RegionDiscoverySources.FAILED_AUTO_DETECTION;
|
|
5921
6004
|
return [2 /*return*/, null];
|
|
5922
6005
|
}
|
|
5923
|
-
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion)];
|
|
6006
|
+
return [4 /*yield*/, this.getRegionFromIMDS(currentIMDSVersion, options)];
|
|
5924
6007
|
case 4:
|
|
5925
6008
|
currentIMDSVersionResponse = _a.sent();
|
|
5926
6009
|
if (currentIMDSVersionResponse.status === ResponseCodes.httpSuccess) {
|
|
@@ -5953,10 +6036,10 @@
|
|
|
5953
6036
|
* @param imdsEndpointUrl
|
|
5954
6037
|
* @returns Promise<NetworkResponse<string>>
|
|
5955
6038
|
*/
|
|
5956
|
-
RegionDiscovery.prototype.getRegionFromIMDS = function (version) {
|
|
6039
|
+
RegionDiscovery.prototype.getRegionFromIMDS = function (version, options) {
|
|
5957
6040
|
return __awaiter(this, void 0, void 0, function () {
|
|
5958
6041
|
return __generator(this, function (_a) {
|
|
5959
|
-
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text",
|
|
6042
|
+
return [2 /*return*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?api-version=" + version + "&format=text", options, Constants.IMDS_TIMEOUT)];
|
|
5960
6043
|
});
|
|
5961
6044
|
});
|
|
5962
6045
|
};
|
|
@@ -5965,14 +6048,14 @@
|
|
|
5965
6048
|
*
|
|
5966
6049
|
* @returns Promise<string | null>
|
|
5967
6050
|
*/
|
|
5968
|
-
RegionDiscovery.prototype.getCurrentVersion = function () {
|
|
6051
|
+
RegionDiscovery.prototype.getCurrentVersion = function (options) {
|
|
5969
6052
|
return __awaiter(this, void 0, void 0, function () {
|
|
5970
6053
|
var response;
|
|
5971
6054
|
return __generator(this, function (_a) {
|
|
5972
6055
|
switch (_a.label) {
|
|
5973
6056
|
case 0:
|
|
5974
6057
|
_a.trys.push([0, 2, , 3]);
|
|
5975
|
-
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json",
|
|
6058
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(Constants.IMDS_ENDPOINT + "?format=json", options)];
|
|
5976
6059
|
case 1:
|
|
5977
6060
|
response = _a.sent();
|
|
5978
6061
|
// When IMDS endpoint is called without the api version query param, bad request response comes back with latest version.
|
|
@@ -5989,11 +6072,15 @@
|
|
|
5989
6072
|
});
|
|
5990
6073
|
};
|
|
5991
6074
|
// Options for the IMDS endpoint request
|
|
5992
|
-
RegionDiscovery.IMDS_OPTIONS = {
|
|
6075
|
+
RegionDiscovery.IMDS_OPTIONS = {
|
|
6076
|
+
headers: {
|
|
6077
|
+
Metadata: "true",
|
|
6078
|
+
},
|
|
6079
|
+
};
|
|
5993
6080
|
return RegionDiscovery;
|
|
5994
6081
|
}());
|
|
5995
6082
|
|
|
5996
|
-
/*! @azure/msal-common
|
|
6083
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
5997
6084
|
|
|
5998
6085
|
/*
|
|
5999
6086
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6004,7 +6091,7 @@
|
|
|
6004
6091
|
* endpoint. It will store the pertinent config data in this object for use during token calls.
|
|
6005
6092
|
*/
|
|
6006
6093
|
var Authority = /** @class */ (function () {
|
|
6007
|
-
function Authority(authority, networkInterface, cacheManager, authorityOptions) {
|
|
6094
|
+
function Authority(authority, networkInterface, cacheManager, authorityOptions, proxyUrl) {
|
|
6008
6095
|
this.canonicalAuthority = authority;
|
|
6009
6096
|
this._canonicalAuthority.validateAsUri();
|
|
6010
6097
|
this.networkInterface = networkInterface;
|
|
@@ -6012,6 +6099,7 @@
|
|
|
6012
6099
|
this.authorityOptions = authorityOptions;
|
|
6013
6100
|
this.regionDiscovery = new RegionDiscovery(networkInterface);
|
|
6014
6101
|
this.regionDiscoveryMetadata = { region_used: undefined, region_source: undefined, region_outcome: undefined };
|
|
6102
|
+
this.proxyUrl = proxyUrl || Constants.EMPTY_STRING;
|
|
6015
6103
|
}
|
|
6016
6104
|
Object.defineProperty(Authority.prototype, "authorityType", {
|
|
6017
6105
|
// See above for AuthorityType
|
|
@@ -6280,7 +6368,7 @@
|
|
|
6280
6368
|
metadata = _b.sent();
|
|
6281
6369
|
if (!metadata) return [3 /*break*/, 4];
|
|
6282
6370
|
if (!((_a = this.authorityOptions.azureRegionConfiguration) === null || _a === void 0 ? void 0 : _a.azureRegion)) return [3 /*break*/, 3];
|
|
6283
|
-
return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata)];
|
|
6371
|
+
return [4 /*yield*/, this.regionDiscovery.detectRegion(this.authorityOptions.azureRegionConfiguration.environmentRegion, this.regionDiscoveryMetadata, this.proxyUrl)];
|
|
6284
6372
|
case 2:
|
|
6285
6373
|
autodetectedRegionName = _b.sent();
|
|
6286
6374
|
azureRegion = this.authorityOptions.azureRegionConfiguration.azureRegion === Constants.AZURE_REGION_AUTO_DISCOVER_FLAG
|
|
@@ -6343,19 +6431,25 @@
|
|
|
6343
6431
|
*/
|
|
6344
6432
|
Authority.prototype.getEndpointMetadataFromNetwork = function () {
|
|
6345
6433
|
return __awaiter(this, void 0, void 0, function () {
|
|
6346
|
-
var response;
|
|
6434
|
+
var options, response;
|
|
6347
6435
|
return __generator(this, function (_a) {
|
|
6348
6436
|
switch (_a.label) {
|
|
6349
6437
|
case 0:
|
|
6350
|
-
|
|
6351
|
-
|
|
6438
|
+
options = {};
|
|
6439
|
+
if (this.proxyUrl) {
|
|
6440
|
+
options.proxyUrl = this.proxyUrl;
|
|
6441
|
+
}
|
|
6442
|
+
_a.label = 1;
|
|
6352
6443
|
case 1:
|
|
6444
|
+
_a.trys.push([1, 3, , 4]);
|
|
6445
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(this.defaultOpenIdConfigurationEndpoint, options)];
|
|
6446
|
+
case 2:
|
|
6353
6447
|
response = _a.sent();
|
|
6354
6448
|
return [2 /*return*/, isOpenIdConfigResponse(response.body) ? response.body : null];
|
|
6355
|
-
case
|
|
6449
|
+
case 3:
|
|
6356
6450
|
_a.sent();
|
|
6357
6451
|
return [2 /*return*/, null];
|
|
6358
|
-
case
|
|
6452
|
+
case 4: return [2 /*return*/];
|
|
6359
6453
|
}
|
|
6360
6454
|
});
|
|
6361
6455
|
});
|
|
@@ -6425,16 +6519,20 @@
|
|
|
6425
6519
|
*/
|
|
6426
6520
|
Authority.prototype.getCloudDiscoveryMetadataFromNetwork = function () {
|
|
6427
6521
|
return __awaiter(this, void 0, void 0, function () {
|
|
6428
|
-
var instanceDiscoveryEndpoint, match, response, metadata;
|
|
6522
|
+
var instanceDiscoveryEndpoint, options, match, response, metadata;
|
|
6429
6523
|
return __generator(this, function (_a) {
|
|
6430
6524
|
switch (_a.label) {
|
|
6431
6525
|
case 0:
|
|
6432
6526
|
instanceDiscoveryEndpoint = "" + Constants.AAD_INSTANCE_DISCOVERY_ENDPT + this.canonicalAuthority + "oauth2/v2.0/authorize";
|
|
6527
|
+
options = {};
|
|
6528
|
+
if (this.proxyUrl) {
|
|
6529
|
+
options.proxyUrl = this.proxyUrl;
|
|
6530
|
+
}
|
|
6433
6531
|
match = null;
|
|
6434
6532
|
_a.label = 1;
|
|
6435
6533
|
case 1:
|
|
6436
6534
|
_a.trys.push([1, 3, , 4]);
|
|
6437
|
-
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint)];
|
|
6535
|
+
return [4 /*yield*/, this.networkInterface.sendGetRequestAsync(instanceDiscoveryEndpoint, options)];
|
|
6438
6536
|
case 2:
|
|
6439
6537
|
response = _a.sent();
|
|
6440
6538
|
metadata = isCloudInstanceDiscoveryResponse(response.body) ? response.body.metadata : [];
|
|
@@ -6449,7 +6547,7 @@
|
|
|
6449
6547
|
return [2 /*return*/, null];
|
|
6450
6548
|
case 4:
|
|
6451
6549
|
if (!match) {
|
|
6452
|
-
// Custom Domain scenario, host is trusted because Instance Discovery call succeeded
|
|
6550
|
+
// Custom Domain scenario, host is trusted because Instance Discovery call succeeded
|
|
6453
6551
|
match = Authority.createCloudDiscoveryMetadataFromHost(this.hostnameAndPort);
|
|
6454
6552
|
}
|
|
6455
6553
|
return [2 /*return*/, match];
|
|
@@ -6467,6 +6565,19 @@
|
|
|
6467
6565
|
});
|
|
6468
6566
|
return matches.length > 0;
|
|
6469
6567
|
};
|
|
6568
|
+
/**
|
|
6569
|
+
* helper function to populate the authority based on azureCloudOptions
|
|
6570
|
+
* @param authorityString
|
|
6571
|
+
* @param azureCloudOptions
|
|
6572
|
+
*/
|
|
6573
|
+
Authority.generateAuthority = function (authorityString, azureCloudOptions) {
|
|
6574
|
+
var authorityAzureCloudInstance;
|
|
6575
|
+
if (azureCloudOptions && azureCloudOptions.azureCloudInstance !== exports.AzureCloudInstance.None) {
|
|
6576
|
+
var tenant = azureCloudOptions.tenant ? azureCloudOptions.tenant : Constants.DEFAULT_COMMON_TENANT;
|
|
6577
|
+
authorityAzureCloudInstance = azureCloudOptions.azureCloudInstance + "/" + tenant + "/";
|
|
6578
|
+
}
|
|
6579
|
+
return authorityAzureCloudInstance ? authorityAzureCloudInstance : authorityString;
|
|
6580
|
+
};
|
|
6470
6581
|
/**
|
|
6471
6582
|
* Creates cloud discovery metadata object from a given host
|
|
6472
6583
|
* @param host
|
|
@@ -6559,7 +6670,7 @@
|
|
|
6559
6670
|
return Authority;
|
|
6560
6671
|
}());
|
|
6561
6672
|
|
|
6562
|
-
/*! @azure/msal-common
|
|
6673
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
6563
6674
|
|
|
6564
6675
|
/*
|
|
6565
6676
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6578,13 +6689,13 @@
|
|
|
6578
6689
|
* @param networkClient
|
|
6579
6690
|
* @param protocolMode
|
|
6580
6691
|
*/
|
|
6581
|
-
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions) {
|
|
6692
|
+
AuthorityFactory.createDiscoveredInstance = function (authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl) {
|
|
6582
6693
|
return __awaiter(this, void 0, void 0, function () {
|
|
6583
6694
|
var acquireTokenAuthority, e_1;
|
|
6584
6695
|
return __generator(this, function (_a) {
|
|
6585
6696
|
switch (_a.label) {
|
|
6586
6697
|
case 0:
|
|
6587
|
-
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions);
|
|
6698
|
+
acquireTokenAuthority = AuthorityFactory.createInstance(authorityUri, networkClient, cacheManager, authorityOptions, proxyUrl);
|
|
6588
6699
|
_a.label = 1;
|
|
6589
6700
|
case 1:
|
|
6590
6701
|
_a.trys.push([1, 3, , 4]);
|
|
@@ -6610,17 +6721,17 @@
|
|
|
6610
6721
|
* @param networkInterface
|
|
6611
6722
|
* @param protocolMode
|
|
6612
6723
|
*/
|
|
6613
|
-
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions) {
|
|
6724
|
+
AuthorityFactory.createInstance = function (authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl) {
|
|
6614
6725
|
// Throw error if authority url is empty
|
|
6615
6726
|
if (StringUtils.isEmpty(authorityUrl)) {
|
|
6616
6727
|
throw ClientConfigurationError.createUrlEmptyError();
|
|
6617
6728
|
}
|
|
6618
|
-
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions);
|
|
6729
|
+
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, proxyUrl);
|
|
6619
6730
|
};
|
|
6620
6731
|
return AuthorityFactory;
|
|
6621
6732
|
}());
|
|
6622
6733
|
|
|
6623
|
-
/*! @azure/msal-common
|
|
6734
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
6624
6735
|
|
|
6625
6736
|
/*
|
|
6626
6737
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6651,7 +6762,7 @@
|
|
|
6651
6762
|
return ServerTelemetryEntity;
|
|
6652
6763
|
}());
|
|
6653
6764
|
|
|
6654
|
-
/*! @azure/msal-common
|
|
6765
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
6655
6766
|
|
|
6656
6767
|
/*
|
|
6657
6768
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6679,7 +6790,7 @@
|
|
|
6679
6790
|
return ThrottlingEntity;
|
|
6680
6791
|
}());
|
|
6681
6792
|
|
|
6682
|
-
/*! @azure/msal-common
|
|
6793
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
6683
6794
|
|
|
6684
6795
|
/*
|
|
6685
6796
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6696,7 +6807,7 @@
|
|
|
6696
6807
|
}
|
|
6697
6808
|
};
|
|
6698
6809
|
|
|
6699
|
-
/*! @azure/msal-common
|
|
6810
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
6700
6811
|
|
|
6701
6812
|
/*
|
|
6702
6813
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6755,7 +6866,7 @@
|
|
|
6755
6866
|
return AuthenticationHeaderParser;
|
|
6756
6867
|
}());
|
|
6757
6868
|
|
|
6758
|
-
/*! @azure/msal-common
|
|
6869
|
+
/*! @azure/msal-common v6.1.0 2022-03-07 */
|
|
6759
6870
|
|
|
6760
6871
|
/*
|
|
6761
6872
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6971,7 +7082,7 @@
|
|
|
6971
7082
|
/**
|
|
6972
7083
|
* Temporary cache keys for MSAL, deleted after any request.
|
|
6973
7084
|
*/
|
|
6974
|
-
|
|
7085
|
+
exports.TemporaryCacheKeys = void 0;
|
|
6975
7086
|
(function (TemporaryCacheKeys) {
|
|
6976
7087
|
TemporaryCacheKeys["AUTHORITY"] = "authority";
|
|
6977
7088
|
TemporaryCacheKeys["ACQUIRE_TOKEN_ACCOUNT"] = "acquireToken.account";
|
|
@@ -6986,7 +7097,7 @@
|
|
|
6986
7097
|
TemporaryCacheKeys["INTERACTION_STATUS_KEY"] = "interaction.status";
|
|
6987
7098
|
TemporaryCacheKeys["CCS_CREDENTIAL"] = "ccs.credential";
|
|
6988
7099
|
TemporaryCacheKeys["CORRELATION_ID"] = "request.correlationId";
|
|
6989
|
-
})(TemporaryCacheKeys || (TemporaryCacheKeys = {}));
|
|
7100
|
+
})(exports.TemporaryCacheKeys || (exports.TemporaryCacheKeys = {}));
|
|
6990
7101
|
/**
|
|
6991
7102
|
* Cache keys stored in-memory
|
|
6992
7103
|
*/
|
|
@@ -7021,6 +7132,7 @@
|
|
|
7021
7132
|
InteractionType["Redirect"] = "redirect";
|
|
7022
7133
|
InteractionType["Popup"] = "popup";
|
|
7023
7134
|
InteractionType["Silent"] = "silent";
|
|
7135
|
+
InteractionType["None"] = "none";
|
|
7024
7136
|
})(exports.InteractionType || (exports.InteractionType = {}));
|
|
7025
7137
|
/**
|
|
7026
7138
|
* Types of interaction currently in progress.
|
|
@@ -8697,7 +8809,7 @@
|
|
|
8697
8809
|
*/
|
|
8698
8810
|
CryptoOps.prototype.getPublicKeyThumbprint = function (request) {
|
|
8699
8811
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8700
|
-
var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString,
|
|
8812
|
+
var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
|
|
8701
8813
|
return __generator$1(this, function (_a) {
|
|
8702
8814
|
switch (_a.label) {
|
|
8703
8815
|
case 0: return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];
|
|
@@ -8712,10 +8824,9 @@
|
|
|
8712
8824
|
n: publicKeyJwk.n
|
|
8713
8825
|
};
|
|
8714
8826
|
publicJwkString = BrowserCrypto.getJwkString(pubKeyThumprintObj);
|
|
8715
|
-
return [4 /*yield*/, this.
|
|
8827
|
+
return [4 /*yield*/, this.hashString(publicJwkString)];
|
|
8716
8828
|
case 3:
|
|
8717
|
-
|
|
8718
|
-
publicJwkHash = this.b64Encode.urlEncodeArr(new Uint8Array(publicJwkBuffer));
|
|
8829
|
+
publicJwkHash = _a.sent();
|
|
8719
8830
|
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];
|
|
8720
8831
|
case 4:
|
|
8721
8832
|
privateKeyJwk = _a.sent();
|
|
@@ -8822,6 +8933,24 @@
|
|
|
8822
8933
|
});
|
|
8823
8934
|
});
|
|
8824
8935
|
};
|
|
8936
|
+
/**
|
|
8937
|
+
* Returns the SHA-256 hash of an input string
|
|
8938
|
+
* @param plainText
|
|
8939
|
+
*/
|
|
8940
|
+
CryptoOps.prototype.hashString = function (plainText) {
|
|
8941
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
8942
|
+
var hashBuffer, hashBytes;
|
|
8943
|
+
return __generator$1(this, function (_a) {
|
|
8944
|
+
switch (_a.label) {
|
|
8945
|
+
case 0: return [4 /*yield*/, this.browserCrypto.sha256Digest(plainText)];
|
|
8946
|
+
case 1:
|
|
8947
|
+
hashBuffer = _a.sent();
|
|
8948
|
+
hashBytes = new Uint8Array(hashBuffer);
|
|
8949
|
+
return [2 /*return*/, this.b64Encode.urlEncodeArr(hashBytes)];
|
|
8950
|
+
}
|
|
8951
|
+
});
|
|
8952
|
+
});
|
|
8953
|
+
};
|
|
8825
8954
|
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
8826
8955
|
CryptoOps.EXTRACTABLE = true;
|
|
8827
8956
|
return CryptoOps;
|
|
@@ -9611,7 +9740,7 @@
|
|
|
9611
9740
|
*/
|
|
9612
9741
|
BrowserCacheManager.prototype.generateAuthorityKey = function (stateString) {
|
|
9613
9742
|
var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
|
|
9614
|
-
return this.generateCacheKey(TemporaryCacheKeys.AUTHORITY + "." + stateId);
|
|
9743
|
+
return this.generateCacheKey(exports.TemporaryCacheKeys.AUTHORITY + "." + stateId);
|
|
9615
9744
|
};
|
|
9616
9745
|
/**
|
|
9617
9746
|
* Create Nonce key to cache nonce
|
|
@@ -9619,7 +9748,7 @@
|
|
|
9619
9748
|
*/
|
|
9620
9749
|
BrowserCacheManager.prototype.generateNonceKey = function (stateString) {
|
|
9621
9750
|
var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
|
|
9622
|
-
return this.generateCacheKey(TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
|
|
9751
|
+
return this.generateCacheKey(exports.TemporaryCacheKeys.NONCE_IDTOKEN + "." + stateId);
|
|
9623
9752
|
};
|
|
9624
9753
|
/**
|
|
9625
9754
|
* Creates full cache key for the request state
|
|
@@ -9628,7 +9757,7 @@
|
|
|
9628
9757
|
BrowserCacheManager.prototype.generateStateKey = function (stateString) {
|
|
9629
9758
|
// Use the library state id to key temp storage for uniqueness for multiple concurrent requests
|
|
9630
9759
|
var stateId = ProtocolUtils.parseRequestState(this.cryptoImpl, stateString).libraryState.id;
|
|
9631
|
-
return this.generateCacheKey(TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
|
|
9760
|
+
return this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_STATE + "." + stateId);
|
|
9632
9761
|
};
|
|
9633
9762
|
/**
|
|
9634
9763
|
* Gets the cached authority based on the cached state. Returns empty if no cached state found.
|
|
@@ -9663,14 +9792,14 @@
|
|
|
9663
9792
|
credential: account.homeAccountId,
|
|
9664
9793
|
type: CcsCredentialType.HOME_ACCOUNT_ID
|
|
9665
9794
|
};
|
|
9666
|
-
this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
9795
|
+
this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
9667
9796
|
}
|
|
9668
9797
|
else if (!StringUtils.isEmpty(loginHint)) {
|
|
9669
9798
|
var ccsCredential = {
|
|
9670
9799
|
credential: loginHint,
|
|
9671
9800
|
type: CcsCredentialType.UPN
|
|
9672
9801
|
};
|
|
9673
|
-
this.setTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
9802
|
+
this.setTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, JSON.stringify(ccsCredential), true);
|
|
9674
9803
|
}
|
|
9675
9804
|
};
|
|
9676
9805
|
/**
|
|
@@ -9694,11 +9823,11 @@
|
|
|
9694
9823
|
this.removeItem(this.generateNonceKey(state));
|
|
9695
9824
|
this.removeItem(this.generateAuthorityKey(state));
|
|
9696
9825
|
}
|
|
9697
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
9698
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.ORIGIN_URI));
|
|
9699
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
|
9700
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CORRELATION_ID));
|
|
9701
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.CCS_CREDENTIAL));
|
|
9826
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_PARAMS));
|
|
9827
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.ORIGIN_URI));
|
|
9828
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.URL_HASH));
|
|
9829
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.CORRELATION_ID));
|
|
9830
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.CCS_CREDENTIAL));
|
|
9702
9831
|
this.setInteractionInProgress(false);
|
|
9703
9832
|
};
|
|
9704
9833
|
/**
|
|
@@ -9727,7 +9856,7 @@
|
|
|
9727
9856
|
// Loop through all keys to find state key
|
|
9728
9857
|
this.getKeys().forEach(function (key) {
|
|
9729
9858
|
// If this key is not the state key, move on
|
|
9730
|
-
if (key.indexOf(TemporaryCacheKeys.REQUEST_STATE) === -1) {
|
|
9859
|
+
if (key.indexOf(exports.TemporaryCacheKeys.REQUEST_STATE) === -1) {
|
|
9731
9860
|
return;
|
|
9732
9861
|
}
|
|
9733
9862
|
// Retrieve state value, return if not a valid value
|
|
@@ -9743,11 +9872,12 @@
|
|
|
9743
9872
|
}
|
|
9744
9873
|
});
|
|
9745
9874
|
this.clearMsalCookies();
|
|
9875
|
+
this.setInteractionInProgress(false);
|
|
9746
9876
|
};
|
|
9747
9877
|
BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {
|
|
9748
9878
|
this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
|
|
9749
9879
|
var encodedValue = browserCrypto.base64Encode(JSON.stringify(authCodeRequest));
|
|
9750
|
-
this.setTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
|
|
9880
|
+
this.setTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, encodedValue, true);
|
|
9751
9881
|
};
|
|
9752
9882
|
/**
|
|
9753
9883
|
* Gets the token exchange parameters from the cache. Throws an error if nothing is found.
|
|
@@ -9755,7 +9885,7 @@
|
|
|
9755
9885
|
BrowserCacheManager.prototype.getCachedRequest = function (state, browserCrypto) {
|
|
9756
9886
|
this.logger.trace("BrowserCacheManager.getCachedRequest called");
|
|
9757
9887
|
// Get token request from cache and parse as TokenExchangeParameters.
|
|
9758
|
-
var encodedTokenRequest = this.getTemporaryCache(TemporaryCacheKeys.REQUEST_PARAMS, true);
|
|
9888
|
+
var encodedTokenRequest = this.getTemporaryCache(exports.TemporaryCacheKeys.REQUEST_PARAMS, true);
|
|
9759
9889
|
if (!encodedTokenRequest) {
|
|
9760
9890
|
throw BrowserAuthError.createNoTokenRequestCacheError();
|
|
9761
9891
|
}
|
|
@@ -9763,7 +9893,7 @@
|
|
|
9763
9893
|
if (!parsedRequest) {
|
|
9764
9894
|
throw BrowserAuthError.createUnableToParseTokenRequestCacheError();
|
|
9765
9895
|
}
|
|
9766
|
-
this.removeItem(this.generateCacheKey(TemporaryCacheKeys.REQUEST_PARAMS));
|
|
9896
|
+
this.removeItem(this.generateCacheKey(exports.TemporaryCacheKeys.REQUEST_PARAMS));
|
|
9767
9897
|
// Get cached authority and use if no authority is cached with request.
|
|
9768
9898
|
if (StringUtils.isEmpty(parsedRequest.authority)) {
|
|
9769
9899
|
var authorityCacheKey = this.generateAuthorityKey(state);
|
|
@@ -9785,18 +9915,22 @@
|
|
|
9785
9915
|
}
|
|
9786
9916
|
};
|
|
9787
9917
|
BrowserCacheManager.prototype.getInteractionInProgress = function () {
|
|
9788
|
-
var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
9918
|
+
var key = Constants.CACHE_PREFIX + "." + exports.TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
9789
9919
|
return this.getTemporaryCache(key, false);
|
|
9790
9920
|
};
|
|
9791
9921
|
BrowserCacheManager.prototype.setInteractionInProgress = function (inProgress) {
|
|
9792
|
-
var clientId = this.getInteractionInProgress();
|
|
9793
9922
|
// Ensure we don't overwrite interaction in progress for a different clientId
|
|
9794
|
-
var key = Constants.CACHE_PREFIX + "." + TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
9795
|
-
if (inProgress
|
|
9796
|
-
|
|
9797
|
-
|
|
9923
|
+
var key = Constants.CACHE_PREFIX + "." + exports.TemporaryCacheKeys.INTERACTION_STATUS_KEY;
|
|
9924
|
+
if (inProgress) {
|
|
9925
|
+
if (this.getInteractionInProgress()) {
|
|
9926
|
+
throw BrowserAuthError.createInteractionInProgressError();
|
|
9927
|
+
}
|
|
9928
|
+
else {
|
|
9929
|
+
// No interaction is in progress
|
|
9930
|
+
this.setTemporaryCache(key, this.clientId, false);
|
|
9931
|
+
}
|
|
9798
9932
|
}
|
|
9799
|
-
else if (!inProgress &&
|
|
9933
|
+
else if (!inProgress && this.getInteractionInProgress() === this.clientId) {
|
|
9800
9934
|
this.removeItem(key);
|
|
9801
9935
|
}
|
|
9802
9936
|
};
|
|
@@ -9833,6 +9967,25 @@
|
|
|
9833
9967
|
}
|
|
9834
9968
|
return null;
|
|
9835
9969
|
};
|
|
9970
|
+
/**
|
|
9971
|
+
* Updates a credential's cache key if the current cache key is outdated
|
|
9972
|
+
*/
|
|
9973
|
+
BrowserCacheManager.prototype.updateCredentialCacheKey = function (currentCacheKey, credential) {
|
|
9974
|
+
var updatedCacheKey = credential.generateCredentialKey();
|
|
9975
|
+
if (currentCacheKey !== updatedCacheKey) {
|
|
9976
|
+
var cacheItem = this.getItem(currentCacheKey);
|
|
9977
|
+
if (cacheItem) {
|
|
9978
|
+
this.removeItem(currentCacheKey);
|
|
9979
|
+
this.setItem(updatedCacheKey, cacheItem);
|
|
9980
|
+
this.logger.verbose("Updated an outdated " + credential.credentialType + " cache key");
|
|
9981
|
+
return updatedCacheKey;
|
|
9982
|
+
}
|
|
9983
|
+
else {
|
|
9984
|
+
this.logger.error("Attempted to update an outdated " + credential.credentialType + " cache key but no item matching the outdated key was found in storage");
|
|
9985
|
+
}
|
|
9986
|
+
}
|
|
9987
|
+
return currentCacheKey;
|
|
9988
|
+
};
|
|
9836
9989
|
return BrowserCacheManager;
|
|
9837
9990
|
}(CacheManager));
|
|
9838
9991
|
var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
|
|
@@ -10304,7 +10457,11 @@
|
|
|
10304
10457
|
postLogoutRedirectUri: "",
|
|
10305
10458
|
navigateToLoginRequestUrl: true,
|
|
10306
10459
|
clientCapabilities: [],
|
|
10307
|
-
protocolMode: exports.ProtocolMode.AAD
|
|
10460
|
+
protocolMode: exports.ProtocolMode.AAD,
|
|
10461
|
+
azureCloudOptions: {
|
|
10462
|
+
azureCloudInstance: exports.AzureCloudInstance.None,
|
|
10463
|
+
tenant: ""
|
|
10464
|
+
},
|
|
10308
10465
|
};
|
|
10309
10466
|
// Default cache options for browser
|
|
10310
10467
|
var DEFAULT_CACHE_OPTIONS = {
|
|
@@ -10333,7 +10490,7 @@
|
|
|
10333
10490
|
|
|
10334
10491
|
/* eslint-disable header/header */
|
|
10335
10492
|
var name = "@azure/msal-browser";
|
|
10336
|
-
var version = "2.
|
|
10493
|
+
var version = "2.22.1";
|
|
10337
10494
|
|
|
10338
10495
|
/*
|
|
10339
10496
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10550,28 +10707,42 @@
|
|
|
10550
10707
|
* @param request
|
|
10551
10708
|
*/
|
|
10552
10709
|
BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
|
|
10553
|
-
this
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10710
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
10711
|
+
var authority, scopes, validatedRequest, _a;
|
|
10712
|
+
return __generator$1(this, function (_b) {
|
|
10713
|
+
switch (_b.label) {
|
|
10714
|
+
case 0:
|
|
10715
|
+
this.logger.verbose("Initializing BaseAuthRequest");
|
|
10716
|
+
authority = request.authority || this.config.auth.authority;
|
|
10717
|
+
scopes = __spread(((request && request.scopes) || []));
|
|
10718
|
+
validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
|
|
10719
|
+
scopes: scopes });
|
|
10720
|
+
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
10721
|
+
if (!validatedRequest.authenticationScheme) {
|
|
10722
|
+
validatedRequest.authenticationScheme = exports.AuthenticationScheme.BEARER;
|
|
10723
|
+
this.logger.verbose("Authentication Scheme wasn't explicitly set in request, defaulting to \"Bearer\" request");
|
|
10724
|
+
}
|
|
10725
|
+
else {
|
|
10726
|
+
if (validatedRequest.authenticationScheme === exports.AuthenticationScheme.SSH) {
|
|
10727
|
+
if (!request.sshJwk) {
|
|
10728
|
+
throw ClientConfigurationError.createMissingSshJwkError();
|
|
10729
|
+
}
|
|
10730
|
+
if (!request.sshKid) {
|
|
10731
|
+
throw ClientConfigurationError.createMissingSshKidError();
|
|
10732
|
+
}
|
|
10733
|
+
}
|
|
10734
|
+
this.logger.verbose("Authentication Scheme set to \"" + validatedRequest.authenticationScheme + "\" as configured in Auth request");
|
|
10735
|
+
}
|
|
10736
|
+
if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 2];
|
|
10737
|
+
_a = validatedRequest;
|
|
10738
|
+
return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
|
|
10739
|
+
case 1:
|
|
10740
|
+
_a.requestedClaimsHash = _b.sent();
|
|
10741
|
+
_b.label = 2;
|
|
10742
|
+
case 2: return [2 /*return*/, validatedRequest];
|
|
10568
10743
|
}
|
|
10569
|
-
}
|
|
10570
|
-
|
|
10571
|
-
}
|
|
10572
|
-
var validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
|
|
10573
|
-
scopes: scopes });
|
|
10574
|
-
return validatedRequest;
|
|
10744
|
+
});
|
|
10745
|
+
});
|
|
10575
10746
|
};
|
|
10576
10747
|
/**
|
|
10577
10748
|
*
|
|
@@ -10648,11 +10819,32 @@
|
|
|
10648
10819
|
*/
|
|
10649
10820
|
StandardInteractionClient.prototype.initializeLogoutRequest = function (logoutRequest) {
|
|
10650
10821
|
this.logger.verbose("initializeLogoutRequest called", logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.correlationId);
|
|
10651
|
-
// Check if interaction is in progress. Throw error if true.
|
|
10652
|
-
if (this.browserStorage.isInteractionInProgress()) {
|
|
10653
|
-
throw BrowserAuthError.createInteractionInProgressError();
|
|
10654
|
-
}
|
|
10655
10822
|
var validLogoutRequest = __assign$1({ correlationId: this.browserCrypto.createNewGuid() }, logoutRequest);
|
|
10823
|
+
/**
|
|
10824
|
+
* Set logout_hint to be login_hint from ID Token Claims if present
|
|
10825
|
+
* and logoutHint attribute wasn't manually set in logout request
|
|
10826
|
+
*/
|
|
10827
|
+
if (logoutRequest) {
|
|
10828
|
+
// If logoutHint isn't set and an account was passed in, try to extract logoutHint from ID Token Claims
|
|
10829
|
+
if (!logoutRequest.logoutHint) {
|
|
10830
|
+
if (logoutRequest.account) {
|
|
10831
|
+
var logoutHint = this.getLogoutHintFromIdTokenClaims(logoutRequest.account);
|
|
10832
|
+
if (logoutHint) {
|
|
10833
|
+
this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided");
|
|
10834
|
+
validLogoutRequest.logoutHint = logoutHint;
|
|
10835
|
+
}
|
|
10836
|
+
}
|
|
10837
|
+
else {
|
|
10838
|
+
this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");
|
|
10839
|
+
}
|
|
10840
|
+
}
|
|
10841
|
+
else {
|
|
10842
|
+
this.logger.verbose("logoutHint has already been set in logoutRequest");
|
|
10843
|
+
}
|
|
10844
|
+
}
|
|
10845
|
+
else {
|
|
10846
|
+
this.logger.verbose("logoutHint will not be set since no logout request was configured");
|
|
10847
|
+
}
|
|
10656
10848
|
/*
|
|
10657
10849
|
* Only set redirect uri if logout request isn't provided or the set uri isn't null.
|
|
10658
10850
|
* Otherwise, use passed uri, config, or current page.
|
|
@@ -10679,17 +10871,37 @@
|
|
|
10679
10871
|
}
|
|
10680
10872
|
return validLogoutRequest;
|
|
10681
10873
|
};
|
|
10874
|
+
/**
|
|
10875
|
+
* Parses login_hint ID Token Claim out of AccountInfo object to be used as
|
|
10876
|
+
* logout_hint in end session request.
|
|
10877
|
+
* @param account
|
|
10878
|
+
*/
|
|
10879
|
+
StandardInteractionClient.prototype.getLogoutHintFromIdTokenClaims = function (account) {
|
|
10880
|
+
var idTokenClaims = account.idTokenClaims;
|
|
10881
|
+
if (idTokenClaims) {
|
|
10882
|
+
if (idTokenClaims.login_hint) {
|
|
10883
|
+
return idTokenClaims.login_hint;
|
|
10884
|
+
}
|
|
10885
|
+
else {
|
|
10886
|
+
this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request");
|
|
10887
|
+
}
|
|
10888
|
+
}
|
|
10889
|
+
else {
|
|
10890
|
+
this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");
|
|
10891
|
+
}
|
|
10892
|
+
return null;
|
|
10893
|
+
};
|
|
10682
10894
|
/**
|
|
10683
10895
|
* Creates an Authorization Code Client with the given authority, or the default authority.
|
|
10684
10896
|
* @param serverTelemetryManager
|
|
10685
10897
|
* @param authorityUrl
|
|
10686
10898
|
*/
|
|
10687
|
-
StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl) {
|
|
10899
|
+
StandardInteractionClient.prototype.createAuthCodeClient = function (serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
|
|
10688
10900
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10689
10901
|
var clientConfig;
|
|
10690
10902
|
return __generator$1(this, function (_a) {
|
|
10691
10903
|
switch (_a.label) {
|
|
10692
|
-
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
|
|
10904
|
+
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions)];
|
|
10693
10905
|
case 1:
|
|
10694
10906
|
clientConfig = _a.sent();
|
|
10695
10907
|
return [2 /*return*/, new AuthorizationCodeClient(clientConfig)];
|
|
@@ -10703,14 +10915,14 @@
|
|
|
10703
10915
|
* @param requestAuthority
|
|
10704
10916
|
* @param requestCorrelationId
|
|
10705
10917
|
*/
|
|
10706
|
-
StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority) {
|
|
10918
|
+
StandardInteractionClient.prototype.getClientConfiguration = function (serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
|
|
10707
10919
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10708
10920
|
var discoveredAuthority;
|
|
10709
10921
|
return __generator$1(this, function (_a) {
|
|
10710
10922
|
switch (_a.label) {
|
|
10711
10923
|
case 0:
|
|
10712
10924
|
this.logger.verbose("getClientConfiguration called");
|
|
10713
|
-
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority)];
|
|
10925
|
+
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];
|
|
10714
10926
|
case 1:
|
|
10715
10927
|
discoveredAuthority = _a.sent();
|
|
10716
10928
|
return [2 /*return*/, {
|
|
@@ -10770,9 +10982,9 @@
|
|
|
10770
10982
|
* @param requestAuthority
|
|
10771
10983
|
* @param requestCorrelationId
|
|
10772
10984
|
*/
|
|
10773
|
-
StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority) {
|
|
10985
|
+
StandardInteractionClient.prototype.getDiscoveredAuthority = function (requestAuthority, requestAzureCloudOptions) {
|
|
10774
10986
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
10775
|
-
var authorityOptions;
|
|
10987
|
+
var authorityOptions, userAuthority, builtAuthority;
|
|
10776
10988
|
return __generator$1(this, function (_a) {
|
|
10777
10989
|
switch (_a.label) {
|
|
10778
10990
|
case 0:
|
|
@@ -10781,63 +10993,55 @@
|
|
|
10781
10993
|
protocolMode: this.config.auth.protocolMode,
|
|
10782
10994
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
10783
10995
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
10784
|
-
authorityMetadata: this.config.auth.authorityMetadata
|
|
10996
|
+
authorityMetadata: this.config.auth.authorityMetadata,
|
|
10785
10997
|
};
|
|
10786
|
-
|
|
10787
|
-
|
|
10788
|
-
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(requestAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
|
|
10789
|
-
case 1: return [2 /*return*/, _a.sent()];
|
|
10790
|
-
case 2:
|
|
10998
|
+
userAuthority = requestAuthority ? requestAuthority : this.config.auth.authority;
|
|
10999
|
+
builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
10791
11000
|
this.logger.verbose("Creating discovered authority with configured authority");
|
|
10792
|
-
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(
|
|
10793
|
-
case
|
|
11001
|
+
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
|
|
11002
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
10794
11003
|
}
|
|
10795
11004
|
});
|
|
10796
11005
|
});
|
|
10797
11006
|
};
|
|
10798
|
-
/**
|
|
10799
|
-
* Helper to validate app environment before making a request.
|
|
10800
|
-
* @param request
|
|
10801
|
-
* @param interactionType
|
|
10802
|
-
*/
|
|
10803
|
-
StandardInteractionClient.prototype.preflightInteractiveRequest = function (request, interactionType) {
|
|
10804
|
-
this.logger.verbose("preflightInteractiveRequest called, validating app environment", request === null || request === void 0 ? void 0 : request.correlationId);
|
|
10805
|
-
// block the reload if it occurred inside a hidden iframe
|
|
10806
|
-
BrowserUtils.blockReloadInHiddenIframes();
|
|
10807
|
-
// Check if interaction is in progress. Throw error if true.
|
|
10808
|
-
if (this.browserStorage.isInteractionInProgress(false)) {
|
|
10809
|
-
throw BrowserAuthError.createInteractionInProgressError();
|
|
10810
|
-
}
|
|
10811
|
-
return this.initializeAuthorizationRequest(request, interactionType);
|
|
10812
|
-
};
|
|
10813
11007
|
/**
|
|
10814
11008
|
* Helper to initialize required request parameters for interactive APIs and ssoSilent()
|
|
10815
11009
|
* @param request
|
|
10816
11010
|
* @param interactionType
|
|
10817
11011
|
*/
|
|
10818
11012
|
StandardInteractionClient.prototype.initializeAuthorizationRequest = function (request, interactionType) {
|
|
10819
|
-
this
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
|
|
10823
|
-
|
|
10824
|
-
|
|
10825
|
-
|
|
10826
|
-
|
|
10827
|
-
|
|
10828
|
-
|
|
10829
|
-
|
|
10830
|
-
|
|
10831
|
-
|
|
10832
|
-
|
|
10833
|
-
|
|
10834
|
-
|
|
10835
|
-
|
|
10836
|
-
|
|
10837
|
-
|
|
10838
|
-
|
|
10839
|
-
|
|
10840
|
-
|
|
11013
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
11014
|
+
var redirectUri, browserState, state, validatedRequest, _a, account, legacyLoginHint;
|
|
11015
|
+
return __generator$1(this, function (_b) {
|
|
11016
|
+
switch (_b.label) {
|
|
11017
|
+
case 0:
|
|
11018
|
+
this.logger.verbose("initializeAuthorizationRequest called");
|
|
11019
|
+
redirectUri = this.getRedirectUri(request.redirectUri);
|
|
11020
|
+
browserState = {
|
|
11021
|
+
interactionType: interactionType
|
|
11022
|
+
};
|
|
11023
|
+
state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
11024
|
+
_a = [{}];
|
|
11025
|
+
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
11026
|
+
case 1:
|
|
11027
|
+
validatedRequest = __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { redirectUri: redirectUri, state: state, nonce: request.nonce || this.browserCrypto.createNewGuid(), responseMode: ResponseMode.FRAGMENT }]);
|
|
11028
|
+
account = request.account || this.browserStorage.getActiveAccount();
|
|
11029
|
+
if (account) {
|
|
11030
|
+
this.logger.verbose("Setting validated request account");
|
|
11031
|
+
this.logger.verbosePii("Setting validated request account: " + account);
|
|
11032
|
+
validatedRequest.account = account;
|
|
11033
|
+
}
|
|
11034
|
+
// Check for ADAL/MSAL v1 SSO
|
|
11035
|
+
if (StringUtils.isEmpty(validatedRequest.loginHint) && !account) {
|
|
11036
|
+
legacyLoginHint = this.browserStorage.getLegacyLoginHint();
|
|
11037
|
+
if (legacyLoginHint) {
|
|
11038
|
+
validatedRequest.loginHint = legacyLoginHint;
|
|
11039
|
+
}
|
|
11040
|
+
}
|
|
11041
|
+
return [2 /*return*/, validatedRequest];
|
|
11042
|
+
}
|
|
11043
|
+
});
|
|
11044
|
+
});
|
|
10841
11045
|
};
|
|
10842
11046
|
return StandardInteractionClient;
|
|
10843
11047
|
}(BaseInteractionClient));
|
|
@@ -11004,8 +11208,8 @@
|
|
|
11004
11208
|
* @param clientId
|
|
11005
11209
|
* @param request
|
|
11006
11210
|
*/
|
|
11007
|
-
PopupUtils.generatePopupName = function (clientId,
|
|
11008
|
-
return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." +
|
|
11211
|
+
PopupUtils.generatePopupName = function (clientId, scopes, authority, correlationId) {
|
|
11212
|
+
return BrowserConstants.POPUP_NAME_PREFIX + "." + clientId + "." + scopes.join("-") + "." + authority + "." + correlationId;
|
|
11009
11213
|
};
|
|
11010
11214
|
/**
|
|
11011
11215
|
* Generates the name for the popup based on the client id and request for logouts
|
|
@@ -11138,7 +11342,7 @@
|
|
|
11138
11342
|
*/
|
|
11139
11343
|
InteractionHandler.prototype.checkCcsCredentials = function () {
|
|
11140
11344
|
// Look up ccs credential in temp cache
|
|
11141
|
-
var cachedCcsCred = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CCS_CREDENTIAL, true);
|
|
11345
|
+
var cachedCcsCred = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CCS_CREDENTIAL, true);
|
|
11142
11346
|
if (cachedCcsCred) {
|
|
11143
11347
|
try {
|
|
11144
11348
|
return JSON.parse(cachedCcsCred);
|
|
@@ -11176,8 +11380,6 @@
|
|
|
11176
11380
|
PopupHandler.prototype.initiateAuthRequest = function (requestUrl, params) {
|
|
11177
11381
|
// Check that request url is not empty.
|
|
11178
11382
|
if (!StringUtils.isEmpty(requestUrl)) {
|
|
11179
|
-
// Set interaction status in the library.
|
|
11180
|
-
this.browserStorage.setInteractionInProgress(true);
|
|
11181
11383
|
this.browserRequestLogger.infoPii("Navigate to: " + requestUrl);
|
|
11182
11384
|
// Open the popup window to requestUrl.
|
|
11183
11385
|
return this.popupUtils.openPopup(requestUrl, params);
|
|
@@ -11228,20 +11430,19 @@
|
|
|
11228
11430
|
*/
|
|
11229
11431
|
PopupClient.prototype.acquireToken = function (request) {
|
|
11230
11432
|
try {
|
|
11231
|
-
var
|
|
11232
|
-
var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, validRequest);
|
|
11433
|
+
var popupName = PopupUtils.generatePopupName(this.config.auth.clientId, request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority, this.correlationId);
|
|
11233
11434
|
var popupWindowAttributes = request.popupWindowAttributes || {};
|
|
11234
11435
|
// asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
|
11235
11436
|
if (this.config.system.asyncPopups) {
|
|
11236
11437
|
this.logger.verbose("asyncPopups set to true, acquiring token");
|
|
11237
11438
|
// Passes on popup position and dimensions if in request
|
|
11238
|
-
return this.acquireTokenPopupAsync(
|
|
11439
|
+
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes);
|
|
11239
11440
|
}
|
|
11240
11441
|
else {
|
|
11241
11442
|
// asyncPopups flag is set to false. Opens popup before acquiring token.
|
|
11242
11443
|
this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
|
|
11243
11444
|
var popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
|
|
11244
|
-
return this.acquireTokenPopupAsync(
|
|
11445
|
+
return this.acquireTokenPopupAsync(request, popupName, popupWindowAttributes, popup);
|
|
11245
11446
|
}
|
|
11246
11447
|
}
|
|
11247
11448
|
catch (e) {
|
|
@@ -11287,26 +11488,30 @@
|
|
|
11287
11488
|
*
|
|
11288
11489
|
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
|
11289
11490
|
*/
|
|
11290
|
-
PopupClient.prototype.acquireTokenPopupAsync = function (
|
|
11491
|
+
PopupClient.prototype.acquireTokenPopupAsync = function (request, popupName, popupWindowAttributes, popup) {
|
|
11291
11492
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11292
|
-
var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
|
|
11493
|
+
var serverTelemetryManager, validRequest, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_1;
|
|
11293
11494
|
return __generator$1(this, function (_a) {
|
|
11294
11495
|
switch (_a.label) {
|
|
11295
11496
|
case 0:
|
|
11296
11497
|
this.logger.verbose("acquireTokenPopupAsync called");
|
|
11297
11498
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenPopup);
|
|
11298
|
-
|
|
11499
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Popup)];
|
|
11299
11500
|
case 1:
|
|
11300
|
-
_a.
|
|
11301
|
-
|
|
11501
|
+
validRequest = _a.sent();
|
|
11502
|
+
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
|
|
11503
|
+
_a.label = 2;
|
|
11302
11504
|
case 2:
|
|
11303
|
-
|
|
11304
|
-
return [4 /*yield*/, this.
|
|
11505
|
+
_a.trys.push([2, 8, , 9]);
|
|
11506
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
11305
11507
|
case 3:
|
|
11508
|
+
authCodeRequest = _a.sent();
|
|
11509
|
+
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
11510
|
+
case 4:
|
|
11306
11511
|
authClient = _a.sent();
|
|
11307
11512
|
this.logger.verbose("Auth code client created");
|
|
11308
11513
|
return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
|
|
11309
|
-
case
|
|
11514
|
+
case 5:
|
|
11310
11515
|
navigateUrl = _a.sent();
|
|
11311
11516
|
interactionHandler = new PopupHandler(authClient, this.browserStorage, authCodeRequest, this.logger);
|
|
11312
11517
|
popupParameters = {
|
|
@@ -11317,16 +11522,16 @@
|
|
|
11317
11522
|
popupWindow = interactionHandler.initiateAuthRequest(navigateUrl, popupParameters);
|
|
11318
11523
|
this.eventHandler.emitEvent(exports.EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow: popupWindow }, null);
|
|
11319
11524
|
return [4 /*yield*/, interactionHandler.monitorPopupForHash(popupWindow)];
|
|
11320
|
-
case
|
|
11525
|
+
case 6:
|
|
11321
11526
|
hash = _a.sent();
|
|
11322
11527
|
state = this.validateAndExtractStateFromHash(hash, exports.InteractionType.Popup, validRequest.correlationId);
|
|
11323
11528
|
// Remove throttle if it exists
|
|
11324
11529
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
|
|
11325
11530
|
return [4 /*yield*/, interactionHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient)];
|
|
11326
|
-
case
|
|
11531
|
+
case 7:
|
|
11327
11532
|
result = _a.sent();
|
|
11328
11533
|
return [2 /*return*/, result];
|
|
11329
|
-
case
|
|
11534
|
+
case 8:
|
|
11330
11535
|
e_1 = _a.sent();
|
|
11331
11536
|
if (popup) {
|
|
11332
11537
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
@@ -11338,7 +11543,7 @@
|
|
|
11338
11543
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
11339
11544
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
11340
11545
|
throw e_1;
|
|
11341
|
-
case
|
|
11546
|
+
case 9: return [2 /*return*/];
|
|
11342
11547
|
}
|
|
11343
11548
|
});
|
|
11344
11549
|
});
|
|
@@ -11369,7 +11574,6 @@
|
|
|
11369
11574
|
case 2:
|
|
11370
11575
|
// Clear cache on logout
|
|
11371
11576
|
_a.sent();
|
|
11372
|
-
this.browserStorage.setInteractionInProgress(true);
|
|
11373
11577
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, requestAuthority)];
|
|
11374
11578
|
case 3:
|
|
11375
11579
|
authClient = _a.sent();
|
|
@@ -11403,7 +11607,7 @@
|
|
|
11403
11607
|
};
|
|
11404
11608
|
absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, BrowserUtils.getCurrentUri());
|
|
11405
11609
|
this.logger.verbose("Redirecting main window to url specified in the request");
|
|
11406
|
-
this.logger.verbosePii("
|
|
11610
|
+
this.logger.verbosePii("Redirecting main window to: " + absoluteUrl);
|
|
11407
11611
|
this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
|
|
11408
11612
|
}
|
|
11409
11613
|
else {
|
|
@@ -11460,11 +11664,10 @@
|
|
|
11460
11664
|
// Cache start page, returns to this page after redirectUri if navigateToLoginRequestUrl is true
|
|
11461
11665
|
if (params.redirectStartPage) {
|
|
11462
11666
|
this.browserRequestLogger.verbose("RedirectHandler.initiateAuthRequest: redirectStartPage set, caching start page");
|
|
11463
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
|
|
11667
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, params.redirectStartPage, true);
|
|
11464
11668
|
}
|
|
11465
11669
|
// Set interaction status in the library.
|
|
11466
|
-
this.browserStorage.
|
|
11467
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
|
|
11670
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, this.authCodeRequest.correlationId, true);
|
|
11468
11671
|
this.browserStorage.cacheCodeRequest(this.authCodeRequest, this.browserCrypto);
|
|
11469
11672
|
this.browserRequestLogger.infoPii("RedirectHandler.initiateAuthRequest: Navigate to: " + requestUrl);
|
|
11470
11673
|
navigationOptions = {
|
|
@@ -11578,46 +11781,59 @@
|
|
|
11578
11781
|
*/
|
|
11579
11782
|
RedirectClient.prototype.acquireToken = function (request) {
|
|
11580
11783
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11581
|
-
var validRequest, serverTelemetryManager, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
|
|
11784
|
+
var validRequest, serverTelemetryManager, handleBackButton, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
|
|
11785
|
+
var _this = this;
|
|
11582
11786
|
return __generator$1(this, function (_a) {
|
|
11583
11787
|
switch (_a.label) {
|
|
11584
|
-
case 0:
|
|
11585
|
-
validRequest = this.preflightInteractiveRequest(request, exports.InteractionType.Redirect);
|
|
11586
|
-
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
|
|
11587
|
-
_a.label = 1;
|
|
11788
|
+
case 0: return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Redirect)];
|
|
11588
11789
|
case 1:
|
|
11589
|
-
_a.
|
|
11590
|
-
|
|
11790
|
+
validRequest = _a.sent();
|
|
11791
|
+
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
|
|
11792
|
+
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
|
|
11793
|
+
handleBackButton = function (event) {
|
|
11794
|
+
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
11795
|
+
if (event.persisted) {
|
|
11796
|
+
_this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
|
|
11797
|
+
_this.browserStorage.cleanRequestByState(validRequest.state);
|
|
11798
|
+
}
|
|
11799
|
+
};
|
|
11800
|
+
_a.label = 2;
|
|
11591
11801
|
case 2:
|
|
11592
|
-
|
|
11593
|
-
return [4 /*yield*/, this.
|
|
11802
|
+
_a.trys.push([2, 7, , 8]);
|
|
11803
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
11594
11804
|
case 3:
|
|
11805
|
+
authCodeRequest = _a.sent();
|
|
11806
|
+
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority, validRequest.azureCloudOptions)];
|
|
11807
|
+
case 4:
|
|
11595
11808
|
authClient = _a.sent();
|
|
11596
11809
|
this.logger.verbose("Auth code client created");
|
|
11597
11810
|
interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto);
|
|
11598
11811
|
return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
|
|
11599
|
-
case
|
|
11812
|
+
case 5:
|
|
11600
11813
|
navigateUrl = _a.sent();
|
|
11601
11814
|
redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
|
|
11602
11815
|
this.logger.verbosePii("Redirect start page: " + redirectStartPage);
|
|
11816
|
+
// Clear temporary cache if the back button is clicked during the redirect flow.
|
|
11817
|
+
window.addEventListener("pageshow", handleBackButton);
|
|
11603
11818
|
return [4 /*yield*/, interactionHandler.initiateAuthRequest(navigateUrl, {
|
|
11604
11819
|
navigationClient: this.navigationClient,
|
|
11605
11820
|
redirectTimeout: this.config.system.redirectNavigationTimeout,
|
|
11606
11821
|
redirectStartPage: redirectStartPage,
|
|
11607
11822
|
onRedirectNavigate: request.onRedirectNavigate
|
|
11608
11823
|
})];
|
|
11609
|
-
case
|
|
11824
|
+
case 6:
|
|
11610
11825
|
// Show the UI once the url has been created. Response will come back in the hash, which will be handled in the handleRedirectCallback function.
|
|
11611
11826
|
return [2 /*return*/, _a.sent()];
|
|
11612
|
-
case
|
|
11827
|
+
case 7:
|
|
11613
11828
|
e_1 = _a.sent();
|
|
11614
11829
|
if (e_1 instanceof AuthError) {
|
|
11615
11830
|
e_1.setCorrelationId(this.correlationId);
|
|
11616
11831
|
}
|
|
11832
|
+
window.removeEventListener("pageshow", handleBackButton);
|
|
11617
11833
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
11618
11834
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
11619
11835
|
throw e_1;
|
|
11620
|
-
case
|
|
11836
|
+
case 8: return [2 /*return*/];
|
|
11621
11837
|
}
|
|
11622
11838
|
});
|
|
11623
11839
|
});
|
|
@@ -11652,7 +11868,6 @@
|
|
|
11652
11868
|
state = void 0;
|
|
11653
11869
|
try {
|
|
11654
11870
|
state = this.validateAndExtractStateFromHash(responseHash, exports.InteractionType.Redirect);
|
|
11655
|
-
BrowserUtils.clearHash(window);
|
|
11656
11871
|
this.logger.verbose("State extracted from hash");
|
|
11657
11872
|
}
|
|
11658
11873
|
catch (e) {
|
|
@@ -11660,7 +11875,7 @@
|
|
|
11660
11875
|
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
|
|
11661
11876
|
return [2 /*return*/, null];
|
|
11662
11877
|
}
|
|
11663
|
-
loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || "";
|
|
11878
|
+
loginRequestUrl = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, true) || "";
|
|
11664
11879
|
loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);
|
|
11665
11880
|
currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);
|
|
11666
11881
|
if (!(loginRequestUrlNormalized === currentUrlNormalized && this.config.auth.navigateToLoginRequestUrl)) return [3 /*break*/, 3];
|
|
@@ -11684,7 +11899,7 @@
|
|
|
11684
11899
|
* Returned from authority using redirect - need to perform navigation before processing response
|
|
11685
11900
|
* Cache the hash to be retrieved after the next redirect
|
|
11686
11901
|
*/
|
|
11687
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseHash, true);
|
|
11902
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, responseHash, true);
|
|
11688
11903
|
navigationOptions = {
|
|
11689
11904
|
apiId: exports.ApiId.handleRedirectPromise,
|
|
11690
11905
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
@@ -11694,7 +11909,7 @@
|
|
|
11694
11909
|
if (!(!loginRequestUrl || loginRequestUrl === "null")) return [3 /*break*/, 6];
|
|
11695
11910
|
homepage = BrowserUtils.getHomepage();
|
|
11696
11911
|
// Cache the homepage under ORIGIN_URI to ensure cached hash is processed on homepage
|
|
11697
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, homepage, true);
|
|
11912
|
+
this.browserStorage.setTemporaryCache(exports.TemporaryCacheKeys.ORIGIN_URI, homepage, true);
|
|
11698
11913
|
this.logger.warning("Unable to get valid login request url from cache, redirecting to home page");
|
|
11699
11914
|
return [4 /*yield*/, this.navigationClient.navigateInternal(homepage, navigationOptions)];
|
|
11700
11915
|
case 5:
|
|
@@ -11736,12 +11951,13 @@
|
|
|
11736
11951
|
this.logger.verbose("getRedirectResponseHash called");
|
|
11737
11952
|
// Get current location hash from window or cache.
|
|
11738
11953
|
var isResponseHash = UrlString.hashContainsKnownProperties(hash);
|
|
11739
|
-
var cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
|
|
11740
|
-
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
|
11741
11954
|
if (isResponseHash) {
|
|
11955
|
+
BrowserUtils.clearHash(window);
|
|
11742
11956
|
this.logger.verbose("Hash contains known properties, returning response hash");
|
|
11743
11957
|
return hash;
|
|
11744
11958
|
}
|
|
11959
|
+
var cachedHash = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.URL_HASH, true);
|
|
11960
|
+
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(exports.TemporaryCacheKeys.URL_HASH));
|
|
11745
11961
|
this.logger.verbose("Hash does not contain known properties, returning cached hash");
|
|
11746
11962
|
return cachedHash;
|
|
11747
11963
|
};
|
|
@@ -12033,24 +12249,27 @@
|
|
|
12033
12249
|
if (request.prompt && request.prompt !== PromptValue.NONE) {
|
|
12034
12250
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
12035
12251
|
}
|
|
12036
|
-
|
|
12037
|
-
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12038
|
-
_a.label = 1;
|
|
12252
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
12039
12253
|
case 1:
|
|
12040
|
-
_a.
|
|
12041
|
-
|
|
12254
|
+
silentRequest = _a.sent();
|
|
12255
|
+
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
|
|
12256
|
+
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12257
|
+
_a.label = 2;
|
|
12042
12258
|
case 2:
|
|
12043
|
-
|
|
12044
|
-
return [4 /*yield*/, this.
|
|
12259
|
+
_a.trys.push([2, 7, , 8]);
|
|
12260
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
|
|
12045
12261
|
case 3:
|
|
12262
|
+
authCodeRequest = _a.sent();
|
|
12263
|
+
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
12264
|
+
case 4:
|
|
12046
12265
|
authClient = _a.sent();
|
|
12047
12266
|
this.logger.verbose("Auth code client created");
|
|
12048
12267
|
return [4 /*yield*/, authClient.getAuthCodeUrl(silentRequest)];
|
|
12049
|
-
case
|
|
12268
|
+
case 5:
|
|
12050
12269
|
navigateUrl = _a.sent();
|
|
12051
12270
|
return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient, this.logger)];
|
|
12052
|
-
case
|
|
12053
|
-
case
|
|
12271
|
+
case 6: return [2 /*return*/, _a.sent()];
|
|
12272
|
+
case 7:
|
|
12054
12273
|
e_1 = _a.sent();
|
|
12055
12274
|
if (e_1 instanceof AuthError) {
|
|
12056
12275
|
e_1.setCorrelationId(this.correlationId);
|
|
@@ -12058,7 +12277,7 @@
|
|
|
12058
12277
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
12059
12278
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
12060
12279
|
throw e_1;
|
|
12061
|
-
case
|
|
12280
|
+
case 8: return [2 /*return*/];
|
|
12062
12281
|
}
|
|
12063
12282
|
});
|
|
12064
12283
|
});
|
|
@@ -12114,16 +12333,19 @@
|
|
|
12114
12333
|
*/
|
|
12115
12334
|
SilentRefreshClient.prototype.acquireToken = function (request) {
|
|
12116
12335
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12117
|
-
var silentRequest, serverTelemetryManager, refreshTokenClient;
|
|
12336
|
+
var silentRequest, _a, serverTelemetryManager, refreshTokenClient;
|
|
12118
12337
|
var _this = this;
|
|
12119
|
-
return __generator$1(this, function (
|
|
12120
|
-
switch (
|
|
12338
|
+
return __generator$1(this, function (_b) {
|
|
12339
|
+
switch (_b.label) {
|
|
12121
12340
|
case 0:
|
|
12122
|
-
|
|
12123
|
-
|
|
12124
|
-
return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority)];
|
|
12341
|
+
_a = [__assign$1({}, request)];
|
|
12342
|
+
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
12125
12343
|
case 1:
|
|
12126
|
-
|
|
12344
|
+
silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
|
|
12345
|
+
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
|
|
12346
|
+
return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
12347
|
+
case 2:
|
|
12348
|
+
refreshTokenClient = _b.sent();
|
|
12127
12349
|
this.logger.verbose("Refresh token client created");
|
|
12128
12350
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
12129
12351
|
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest).catch(function (e) {
|
|
@@ -12149,12 +12371,12 @@
|
|
|
12149
12371
|
* @param serverTelemetryManager
|
|
12150
12372
|
* @param authorityUrl
|
|
12151
12373
|
*/
|
|
12152
|
-
SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl) {
|
|
12374
|
+
SilentRefreshClient.prototype.createRefreshTokenClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
12153
12375
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12154
12376
|
var clientConfig;
|
|
12155
12377
|
return __generator$1(this, function (_a) {
|
|
12156
12378
|
switch (_a.label) {
|
|
12157
|
-
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
|
|
12379
|
+
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
12158
12380
|
case 1:
|
|
12159
12381
|
clientConfig = _a.sent();
|
|
12160
12382
|
return [2 /*return*/, new RefreshTokenClient(clientConfig)];
|
|
@@ -12197,13 +12419,14 @@
|
|
|
12197
12419
|
this.loadAccessToken(request, response, request.account.homeAccountId, request.account.environment, request.account.tenantId, options);
|
|
12198
12420
|
}
|
|
12199
12421
|
else if (request.authority) {
|
|
12422
|
+
var authorityUrl = Authority.generateAuthority(request.authority, request.azureCloudOptions);
|
|
12200
12423
|
var authorityOptions = {
|
|
12201
12424
|
protocolMode: this.config.auth.protocolMode,
|
|
12202
12425
|
knownAuthorities: this.config.auth.knownAuthorities,
|
|
12203
12426
|
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
|
12204
|
-
authorityMetadata: this.config.auth.authorityMetadata
|
|
12427
|
+
authorityMetadata: this.config.auth.authorityMetadata,
|
|
12205
12428
|
};
|
|
12206
|
-
var authority = new Authority(
|
|
12429
|
+
var authority = new Authority(authorityUrl, this.config.system.networkClient, this.storage, authorityOptions);
|
|
12207
12430
|
// "clientInfo" from options takes precedence over "clientInfo" in response
|
|
12208
12431
|
if (options.clientInfo) {
|
|
12209
12432
|
this.logger.trace("TokenCache - homeAccountId from options");
|
|
@@ -12322,14 +12545,17 @@
|
|
|
12322
12545
|
if (!request.code) {
|
|
12323
12546
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
12324
12547
|
}
|
|
12325
|
-
|
|
12326
|
-
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12327
|
-
_a.label = 1;
|
|
12548
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
|
|
12328
12549
|
case 1:
|
|
12329
|
-
_a.
|
|
12550
|
+
silentRequest = _a.sent();
|
|
12551
|
+
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
|
|
12552
|
+
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12553
|
+
_a.label = 2;
|
|
12554
|
+
case 2:
|
|
12555
|
+
_a.trys.push([2, 4, , 5]);
|
|
12330
12556
|
authCodeRequest = __assign$1(__assign$1({}, silentRequest), { code: request.code });
|
|
12331
12557
|
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];
|
|
12332
|
-
case
|
|
12558
|
+
case 3:
|
|
12333
12559
|
clientConfig = _a.sent();
|
|
12334
12560
|
authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
|
|
12335
12561
|
this.logger.verbose("Auth code client created");
|
|
@@ -12341,7 +12567,7 @@
|
|
|
12341
12567
|
cloud_graph_host_name: request.cloudGraphHostName,
|
|
12342
12568
|
cloud_instance_host_name: request.cloudInstanceHostName
|
|
12343
12569
|
}, silentRequest.state, authClient.authority, this.networkClient, false)];
|
|
12344
|
-
case
|
|
12570
|
+
case 4:
|
|
12345
12571
|
e_1 = _a.sent();
|
|
12346
12572
|
if (e_1 instanceof AuthError) {
|
|
12347
12573
|
e_1.setCorrelationId(this.correlationId);
|
|
@@ -12349,7 +12575,7 @@
|
|
|
12349
12575
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
12350
12576
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
12351
12577
|
throw e_1;
|
|
12352
|
-
case
|
|
12578
|
+
case 5: return [2 /*return*/];
|
|
12353
12579
|
}
|
|
12354
12580
|
});
|
|
12355
12581
|
});
|
|
@@ -12440,7 +12666,7 @@
|
|
|
12440
12666
|
if (typeof response === "undefined") {
|
|
12441
12667
|
this.eventHandler.emitEvent(exports.EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
12442
12668
|
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
|
|
12443
|
-
correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
12669
|
+
correlationId = this.browserStorage.getTemporaryCache(exports.TemporaryCacheKeys.CORRELATION_ID, true) || "";
|
|
12444
12670
|
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, correlationId);
|
|
12445
12671
|
response = redirectClient.handleRedirectPromise(hash)
|
|
12446
12672
|
.then(function (result) {
|
|
@@ -12497,8 +12723,8 @@
|
|
|
12497
12723
|
var _this = this;
|
|
12498
12724
|
return __generator$1(this, function (_a) {
|
|
12499
12725
|
// Preflight request
|
|
12500
|
-
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
|
|
12501
12726
|
this.logger.verbose("acquireTokenRedirect called");
|
|
12727
|
+
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Redirect);
|
|
12502
12728
|
isLoggedIn = this.getAllAccounts().length > 0;
|
|
12503
12729
|
if (isLoggedIn) {
|
|
12504
12730
|
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Redirect, request);
|
|
@@ -12532,8 +12758,8 @@
|
|
|
12532
12758
|
ClientApplication.prototype.acquireTokenPopup = function (request) {
|
|
12533
12759
|
var _this = this;
|
|
12534
12760
|
try {
|
|
12535
|
-
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
12536
12761
|
this.logger.verbose("acquireTokenPopup called", request.correlationId);
|
|
12762
|
+
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Popup);
|
|
12537
12763
|
}
|
|
12538
12764
|
catch (e) {
|
|
12539
12765
|
// Since this function is syncronous we need to reject
|
|
@@ -12868,6 +13094,21 @@
|
|
|
12868
13094
|
!this.config.cache.storeAuthStateInCookie) {
|
|
12869
13095
|
throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
|
|
12870
13096
|
}
|
|
13097
|
+
if (interactionType === exports.InteractionType.Redirect || interactionType === exports.InteractionType.Popup) {
|
|
13098
|
+
this.preflightInteractiveRequest();
|
|
13099
|
+
}
|
|
13100
|
+
};
|
|
13101
|
+
/**
|
|
13102
|
+
* Helper to validate app environment before making a request.
|
|
13103
|
+
* @param request
|
|
13104
|
+
* @param interactionType
|
|
13105
|
+
*/
|
|
13106
|
+
ClientApplication.prototype.preflightInteractiveRequest = function () {
|
|
13107
|
+
this.logger.verbose("preflightInteractiveRequest called, validating app environment");
|
|
13108
|
+
// block the reload if it occurred inside a hidden iframe
|
|
13109
|
+
BrowserUtils.blockReloadInHiddenIframes();
|
|
13110
|
+
// Set interaction in progress temporary cache or throw if alread set.
|
|
13111
|
+
this.browserStorage.setInteractionInProgress(true);
|
|
12871
13112
|
};
|
|
12872
13113
|
/**
|
|
12873
13114
|
* Adds event callbacks to array
|
|
@@ -12959,7 +13200,7 @@
|
|
|
12959
13200
|
switch (_a.label) {
|
|
12960
13201
|
case 0:
|
|
12961
13202
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
|
|
12962
|
-
return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority)];
|
|
13203
|
+
return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];
|
|
12963
13204
|
case 1:
|
|
12964
13205
|
silentAuthClient = _a.sent();
|
|
12965
13206
|
this.logger.verbose("Silent auth client created");
|
|
@@ -12994,12 +13235,12 @@
|
|
|
12994
13235
|
* @param serverTelemetryManager
|
|
12995
13236
|
* @param authorityUrl
|
|
12996
13237
|
*/
|
|
12997
|
-
SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl) {
|
|
13238
|
+
SilentCacheClient.prototype.createSilentFlowClient = function (serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
12998
13239
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12999
13240
|
var clientConfig;
|
|
13000
13241
|
return __generator$1(this, function (_a) {
|
|
13001
13242
|
switch (_a.label) {
|
|
13002
|
-
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl)];
|
|
13243
|
+
case 0: return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions)];
|
|
13003
13244
|
case 1:
|
|
13004
13245
|
clientConfig = _a.sent();
|
|
13005
13246
|
return [2 /*return*/, new SilentFlowClient(clientConfig)];
|
|
@@ -13008,7 +13249,17 @@
|
|
|
13008
13249
|
});
|
|
13009
13250
|
};
|
|
13010
13251
|
SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {
|
|
13011
|
-
return
|
|
13252
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
13253
|
+
var _a;
|
|
13254
|
+
return __generator$1(this, function (_b) {
|
|
13255
|
+
switch (_b.label) {
|
|
13256
|
+
case 0:
|
|
13257
|
+
_a = [__assign$1({}, request)];
|
|
13258
|
+
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
13259
|
+
case 1: return [2 /*return*/, __assign$1.apply(void 0, [__assign$1.apply(void 0, _a.concat([_b.sent()])), { account: account, forceRefresh: request.forceRefresh || false }])];
|
|
13260
|
+
}
|
|
13261
|
+
});
|
|
13262
|
+
});
|
|
13012
13263
|
};
|
|
13013
13264
|
return SilentCacheClient;
|
|
13014
13265
|
}(StandardInteractionClient));
|
|
@@ -13099,11 +13350,11 @@
|
|
|
13099
13350
|
authority: request.authority || "",
|
|
13100
13351
|
scopes: request.scopes,
|
|
13101
13352
|
homeAccountIdentifier: account.homeAccountId,
|
|
13353
|
+
claims: request.claims,
|
|
13102
13354
|
authenticationScheme: request.authenticationScheme,
|
|
13103
13355
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
13104
13356
|
resourceRequestUri: request.resourceRequestUri,
|
|
13105
13357
|
shrClaims: request.shrClaims,
|
|
13106
|
-
sshJwk: request.sshJwk,
|
|
13107
13358
|
sshKid: request.sshKid
|
|
13108
13359
|
};
|
|
13109
13360
|
silentRequestKey = JSON.stringify(thumbprint);
|
|
@@ -13140,28 +13391,33 @@
|
|
|
13140
13391
|
var silentCacheClient, silentRequest;
|
|
13141
13392
|
var _this = this;
|
|
13142
13393
|
return __generator$1(this, function (_a) {
|
|
13143
|
-
|
|
13144
|
-
|
|
13145
|
-
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
13155
|
-
|
|
13156
|
-
|
|
13157
|
-
|
|
13158
|
-
|
|
13159
|
-
|
|
13160
|
-
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13394
|
+
switch (_a.label) {
|
|
13395
|
+
case 0:
|
|
13396
|
+
silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
|
|
13397
|
+
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
|
|
13398
|
+
case 1:
|
|
13399
|
+
silentRequest = _a.sent();
|
|
13400
|
+
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
13401
|
+
return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
13402
|
+
var tokenRenewalResult, tokenRenewalError_1;
|
|
13403
|
+
return __generator$1(this, function (_a) {
|
|
13404
|
+
switch (_a.label) {
|
|
13405
|
+
case 0:
|
|
13406
|
+
_a.trys.push([0, 2, , 3]);
|
|
13407
|
+
return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
|
|
13408
|
+
case 1:
|
|
13409
|
+
tokenRenewalResult = _a.sent();
|
|
13410
|
+
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, tokenRenewalResult);
|
|
13411
|
+
return [2 /*return*/, tokenRenewalResult];
|
|
13412
|
+
case 2:
|
|
13413
|
+
tokenRenewalError_1 = _a.sent();
|
|
13414
|
+
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError_1);
|
|
13415
|
+
throw tokenRenewalError_1;
|
|
13416
|
+
case 3: return [2 /*return*/];
|
|
13417
|
+
}
|
|
13418
|
+
});
|
|
13419
|
+
}); })];
|
|
13420
|
+
}
|
|
13165
13421
|
});
|
|
13166
13422
|
});
|
|
13167
13423
|
};
|
|
@@ -13387,21 +13643,34 @@
|
|
|
13387
13643
|
exports.AuthenticationHeaderParser = AuthenticationHeaderParser;
|
|
13388
13644
|
exports.BrowserAuthError = BrowserAuthError;
|
|
13389
13645
|
exports.BrowserAuthErrorMessage = BrowserAuthErrorMessage;
|
|
13646
|
+
exports.BrowserCacheManager = BrowserCacheManager;
|
|
13390
13647
|
exports.BrowserConfigurationAuthError = BrowserConfigurationAuthError;
|
|
13391
13648
|
exports.BrowserConfigurationAuthErrorMessage = BrowserConfigurationAuthErrorMessage;
|
|
13649
|
+
exports.BrowserConstants = BrowserConstants;
|
|
13392
13650
|
exports.BrowserUtils = BrowserUtils;
|
|
13393
13651
|
exports.ClientAuthError = ClientAuthError;
|
|
13394
13652
|
exports.ClientAuthErrorMessage = ClientAuthErrorMessage;
|
|
13395
13653
|
exports.ClientConfigurationError = ClientConfigurationError;
|
|
13396
13654
|
exports.ClientConfigurationErrorMessage = ClientConfigurationErrorMessage;
|
|
13655
|
+
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
|
|
13656
|
+
exports.EventHandler = EventHandler;
|
|
13397
13657
|
exports.EventMessageUtils = EventMessageUtils;
|
|
13398
13658
|
exports.InteractionRequiredAuthError = InteractionRequiredAuthError;
|
|
13399
13659
|
exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
|
|
13400
13660
|
exports.Logger = Logger;
|
|
13401
13661
|
exports.NavigationClient = NavigationClient;
|
|
13662
|
+
exports.OIDC_DEFAULT_SCOPES = OIDC_DEFAULT_SCOPES;
|
|
13663
|
+
exports.PopupClient = PopupClient;
|
|
13664
|
+
exports.PopupUtils = PopupUtils;
|
|
13402
13665
|
exports.PublicClientApplication = PublicClientApplication;
|
|
13666
|
+
exports.RedirectClient = RedirectClient;
|
|
13667
|
+
exports.RedirectHandler = RedirectHandler;
|
|
13403
13668
|
exports.ServerError = ServerError;
|
|
13404
13669
|
exports.SignedHttpRequest = SignedHttpRequest;
|
|
13670
|
+
exports.SilentCacheClient = SilentCacheClient;
|
|
13671
|
+
exports.SilentIframeClient = SilentIframeClient;
|
|
13672
|
+
exports.SilentRefreshClient = SilentRefreshClient;
|
|
13673
|
+
exports.StandardInteractionClient = StandardInteractionClient;
|
|
13405
13674
|
exports.StringUtils = StringUtils;
|
|
13406
13675
|
exports.UrlString = UrlString;
|
|
13407
13676
|
exports.stubbedPublicClientApplication = stubbedPublicClientApplication;
|