@azure/msal-browser 2.20.0 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.json +29 -0
- package/CHANGELOG.md +14 -1
- package/README.md +3 -3
- package/dist/_virtual/_tslib.js +1 -1
- package/dist/app/ClientApplication.js +1 -1
- package/dist/app/IPublicClientApplication.js +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 +5 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.js +21 -1
- 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.js +1 -1
- package/dist/config/Configuration.js +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 +396 -258
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.js +39 -24
- package/dist/interaction_client/BaseInteractionClient.js.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.js +46 -36
- package/dist/interaction_client/PopupClient.js.map +1 -1
- package/dist/interaction_client/RedirectClient.js +14 -13
- package/dist/interaction_client/RedirectClient.js.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.js +10 -8
- package/dist/interaction_client/SilentAuthCodeClient.js.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.js +12 -2
- package/dist/interaction_client/SilentCacheClient.js.map +1 -1
- package/dist/interaction_client/SilentIframeClient.js +13 -11
- package/dist/interaction_client/SilentIframeClient.js.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.js +10 -7
- package/dist/interaction_client/SilentRefreshClient.js.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +2 -2
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.js +51 -32
- package/dist/interaction_client/StandardInteractionClient.js.map +1 -1
- package/dist/interaction_handler/InteractionHandler.js +1 -1
- package/dist/interaction_handler/PopupHandler.js +1 -1
- package/dist/interaction_handler/RedirectHandler.js +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/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.js +1 -1
- package/dist/utils/BrowserProtocolUtils.js +1 -1
- package/dist/utils/BrowserStringUtils.js +1 -1
- package/dist/utils/BrowserUtils.js +1 -1
- package/dist/utils/MathUtils.js +1 -1
- package/dist/utils/PopupUtils.js +1 -1
- package/lib/msal-browser.js +396 -258
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +30 -30
- package/package.json +2 -2
package/lib/msal-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v2.
|
|
1
|
+
/*! @azure/msal-browser v2.21.0 2022-01-04 */
|
|
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.0.0 2022-01-04 */
|
|
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.0.0 2022-01-04 */
|
|
198
198
|
|
|
199
199
|
/*
|
|
200
200
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -556,7 +556,7 @@
|
|
|
556
556
|
CacheOutcome["REFRESH_CACHED_ACCESS_TOKEN"] = "4";
|
|
557
557
|
})(CacheOutcome || (CacheOutcome = {}));
|
|
558
558
|
|
|
559
|
-
/*! @azure/msal-common
|
|
559
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
560
560
|
|
|
561
561
|
/*
|
|
562
562
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -600,7 +600,7 @@
|
|
|
600
600
|
return AuthError;
|
|
601
601
|
}(Error));
|
|
602
602
|
|
|
603
|
-
/*! @azure/msal-common
|
|
603
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
604
604
|
|
|
605
605
|
/*
|
|
606
606
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -663,10 +663,19 @@
|
|
|
663
663
|
throw AuthError.createUnexpectedError(notImplErr);
|
|
664
664
|
});
|
|
665
665
|
});
|
|
666
|
+
},
|
|
667
|
+
hashString: function () {
|
|
668
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
669
|
+
var notImplErr;
|
|
670
|
+
return __generator(this, function (_a) {
|
|
671
|
+
notImplErr = "Crypto interface - hashString() has not been implemented";
|
|
672
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
673
|
+
});
|
|
674
|
+
});
|
|
666
675
|
}
|
|
667
676
|
};
|
|
668
677
|
|
|
669
|
-
/*! @azure/msal-common
|
|
678
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
670
679
|
|
|
671
680
|
/*
|
|
672
681
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1128,7 +1137,7 @@
|
|
|
1128
1137
|
return ClientAuthError;
|
|
1129
1138
|
}(AuthError));
|
|
1130
1139
|
|
|
1131
|
-
/*! @azure/msal-common
|
|
1140
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
1132
1141
|
|
|
1133
1142
|
/*
|
|
1134
1143
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1253,7 +1262,7 @@
|
|
|
1253
1262
|
return StringUtils;
|
|
1254
1263
|
}());
|
|
1255
1264
|
|
|
1256
|
-
/*! @azure/msal-common
|
|
1265
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
1257
1266
|
|
|
1258
1267
|
/*
|
|
1259
1268
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1433,12 +1442,12 @@
|
|
|
1433
1442
|
return Logger;
|
|
1434
1443
|
}());
|
|
1435
1444
|
|
|
1436
|
-
/*! @azure/msal-common
|
|
1445
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
1437
1446
|
/* eslint-disable header/header */
|
|
1438
1447
|
var name$1 = "@azure/msal-common";
|
|
1439
|
-
var version$1 = "
|
|
1448
|
+
var version$1 = "6.0.0";
|
|
1440
1449
|
|
|
1441
|
-
/*! @azure/msal-common
|
|
1450
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
1442
1451
|
|
|
1443
1452
|
/*
|
|
1444
1453
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1449,7 +1458,7 @@
|
|
|
1449
1458
|
*
|
|
1450
1459
|
* Key:Value Schema:
|
|
1451
1460
|
*
|
|
1452
|
-
* Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<scheme
|
|
1461
|
+
* Key: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<requestedClaims*>-<scheme*>
|
|
1453
1462
|
*
|
|
1454
1463
|
* Value Schema:
|
|
1455
1464
|
* {
|
|
@@ -1463,6 +1472,7 @@
|
|
|
1463
1472
|
* target: Permissions that are included in the token, or for refresh tokens, the resource identifier.
|
|
1464
1473
|
* oboAssertion: access token passed in as part of OBO request
|
|
1465
1474
|
* tokenType: Matches the authentication scheme for which the token was issued (i.e. Bearer or pop)
|
|
1475
|
+
* requestedClaimsHash: Matches the SHA 256 hash of the claims object included in the token request
|
|
1466
1476
|
* }
|
|
1467
1477
|
*/
|
|
1468
1478
|
var CredentialEntity = /** @class */ (function () {
|
|
@@ -1490,7 +1500,7 @@
|
|
|
1490
1500
|
* generates credential key
|
|
1491
1501
|
*/
|
|
1492
1502
|
CredentialEntity.prototype.generateCredentialKey = function () {
|
|
1493
|
-
return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType);
|
|
1503
|
+
return CredentialEntity.generateCredentialCacheKey(this.homeAccountId, this.environment, this.credentialType, this.clientId, this.realm, this.target, this.familyId, this.tokenType, this.requestedClaimsHash);
|
|
1494
1504
|
};
|
|
1495
1505
|
/**
|
|
1496
1506
|
* returns the type of the cache (in this case credential)
|
|
@@ -1534,16 +1544,14 @@
|
|
|
1534
1544
|
* generates credential key
|
|
1535
1545
|
* <home_account_id*>-\<environment>-<credential_type>-<client_id>-<realm\*>-<target\*>-<scheme\*>
|
|
1536
1546
|
*/
|
|
1537
|
-
CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType) {
|
|
1547
|
+
CredentialEntity.generateCredentialCacheKey = function (homeAccountId, environment, credentialType, clientId, realm, target, familyId, tokenType, requestedClaimsHash) {
|
|
1538
1548
|
var credentialKey = [
|
|
1539
1549
|
this.generateAccountIdForCacheKey(homeAccountId, environment),
|
|
1540
1550
|
this.generateCredentialIdForCacheKey(credentialType, clientId, realm, familyId),
|
|
1541
|
-
this.generateTargetForCacheKey(target)
|
|
1551
|
+
this.generateTargetForCacheKey(target),
|
|
1552
|
+
this.generateClaimsHashForCacheKey(requestedClaimsHash),
|
|
1553
|
+
this.generateSchemeForCacheKey(tokenType)
|
|
1542
1554
|
];
|
|
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
1555
|
return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
|
1548
1556
|
};
|
|
1549
1557
|
/**
|
|
@@ -1579,10 +1587,26 @@
|
|
|
1579
1587
|
CredentialEntity.generateTargetForCacheKey = function (scopes) {
|
|
1580
1588
|
return (scopes || "").toLowerCase();
|
|
1581
1589
|
};
|
|
1590
|
+
/**
|
|
1591
|
+
* Generate requested claims key component as per schema: <requestedClaims>
|
|
1592
|
+
*/
|
|
1593
|
+
CredentialEntity.generateClaimsHashForCacheKey = function (requestedClaimsHash) {
|
|
1594
|
+
return (requestedClaimsHash || "").toLowerCase();
|
|
1595
|
+
};
|
|
1596
|
+
/**
|
|
1597
|
+
* Generate scheme key componenet as per schema: <scheme>
|
|
1598
|
+
*/
|
|
1599
|
+
CredentialEntity.generateSchemeForCacheKey = function (tokenType) {
|
|
1600
|
+
/*
|
|
1601
|
+
* PoP Tokens and SSH certs include scheme in cache key
|
|
1602
|
+
* Cast to lowercase to handle "bearer" from ADFS
|
|
1603
|
+
*/
|
|
1604
|
+
return (tokenType && tokenType.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? tokenType.toLowerCase() : "";
|
|
1605
|
+
};
|
|
1582
1606
|
return CredentialEntity;
|
|
1583
1607
|
}());
|
|
1584
1608
|
|
|
1585
|
-
/*! @azure/msal-common
|
|
1609
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
1586
1610
|
|
|
1587
1611
|
/*
|
|
1588
1612
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1827,7 +1851,7 @@
|
|
|
1827
1851
|
return ClientConfigurationError;
|
|
1828
1852
|
}(ClientAuthError));
|
|
1829
1853
|
|
|
1830
|
-
/*! @azure/msal-common
|
|
1854
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
1831
1855
|
|
|
1832
1856
|
/*
|
|
1833
1857
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2011,7 +2035,7 @@
|
|
|
2011
2035
|
return ScopeSet;
|
|
2012
2036
|
}());
|
|
2013
2037
|
|
|
2014
|
-
/*! @azure/msal-common
|
|
2038
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
2015
2039
|
|
|
2016
2040
|
/*
|
|
2017
2041
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2049,7 +2073,7 @@
|
|
|
2049
2073
|
};
|
|
2050
2074
|
}
|
|
2051
2075
|
|
|
2052
|
-
/*! @azure/msal-common
|
|
2076
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
2053
2077
|
/*
|
|
2054
2078
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2055
2079
|
* Licensed under the MIT License.
|
|
@@ -2063,7 +2087,7 @@
|
|
|
2063
2087
|
AuthorityType[AuthorityType["Adfs"] = 1] = "Adfs";
|
|
2064
2088
|
})(AuthorityType || (AuthorityType = {}));
|
|
2065
2089
|
|
|
2066
|
-
/*! @azure/msal-common
|
|
2090
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
2067
2091
|
|
|
2068
2092
|
/*
|
|
2069
2093
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2297,7 +2321,7 @@
|
|
|
2297
2321
|
return AccountEntity;
|
|
2298
2322
|
}());
|
|
2299
2323
|
|
|
2300
|
-
/*! @azure/msal-common
|
|
2324
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
2301
2325
|
|
|
2302
2326
|
/*
|
|
2303
2327
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2335,7 +2359,7 @@
|
|
|
2335
2359
|
return AuthToken;
|
|
2336
2360
|
}());
|
|
2337
2361
|
|
|
2338
|
-
/*! @azure/msal-common
|
|
2362
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
2339
2363
|
|
|
2340
2364
|
/*
|
|
2341
2365
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2425,7 +2449,8 @@
|
|
|
2425
2449
|
environment: credential.environment,
|
|
2426
2450
|
homeAccountId: credential.homeAccountId,
|
|
2427
2451
|
realm: credential.realm,
|
|
2428
|
-
tokenType: credential.tokenType
|
|
2452
|
+
tokenType: credential.tokenType,
|
|
2453
|
+
requestedClaimsHash: credential.requestedClaimsHash
|
|
2429
2454
|
});
|
|
2430
2455
|
currentScopes = ScopeSet.fromString(credential.target);
|
|
2431
2456
|
currentAccessTokens = Object.keys(currentTokenCache.accessTokens).map(function (key) { return currentTokenCache.accessTokens[key]; });
|
|
@@ -2497,7 +2522,7 @@
|
|
|
2497
2522
|
* @param target
|
|
2498
2523
|
*/
|
|
2499
2524
|
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);
|
|
2525
|
+
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
2526
|
};
|
|
2502
2527
|
/**
|
|
2503
2528
|
* Support function to help match credentials
|
|
@@ -2510,7 +2535,7 @@
|
|
|
2510
2535
|
* @param oboAssertion
|
|
2511
2536
|
* @param tokenType
|
|
2512
2537
|
*/
|
|
2513
|
-
CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType, keyId) {
|
|
2538
|
+
CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, oboAssertion, tokenType, keyId, requestedClaimsHash) {
|
|
2514
2539
|
var _this = this;
|
|
2515
2540
|
var allCacheKeys = this.getKeys();
|
|
2516
2541
|
var matchingCredentials = {
|
|
@@ -2557,38 +2582,37 @@
|
|
|
2557
2582
|
if (!!target && !_this.matchTarget(entity, target)) {
|
|
2558
2583
|
return;
|
|
2559
2584
|
}
|
|
2585
|
+
// If request OR cached entity has requested Claims Hash, check if they match
|
|
2586
|
+
if (requestedClaimsHash || entity.requestedClaimsHash) {
|
|
2587
|
+
// Don't match if either is undefined or they are different
|
|
2588
|
+
if (entity.requestedClaimsHash !== requestedClaimsHash) {
|
|
2589
|
+
return;
|
|
2590
|
+
}
|
|
2591
|
+
}
|
|
2560
2592
|
// Access Token with Auth Scheme specific matching
|
|
2561
2593
|
if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
|
|
2562
2594
|
if (!!tokenType && !_this.matchTokenType(entity, tokenType)) {
|
|
2563
2595
|
return;
|
|
2564
2596
|
}
|
|
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;
|
|
2597
|
+
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
|
|
2598
|
+
if (tokenType === exports.AuthenticationScheme.SSH) {
|
|
2599
|
+
if (keyId && !_this.matchKeyId(entity, keyId)) {
|
|
2600
|
+
return;
|
|
2601
|
+
}
|
|
2580
2602
|
}
|
|
2581
2603
|
}
|
|
2604
|
+
// At this point, the entity matches the request, update cache key if key schema has changed
|
|
2605
|
+
var updatedCacheKey = _this.updateCredentialCacheKey(cacheKey, entity);
|
|
2582
2606
|
switch (credType) {
|
|
2583
2607
|
case CredentialType.ID_TOKEN:
|
|
2584
|
-
matchingCredentials.idTokens[
|
|
2608
|
+
matchingCredentials.idTokens[updatedCacheKey] = entity;
|
|
2585
2609
|
break;
|
|
2586
2610
|
case CredentialType.ACCESS_TOKEN:
|
|
2587
2611
|
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
|
|
2588
|
-
matchingCredentials.accessTokens[
|
|
2612
|
+
matchingCredentials.accessTokens[updatedCacheKey] = entity;
|
|
2589
2613
|
break;
|
|
2590
2614
|
case CredentialType.REFRESH_TOKEN:
|
|
2591
|
-
matchingCredentials.refreshTokens[
|
|
2615
|
+
matchingCredentials.refreshTokens[updatedCacheKey] = entity;
|
|
2592
2616
|
break;
|
|
2593
2617
|
}
|
|
2594
2618
|
});
|
|
@@ -2787,10 +2811,10 @@
|
|
|
2787
2811
|
* @param environment
|
|
2788
2812
|
* @param authScheme
|
|
2789
2813
|
*/
|
|
2790
|
-
CacheManager.prototype.readCacheRecord = function (account, clientId,
|
|
2814
|
+
CacheManager.prototype.readCacheRecord = function (account, clientId, request, environment) {
|
|
2791
2815
|
var cachedAccount = this.readAccountFromCache(account);
|
|
2792
2816
|
var cachedIdToken = this.readIdTokenFromCache(clientId, account);
|
|
2793
|
-
var cachedAccessToken = this.readAccessTokenFromCache(clientId, account,
|
|
2817
|
+
var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, request);
|
|
2794
2818
|
var cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);
|
|
2795
2819
|
var cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);
|
|
2796
2820
|
if (cachedAccount && cachedIdToken) {
|
|
@@ -2844,9 +2868,14 @@
|
|
|
2844
2868
|
* @param scopes
|
|
2845
2869
|
* @param authScheme
|
|
2846
2870
|
*/
|
|
2847
|
-
CacheManager.prototype.readAccessTokenFromCache = function (clientId, account,
|
|
2848
|
-
|
|
2849
|
-
var
|
|
2871
|
+
CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, request) {
|
|
2872
|
+
var scopes = new ScopeSet(request.scopes || []);
|
|
2873
|
+
var authScheme = request.authenticationScheme || exports.AuthenticationScheme.BEARER;
|
|
2874
|
+
/*
|
|
2875
|
+
* Distinguish between Bearer and PoP/SSH token cache types
|
|
2876
|
+
* Cast to lowercase to handle "bearer" from ADFS
|
|
2877
|
+
*/
|
|
2878
|
+
var credentialType = (authScheme && authScheme.toLowerCase() !== exports.AuthenticationScheme.BEARER.toLowerCase()) ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME : CredentialType.ACCESS_TOKEN;
|
|
2850
2879
|
var accessTokenFilter = {
|
|
2851
2880
|
homeAccountId: account.homeAccountId,
|
|
2852
2881
|
environment: account.environment,
|
|
@@ -2855,7 +2884,8 @@
|
|
|
2855
2884
|
realm: account.tenantId,
|
|
2856
2885
|
target: scopes.printScopesLowerCase(),
|
|
2857
2886
|
tokenType: authScheme,
|
|
2858
|
-
keyId:
|
|
2887
|
+
keyId: request.sshKid,
|
|
2888
|
+
requestedClaimsHash: request.requestedClaimsHash
|
|
2859
2889
|
};
|
|
2860
2890
|
var credentialCache = this.getCredentialsFilteredBy(accessTokenFilter);
|
|
2861
2891
|
var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
|
|
@@ -3164,10 +3194,14 @@
|
|
|
3164
3194
|
});
|
|
3165
3195
|
});
|
|
3166
3196
|
};
|
|
3197
|
+
DefaultStorageClass.prototype.updateCredentialCacheKey = function () {
|
|
3198
|
+
var notImplErr = "Storage interface - updateCredentialCacheKey() has not been implemented for the cacheStorage interface.";
|
|
3199
|
+
throw AuthError.createUnexpectedError(notImplErr);
|
|
3200
|
+
};
|
|
3167
3201
|
return DefaultStorageClass;
|
|
3168
3202
|
}(CacheManager));
|
|
3169
3203
|
|
|
3170
|
-
/*! @azure/msal-common
|
|
3204
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3171
3205
|
|
|
3172
3206
|
/*
|
|
3173
3207
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3249,7 +3283,7 @@
|
|
|
3249
3283
|
return __assign({ clientCapabilities: [] }, authOptions);
|
|
3250
3284
|
}
|
|
3251
3285
|
|
|
3252
|
-
/*! @azure/msal-common
|
|
3286
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3253
3287
|
|
|
3254
3288
|
/*
|
|
3255
3289
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3269,7 +3303,7 @@
|
|
|
3269
3303
|
return ServerError;
|
|
3270
3304
|
}(AuthError));
|
|
3271
3305
|
|
|
3272
|
-
/*! @azure/msal-common
|
|
3306
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3273
3307
|
|
|
3274
3308
|
/*
|
|
3275
3309
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3352,11 +3386,11 @@
|
|
|
3352
3386
|
authority: request.authority,
|
|
3353
3387
|
scopes: request.scopes,
|
|
3354
3388
|
homeAccountIdentifier: homeAccountIdentifier,
|
|
3389
|
+
claims: request.claims,
|
|
3355
3390
|
authenticationScheme: request.authenticationScheme,
|
|
3356
3391
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
3357
3392
|
resourceRequestUri: request.resourceRequestUri,
|
|
3358
3393
|
shrClaims: request.shrClaims,
|
|
3359
|
-
sshJwk: request.sshJwk,
|
|
3360
3394
|
sshKid: request.sshKid
|
|
3361
3395
|
};
|
|
3362
3396
|
var key = this.generateThrottlingStorageKey(thumbprint);
|
|
@@ -3365,7 +3399,7 @@
|
|
|
3365
3399
|
return ThrottlingUtils;
|
|
3366
3400
|
}());
|
|
3367
3401
|
|
|
3368
|
-
/*! @azure/msal-common
|
|
3402
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3369
3403
|
|
|
3370
3404
|
/*
|
|
3371
3405
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3414,7 +3448,7 @@
|
|
|
3414
3448
|
return NetworkManager;
|
|
3415
3449
|
}());
|
|
3416
3450
|
|
|
3417
|
-
/*! @azure/msal-common
|
|
3451
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3418
3452
|
/*
|
|
3419
3453
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3420
3454
|
* Licensed under the MIT License.
|
|
@@ -3425,7 +3459,7 @@
|
|
|
3425
3459
|
CcsCredentialType["UPN"] = "UPN";
|
|
3426
3460
|
})(CcsCredentialType || (CcsCredentialType = {}));
|
|
3427
3461
|
|
|
3428
|
-
/*! @azure/msal-common
|
|
3462
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3429
3463
|
|
|
3430
3464
|
/*
|
|
3431
3465
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3514,7 +3548,7 @@
|
|
|
3514
3548
|
return BaseClient;
|
|
3515
3549
|
}());
|
|
3516
3550
|
|
|
3517
|
-
/*! @azure/msal-common
|
|
3551
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3518
3552
|
|
|
3519
3553
|
/*
|
|
3520
3554
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3600,7 +3634,7 @@
|
|
|
3600
3634
|
return RequestValidator;
|
|
3601
3635
|
}());
|
|
3602
3636
|
|
|
3603
|
-
/*! @azure/msal-common
|
|
3637
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3604
3638
|
|
|
3605
3639
|
/*
|
|
3606
3640
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3940,7 +3974,7 @@
|
|
|
3940
3974
|
return RequestParameterBuilder;
|
|
3941
3975
|
}());
|
|
3942
3976
|
|
|
3943
|
-
/*! @azure/msal-common
|
|
3977
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
3944
3978
|
|
|
3945
3979
|
/*
|
|
3946
3980
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4005,7 +4039,7 @@
|
|
|
4005
4039
|
return IdTokenEntity;
|
|
4006
4040
|
}(CredentialEntity));
|
|
4007
4041
|
|
|
4008
|
-
/*! @azure/msal-common
|
|
4042
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4009
4043
|
/*
|
|
4010
4044
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4011
4045
|
* Licensed under the MIT License.
|
|
@@ -4055,7 +4089,7 @@
|
|
|
4055
4089
|
return TimeUtils;
|
|
4056
4090
|
}());
|
|
4057
4091
|
|
|
4058
|
-
/*! @azure/msal-common
|
|
4092
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4059
4093
|
|
|
4060
4094
|
/*
|
|
4061
4095
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4101,8 +4135,8 @@
|
|
|
4101
4135
|
* @param expiresOn
|
|
4102
4136
|
* @param extExpiresOn
|
|
4103
4137
|
*/
|
|
4104
|
-
AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion, keyId) {
|
|
4105
|
-
var _a;
|
|
4138
|
+
AccessTokenEntity.createAccessTokenEntity = function (homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, cryptoUtils, refreshOn, tokenType, oboAssertion, keyId, requestedClaims, requestedClaimsHash) {
|
|
4139
|
+
var _a, _b;
|
|
4106
4140
|
var atEntity = new AccessTokenEntity();
|
|
4107
4141
|
atEntity.homeAccountId = homeAccountId;
|
|
4108
4142
|
atEntity.credentialType = CredentialType.ACCESS_TOKEN;
|
|
@@ -4124,14 +4158,21 @@
|
|
|
4124
4158
|
atEntity.target = scopes;
|
|
4125
4159
|
atEntity.oboAssertion = oboAssertion;
|
|
4126
4160
|
atEntity.tokenType = StringUtils.isEmpty(tokenType) ? exports.AuthenticationScheme.BEARER : tokenType;
|
|
4127
|
-
|
|
4128
|
-
|
|
4161
|
+
if (requestedClaims) {
|
|
4162
|
+
atEntity.requestedClaims = requestedClaims;
|
|
4163
|
+
atEntity.requestedClaimsHash = requestedClaimsHash;
|
|
4164
|
+
}
|
|
4165
|
+
/*
|
|
4166
|
+
* Create Access Token With Auth Scheme instead of regular access token
|
|
4167
|
+
* Cast to lower to handle "bearer" from ADFS
|
|
4168
|
+
*/
|
|
4169
|
+
if (((_a = atEntity.tokenType) === null || _a === void 0 ? void 0 : _a.toLowerCase()) !== exports.AuthenticationScheme.BEARER.toLowerCase()) {
|
|
4129
4170
|
atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
4130
4171
|
switch (atEntity.tokenType) {
|
|
4131
4172
|
case exports.AuthenticationScheme.POP:
|
|
4132
4173
|
// Make sure keyId is present and add it to credential
|
|
4133
4174
|
var tokenClaims = AuthToken.extractTokenClaims(accessToken, cryptoUtils);
|
|
4134
|
-
if (!((
|
|
4175
|
+
if (!((_b = tokenClaims === null || tokenClaims === void 0 ? void 0 : tokenClaims.cnf) === null || _b === void 0 ? void 0 : _b.kid)) {
|
|
4135
4176
|
throw ClientAuthError.createTokenClaimsRequiredError();
|
|
4136
4177
|
}
|
|
4137
4178
|
atEntity.keyId = tokenClaims.cnf.kid;
|
|
@@ -4162,7 +4203,7 @@
|
|
|
4162
4203
|
return AccessTokenEntity;
|
|
4163
4204
|
}(CredentialEntity));
|
|
4164
4205
|
|
|
4165
|
-
/*! @azure/msal-common
|
|
4206
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4166
4207
|
|
|
4167
4208
|
/*
|
|
4168
4209
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4229,7 +4270,7 @@
|
|
|
4229
4270
|
return RefreshTokenEntity;
|
|
4230
4271
|
}(CredentialEntity));
|
|
4231
4272
|
|
|
4232
|
-
/*! @azure/msal-common
|
|
4273
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4233
4274
|
|
|
4234
4275
|
/*
|
|
4235
4276
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4293,7 +4334,7 @@
|
|
|
4293
4334
|
return InteractionRequiredAuthError;
|
|
4294
4335
|
}(AuthError));
|
|
4295
4336
|
|
|
4296
|
-
/*! @azure/msal-common
|
|
4337
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4297
4338
|
/*
|
|
4298
4339
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4299
4340
|
* Licensed under the MIT License.
|
|
@@ -4309,7 +4350,7 @@
|
|
|
4309
4350
|
return CacheRecord;
|
|
4310
4351
|
}());
|
|
4311
4352
|
|
|
4312
|
-
/*! @azure/msal-common
|
|
4353
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4313
4354
|
|
|
4314
4355
|
/*
|
|
4315
4356
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4380,7 +4421,7 @@
|
|
|
4380
4421
|
return ProtocolUtils;
|
|
4381
4422
|
}());
|
|
4382
4423
|
|
|
4383
|
-
/*! @azure/msal-common
|
|
4424
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4384
4425
|
|
|
4385
4426
|
/*
|
|
4386
4427
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4581,7 +4622,7 @@
|
|
|
4581
4622
|
return UrlString;
|
|
4582
4623
|
}());
|
|
4583
4624
|
|
|
4584
|
-
/*! @azure/msal-common
|
|
4625
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4585
4626
|
|
|
4586
4627
|
/*
|
|
4587
4628
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4656,7 +4697,7 @@
|
|
|
4656
4697
|
return PopTokenGenerator;
|
|
4657
4698
|
}());
|
|
4658
4699
|
|
|
4659
|
-
/*! @azure/msal-common
|
|
4700
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4660
4701
|
|
|
4661
4702
|
/*
|
|
4662
4703
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4726,7 +4767,7 @@
|
|
|
4726
4767
|
return AppMetadataEntity;
|
|
4727
4768
|
}());
|
|
4728
4769
|
|
|
4729
|
-
/*! @azure/msal-common
|
|
4770
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4730
4771
|
/*
|
|
4731
4772
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4732
4773
|
* Licensed under the MIT License.
|
|
@@ -4762,7 +4803,7 @@
|
|
|
4762
4803
|
return TokenCacheContext;
|
|
4763
4804
|
}());
|
|
4764
4805
|
|
|
4765
|
-
/*! @azure/msal-common
|
|
4806
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
4766
4807
|
|
|
4767
4808
|
/*
|
|
4768
4809
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4845,7 +4886,7 @@
|
|
|
4845
4886
|
}
|
|
4846
4887
|
// Add keyId from request to serverTokenResponse if defined
|
|
4847
4888
|
serverTokenResponse.key_id = serverTokenResponse.key_id || request.sshKid || undefined;
|
|
4848
|
-
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp,
|
|
4889
|
+
cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenObj, oboAssertion, authCodePayload);
|
|
4849
4890
|
_a.label = 1;
|
|
4850
4891
|
case 1:
|
|
4851
4892
|
_a.trys.push([1, , 5, 8]);
|
|
@@ -4893,7 +4934,7 @@
|
|
|
4893
4934
|
* @param idTokenObj
|
|
4894
4935
|
* @param authority
|
|
4895
4936
|
*/
|
|
4896
|
-
ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp,
|
|
4937
|
+
ResponseHandler.prototype.generateCacheRecord = function (serverTokenResponse, authority, reqTimestamp, request, idTokenObj, oboAssertion, authCodePayload) {
|
|
4897
4938
|
var env = authority.getPreferredCache();
|
|
4898
4939
|
if (StringUtils.isEmpty(env)) {
|
|
4899
4940
|
throw ClientAuthError.createInvalidCacheEnvironmentError();
|
|
@@ -4909,7 +4950,7 @@
|
|
|
4909
4950
|
var cachedAccessToken = null;
|
|
4910
4951
|
if (!StringUtils.isEmpty(serverTokenResponse.access_token)) {
|
|
4911
4952
|
// If scopes not returned in server response, use request scopes
|
|
4912
|
-
var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(
|
|
4953
|
+
var responseScopes = serverTokenResponse.scope ? ScopeSet.fromString(serverTokenResponse.scope) : new ScopeSet(request.scopes || []);
|
|
4913
4954
|
/*
|
|
4914
4955
|
* Use timestamp calculated before request
|
|
4915
4956
|
* Server may return timestamps as strings, parse to numbers if so.
|
|
@@ -4921,7 +4962,7 @@
|
|
|
4921
4962
|
var extendedTokenExpirationSeconds = tokenExpirationSeconds + extExpiresIn;
|
|
4922
4963
|
var refreshOnSeconds = refreshIn && refreshIn > 0 ? reqTimestamp + refreshIn : undefined;
|
|
4923
4964
|
// 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);
|
|
4965
|
+
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
4966
|
}
|
|
4926
4967
|
// refreshToken
|
|
4927
4968
|
var cachedRefreshToken = null;
|
|
@@ -5027,7 +5068,7 @@
|
|
|
5027
5068
|
return ResponseHandler;
|
|
5028
5069
|
}());
|
|
5029
5070
|
|
|
5030
|
-
/*! @azure/msal-common
|
|
5071
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5031
5072
|
|
|
5032
5073
|
/*
|
|
5033
5074
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5142,11 +5183,11 @@
|
|
|
5142
5183
|
clientId: this.config.authOptions.clientId,
|
|
5143
5184
|
authority: authority.canonicalAuthority,
|
|
5144
5185
|
scopes: request.scopes,
|
|
5186
|
+
claims: request.claims,
|
|
5145
5187
|
authenticationScheme: request.authenticationScheme,
|
|
5146
5188
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
5147
5189
|
resourceRequestUri: request.resourceRequestUri,
|
|
5148
5190
|
shrClaims: request.shrClaims,
|
|
5149
|
-
sshJwk: request.sshJwk,
|
|
5150
5191
|
sshKid: request.sshKid
|
|
5151
5192
|
};
|
|
5152
5193
|
return [4 /*yield*/, this.createTokenRequestBody(request)];
|
|
@@ -5435,7 +5476,7 @@
|
|
|
5435
5476
|
return AuthorizationCodeClient;
|
|
5436
5477
|
}(BaseClient));
|
|
5437
5478
|
|
|
5438
|
-
/*! @azure/msal-common
|
|
5479
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5439
5480
|
|
|
5440
5481
|
/*
|
|
5441
5482
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5546,11 +5587,11 @@
|
|
|
5546
5587
|
clientId: this.config.authOptions.clientId,
|
|
5547
5588
|
authority: authority.canonicalAuthority,
|
|
5548
5589
|
scopes: request.scopes,
|
|
5590
|
+
claims: request.claims,
|
|
5549
5591
|
authenticationScheme: request.authenticationScheme,
|
|
5550
5592
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
5551
5593
|
resourceRequestUri: request.resourceRequestUri,
|
|
5552
5594
|
shrClaims: request.shrClaims,
|
|
5553
|
-
sshJwk: request.sshJwk,
|
|
5554
5595
|
sshKid: request.sshKid
|
|
5555
5596
|
};
|
|
5556
5597
|
endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParameters);
|
|
@@ -5646,7 +5687,7 @@
|
|
|
5646
5687
|
return RefreshTokenClient;
|
|
5647
5688
|
}(BaseClient));
|
|
5648
5689
|
|
|
5649
|
-
/*! @azure/msal-common
|
|
5690
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5650
5691
|
|
|
5651
5692
|
/*
|
|
5652
5693
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5692,7 +5733,7 @@
|
|
|
5692
5733
|
SilentFlowClient.prototype.acquireCachedToken = function (request) {
|
|
5693
5734
|
var _a, _b, _c, _d;
|
|
5694
5735
|
return __awaiter(this, void 0, void 0, function () {
|
|
5695
|
-
var
|
|
5736
|
+
var environment, cacheRecord;
|
|
5696
5737
|
return __generator(this, function (_e) {
|
|
5697
5738
|
switch (_e.label) {
|
|
5698
5739
|
case 0:
|
|
@@ -5706,19 +5747,12 @@
|
|
|
5706
5747
|
this.logger.info("SilentFlowClient:acquireCachedToken - Skipping cache because forceRefresh is true.");
|
|
5707
5748
|
throw ClientAuthError.createRefreshRequiredError();
|
|
5708
5749
|
}
|
|
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
5750
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
5715
5751
|
if (!request.account) {
|
|
5716
5752
|
throw ClientAuthError.createNoAccountInSilentRequestError();
|
|
5717
5753
|
}
|
|
5718
|
-
requestScopes = new ScopeSet(request.scopes || []);
|
|
5719
5754
|
environment = request.authority || this.authority.getPreferredCache();
|
|
5720
|
-
|
|
5721
|
-
cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, requestScopes, environment, authScheme, request.sshKid);
|
|
5755
|
+
cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, request, environment);
|
|
5722
5756
|
if (!cacheRecord.accessToken) {
|
|
5723
5757
|
// Must refresh due to non-existent access_token.
|
|
5724
5758
|
(_b = this.serverTelemetryManager) === null || _b === void 0 ? void 0 : _b.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN);
|
|
@@ -5769,7 +5803,7 @@
|
|
|
5769
5803
|
return SilentFlowClient;
|
|
5770
5804
|
}(BaseClient));
|
|
5771
5805
|
|
|
5772
|
-
/*! @azure/msal-common
|
|
5806
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5773
5807
|
/*
|
|
5774
5808
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5775
5809
|
* Licensed under the MIT License.
|
|
@@ -5780,7 +5814,7 @@
|
|
|
5780
5814
|
response.hasOwnProperty("issuer"));
|
|
5781
5815
|
}
|
|
5782
5816
|
|
|
5783
|
-
/*! @azure/msal-common
|
|
5817
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5784
5818
|
/*
|
|
5785
5819
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5786
5820
|
* Licensed under the MIT License.
|
|
@@ -5794,7 +5828,7 @@
|
|
|
5794
5828
|
ProtocolMode["OIDC"] = "OIDC";
|
|
5795
5829
|
})(exports.ProtocolMode || (exports.ProtocolMode = {}));
|
|
5796
5830
|
|
|
5797
|
-
/*! @azure/msal-common
|
|
5831
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5798
5832
|
|
|
5799
5833
|
/*
|
|
5800
5834
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5869,7 +5903,7 @@
|
|
|
5869
5903
|
return AuthorityMetadataEntity;
|
|
5870
5904
|
}());
|
|
5871
5905
|
|
|
5872
|
-
/*! @azure/msal-common
|
|
5906
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5873
5907
|
/*
|
|
5874
5908
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5875
5909
|
* Licensed under the MIT License.
|
|
@@ -5879,7 +5913,7 @@
|
|
|
5879
5913
|
response.hasOwnProperty("metadata"));
|
|
5880
5914
|
}
|
|
5881
5915
|
|
|
5882
|
-
/*! @azure/msal-common
|
|
5916
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5883
5917
|
|
|
5884
5918
|
/*
|
|
5885
5919
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5993,7 +6027,7 @@
|
|
|
5993
6027
|
return RegionDiscovery;
|
|
5994
6028
|
}());
|
|
5995
6029
|
|
|
5996
|
-
/*! @azure/msal-common
|
|
6030
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
5997
6031
|
|
|
5998
6032
|
/*
|
|
5999
6033
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6559,7 +6593,7 @@
|
|
|
6559
6593
|
return Authority;
|
|
6560
6594
|
}());
|
|
6561
6595
|
|
|
6562
|
-
/*! @azure/msal-common
|
|
6596
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
6563
6597
|
|
|
6564
6598
|
/*
|
|
6565
6599
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6620,7 +6654,7 @@
|
|
|
6620
6654
|
return AuthorityFactory;
|
|
6621
6655
|
}());
|
|
6622
6656
|
|
|
6623
|
-
/*! @azure/msal-common
|
|
6657
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
6624
6658
|
|
|
6625
6659
|
/*
|
|
6626
6660
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6651,7 +6685,7 @@
|
|
|
6651
6685
|
return ServerTelemetryEntity;
|
|
6652
6686
|
}());
|
|
6653
6687
|
|
|
6654
|
-
/*! @azure/msal-common
|
|
6688
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
6655
6689
|
|
|
6656
6690
|
/*
|
|
6657
6691
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6679,7 +6713,7 @@
|
|
|
6679
6713
|
return ThrottlingEntity;
|
|
6680
6714
|
}());
|
|
6681
6715
|
|
|
6682
|
-
/*! @azure/msal-common
|
|
6716
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
6683
6717
|
|
|
6684
6718
|
/*
|
|
6685
6719
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6696,7 +6730,7 @@
|
|
|
6696
6730
|
}
|
|
6697
6731
|
};
|
|
6698
6732
|
|
|
6699
|
-
/*! @azure/msal-common
|
|
6733
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
6700
6734
|
|
|
6701
6735
|
/*
|
|
6702
6736
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6755,7 +6789,7 @@
|
|
|
6755
6789
|
return AuthenticationHeaderParser;
|
|
6756
6790
|
}());
|
|
6757
6791
|
|
|
6758
|
-
/*! @azure/msal-common
|
|
6792
|
+
/*! @azure/msal-common v6.0.0 2022-01-04 */
|
|
6759
6793
|
|
|
6760
6794
|
/*
|
|
6761
6795
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8697,7 +8731,7 @@
|
|
|
8697
8731
|
*/
|
|
8698
8732
|
CryptoOps.prototype.getPublicKeyThumbprint = function (request) {
|
|
8699
8733
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
8700
|
-
var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString,
|
|
8734
|
+
var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
|
|
8701
8735
|
return __generator$1(this, function (_a) {
|
|
8702
8736
|
switch (_a.label) {
|
|
8703
8737
|
case 0: return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];
|
|
@@ -8712,10 +8746,9 @@
|
|
|
8712
8746
|
n: publicKeyJwk.n
|
|
8713
8747
|
};
|
|
8714
8748
|
publicJwkString = BrowserCrypto.getJwkString(pubKeyThumprintObj);
|
|
8715
|
-
return [4 /*yield*/, this.
|
|
8749
|
+
return [4 /*yield*/, this.hashString(publicJwkString)];
|
|
8716
8750
|
case 3:
|
|
8717
|
-
|
|
8718
|
-
publicJwkHash = this.b64Encode.urlEncodeArr(new Uint8Array(publicJwkBuffer));
|
|
8751
|
+
publicJwkHash = _a.sent();
|
|
8719
8752
|
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];
|
|
8720
8753
|
case 4:
|
|
8721
8754
|
privateKeyJwk = _a.sent();
|
|
@@ -8822,6 +8855,24 @@
|
|
|
8822
8855
|
});
|
|
8823
8856
|
});
|
|
8824
8857
|
};
|
|
8858
|
+
/**
|
|
8859
|
+
* Returns the SHA-256 hash of an input string
|
|
8860
|
+
* @param plainText
|
|
8861
|
+
*/
|
|
8862
|
+
CryptoOps.prototype.hashString = function (plainText) {
|
|
8863
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
8864
|
+
var hashBuffer, hashBytes;
|
|
8865
|
+
return __generator$1(this, function (_a) {
|
|
8866
|
+
switch (_a.label) {
|
|
8867
|
+
case 0: return [4 /*yield*/, this.browserCrypto.sha256Digest(plainText)];
|
|
8868
|
+
case 1:
|
|
8869
|
+
hashBuffer = _a.sent();
|
|
8870
|
+
hashBytes = new Uint8Array(hashBuffer);
|
|
8871
|
+
return [2 /*return*/, this.b64Encode.urlEncodeArr(hashBytes)];
|
|
8872
|
+
}
|
|
8873
|
+
});
|
|
8874
|
+
});
|
|
8875
|
+
};
|
|
8825
8876
|
CryptoOps.POP_KEY_USAGES = ["sign", "verify"];
|
|
8826
8877
|
CryptoOps.EXTRACTABLE = true;
|
|
8827
8878
|
return CryptoOps;
|
|
@@ -9743,6 +9794,7 @@
|
|
|
9743
9794
|
}
|
|
9744
9795
|
});
|
|
9745
9796
|
this.clearMsalCookies();
|
|
9797
|
+
this.setInteractionInProgress(false);
|
|
9746
9798
|
};
|
|
9747
9799
|
BrowserCacheManager.prototype.cacheCodeRequest = function (authCodeRequest, browserCrypto) {
|
|
9748
9800
|
this.logger.trace("BrowserCacheManager.cacheCodeRequest called");
|
|
@@ -9833,6 +9885,25 @@
|
|
|
9833
9885
|
}
|
|
9834
9886
|
return null;
|
|
9835
9887
|
};
|
|
9888
|
+
/**
|
|
9889
|
+
* Updates a credential's cache key if the current cache key is outdated
|
|
9890
|
+
*/
|
|
9891
|
+
BrowserCacheManager.prototype.updateCredentialCacheKey = function (currentCacheKey, credential) {
|
|
9892
|
+
var updatedCacheKey = credential.generateCredentialKey();
|
|
9893
|
+
if (currentCacheKey !== updatedCacheKey) {
|
|
9894
|
+
var cacheItem = this.getItem(currentCacheKey);
|
|
9895
|
+
if (cacheItem) {
|
|
9896
|
+
this.removeItem(currentCacheKey);
|
|
9897
|
+
this.setItem(updatedCacheKey, cacheItem);
|
|
9898
|
+
this.logger.verbose("Updated an outdated " + credential.credentialType + " cache key");
|
|
9899
|
+
return updatedCacheKey;
|
|
9900
|
+
}
|
|
9901
|
+
else {
|
|
9902
|
+
this.logger.error("Attempted to update an outdated " + credential.credentialType + " cache key but no item matching the outdated key was found in storage");
|
|
9903
|
+
}
|
|
9904
|
+
}
|
|
9905
|
+
return currentCacheKey;
|
|
9906
|
+
};
|
|
9836
9907
|
return BrowserCacheManager;
|
|
9837
9908
|
}(CacheManager));
|
|
9838
9909
|
var DEFAULT_BROWSER_CACHE_MANAGER = function (clientId, logger) {
|
|
@@ -10333,7 +10404,7 @@
|
|
|
10333
10404
|
|
|
10334
10405
|
/* eslint-disable header/header */
|
|
10335
10406
|
var name = "@azure/msal-browser";
|
|
10336
|
-
var version = "2.
|
|
10407
|
+
var version = "2.21.0";
|
|
10337
10408
|
|
|
10338
10409
|
/*
|
|
10339
10410
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10550,28 +10621,43 @@
|
|
|
10550
10621
|
* @param request
|
|
10551
10622
|
*/
|
|
10552
10623
|
BaseInteractionClient.prototype.initializeBaseRequest = function (request) {
|
|
10553
|
-
this
|
|
10554
|
-
|
|
10555
|
-
|
|
10556
|
-
|
|
10557
|
-
|
|
10558
|
-
|
|
10559
|
-
|
|
10560
|
-
|
|
10561
|
-
|
|
10562
|
-
|
|
10563
|
-
|
|
10564
|
-
|
|
10565
|
-
|
|
10566
|
-
|
|
10567
|
-
|
|
10624
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
10625
|
+
var authority, scopes, _a, validatedRequest;
|
|
10626
|
+
return __generator$1(this, function (_b) {
|
|
10627
|
+
switch (_b.label) {
|
|
10628
|
+
case 0:
|
|
10629
|
+
this.logger.verbose("Initializing BaseAuthRequest");
|
|
10630
|
+
authority = request.authority || this.config.auth.authority;
|
|
10631
|
+
scopes = __spread(((request && request.scopes) || []));
|
|
10632
|
+
// Set authenticationScheme to BEARER if not explicitly set in the request
|
|
10633
|
+
if (!request.authenticationScheme) {
|
|
10634
|
+
request.authenticationScheme = exports.AuthenticationScheme.BEARER;
|
|
10635
|
+
this.logger.verbose("Authentication Scheme wasn't explicitly set in request, defaulting to \"Bearer\" request");
|
|
10636
|
+
}
|
|
10637
|
+
else {
|
|
10638
|
+
if (request.authenticationScheme === exports.AuthenticationScheme.SSH) {
|
|
10639
|
+
if (!request.sshJwk) {
|
|
10640
|
+
throw ClientConfigurationError.createMissingSshJwkError();
|
|
10641
|
+
}
|
|
10642
|
+
if (!request.sshKid) {
|
|
10643
|
+
throw ClientConfigurationError.createMissingSshKidError();
|
|
10644
|
+
}
|
|
10645
|
+
}
|
|
10646
|
+
this.logger.verbose("Authentication Scheme set to \"" + request.authenticationScheme + "\" as configured in Auth request");
|
|
10647
|
+
}
|
|
10648
|
+
if (!(request.claims && !StringUtils.isEmpty(request.claims))) return [3 /*break*/, 2];
|
|
10649
|
+
_a = request;
|
|
10650
|
+
return [4 /*yield*/, this.browserCrypto.hashString(request.claims)];
|
|
10651
|
+
case 1:
|
|
10652
|
+
_a.requestedClaimsHash = _b.sent();
|
|
10653
|
+
_b.label = 2;
|
|
10654
|
+
case 2:
|
|
10655
|
+
validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
|
|
10656
|
+
scopes: scopes });
|
|
10657
|
+
return [2 /*return*/, validatedRequest];
|
|
10568
10658
|
}
|
|
10569
|
-
}
|
|
10570
|
-
|
|
10571
|
-
}
|
|
10572
|
-
var validatedRequest = __assign$1(__assign$1({}, request), { correlationId: this.correlationId, authority: authority,
|
|
10573
|
-
scopes: scopes });
|
|
10574
|
-
return validatedRequest;
|
|
10659
|
+
});
|
|
10660
|
+
});
|
|
10575
10661
|
};
|
|
10576
10662
|
/**
|
|
10577
10663
|
*
|
|
@@ -10801,14 +10887,22 @@
|
|
|
10801
10887
|
* @param interactionType
|
|
10802
10888
|
*/
|
|
10803
10889
|
StandardInteractionClient.prototype.preflightInteractiveRequest = function (request, interactionType) {
|
|
10804
|
-
this
|
|
10805
|
-
|
|
10806
|
-
|
|
10807
|
-
|
|
10808
|
-
|
|
10809
|
-
|
|
10810
|
-
|
|
10811
|
-
|
|
10890
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
10891
|
+
return __generator$1(this, function (_a) {
|
|
10892
|
+
switch (_a.label) {
|
|
10893
|
+
case 0:
|
|
10894
|
+
this.logger.verbose("preflightInteractiveRequest called, validating app environment", request === null || request === void 0 ? void 0 : request.correlationId);
|
|
10895
|
+
// block the reload if it occurred inside a hidden iframe
|
|
10896
|
+
BrowserUtils.blockReloadInHiddenIframes();
|
|
10897
|
+
// Check if interaction is in progress. Throw error if true.
|
|
10898
|
+
if (this.browserStorage.isInteractionInProgress(false)) {
|
|
10899
|
+
throw BrowserAuthError.createInteractionInProgressError();
|
|
10900
|
+
}
|
|
10901
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(request, interactionType)];
|
|
10902
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
10903
|
+
}
|
|
10904
|
+
});
|
|
10905
|
+
});
|
|
10812
10906
|
};
|
|
10813
10907
|
/**
|
|
10814
10908
|
* Helper to initialize required request parameters for interactive APIs and ssoSilent()
|
|
@@ -10816,28 +10910,39 @@
|
|
|
10816
10910
|
* @param interactionType
|
|
10817
10911
|
*/
|
|
10818
10912
|
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
|
-
|
|
10913
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
10914
|
+
var redirectUri, browserState, state, validatedRequest, _a, account, legacyLoginHint;
|
|
10915
|
+
return __generator$1(this, function (_b) {
|
|
10916
|
+
switch (_b.label) {
|
|
10917
|
+
case 0:
|
|
10918
|
+
this.logger.verbose("initializeAuthorizationRequest called");
|
|
10919
|
+
redirectUri = this.getRedirectUri(request.redirectUri);
|
|
10920
|
+
browserState = {
|
|
10921
|
+
interactionType: interactionType
|
|
10922
|
+
};
|
|
10923
|
+
state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || "", browserState);
|
|
10924
|
+
_a = [{}];
|
|
10925
|
+
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
10926
|
+
case 1:
|
|
10927
|
+
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 }]);
|
|
10928
|
+
account = request.account || this.browserStorage.getActiveAccount();
|
|
10929
|
+
if (account) {
|
|
10930
|
+
this.logger.verbose("Setting validated request account");
|
|
10931
|
+
this.logger.verbosePii("Setting validated request account: " + account);
|
|
10932
|
+
validatedRequest.account = account;
|
|
10933
|
+
}
|
|
10934
|
+
// Check for ADAL/MSAL v1 SSO
|
|
10935
|
+
if (StringUtils.isEmpty(validatedRequest.loginHint) && !account) {
|
|
10936
|
+
legacyLoginHint = this.browserStorage.getLegacyLoginHint();
|
|
10937
|
+
if (legacyLoginHint) {
|
|
10938
|
+
validatedRequest.loginHint = legacyLoginHint;
|
|
10939
|
+
}
|
|
10940
|
+
}
|
|
10941
|
+
this.browserStorage.updateCacheEntries(validatedRequest.state, validatedRequest.nonce, validatedRequest.authority, validatedRequest.loginHint || "", validatedRequest.account || null);
|
|
10942
|
+
return [2 /*return*/, validatedRequest];
|
|
10943
|
+
}
|
|
10944
|
+
});
|
|
10945
|
+
});
|
|
10841
10946
|
};
|
|
10842
10947
|
return StandardInteractionClient;
|
|
10843
10948
|
}(BaseInteractionClient));
|
|
@@ -11227,26 +11332,36 @@
|
|
|
11227
11332
|
* @param request
|
|
11228
11333
|
*/
|
|
11229
11334
|
PopupClient.prototype.acquireToken = function (request) {
|
|
11230
|
-
|
|
11231
|
-
var validRequest
|
|
11232
|
-
|
|
11233
|
-
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
|
|
11243
|
-
|
|
11244
|
-
|
|
11245
|
-
|
|
11246
|
-
|
|
11247
|
-
|
|
11248
|
-
|
|
11249
|
-
|
|
11335
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
11336
|
+
var validRequest, popupName, popupWindowAttributes, popup, e_1;
|
|
11337
|
+
return __generator$1(this, function (_a) {
|
|
11338
|
+
switch (_a.label) {
|
|
11339
|
+
case 0:
|
|
11340
|
+
_a.trys.push([0, 2, , 3]);
|
|
11341
|
+
return [4 /*yield*/, this.preflightInteractiveRequest(request, exports.InteractionType.Popup)];
|
|
11342
|
+
case 1:
|
|
11343
|
+
validRequest = _a.sent();
|
|
11344
|
+
popupName = PopupUtils.generatePopupName(this.config.auth.clientId, validRequest);
|
|
11345
|
+
popupWindowAttributes = request.popupWindowAttributes || {};
|
|
11346
|
+
// asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
|
11347
|
+
if (this.config.system.asyncPopups) {
|
|
11348
|
+
this.logger.verbose("asyncPopups set to true, acquiring token");
|
|
11349
|
+
// Passes on popup position and dimensions if in request
|
|
11350
|
+
return [2 /*return*/, this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes)];
|
|
11351
|
+
}
|
|
11352
|
+
else {
|
|
11353
|
+
// asyncPopups flag is set to false. Opens popup before acquiring token.
|
|
11354
|
+
this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
|
|
11355
|
+
popup = PopupUtils.openSizedPopup("about:blank", popupName, popupWindowAttributes, this.logger);
|
|
11356
|
+
return [2 /*return*/, this.acquireTokenPopupAsync(validRequest, popupName, popupWindowAttributes, popup)];
|
|
11357
|
+
}
|
|
11358
|
+
case 2:
|
|
11359
|
+
e_1 = _a.sent();
|
|
11360
|
+
return [2 /*return*/, Promise.reject(e_1)];
|
|
11361
|
+
case 3: return [2 /*return*/];
|
|
11362
|
+
}
|
|
11363
|
+
});
|
|
11364
|
+
});
|
|
11250
11365
|
};
|
|
11251
11366
|
/**
|
|
11252
11367
|
* Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
|
|
@@ -11289,7 +11404,7 @@
|
|
|
11289
11404
|
*/
|
|
11290
11405
|
PopupClient.prototype.acquireTokenPopupAsync = function (validRequest, popupName, popupWindowAttributes, popup) {
|
|
11291
11406
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11292
|
-
var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result,
|
|
11407
|
+
var serverTelemetryManager, authCodeRequest, authClient, navigateUrl, interactionHandler, popupParameters, popupWindow, hash, state, result, e_2;
|
|
11293
11408
|
return __generator$1(this, function (_a) {
|
|
11294
11409
|
switch (_a.label) {
|
|
11295
11410
|
case 0:
|
|
@@ -11327,17 +11442,17 @@
|
|
|
11327
11442
|
result = _a.sent();
|
|
11328
11443
|
return [2 /*return*/, result];
|
|
11329
11444
|
case 7:
|
|
11330
|
-
|
|
11445
|
+
e_2 = _a.sent();
|
|
11331
11446
|
if (popup) {
|
|
11332
11447
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
11333
11448
|
popup.close();
|
|
11334
11449
|
}
|
|
11335
|
-
if (
|
|
11336
|
-
|
|
11450
|
+
if (e_2 instanceof AuthError) {
|
|
11451
|
+
e_2.setCorrelationId(this.correlationId);
|
|
11337
11452
|
}
|
|
11338
|
-
serverTelemetryManager.cacheFailedRequest(
|
|
11453
|
+
serverTelemetryManager.cacheFailedRequest(e_2);
|
|
11339
11454
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
11340
|
-
throw
|
|
11455
|
+
throw e_2;
|
|
11341
11456
|
case 8: return [2 /*return*/];
|
|
11342
11457
|
}
|
|
11343
11458
|
});
|
|
@@ -11354,7 +11469,7 @@
|
|
|
11354
11469
|
*/
|
|
11355
11470
|
PopupClient.prototype.logoutPopupAsync = function (validRequest, popupName, popupWindowAttributes, requestAuthority, popup, mainWindowRedirectUri) {
|
|
11356
11471
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
11357
|
-
var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow,
|
|
11472
|
+
var serverTelemetryManager, authClient, logoutUri, popupUtils, popupWindow, e_3, navigationOptions, absoluteUrl, e_4;
|
|
11358
11473
|
return __generator$1(this, function (_a) {
|
|
11359
11474
|
switch (_a.label) {
|
|
11360
11475
|
case 0:
|
|
@@ -11390,8 +11505,8 @@
|
|
|
11390
11505
|
this.logger.verbose("Popup successfully redirected to postLogoutRedirectUri");
|
|
11391
11506
|
return [3 /*break*/, 7];
|
|
11392
11507
|
case 6:
|
|
11393
|
-
|
|
11394
|
-
this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " +
|
|
11508
|
+
e_3 = _a.sent();
|
|
11509
|
+
this.logger.verbose("Error occurred while monitoring popup for same origin. Session on server may remain active. Error: " + e_3);
|
|
11395
11510
|
return [3 /*break*/, 7];
|
|
11396
11511
|
case 7:
|
|
11397
11512
|
popupUtils.cleanPopup(popupWindow);
|
|
@@ -11411,19 +11526,19 @@
|
|
|
11411
11526
|
}
|
|
11412
11527
|
return [3 /*break*/, 9];
|
|
11413
11528
|
case 8:
|
|
11414
|
-
|
|
11529
|
+
e_4 = _a.sent();
|
|
11415
11530
|
if (popup) {
|
|
11416
11531
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
11417
11532
|
popup.close();
|
|
11418
11533
|
}
|
|
11419
|
-
if (
|
|
11420
|
-
|
|
11534
|
+
if (e_4 instanceof AuthError) {
|
|
11535
|
+
e_4.setCorrelationId(this.correlationId);
|
|
11421
11536
|
}
|
|
11422
11537
|
this.browserStorage.setInteractionInProgress(false);
|
|
11423
|
-
this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null,
|
|
11538
|
+
this.eventHandler.emitEvent(exports.EventType.LOGOUT_FAILURE, exports.InteractionType.Popup, null, e_4);
|
|
11424
11539
|
this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
11425
|
-
serverTelemetryManager.cacheFailedRequest(
|
|
11426
|
-
throw
|
|
11540
|
+
serverTelemetryManager.cacheFailedRequest(e_4);
|
|
11541
|
+
throw e_4;
|
|
11427
11542
|
case 9:
|
|
11428
11543
|
this.eventHandler.emitEvent(exports.EventType.LOGOUT_END, exports.InteractionType.Popup);
|
|
11429
11544
|
return [2 /*return*/];
|
|
@@ -11581,22 +11696,23 @@
|
|
|
11581
11696
|
var validRequest, serverTelemetryManager, authCodeRequest, authClient, interactionHandler, navigateUrl, redirectStartPage, e_1;
|
|
11582
11697
|
return __generator$1(this, function (_a) {
|
|
11583
11698
|
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;
|
|
11699
|
+
case 0: return [4 /*yield*/, this.preflightInteractiveRequest(request, exports.InteractionType.Redirect)];
|
|
11588
11700
|
case 1:
|
|
11589
|
-
_a.
|
|
11590
|
-
|
|
11701
|
+
validRequest = _a.sent();
|
|
11702
|
+
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenRedirect);
|
|
11703
|
+
_a.label = 2;
|
|
11591
11704
|
case 2:
|
|
11705
|
+
_a.trys.push([2, 7, , 8]);
|
|
11706
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(validRequest)];
|
|
11707
|
+
case 3:
|
|
11592
11708
|
authCodeRequest = _a.sent();
|
|
11593
11709
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, validRequest.authority)];
|
|
11594
|
-
case
|
|
11710
|
+
case 4:
|
|
11595
11711
|
authClient = _a.sent();
|
|
11596
11712
|
this.logger.verbose("Auth code client created");
|
|
11597
11713
|
interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.browserCrypto);
|
|
11598
11714
|
return [4 /*yield*/, authClient.getAuthCodeUrl(validRequest)];
|
|
11599
|
-
case
|
|
11715
|
+
case 5:
|
|
11600
11716
|
navigateUrl = _a.sent();
|
|
11601
11717
|
redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
|
|
11602
11718
|
this.logger.verbosePii("Redirect start page: " + redirectStartPage);
|
|
@@ -11606,10 +11722,10 @@
|
|
|
11606
11722
|
redirectStartPage: redirectStartPage,
|
|
11607
11723
|
onRedirectNavigate: request.onRedirectNavigate
|
|
11608
11724
|
})];
|
|
11609
|
-
case
|
|
11725
|
+
case 6:
|
|
11610
11726
|
// 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
11727
|
return [2 /*return*/, _a.sent()];
|
|
11612
|
-
case
|
|
11728
|
+
case 7:
|
|
11613
11729
|
e_1 = _a.sent();
|
|
11614
11730
|
if (e_1 instanceof AuthError) {
|
|
11615
11731
|
e_1.setCorrelationId(this.correlationId);
|
|
@@ -11617,7 +11733,7 @@
|
|
|
11617
11733
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
11618
11734
|
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
11619
11735
|
throw e_1;
|
|
11620
|
-
case
|
|
11736
|
+
case 8: return [2 /*return*/];
|
|
11621
11737
|
}
|
|
11622
11738
|
});
|
|
11623
11739
|
});
|
|
@@ -12033,24 +12149,26 @@
|
|
|
12033
12149
|
if (request.prompt && request.prompt !== PromptValue.NONE) {
|
|
12034
12150
|
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
12035
12151
|
}
|
|
12036
|
-
|
|
12037
|
-
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12038
|
-
_a.label = 1;
|
|
12152
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(__assign$1(__assign$1({}, request), { prompt: PromptValue.NONE }), exports.InteractionType.Silent)];
|
|
12039
12153
|
case 1:
|
|
12040
|
-
_a.
|
|
12041
|
-
|
|
12154
|
+
silentRequest = _a.sent();
|
|
12155
|
+
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12156
|
+
_a.label = 2;
|
|
12042
12157
|
case 2:
|
|
12158
|
+
_a.trys.push([2, 7, , 8]);
|
|
12159
|
+
return [4 /*yield*/, this.initializeAuthorizationCodeRequest(silentRequest)];
|
|
12160
|
+
case 3:
|
|
12043
12161
|
authCodeRequest = _a.sent();
|
|
12044
12162
|
return [4 /*yield*/, this.createAuthCodeClient(serverTelemetryManager, silentRequest.authority)];
|
|
12045
|
-
case
|
|
12163
|
+
case 4:
|
|
12046
12164
|
authClient = _a.sent();
|
|
12047
12165
|
this.logger.verbose("Auth code client created");
|
|
12048
12166
|
return [4 /*yield*/, authClient.getAuthCodeUrl(silentRequest)];
|
|
12049
|
-
case
|
|
12167
|
+
case 5:
|
|
12050
12168
|
navigateUrl = _a.sent();
|
|
12051
12169
|
return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient, this.logger)];
|
|
12052
|
-
case
|
|
12053
|
-
case
|
|
12170
|
+
case 6: return [2 /*return*/, _a.sent()];
|
|
12171
|
+
case 7:
|
|
12054
12172
|
e_1 = _a.sent();
|
|
12055
12173
|
if (e_1 instanceof AuthError) {
|
|
12056
12174
|
e_1.setCorrelationId(this.correlationId);
|
|
@@ -12058,7 +12176,7 @@
|
|
|
12058
12176
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
12059
12177
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
12060
12178
|
throw e_1;
|
|
12061
|
-
case
|
|
12179
|
+
case 8: return [2 /*return*/];
|
|
12062
12180
|
}
|
|
12063
12181
|
});
|
|
12064
12182
|
});
|
|
@@ -12114,16 +12232,19 @@
|
|
|
12114
12232
|
*/
|
|
12115
12233
|
SilentRefreshClient.prototype.acquireToken = function (request) {
|
|
12116
12234
|
return __awaiter$1(this, void 0, void 0, function () {
|
|
12117
|
-
var silentRequest, serverTelemetryManager, refreshTokenClient;
|
|
12235
|
+
var silentRequest, _a, serverTelemetryManager, refreshTokenClient;
|
|
12118
12236
|
var _this = this;
|
|
12119
|
-
return __generator$1(this, function (
|
|
12120
|
-
switch (
|
|
12237
|
+
return __generator$1(this, function (_b) {
|
|
12238
|
+
switch (_b.label) {
|
|
12121
12239
|
case 0:
|
|
12122
|
-
|
|
12240
|
+
_a = [__assign$1({}, request)];
|
|
12241
|
+
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
12242
|
+
case 1:
|
|
12243
|
+
silentRequest = __assign$1.apply(void 0, _a.concat([_b.sent()]));
|
|
12123
12244
|
serverTelemetryManager = this.initializeServerTelemetryManager(exports.ApiId.acquireTokenSilent_silentFlow);
|
|
12124
12245
|
return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority)];
|
|
12125
|
-
case
|
|
12126
|
-
refreshTokenClient =
|
|
12246
|
+
case 2:
|
|
12247
|
+
refreshTokenClient = _b.sent();
|
|
12127
12248
|
this.logger.verbose("Refresh token client created");
|
|
12128
12249
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
12129
12250
|
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest).catch(function (e) {
|
|
@@ -12322,14 +12443,16 @@
|
|
|
12322
12443
|
if (!request.code) {
|
|
12323
12444
|
throw BrowserAuthError.createAuthCodeRequiredError();
|
|
12324
12445
|
}
|
|
12325
|
-
|
|
12326
|
-
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12327
|
-
_a.label = 1;
|
|
12446
|
+
return [4 /*yield*/, this.initializeAuthorizationRequest(request, exports.InteractionType.Silent)];
|
|
12328
12447
|
case 1:
|
|
12329
|
-
_a.
|
|
12448
|
+
silentRequest = _a.sent();
|
|
12449
|
+
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
12450
|
+
_a.label = 2;
|
|
12451
|
+
case 2:
|
|
12452
|
+
_a.trys.push([2, 4, , 5]);
|
|
12330
12453
|
authCodeRequest = __assign$1(__assign$1({}, silentRequest), { code: request.code });
|
|
12331
12454
|
return [4 /*yield*/, this.getClientConfiguration(serverTelemetryManager, silentRequest.authority)];
|
|
12332
|
-
case
|
|
12455
|
+
case 3:
|
|
12333
12456
|
clientConfig = _a.sent();
|
|
12334
12457
|
authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
|
|
12335
12458
|
this.logger.verbose("Auth code client created");
|
|
@@ -12341,7 +12464,7 @@
|
|
|
12341
12464
|
cloud_graph_host_name: request.cloudGraphHostName,
|
|
12342
12465
|
cloud_instance_host_name: request.cloudInstanceHostName
|
|
12343
12466
|
}, silentRequest.state, authClient.authority, this.networkClient, false)];
|
|
12344
|
-
case
|
|
12467
|
+
case 4:
|
|
12345
12468
|
e_1 = _a.sent();
|
|
12346
12469
|
if (e_1 instanceof AuthError) {
|
|
12347
12470
|
e_1.setCorrelationId(this.correlationId);
|
|
@@ -12349,7 +12472,7 @@
|
|
|
12349
12472
|
serverTelemetryManager.cacheFailedRequest(e_1);
|
|
12350
12473
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
12351
12474
|
throw e_1;
|
|
12352
|
-
case
|
|
12475
|
+
case 5: return [2 /*return*/];
|
|
12353
12476
|
}
|
|
12354
12477
|
});
|
|
12355
12478
|
});
|
|
@@ -13008,7 +13131,17 @@
|
|
|
13008
13131
|
});
|
|
13009
13132
|
};
|
|
13010
13133
|
SilentCacheClient.prototype.initializeSilentRequest = function (request, account) {
|
|
13011
|
-
return
|
|
13134
|
+
return __awaiter$1(this, void 0, void 0, function () {
|
|
13135
|
+
var _a;
|
|
13136
|
+
return __generator$1(this, function (_b) {
|
|
13137
|
+
switch (_b.label) {
|
|
13138
|
+
case 0:
|
|
13139
|
+
_a = [__assign$1({}, request)];
|
|
13140
|
+
return [4 /*yield*/, this.initializeBaseRequest(request)];
|
|
13141
|
+
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 }])];
|
|
13142
|
+
}
|
|
13143
|
+
});
|
|
13144
|
+
});
|
|
13012
13145
|
};
|
|
13013
13146
|
return SilentCacheClient;
|
|
13014
13147
|
}(StandardInteractionClient));
|
|
@@ -13099,11 +13232,11 @@
|
|
|
13099
13232
|
authority: request.authority || "",
|
|
13100
13233
|
scopes: request.scopes,
|
|
13101
13234
|
homeAccountIdentifier: account.homeAccountId,
|
|
13235
|
+
claims: request.claims,
|
|
13102
13236
|
authenticationScheme: request.authenticationScheme,
|
|
13103
13237
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
13104
13238
|
resourceRequestUri: request.resourceRequestUri,
|
|
13105
13239
|
shrClaims: request.shrClaims,
|
|
13106
|
-
sshJwk: request.sshJwk,
|
|
13107
13240
|
sshKid: request.sshKid
|
|
13108
13241
|
};
|
|
13109
13242
|
silentRequestKey = JSON.stringify(thumbprint);
|
|
@@ -13140,28 +13273,33 @@
|
|
|
13140
13273
|
var silentCacheClient, silentRequest;
|
|
13141
13274
|
var _this = this;
|
|
13142
13275
|
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
|
-
|
|
13276
|
+
switch (_a.label) {
|
|
13277
|
+
case 0:
|
|
13278
|
+
silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
|
|
13279
|
+
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
|
|
13280
|
+
case 1:
|
|
13281
|
+
silentRequest = _a.sent();
|
|
13282
|
+
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_START, exports.InteractionType.Silent, request);
|
|
13283
|
+
return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter$1(_this, void 0, void 0, function () {
|
|
13284
|
+
var tokenRenewalResult, tokenRenewalError_1;
|
|
13285
|
+
return __generator$1(this, function (_a) {
|
|
13286
|
+
switch (_a.label) {
|
|
13287
|
+
case 0:
|
|
13288
|
+
_a.trys.push([0, 2, , 3]);
|
|
13289
|
+
return [4 /*yield*/, this.acquireTokenByRefreshToken(silentRequest)];
|
|
13290
|
+
case 1:
|
|
13291
|
+
tokenRenewalResult = _a.sent();
|
|
13292
|
+
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_SUCCESS, exports.InteractionType.Silent, tokenRenewalResult);
|
|
13293
|
+
return [2 /*return*/, tokenRenewalResult];
|
|
13294
|
+
case 2:
|
|
13295
|
+
tokenRenewalError_1 = _a.sent();
|
|
13296
|
+
this.eventHandler.emitEvent(exports.EventType.ACQUIRE_TOKEN_FAILURE, exports.InteractionType.Silent, null, tokenRenewalError_1);
|
|
13297
|
+
throw tokenRenewalError_1;
|
|
13298
|
+
case 3: return [2 /*return*/];
|
|
13299
|
+
}
|
|
13300
|
+
});
|
|
13301
|
+
}); })];
|
|
13302
|
+
}
|
|
13165
13303
|
});
|
|
13166
13304
|
});
|
|
13167
13305
|
};
|