@azure/msal-browser 3.4.0 → 3.5.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/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientNext.mjs +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +8 -8
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +23 -22
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.mjs +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.d.ts +2 -2
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +4 -3
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/interaction_client/BaseInteractionClient.d.ts +0 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +2 -3
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +1 -1
- package/dist/interaction_client/PopupClient.d.ts +0 -10
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +22 -92
- package/dist/interaction_client/PopupClient.mjs.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.mjs +51 -34
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +8 -17
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts +1 -6
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +2 -24
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts +2 -2
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +5 -9
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +2 -2
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +4 -8
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +2 -2
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +13 -7
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/response/ResponseHandler.d.ts +8 -0
- package/dist/response/ResponseHandler.d.ts.map +1 -0
- package/dist/response/ResponseHandler.mjs +46 -0
- package/dist/response/ResponseHandler.mjs.map +1 -0
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts +7 -14
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +17 -30
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/lib/msal-browser.cjs +360 -490
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +360 -490
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -65
- package/package.json +2 -2
- package/src/cache/BrowserCacheManager.ts +7 -10
- package/src/controllers/StandardController.ts +28 -39
- package/src/crypto/CryptoOps.ts +5 -3
- package/src/index.ts +1 -0
- package/src/interaction_client/BaseInteractionClient.ts +1 -2
- package/src/interaction_client/PopupClient.ts +34 -137
- package/src/interaction_client/RedirectClient.ts +71 -55
- package/src/interaction_client/SilentIframeClient.ts +16 -27
- package/src/interaction_client/StandardInteractionClient.ts +2 -48
- package/src/interaction_handler/InteractionHandler.ts +5 -8
- package/src/interaction_handler/RedirectHandler.ts +4 -8
- package/src/interaction_handler/SilentHandler.ts +12 -5
- package/src/packageMetadata.ts +1 -1
- package/src/response/ResponseHandler.ts +73 -0
- package/src/utils/BrowserProtocolUtils.ts +17 -36
package/lib/msal-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.5.0 2023-11-07 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v14.
|
|
9
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -58,7 +58,6 @@
|
|
|
58
58
|
IMDS_TIMEOUT: 2000,
|
|
59
59
|
AZURE_REGION_AUTO_DISCOVER_FLAG: "TryAutoDetect",
|
|
60
60
|
REGIONAL_AUTH_PUBLIC_CLOUD_SUFFIX: "login.microsoft.com",
|
|
61
|
-
REGIONAL_AUTH_NON_MSI_QUERY_STRING: "allowestsrnonmsi=true",
|
|
62
61
|
KNOWN_PUBLIC_CLOUDS: [
|
|
63
62
|
"login.microsoftonline.com",
|
|
64
63
|
"login.windows.net",
|
|
@@ -363,13 +362,13 @@
|
|
|
363
362
|
// When the token request goes to the identity provider because refresh_in was used and the existing token needs to be refreshed
|
|
364
363
|
PROACTIVELY_REFRESHED: "4",
|
|
365
364
|
};
|
|
366
|
-
const
|
|
365
|
+
const JsonWebTokenTypes = {
|
|
367
366
|
Jwt: "JWT",
|
|
368
367
|
Jwk: "JWK",
|
|
369
368
|
Pop: "pop",
|
|
370
369
|
};
|
|
371
370
|
|
|
372
|
-
/*! @azure/msal-common v14.
|
|
371
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
373
372
|
/*
|
|
374
373
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
375
374
|
* Licensed under the MIT License.
|
|
@@ -386,7 +385,7 @@
|
|
|
386
385
|
unexpectedError: unexpectedError
|
|
387
386
|
});
|
|
388
387
|
|
|
389
|
-
/*! @azure/msal-common v14.
|
|
388
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
390
389
|
|
|
391
390
|
/*
|
|
392
391
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -435,7 +434,7 @@
|
|
|
435
434
|
: AuthErrorMessages[code]);
|
|
436
435
|
}
|
|
437
436
|
|
|
438
|
-
/*! @azure/msal-common v14.
|
|
437
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
439
438
|
/*
|
|
440
439
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
441
440
|
* Licensed under the MIT License.
|
|
@@ -533,7 +532,7 @@
|
|
|
533
532
|
userTimeoutReached: userTimeoutReached
|
|
534
533
|
});
|
|
535
534
|
|
|
536
|
-
/*! @azure/msal-common v14.
|
|
535
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
537
536
|
|
|
538
537
|
/*
|
|
539
538
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -785,7 +784,7 @@
|
|
|
785
784
|
return new ClientAuthError(errorCode, additionalMessage);
|
|
786
785
|
}
|
|
787
786
|
|
|
788
|
-
/*! @azure/msal-common v14.
|
|
787
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
789
788
|
|
|
790
789
|
/*
|
|
791
790
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -818,7 +817,7 @@
|
|
|
818
817
|
},
|
|
819
818
|
};
|
|
820
819
|
|
|
821
|
-
/*! @azure/msal-common v14.
|
|
820
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
822
821
|
|
|
823
822
|
/*
|
|
824
823
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1009,12 +1008,12 @@
|
|
|
1009
1008
|
}
|
|
1010
1009
|
}
|
|
1011
1010
|
|
|
1012
|
-
/*! @azure/msal-common v14.
|
|
1011
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1013
1012
|
/* eslint-disable header/header */
|
|
1014
1013
|
const name$1 = "@azure/msal-common";
|
|
1015
|
-
const version$1 = "14.
|
|
1014
|
+
const version$1 = "14.4.0";
|
|
1016
1015
|
|
|
1017
|
-
/*! @azure/msal-common v14.
|
|
1016
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1018
1017
|
/*
|
|
1019
1018
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1020
1019
|
* Licensed under the MIT License.
|
|
@@ -1034,7 +1033,7 @@
|
|
|
1034
1033
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1035
1034
|
};
|
|
1036
1035
|
|
|
1037
|
-
/*! @azure/msal-common v14.
|
|
1036
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1038
1037
|
|
|
1039
1038
|
/*
|
|
1040
1039
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1095,7 +1094,7 @@
|
|
|
1095
1094
|
}
|
|
1096
1095
|
}
|
|
1097
1096
|
|
|
1098
|
-
/*! @azure/msal-common v14.
|
|
1097
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1099
1098
|
/*
|
|
1100
1099
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1101
1100
|
* Licensed under the MIT License.
|
|
@@ -1142,7 +1141,7 @@
|
|
|
1142
1141
|
}
|
|
1143
1142
|
}
|
|
1144
1143
|
|
|
1145
|
-
/*! @azure/msal-common v14.
|
|
1144
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1146
1145
|
|
|
1147
1146
|
/*
|
|
1148
1147
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1359,8 +1358,24 @@
|
|
|
1359
1358
|
? credentialEntity.tokenType.toLowerCase()
|
|
1360
1359
|
: "";
|
|
1361
1360
|
}
|
|
1361
|
+
/**
|
|
1362
|
+
* validates if a given cache entry is "Telemetry", parses <key,value>
|
|
1363
|
+
* @param key
|
|
1364
|
+
* @param entity
|
|
1365
|
+
*/
|
|
1366
|
+
function isServerTelemetryEntity(key, entity) {
|
|
1367
|
+
const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;
|
|
1368
|
+
let validateEntity = true;
|
|
1369
|
+
if (entity) {
|
|
1370
|
+
validateEntity =
|
|
1371
|
+
entity.hasOwnProperty("failedRequests") &&
|
|
1372
|
+
entity.hasOwnProperty("errors") &&
|
|
1373
|
+
entity.hasOwnProperty("cacheHits");
|
|
1374
|
+
}
|
|
1375
|
+
return validateKey && validateEntity;
|
|
1376
|
+
}
|
|
1362
1377
|
|
|
1363
|
-
/*! @azure/msal-common v14.
|
|
1378
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1364
1379
|
/*
|
|
1365
1380
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1366
1381
|
* Licensed under the MIT License.
|
|
@@ -1414,7 +1429,7 @@
|
|
|
1414
1429
|
urlParseError: urlParseError
|
|
1415
1430
|
});
|
|
1416
1431
|
|
|
1417
|
-
/*! @azure/msal-common v14.
|
|
1432
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1418
1433
|
|
|
1419
1434
|
/*
|
|
1420
1435
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1552,7 +1567,7 @@
|
|
|
1552
1567
|
return new ClientConfigurationError(errorCode);
|
|
1553
1568
|
}
|
|
1554
1569
|
|
|
1555
|
-
/*! @azure/msal-common v14.
|
|
1570
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1556
1571
|
/*
|
|
1557
1572
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1558
1573
|
* Licensed under the MIT License.
|
|
@@ -1649,7 +1664,7 @@
|
|
|
1649
1664
|
}
|
|
1650
1665
|
}
|
|
1651
1666
|
|
|
1652
|
-
/*! @azure/msal-common v14.
|
|
1667
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1653
1668
|
|
|
1654
1669
|
/*
|
|
1655
1670
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1849,7 +1864,7 @@
|
|
|
1849
1864
|
}
|
|
1850
1865
|
}
|
|
1851
1866
|
|
|
1852
|
-
/*! @azure/msal-common v14.
|
|
1867
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1853
1868
|
|
|
1854
1869
|
/*
|
|
1855
1870
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1889,7 +1904,7 @@
|
|
|
1889
1904
|
};
|
|
1890
1905
|
}
|
|
1891
1906
|
|
|
1892
|
-
/*! @azure/msal-common v14.
|
|
1907
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1893
1908
|
/*
|
|
1894
1909
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1895
1910
|
* Licensed under the MIT License.
|
|
@@ -1904,7 +1919,7 @@
|
|
|
1904
1919
|
Ciam: 3,
|
|
1905
1920
|
};
|
|
1906
1921
|
|
|
1907
|
-
/*! @azure/msal-common v14.
|
|
1922
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1908
1923
|
/*
|
|
1909
1924
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1910
1925
|
* Licensed under the MIT License.
|
|
@@ -1917,7 +1932,7 @@
|
|
|
1917
1932
|
OIDC: "OIDC",
|
|
1918
1933
|
};
|
|
1919
1934
|
|
|
1920
|
-
/*! @azure/msal-common v14.
|
|
1935
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
1921
1936
|
|
|
1922
1937
|
/*
|
|
1923
1938
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2138,7 +2153,54 @@
|
|
|
2138
2153
|
}
|
|
2139
2154
|
}
|
|
2140
2155
|
|
|
2141
|
-
/*! @azure/msal-common v14.
|
|
2156
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
2157
|
+
|
|
2158
|
+
/*
|
|
2159
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
2160
|
+
* Licensed under the MIT License.
|
|
2161
|
+
*/
|
|
2162
|
+
/**
|
|
2163
|
+
* Parses hash string from given string. Returns empty string if no hash symbol is found.
|
|
2164
|
+
* @param hashString
|
|
2165
|
+
*/
|
|
2166
|
+
function stripLeadingHashOrQuery(responseString) {
|
|
2167
|
+
if (responseString.startsWith("#/")) {
|
|
2168
|
+
return responseString.substring(2);
|
|
2169
|
+
}
|
|
2170
|
+
else if (responseString.startsWith("#") ||
|
|
2171
|
+
responseString.startsWith("?")) {
|
|
2172
|
+
return responseString.substring(1);
|
|
2173
|
+
}
|
|
2174
|
+
return responseString;
|
|
2175
|
+
}
|
|
2176
|
+
/**
|
|
2177
|
+
* Returns URL hash as server auth code response object.
|
|
2178
|
+
*/
|
|
2179
|
+
function getDeserializedResponse(responseString) {
|
|
2180
|
+
// Check if given hash is empty
|
|
2181
|
+
if (!responseString || responseString.indexOf("=") < 0) {
|
|
2182
|
+
return null;
|
|
2183
|
+
}
|
|
2184
|
+
try {
|
|
2185
|
+
// Strip the # or ? symbol if present
|
|
2186
|
+
const normalizedResponse = stripLeadingHashOrQuery(responseString);
|
|
2187
|
+
// If # symbol was not present, above will return empty string, so give original hash value
|
|
2188
|
+
const deserializedHash = Object.fromEntries(new URLSearchParams(normalizedResponse));
|
|
2189
|
+
// Check for known response properties
|
|
2190
|
+
if (deserializedHash.code ||
|
|
2191
|
+
deserializedHash.error ||
|
|
2192
|
+
deserializedHash.error_description ||
|
|
2193
|
+
deserializedHash.state) {
|
|
2194
|
+
return deserializedHash;
|
|
2195
|
+
}
|
|
2196
|
+
}
|
|
2197
|
+
catch (e) {
|
|
2198
|
+
throw createClientAuthError(hashNotDeserialized);
|
|
2199
|
+
}
|
|
2200
|
+
return null;
|
|
2201
|
+
}
|
|
2202
|
+
|
|
2203
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
2142
2204
|
|
|
2143
2205
|
/*
|
|
2144
2206
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2157,7 +2219,7 @@
|
|
|
2157
2219
|
// Throws error if url is empty
|
|
2158
2220
|
throw createClientConfigurationError(urlEmptyError);
|
|
2159
2221
|
}
|
|
2160
|
-
if (!
|
|
2222
|
+
if (!url.includes("#")) {
|
|
2161
2223
|
this._urlString = UrlString.canonicalizeUri(url);
|
|
2162
2224
|
}
|
|
2163
2225
|
}
|
|
@@ -2239,12 +2301,6 @@
|
|
|
2239
2301
|
}
|
|
2240
2302
|
return UrlString.constructAuthorityUriFromObject(urlObject);
|
|
2241
2303
|
}
|
|
2242
|
-
/**
|
|
2243
|
-
* Returns the anchor part(#) of the URL
|
|
2244
|
-
*/
|
|
2245
|
-
getHash() {
|
|
2246
|
-
return UrlString.parseHash(this.urlString);
|
|
2247
|
-
}
|
|
2248
2304
|
/**
|
|
2249
2305
|
* Parses out the components from a url string.
|
|
2250
2306
|
* @returns An object with the various components. Please cache this value insted of calling this multiple times on the same url.
|
|
@@ -2292,60 +2348,6 @@
|
|
|
2292
2348
|
}
|
|
2293
2349
|
return relativeUrl;
|
|
2294
2350
|
}
|
|
2295
|
-
/**
|
|
2296
|
-
* Parses hash string from given string. Returns empty string if no hash symbol is found.
|
|
2297
|
-
* @param hashString
|
|
2298
|
-
*/
|
|
2299
|
-
static parseHash(hashString) {
|
|
2300
|
-
const hashIndex1 = hashString.indexOf("#");
|
|
2301
|
-
const hashIndex2 = hashString.indexOf("#/");
|
|
2302
|
-
if (hashIndex2 > -1) {
|
|
2303
|
-
return hashString.substring(hashIndex2 + 2);
|
|
2304
|
-
}
|
|
2305
|
-
else if (hashIndex1 > -1) {
|
|
2306
|
-
return hashString.substring(hashIndex1 + 1);
|
|
2307
|
-
}
|
|
2308
|
-
return Constants.EMPTY_STRING;
|
|
2309
|
-
}
|
|
2310
|
-
/**
|
|
2311
|
-
* Parses query string from given string. Returns empty string if no query symbol is found.
|
|
2312
|
-
* @param queryString
|
|
2313
|
-
*/
|
|
2314
|
-
static parseQueryString(queryString) {
|
|
2315
|
-
const queryIndex1 = queryString.indexOf("?");
|
|
2316
|
-
const queryIndex2 = queryString.indexOf("/?");
|
|
2317
|
-
if (queryIndex2 > -1) {
|
|
2318
|
-
return queryString.substring(queryIndex2 + 2);
|
|
2319
|
-
}
|
|
2320
|
-
else if (queryIndex1 > -1) {
|
|
2321
|
-
return queryString.substring(queryIndex1 + 1);
|
|
2322
|
-
}
|
|
2323
|
-
return Constants.EMPTY_STRING;
|
|
2324
|
-
}
|
|
2325
|
-
/**
|
|
2326
|
-
* Parses query server response string from given string.
|
|
2327
|
-
* Extract hash between '?code=' and '#' if trailing '# is present.
|
|
2328
|
-
* Returns empty string if no query symbol is found.
|
|
2329
|
-
* @param queryString
|
|
2330
|
-
*/
|
|
2331
|
-
static parseQueryServerResponse(queryString) {
|
|
2332
|
-
const queryIndex1 = queryString.indexOf("?code");
|
|
2333
|
-
const queryIndex2 = queryString.indexOf("/?code");
|
|
2334
|
-
const hashIndex = queryString.indexOf("#");
|
|
2335
|
-
if (queryIndex2 > -1 && hashIndex > -1) {
|
|
2336
|
-
return queryString.substring(queryIndex2 + 2, hashIndex);
|
|
2337
|
-
}
|
|
2338
|
-
else if (queryIndex2 > -1) {
|
|
2339
|
-
return queryString.substring(queryIndex2 + 2);
|
|
2340
|
-
}
|
|
2341
|
-
else if (queryIndex1 > -1 && hashIndex > -1) {
|
|
2342
|
-
return queryString.substring(queryIndex1 + 1, hashIndex);
|
|
2343
|
-
}
|
|
2344
|
-
else if (queryIndex1 > -1) {
|
|
2345
|
-
return queryString.substring(queryIndex1 + 1);
|
|
2346
|
-
}
|
|
2347
|
-
return Constants.EMPTY_STRING;
|
|
2348
|
-
}
|
|
2349
2351
|
static constructAuthorityUriFromObject(urlObject) {
|
|
2350
2352
|
return new UrlString(urlObject.Protocol +
|
|
2351
2353
|
"//" +
|
|
@@ -2353,74 +2355,16 @@
|
|
|
2353
2355
|
"/" +
|
|
2354
2356
|
urlObject.PathSegments.join("/"));
|
|
2355
2357
|
}
|
|
2356
|
-
/**
|
|
2357
|
-
* Returns URL hash as server auth code response object.
|
|
2358
|
-
*/
|
|
2359
|
-
static getDeserializedHash(hash) {
|
|
2360
|
-
// Check if given hash is empty
|
|
2361
|
-
if (!hash) {
|
|
2362
|
-
return {};
|
|
2363
|
-
}
|
|
2364
|
-
// Strip the # symbol if present
|
|
2365
|
-
const parsedHash = UrlString.parseHash(hash);
|
|
2366
|
-
// If # symbol was not present, above will return empty string, so give original hash value
|
|
2367
|
-
const deserializedHash = StringUtils.queryStringToObject(parsedHash || hash);
|
|
2368
|
-
// Check if deserialization didn't work
|
|
2369
|
-
if (!deserializedHash) {
|
|
2370
|
-
throw createClientAuthError(hashNotDeserialized);
|
|
2371
|
-
}
|
|
2372
|
-
return deserializedHash;
|
|
2373
|
-
}
|
|
2374
|
-
/**
|
|
2375
|
-
* Returns URL query string as server auth code response object.
|
|
2376
|
-
*/
|
|
2377
|
-
static getDeserializedQueryString(query) {
|
|
2378
|
-
// Check if given query is empty
|
|
2379
|
-
if (!query) {
|
|
2380
|
-
return {};
|
|
2381
|
-
}
|
|
2382
|
-
// Strip the ? symbol if present
|
|
2383
|
-
const parsedQueryString = UrlString.parseQueryString(query);
|
|
2384
|
-
// If ? symbol was not present, above will return empty string, so give original query value
|
|
2385
|
-
const deserializedQueryString = StringUtils.queryStringToObject(parsedQueryString || query);
|
|
2386
|
-
// Check if deserialization didn't work
|
|
2387
|
-
if (!deserializedQueryString) {
|
|
2388
|
-
throw createClientAuthError(hashNotDeserialized);
|
|
2389
|
-
}
|
|
2390
|
-
return deserializedQueryString;
|
|
2391
|
-
}
|
|
2392
|
-
/**
|
|
2393
|
-
* Returns either deserialized query string or deserialized hash, depending on the serverResponseType
|
|
2394
|
-
* as a server auth code response object.
|
|
2395
|
-
*/
|
|
2396
|
-
static getDeserializedCodeResponse(serverResponseType, hashFragment) {
|
|
2397
|
-
const hashUrlString = new UrlString(hashFragment);
|
|
2398
|
-
let serverParams;
|
|
2399
|
-
if (serverResponseType === ServerResponseType.QUERY) {
|
|
2400
|
-
serverParams = UrlString.getDeserializedQueryString(hashFragment);
|
|
2401
|
-
}
|
|
2402
|
-
else {
|
|
2403
|
-
serverParams = UrlString.getDeserializedHash(hashUrlString.getHash());
|
|
2404
|
-
}
|
|
2405
|
-
return serverParams;
|
|
2406
|
-
}
|
|
2407
2358
|
/**
|
|
2408
2359
|
* Check if the hash of the URL string contains known properties
|
|
2360
|
+
* @deprecated This API will be removed in a future version
|
|
2409
2361
|
*/
|
|
2410
|
-
static hashContainsKnownProperties(
|
|
2411
|
-
|
|
2412
|
-
// Hash doesn't contain key/value pairs
|
|
2413
|
-
return false;
|
|
2414
|
-
}
|
|
2415
|
-
const parameters = UrlString.getDeserializedHash(hash);
|
|
2416
|
-
return !!(parameters.code ||
|
|
2417
|
-
parameters.error_description ||
|
|
2418
|
-
parameters.error ||
|
|
2419
|
-
parameters.state);
|
|
2362
|
+
static hashContainsKnownProperties(response) {
|
|
2363
|
+
return !!getDeserializedResponse(response);
|
|
2420
2364
|
}
|
|
2421
2365
|
}
|
|
2422
2366
|
|
|
2423
|
-
/*! @azure/msal-common v14.
|
|
2367
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
2424
2368
|
|
|
2425
2369
|
/*
|
|
2426
2370
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3026,7 +2970,7 @@
|
|
|
3026
2970
|
return null;
|
|
3027
2971
|
}
|
|
3028
2972
|
|
|
3029
|
-
/*! @azure/msal-common v14.
|
|
2973
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
3030
2974
|
|
|
3031
2975
|
/*
|
|
3032
2976
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3506,18 +3450,18 @@
|
|
|
3506
3450
|
}
|
|
3507
3451
|
/**
|
|
3508
3452
|
* Retrieve the cached credentials into a cacherecord
|
|
3509
|
-
* @param account
|
|
3510
|
-
* @param
|
|
3511
|
-
* @param
|
|
3512
|
-
* @param
|
|
3513
|
-
* @param
|
|
3453
|
+
* @param account {AccountInfo}
|
|
3454
|
+
* @param request {BaseAuthRequest}
|
|
3455
|
+
* @param environment {string}
|
|
3456
|
+
* @param performanceClient {?IPerformanceClient}
|
|
3457
|
+
* @param correlationId {?string}
|
|
3514
3458
|
*/
|
|
3515
|
-
readCacheRecord(account, request, environment) {
|
|
3459
|
+
readCacheRecord(account, request, environment, performanceClient, correlationId) {
|
|
3516
3460
|
const tokenKeys = this.getTokenKeys();
|
|
3517
3461
|
const cachedAccount = this.readAccountFromCache(account);
|
|
3518
|
-
const cachedIdToken = this.getIdToken(account, tokenKeys);
|
|
3519
|
-
const cachedAccessToken = this.getAccessToken(account, request, tokenKeys);
|
|
3520
|
-
const cachedRefreshToken = this.getRefreshToken(account, false, tokenKeys);
|
|
3462
|
+
const cachedIdToken = this.getIdToken(account, tokenKeys, performanceClient, correlationId);
|
|
3463
|
+
const cachedAccessToken = this.getAccessToken(account, request, tokenKeys, performanceClient, correlationId);
|
|
3464
|
+
const cachedRefreshToken = this.getRefreshToken(account, false, tokenKeys, performanceClient, correlationId);
|
|
3521
3465
|
const cachedAppMetadata = this.readAppMetadataFromCache(environment);
|
|
3522
3466
|
if (cachedAccount && cachedIdToken) {
|
|
3523
3467
|
cachedAccount.idTokenClaims = extractTokenClaims(cachedIdToken.secret, this.cryptoImpl.base64Decode);
|
|
@@ -3540,11 +3484,12 @@
|
|
|
3540
3484
|
}
|
|
3541
3485
|
/**
|
|
3542
3486
|
* Retrieve IdTokenEntity from cache
|
|
3543
|
-
* @param
|
|
3544
|
-
* @param
|
|
3545
|
-
* @param
|
|
3487
|
+
* @param account {AccountInfo}
|
|
3488
|
+
* @param tokenKeys {?TokenKeys}
|
|
3489
|
+
* @param performanceClient {?IPerformanceClient}
|
|
3490
|
+
* @param correlationId {?string}
|
|
3546
3491
|
*/
|
|
3547
|
-
getIdToken(account, tokenKeys) {
|
|
3492
|
+
getIdToken(account, tokenKeys, performanceClient, correlationId) {
|
|
3548
3493
|
this.commonLogger.trace("CacheManager - getIdToken called");
|
|
3549
3494
|
const idTokenFilter = {
|
|
3550
3495
|
homeAccountId: account.homeAccountId,
|
|
@@ -3564,6 +3509,9 @@
|
|
|
3564
3509
|
idTokens.forEach((idToken) => {
|
|
3565
3510
|
this.removeIdToken(generateCredentialKey(idToken));
|
|
3566
3511
|
});
|
|
3512
|
+
if (performanceClient && correlationId) {
|
|
3513
|
+
performanceClient.addFields({ multiMatchedID: idTokens.length }, correlationId);
|
|
3514
|
+
}
|
|
3567
3515
|
return null;
|
|
3568
3516
|
}
|
|
3569
3517
|
this.commonLogger.info("CacheManager:getIdToken - Returning id token");
|
|
@@ -3625,12 +3573,13 @@
|
|
|
3625
3573
|
}
|
|
3626
3574
|
/**
|
|
3627
3575
|
* Retrieve AccessTokenEntity from cache
|
|
3628
|
-
* @param
|
|
3629
|
-
* @param
|
|
3630
|
-
* @param
|
|
3631
|
-
* @param
|
|
3576
|
+
* @param account {AccountInfo}
|
|
3577
|
+
* @param request {BaseAuthRequest}
|
|
3578
|
+
* @param tokenKeys {?TokenKeys}
|
|
3579
|
+
* @param performanceClient {?IPerformanceClient}
|
|
3580
|
+
* @param correlationId {?string}
|
|
3632
3581
|
*/
|
|
3633
|
-
getAccessToken(account, request, tokenKeys) {
|
|
3582
|
+
getAccessToken(account, request, tokenKeys, performanceClient, correlationId) {
|
|
3634
3583
|
this.commonLogger.trace("CacheManager - getAccessToken called");
|
|
3635
3584
|
const scopes = ScopeSet.createSearchScopes(request.scopes);
|
|
3636
3585
|
const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;
|
|
@@ -3678,6 +3627,9 @@
|
|
|
3678
3627
|
accessTokens.forEach((accessToken) => {
|
|
3679
3628
|
void this.removeAccessToken(generateCredentialKey(accessToken));
|
|
3680
3629
|
});
|
|
3630
|
+
if (performanceClient && correlationId) {
|
|
3631
|
+
performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
|
|
3632
|
+
}
|
|
3681
3633
|
return null;
|
|
3682
3634
|
}
|
|
3683
3635
|
this.commonLogger.info("CacheManager:getAccessToken - Returning access token");
|
|
@@ -3746,11 +3698,13 @@
|
|
|
3746
3698
|
}
|
|
3747
3699
|
/**
|
|
3748
3700
|
* Helper to retrieve the appropriate refresh token from cache
|
|
3749
|
-
* @param
|
|
3750
|
-
* @param
|
|
3751
|
-
* @param
|
|
3701
|
+
* @param account {AccountInfo}
|
|
3702
|
+
* @param familyRT {boolean}
|
|
3703
|
+
* @param tokenKeys {?TokenKeys}
|
|
3704
|
+
* @param performanceClient {?IPerformanceClient}
|
|
3705
|
+
* @param correlationId {?string}
|
|
3752
3706
|
*/
|
|
3753
|
-
getRefreshToken(account, familyRT, tokenKeys) {
|
|
3707
|
+
getRefreshToken(account, familyRT, tokenKeys, performanceClient, correlationId) {
|
|
3754
3708
|
this.commonLogger.trace("CacheManager - getRefreshToken called");
|
|
3755
3709
|
const id = familyRT ? THE_FAMILY_ID : undefined;
|
|
3756
3710
|
const refreshTokenFilter = {
|
|
@@ -3780,6 +3734,9 @@
|
|
|
3780
3734
|
return null;
|
|
3781
3735
|
}
|
|
3782
3736
|
// address the else case after remove functions address environment aliases
|
|
3737
|
+
if (numRefreshTokens > 1 && performanceClient && correlationId) {
|
|
3738
|
+
performanceClient.addFields({ multiMatchedRT: numRefreshTokens }, correlationId);
|
|
3739
|
+
}
|
|
3783
3740
|
this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token");
|
|
3784
3741
|
return refreshTokens[0];
|
|
3785
3742
|
}
|
|
@@ -4118,7 +4075,7 @@
|
|
|
4118
4075
|
}
|
|
4119
4076
|
}
|
|
4120
4077
|
|
|
4121
|
-
/*! @azure/msal-common v14.
|
|
4078
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4122
4079
|
|
|
4123
4080
|
/*
|
|
4124
4081
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4218,7 +4175,7 @@
|
|
|
4218
4175
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
4219
4176
|
}
|
|
4220
4177
|
|
|
4221
|
-
/*! @azure/msal-common v14.
|
|
4178
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4222
4179
|
|
|
4223
4180
|
/*
|
|
4224
4181
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4235,7 +4192,7 @@
|
|
|
4235
4192
|
}
|
|
4236
4193
|
}
|
|
4237
4194
|
|
|
4238
|
-
/*! @azure/msal-common v14.
|
|
4195
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4239
4196
|
|
|
4240
4197
|
/*
|
|
4241
4198
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4333,7 +4290,7 @@
|
|
|
4333
4290
|
}
|
|
4334
4291
|
}
|
|
4335
4292
|
|
|
4336
|
-
/*! @azure/msal-common v14.
|
|
4293
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4337
4294
|
|
|
4338
4295
|
/*
|
|
4339
4296
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4370,7 +4327,7 @@
|
|
|
4370
4327
|
}
|
|
4371
4328
|
}
|
|
4372
4329
|
|
|
4373
|
-
/*! @azure/msal-common v14.
|
|
4330
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4374
4331
|
/*
|
|
4375
4332
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4376
4333
|
* Licensed under the MIT License.
|
|
@@ -4380,7 +4337,7 @@
|
|
|
4380
4337
|
UPN: "UPN",
|
|
4381
4338
|
};
|
|
4382
4339
|
|
|
4383
|
-
/*! @azure/msal-common v14.
|
|
4340
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4384
4341
|
|
|
4385
4342
|
/*
|
|
4386
4343
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4464,7 +4421,7 @@
|
|
|
4464
4421
|
}
|
|
4465
4422
|
}
|
|
4466
4423
|
|
|
4467
|
-
/*! @azure/msal-common v14.
|
|
4424
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4468
4425
|
|
|
4469
4426
|
/*
|
|
4470
4427
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4848,7 +4805,7 @@
|
|
|
4848
4805
|
}
|
|
4849
4806
|
}
|
|
4850
4807
|
|
|
4851
|
-
/*! @azure/msal-common v14.
|
|
4808
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4852
4809
|
/*
|
|
4853
4810
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4854
4811
|
* Licensed under the MIT License.
|
|
@@ -4860,7 +4817,7 @@
|
|
|
4860
4817
|
response.hasOwnProperty("jwks_uri"));
|
|
4861
4818
|
}
|
|
4862
4819
|
|
|
4863
|
-
/*! @azure/msal-common v14.
|
|
4820
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4864
4821
|
|
|
4865
4822
|
/*
|
|
4866
4823
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4941,7 +4898,7 @@
|
|
|
4941
4898
|
}
|
|
4942
4899
|
}
|
|
4943
4900
|
|
|
4944
|
-
/*! @azure/msal-common v14.
|
|
4901
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4945
4902
|
/*
|
|
4946
4903
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4947
4904
|
* Licensed under the MIT License.
|
|
@@ -4951,7 +4908,7 @@
|
|
|
4951
4908
|
response.hasOwnProperty("metadata"));
|
|
4952
4909
|
}
|
|
4953
4910
|
|
|
4954
|
-
/*! @azure/msal-common v14.
|
|
4911
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4955
4912
|
/*
|
|
4956
4913
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4957
4914
|
* Licensed under the MIT License.
|
|
@@ -4961,7 +4918,7 @@
|
|
|
4961
4918
|
response.hasOwnProperty("error_description"));
|
|
4962
4919
|
}
|
|
4963
4920
|
|
|
4964
|
-
/*! @azure/msal-common v14.
|
|
4921
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
4965
4922
|
/*
|
|
4966
4923
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4967
4924
|
* Licensed under the MIT License.
|
|
@@ -5131,7 +5088,7 @@
|
|
|
5131
5088
|
* Functions from InteractionHandler (msal-browser)
|
|
5132
5089
|
*/
|
|
5133
5090
|
HandleCodeResponseFromServer: "handleCodeResponseFromServer",
|
|
5134
|
-
|
|
5091
|
+
HandleCodeResponse: "handleCodeResponse",
|
|
5135
5092
|
UpdateTokenEndpointAuthority: "updateTokenEndpointAuthority",
|
|
5136
5093
|
/**
|
|
5137
5094
|
* APIs in Authorization Code Client (msal-common)
|
|
@@ -5149,6 +5106,7 @@
|
|
|
5149
5106
|
* handleServerTokenResponse API in ResponseHandler (msal-common)
|
|
5150
5107
|
*/
|
|
5151
5108
|
HandleServerTokenResponse: "handleServerTokenResponse",
|
|
5109
|
+
DeserializeResponse: "deserializeResponse",
|
|
5152
5110
|
/**
|
|
5153
5111
|
* Authority functions
|
|
5154
5112
|
*/
|
|
@@ -5210,9 +5168,12 @@
|
|
|
5210
5168
|
"queuedTimeMs",
|
|
5211
5169
|
"startTimeMs",
|
|
5212
5170
|
"status",
|
|
5171
|
+
"multiMatchedAT",
|
|
5172
|
+
"multiMatchedID",
|
|
5173
|
+
"multiMatchedRT",
|
|
5213
5174
|
]);
|
|
5214
5175
|
|
|
5215
|
-
/*! @azure/msal-common v14.
|
|
5176
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
5216
5177
|
/*
|
|
5217
5178
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5218
5179
|
* Licensed under the MIT License.
|
|
@@ -5298,7 +5259,7 @@
|
|
|
5298
5259
|
};
|
|
5299
5260
|
};
|
|
5300
5261
|
|
|
5301
|
-
/*! @azure/msal-common v14.
|
|
5262
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
5302
5263
|
|
|
5303
5264
|
/*
|
|
5304
5265
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5407,7 +5368,7 @@
|
|
|
5407
5368
|
},
|
|
5408
5369
|
};
|
|
5409
5370
|
|
|
5410
|
-
/*! @azure/msal-common v14.
|
|
5371
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
5411
5372
|
|
|
5412
5373
|
/*
|
|
5413
5374
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6135,9 +6096,8 @@
|
|
|
6135
6096
|
const regionalMetadata = { ...metadata };
|
|
6136
6097
|
regionalMetadata.authorization_endpoint =
|
|
6137
6098
|
Authority.buildRegionalAuthorityString(regionalMetadata.authorization_endpoint, azureRegion);
|
|
6138
|
-
// TODO: Enquire on whether we should leave the query string or remove it before releasing the feature
|
|
6139
6099
|
regionalMetadata.token_endpoint =
|
|
6140
|
-
Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion
|
|
6100
|
+
Authority.buildRegionalAuthorityString(regionalMetadata.token_endpoint, azureRegion);
|
|
6141
6101
|
if (regionalMetadata.end_session_endpoint) {
|
|
6142
6102
|
regionalMetadata.end_session_endpoint =
|
|
6143
6103
|
Authority.buildRegionalAuthorityString(regionalMetadata.end_session_endpoint, azureRegion);
|
|
@@ -6199,7 +6159,7 @@
|
|
|
6199
6159
|
};
|
|
6200
6160
|
}
|
|
6201
6161
|
|
|
6202
|
-
/*! @azure/msal-common v14.
|
|
6162
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6203
6163
|
|
|
6204
6164
|
/*
|
|
6205
6165
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6249,7 +6209,7 @@
|
|
|
6249
6209
|
}
|
|
6250
6210
|
}
|
|
6251
6211
|
|
|
6252
|
-
/*! @azure/msal-common v14.
|
|
6212
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6253
6213
|
|
|
6254
6214
|
/*
|
|
6255
6215
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6352,7 +6312,7 @@
|
|
|
6352
6312
|
}
|
|
6353
6313
|
}
|
|
6354
6314
|
|
|
6355
|
-
/*! @azure/msal-common v14.
|
|
6315
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6356
6316
|
/*
|
|
6357
6317
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6358
6318
|
* Licensed under the MIT License.
|
|
@@ -6374,7 +6334,7 @@
|
|
|
6374
6334
|
noTokensFound: noTokensFound
|
|
6375
6335
|
});
|
|
6376
6336
|
|
|
6377
|
-
/*! @azure/msal-common v14.
|
|
6337
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6378
6338
|
|
|
6379
6339
|
/*
|
|
6380
6340
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6453,7 +6413,7 @@
|
|
|
6453
6413
|
return new InteractionRequiredAuthError(errorCode, InteractionRequiredAuthErrorMessages[errorCode]);
|
|
6454
6414
|
}
|
|
6455
6415
|
|
|
6456
|
-
/*! @azure/msal-common v14.
|
|
6416
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6457
6417
|
/*
|
|
6458
6418
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6459
6419
|
* Licensed under the MIT License.
|
|
@@ -6469,7 +6429,7 @@
|
|
|
6469
6429
|
}
|
|
6470
6430
|
}
|
|
6471
6431
|
|
|
6472
|
-
/*! @azure/msal-common v14.
|
|
6432
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6473
6433
|
|
|
6474
6434
|
/*
|
|
6475
6435
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6541,7 +6501,7 @@
|
|
|
6541
6501
|
}
|
|
6542
6502
|
}
|
|
6543
6503
|
|
|
6544
|
-
/*! @azure/msal-common v14.
|
|
6504
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6545
6505
|
|
|
6546
6506
|
/*
|
|
6547
6507
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6605,7 +6565,7 @@
|
|
|
6605
6565
|
*/
|
|
6606
6566
|
async signPayload(payload, keyId, request, claims) {
|
|
6607
6567
|
// Deconstruct request to extract SHR parameters
|
|
6608
|
-
const { resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, } = request;
|
|
6568
|
+
const { resourceRequestMethod, resourceRequestUri, shrClaims, shrNonce, shrOptions, } = request;
|
|
6609
6569
|
const resourceUrlString = resourceRequestUri
|
|
6610
6570
|
? new UrlString(resourceRequestUri)
|
|
6611
6571
|
: undefined;
|
|
@@ -6622,11 +6582,11 @@
|
|
|
6622
6582
|
: undefined,
|
|
6623
6583
|
client_claims: shrClaims || undefined,
|
|
6624
6584
|
...claims,
|
|
6625
|
-
}, keyId, request.correlationId);
|
|
6585
|
+
}, keyId, shrOptions, request.correlationId);
|
|
6626
6586
|
}
|
|
6627
6587
|
}
|
|
6628
6588
|
|
|
6629
|
-
/*! @azure/msal-common v14.
|
|
6589
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6630
6590
|
|
|
6631
6591
|
/*
|
|
6632
6592
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6695,7 +6655,7 @@
|
|
|
6695
6655
|
}
|
|
6696
6656
|
}
|
|
6697
6657
|
|
|
6698
|
-
/*! @azure/msal-common v14.
|
|
6658
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6699
6659
|
/*
|
|
6700
6660
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6701
6661
|
* Licensed under the MIT License.
|
|
@@ -6722,7 +6682,7 @@
|
|
|
6722
6682
|
}
|
|
6723
6683
|
}
|
|
6724
6684
|
|
|
6725
|
-
/*! @azure/msal-common v14.
|
|
6685
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
6726
6686
|
|
|
6727
6687
|
/*
|
|
6728
6688
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7037,7 +6997,7 @@
|
|
|
7037
6997
|
}
|
|
7038
6998
|
}
|
|
7039
6999
|
|
|
7040
|
-
/*! @azure/msal-common v14.
|
|
7000
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7041
7001
|
|
|
7042
7002
|
/*
|
|
7043
7003
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7094,22 +7054,16 @@
|
|
|
7094
7054
|
* the client to exchange for a token in acquireToken.
|
|
7095
7055
|
* @param hashFragment
|
|
7096
7056
|
*/
|
|
7097
|
-
handleFragmentResponse(
|
|
7057
|
+
handleFragmentResponse(serverParams, cachedState) {
|
|
7098
7058
|
// Handle responses.
|
|
7099
7059
|
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);
|
|
7100
|
-
const serverParams = UrlString.getDeserializedCodeResponse(this.config.authOptions.authority.options.OIDCOptions
|
|
7101
|
-
?.serverResponseType, hashFragment);
|
|
7102
7060
|
// Get code response
|
|
7103
7061
|
responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState);
|
|
7104
7062
|
// throw when there is no auth code in the response
|
|
7105
7063
|
if (!serverParams.code) {
|
|
7106
7064
|
throw createClientAuthError(authorizationCodeMissingFromServerResponse);
|
|
7107
7065
|
}
|
|
7108
|
-
return
|
|
7109
|
-
...serverParams,
|
|
7110
|
-
// Code param is optional in ServerAuthorizationCodeResponse but required in AuthorizationCodePaylod
|
|
7111
|
-
code: serverParams.code,
|
|
7112
|
-
};
|
|
7066
|
+
return serverParams;
|
|
7113
7067
|
}
|
|
7114
7068
|
/**
|
|
7115
7069
|
* Used to log out the current user, and redirect the user to the postLogoutRedirectUri.
|
|
@@ -7448,7 +7402,7 @@
|
|
|
7448
7402
|
}
|
|
7449
7403
|
}
|
|
7450
7404
|
|
|
7451
|
-
/*! @azure/msal-common v14.
|
|
7405
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7452
7406
|
|
|
7453
7407
|
/*
|
|
7454
7408
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7520,7 +7474,7 @@
|
|
|
7520
7474
|
async acquireTokenWithCachedRefreshToken(request, foci) {
|
|
7521
7475
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);
|
|
7522
7476
|
// fetches family RT or application RT based on FOCI value
|
|
7523
|
-
const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci);
|
|
7477
|
+
const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, undefined, this.performanceClient, request.correlationId);
|
|
7524
7478
|
if (!refreshToken) {
|
|
7525
7479
|
throw createInteractionRequiredAuthError(noTokensFound);
|
|
7526
7480
|
}
|
|
@@ -7637,7 +7591,7 @@
|
|
|
7637
7591
|
}
|
|
7638
7592
|
}
|
|
7639
7593
|
|
|
7640
|
-
/*! @azure/msal-common v14.
|
|
7594
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7641
7595
|
|
|
7642
7596
|
/*
|
|
7643
7597
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7700,7 +7654,7 @@
|
|
|
7700
7654
|
throw createClientAuthError(noAccountInSilentRequest);
|
|
7701
7655
|
}
|
|
7702
7656
|
const environment = request.authority || this.authority.getPreferredCache();
|
|
7703
|
-
const cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment);
|
|
7657
|
+
const cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment, this.performanceClient, request.correlationId);
|
|
7704
7658
|
if (!cacheRecord.accessToken) {
|
|
7705
7659
|
// must refresh due to non-existent access_token
|
|
7706
7660
|
this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
|
|
@@ -7732,7 +7686,9 @@
|
|
|
7732
7686
|
this.performanceClient?.addFields({
|
|
7733
7687
|
cacheOutcome: cacheOutcome,
|
|
7734
7688
|
}, correlationId);
|
|
7735
|
-
|
|
7689
|
+
if (cacheOutcome !== CacheOutcome.NOT_APPLICABLE) {
|
|
7690
|
+
this.logger.info(`Token refresh is required due to cache outcome: ${cacheOutcome}`);
|
|
7691
|
+
}
|
|
7736
7692
|
}
|
|
7737
7693
|
/**
|
|
7738
7694
|
* Helper function to build response object from the CacheRecord
|
|
@@ -7756,37 +7712,7 @@
|
|
|
7756
7712
|
}
|
|
7757
7713
|
}
|
|
7758
7714
|
|
|
7759
|
-
/*! @azure/msal-common v14.
|
|
7760
|
-
|
|
7761
|
-
/*
|
|
7762
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7763
|
-
* Licensed under the MIT License.
|
|
7764
|
-
*/
|
|
7765
|
-
class ServerTelemetryEntity {
|
|
7766
|
-
constructor() {
|
|
7767
|
-
this.failedRequests = [];
|
|
7768
|
-
this.errors = [];
|
|
7769
|
-
this.cacheHits = 0;
|
|
7770
|
-
}
|
|
7771
|
-
/**
|
|
7772
|
-
* validates if a given cache entry is "Telemetry", parses <key,value>
|
|
7773
|
-
* @param key
|
|
7774
|
-
* @param entity
|
|
7775
|
-
*/
|
|
7776
|
-
static isServerTelemetryEntity(key, entity) {
|
|
7777
|
-
const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;
|
|
7778
|
-
let validateEntity = true;
|
|
7779
|
-
if (entity) {
|
|
7780
|
-
validateEntity =
|
|
7781
|
-
entity.hasOwnProperty("failedRequests") &&
|
|
7782
|
-
entity.hasOwnProperty("errors") &&
|
|
7783
|
-
entity.hasOwnProperty("cacheHits");
|
|
7784
|
-
}
|
|
7785
|
-
return validateKey && validateEntity;
|
|
7786
|
-
}
|
|
7787
|
-
}
|
|
7788
|
-
|
|
7789
|
-
/*! @azure/msal-common v14.3.0 2023-10-30 */
|
|
7715
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7790
7716
|
|
|
7791
7717
|
/*
|
|
7792
7718
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7812,7 +7738,7 @@
|
|
|
7812
7738
|
}
|
|
7813
7739
|
}
|
|
7814
7740
|
|
|
7815
|
-
/*! @azure/msal-common v14.
|
|
7741
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7816
7742
|
|
|
7817
7743
|
/*
|
|
7818
7744
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7827,7 +7753,7 @@
|
|
|
7827
7753
|
},
|
|
7828
7754
|
};
|
|
7829
7755
|
|
|
7830
|
-
/*! @azure/msal-common v14.
|
|
7756
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7831
7757
|
/*
|
|
7832
7758
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7833
7759
|
* Licensed under the MIT License.
|
|
@@ -7835,7 +7761,7 @@
|
|
|
7835
7761
|
const missingKidError = "missing_kid_error";
|
|
7836
7762
|
const missingAlgError = "missing_alg_error";
|
|
7837
7763
|
|
|
7838
|
-
/*! @azure/msal-common v14.
|
|
7764
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7839
7765
|
|
|
7840
7766
|
/*
|
|
7841
7767
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7860,7 +7786,7 @@
|
|
|
7860
7786
|
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
|
|
7861
7787
|
}
|
|
7862
7788
|
|
|
7863
|
-
/*! @azure/msal-common v14.
|
|
7789
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7864
7790
|
|
|
7865
7791
|
/*
|
|
7866
7792
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7892,7 +7818,7 @@
|
|
|
7892
7818
|
}
|
|
7893
7819
|
const shrHeader = new JoseHeader({
|
|
7894
7820
|
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
|
|
7895
|
-
typ: shrHeaderOptions.typ ||
|
|
7821
|
+
typ: shrHeaderOptions.typ || JsonWebTokenTypes.Pop,
|
|
7896
7822
|
kid: shrHeaderOptions.kid,
|
|
7897
7823
|
alg: shrHeaderOptions.alg,
|
|
7898
7824
|
});
|
|
@@ -7900,7 +7826,7 @@
|
|
|
7900
7826
|
}
|
|
7901
7827
|
}
|
|
7902
7828
|
|
|
7903
|
-
/*! @azure/msal-common v14.
|
|
7829
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7904
7830
|
|
|
7905
7831
|
/*
|
|
7906
7832
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7958,7 +7884,7 @@
|
|
|
7958
7884
|
}
|
|
7959
7885
|
}
|
|
7960
7886
|
|
|
7961
|
-
/*! @azure/msal-common v14.
|
|
7887
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
7962
7888
|
|
|
7963
7889
|
/*
|
|
7964
7890
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8070,7 +7996,11 @@
|
|
|
8070
7996
|
* Get the server telemetry entity from cache or initialize a new one
|
|
8071
7997
|
*/
|
|
8072
7998
|
getLastRequests() {
|
|
8073
|
-
const initialValue =
|
|
7999
|
+
const initialValue = {
|
|
8000
|
+
failedRequests: [],
|
|
8001
|
+
errors: [],
|
|
8002
|
+
cacheHits: 0,
|
|
8003
|
+
};
|
|
8074
8004
|
const lastRequests = this.cacheManager.getServerTelemetry(this.telemetryCacheKey);
|
|
8075
8005
|
return lastRequests || initialValue;
|
|
8076
8006
|
}
|
|
@@ -8087,11 +8017,11 @@
|
|
|
8087
8017
|
}
|
|
8088
8018
|
else {
|
|
8089
8019
|
// Partial data was flushed to server, construct a new telemetry cache item with errors that were not flushed
|
|
8090
|
-
const serverTelemEntity =
|
|
8091
|
-
|
|
8092
|
-
lastRequests.
|
|
8093
|
-
|
|
8094
|
-
|
|
8020
|
+
const serverTelemEntity = {
|
|
8021
|
+
failedRequests: lastRequests.failedRequests.slice(numErrorsFlushed * 2),
|
|
8022
|
+
errors: lastRequests.errors.slice(numErrorsFlushed),
|
|
8023
|
+
cacheHits: 0,
|
|
8024
|
+
};
|
|
8095
8025
|
this.cacheManager.setServerTelemetry(this.telemetryCacheKey, serverTelemEntity);
|
|
8096
8026
|
}
|
|
8097
8027
|
}
|
|
@@ -8158,7 +8088,7 @@
|
|
|
8158
8088
|
}
|
|
8159
8089
|
}
|
|
8160
8090
|
|
|
8161
|
-
/*! @azure/msal-common v14.
|
|
8091
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
8162
8092
|
|
|
8163
8093
|
/*
|
|
8164
8094
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8570,7 +8500,7 @@
|
|
|
8570
8500
|
}
|
|
8571
8501
|
}
|
|
8572
8502
|
|
|
8573
|
-
/*! @azure/msal-common v14.
|
|
8503
|
+
/*! @azure/msal-common v14.4.0 2023-11-07 */
|
|
8574
8504
|
|
|
8575
8505
|
/*
|
|
8576
8506
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9626,7 +9556,7 @@
|
|
|
9626
9556
|
|
|
9627
9557
|
/* eslint-disable header/header */
|
|
9628
9558
|
const name = "@azure/msal-browser";
|
|
9629
|
-
const version = "3.
|
|
9559
|
+
const version = "3.5.0";
|
|
9630
9560
|
|
|
9631
9561
|
/*
|
|
9632
9562
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -10644,7 +10574,7 @@
|
|
|
10644
10574
|
* @param payload
|
|
10645
10575
|
* @param kid
|
|
10646
10576
|
*/
|
|
10647
|
-
async signJwt(payload, kid, correlationId) {
|
|
10577
|
+
async signJwt(payload, kid, shrOptions, correlationId) {
|
|
10648
10578
|
const signJwtMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
|
|
10649
10579
|
const cachedKeyPair = await this.cache.asymmetricKeys.getItem(kid);
|
|
10650
10580
|
if (!cachedKeyPair) {
|
|
@@ -10657,8 +10587,9 @@
|
|
|
10657
10587
|
const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
|
|
10658
10588
|
// Generate header
|
|
10659
10589
|
const shrHeader = JoseHeader.getShrHeaderString({
|
|
10660
|
-
|
|
10590
|
+
...shrOptions?.header,
|
|
10661
10591
|
alg: publicKeyJwk.alg,
|
|
10592
|
+
kid: encodedKeyIdThumbprint,
|
|
10662
10593
|
});
|
|
10663
10594
|
const encodedShrHeader = urlEncode(shrHeader);
|
|
10664
10595
|
// Generate payload
|
|
@@ -10790,34 +10721,21 @@
|
|
|
10790
10721
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10791
10722
|
* Licensed under the MIT License.
|
|
10792
10723
|
*/
|
|
10793
|
-
|
|
10794
|
-
|
|
10795
|
-
|
|
10796
|
-
|
|
10797
|
-
|
|
10798
|
-
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
return null;
|
|
10802
|
-
}
|
|
10803
|
-
try {
|
|
10804
|
-
const requestStateObj = ProtocolUtils.parseRequestState(browserCrypto, state);
|
|
10805
|
-
return requestStateObj.libraryState.meta;
|
|
10806
|
-
}
|
|
10807
|
-
catch (e) {
|
|
10808
|
-
throw createClientAuthError(invalidState);
|
|
10809
|
-
}
|
|
10724
|
+
/**
|
|
10725
|
+
* Extracts the BrowserStateObject from the state string.
|
|
10726
|
+
* @param browserCrypto
|
|
10727
|
+
* @param state
|
|
10728
|
+
*/
|
|
10729
|
+
function extractBrowserRequestState(browserCrypto, state) {
|
|
10730
|
+
if (!state) {
|
|
10731
|
+
return null;
|
|
10810
10732
|
}
|
|
10811
|
-
|
|
10812
|
-
|
|
10813
|
-
|
|
10814
|
-
|
|
10815
|
-
|
|
10816
|
-
|
|
10817
|
-
return {};
|
|
10818
|
-
}
|
|
10819
|
-
const hashUrlString = new UrlString(locationHash);
|
|
10820
|
-
return UrlString.getDeserializedHash(hashUrlString.getHash());
|
|
10733
|
+
try {
|
|
10734
|
+
const requestStateObj = ProtocolUtils.parseRequestState(browserCrypto, state);
|
|
10735
|
+
return requestStateObj.libraryState.meta;
|
|
10736
|
+
}
|
|
10737
|
+
catch (e) {
|
|
10738
|
+
throw createClientAuthError(invalidState);
|
|
10821
10739
|
}
|
|
10822
10740
|
}
|
|
10823
10741
|
|
|
@@ -11396,14 +11314,14 @@
|
|
|
11396
11314
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit");
|
|
11397
11315
|
return null;
|
|
11398
11316
|
}
|
|
11399
|
-
const
|
|
11400
|
-
if (!
|
|
11401
|
-
!
|
|
11317
|
+
const parsedEntity = this.validateAndParseJson(value);
|
|
11318
|
+
if (!parsedEntity ||
|
|
11319
|
+
!isServerTelemetryEntity(serverTelemetryKey, parsedEntity)) {
|
|
11402
11320
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: called, no cache hit");
|
|
11403
11321
|
return null;
|
|
11404
11322
|
}
|
|
11405
11323
|
this.logger.trace("BrowserCacheManager.getServerTelemetry: cache hit");
|
|
11406
|
-
return
|
|
11324
|
+
return parsedEntity;
|
|
11407
11325
|
}
|
|
11408
11326
|
/**
|
|
11409
11327
|
* set server telemetry entity to the platform cache
|
|
@@ -11896,7 +11814,7 @@
|
|
|
11896
11814
|
return;
|
|
11897
11815
|
}
|
|
11898
11816
|
// Extract state and ensure it matches given InteractionType, then clean request cache
|
|
11899
|
-
const parsedState =
|
|
11817
|
+
const parsedState = extractBrowserRequestState(this.cryptoImpl, stateValue);
|
|
11900
11818
|
if (parsedState &&
|
|
11901
11819
|
parsedState.interactionType === interactionType) {
|
|
11902
11820
|
this.logger.infoPii(`BrowserCacheManager.cleanRequestByInteractionType: Removing temporary cache items for state: ${stateValue}`);
|
|
@@ -12287,7 +12205,7 @@
|
|
|
12287
12205
|
* @param request
|
|
12288
12206
|
*/
|
|
12289
12207
|
async initializeBaseRequest(request, account) {
|
|
12290
|
-
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest,
|
|
12208
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeBaseRequest, this.correlationId);
|
|
12291
12209
|
const authority = request.authority || this.config.auth.authority;
|
|
12292
12210
|
if (account) {
|
|
12293
12211
|
await this.validateRequestAuthority(authority, account);
|
|
@@ -12371,7 +12289,6 @@
|
|
|
12371
12289
|
/**
|
|
12372
12290
|
* Used to get a discovered version of the default authority.
|
|
12373
12291
|
* @param requestAuthority
|
|
12374
|
-
* @param requestCorrelationId
|
|
12375
12292
|
*/
|
|
12376
12293
|
async getDiscoveredAuthority(requestAuthority) {
|
|
12377
12294
|
this.logger.verbose("getDiscoveredAuthority called");
|
|
@@ -12459,7 +12376,7 @@
|
|
|
12459
12376
|
* @param request
|
|
12460
12377
|
*/
|
|
12461
12378
|
async initializeAuthorizationCodeRequest(request) {
|
|
12462
|
-
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
12379
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.correlationId);
|
|
12463
12380
|
const generatedPkceParams = await invokeAsync(generatePkceCodes, PerformanceEvents.GeneratePkceCodes, this.logger, this.performanceClient, this.correlationId)(this.performanceClient, this.logger, this.correlationId);
|
|
12464
12381
|
const authCodeRequest = {
|
|
12465
12382
|
...request,
|
|
@@ -12608,25 +12525,6 @@
|
|
|
12608
12525
|
telemetry: this.config.telemetry,
|
|
12609
12526
|
};
|
|
12610
12527
|
}
|
|
12611
|
-
/**
|
|
12612
|
-
* @param hash
|
|
12613
|
-
* @param interactionType
|
|
12614
|
-
*/
|
|
12615
|
-
validateAndExtractStateFromHash(serverParams, interactionType, requestCorrelationId) {
|
|
12616
|
-
this.logger.verbose("validateAndExtractStateFromHash called", requestCorrelationId);
|
|
12617
|
-
if (!serverParams.state) {
|
|
12618
|
-
throw createBrowserAuthError(noStateInHash);
|
|
12619
|
-
}
|
|
12620
|
-
const platformStateObj = BrowserProtocolUtils.extractBrowserRequestState(this.browserCrypto, serverParams.state);
|
|
12621
|
-
if (!platformStateObj) {
|
|
12622
|
-
throw createBrowserAuthError(unableToParseState);
|
|
12623
|
-
}
|
|
12624
|
-
if (platformStateObj.interactionType !== interactionType) {
|
|
12625
|
-
throw createBrowserAuthError(stateInteractionTypeMismatch);
|
|
12626
|
-
}
|
|
12627
|
-
this.logger.verbose("Returning state from hash", requestCorrelationId);
|
|
12628
|
-
return serverParams.state;
|
|
12629
|
-
}
|
|
12630
12528
|
/**
|
|
12631
12529
|
* Used to get a discovered version of the default authority.
|
|
12632
12530
|
* @param requestAuthority
|
|
@@ -13653,15 +13551,11 @@
|
|
|
13653
13551
|
* Function to handle response parameters from hash.
|
|
13654
13552
|
* @param locationHash
|
|
13655
13553
|
*/
|
|
13656
|
-
async
|
|
13657
|
-
this.performanceClient.addQueueMeasurement(PerformanceEvents.
|
|
13658
|
-
// Check that location hash isn't empty.
|
|
13659
|
-
if (!locationHash) {
|
|
13660
|
-
throw createBrowserAuthError(hashEmptyError);
|
|
13661
|
-
}
|
|
13554
|
+
async handleCodeResponse(response, request) {
|
|
13555
|
+
this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponse, request.correlationId);
|
|
13662
13556
|
let authCodeResponse;
|
|
13663
13557
|
try {
|
|
13664
|
-
authCodeResponse = this.authModule.handleFragmentResponse(
|
|
13558
|
+
authCodeResponse = this.authModule.handleFragmentResponse(response, request.state);
|
|
13665
13559
|
}
|
|
13666
13560
|
catch (e) {
|
|
13667
13561
|
if (e instanceof ServerError &&
|
|
@@ -13732,6 +13626,43 @@
|
|
|
13732
13626
|
}
|
|
13733
13627
|
}
|
|
13734
13628
|
|
|
13629
|
+
/*
|
|
13630
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13631
|
+
* Licensed under the MIT License.
|
|
13632
|
+
*/
|
|
13633
|
+
function deserializeResponse(responseString, responseLocation, logger) {
|
|
13634
|
+
// Deserialize hash fragment response parameters.
|
|
13635
|
+
const serverParams = getDeserializedResponse(responseString);
|
|
13636
|
+
if (!serverParams) {
|
|
13637
|
+
if (!stripLeadingHashOrQuery(responseString)) {
|
|
13638
|
+
// Hash or Query string is empty
|
|
13639
|
+
logger.error(`The request has returned to the redirectUri but a ${responseLocation} is not present. It's likely that the ${responseLocation} has been removed or the page has been redirected by code running on the redirectUri page.`);
|
|
13640
|
+
throw createBrowserAuthError(hashEmptyError);
|
|
13641
|
+
}
|
|
13642
|
+
else {
|
|
13643
|
+
logger.error(`A ${responseLocation} is present in the iframe but it does not contain known properties. It's likely that the ${responseLocation} has been replaced by code running on the redirectUri page.`);
|
|
13644
|
+
logger.errorPii(`The ${responseLocation} detected is: ${responseString}`);
|
|
13645
|
+
throw createBrowserAuthError(hashDoesNotContainKnownProperties);
|
|
13646
|
+
}
|
|
13647
|
+
}
|
|
13648
|
+
return serverParams;
|
|
13649
|
+
}
|
|
13650
|
+
/**
|
|
13651
|
+
* Returns the interaction type that the response object belongs to
|
|
13652
|
+
*/
|
|
13653
|
+
function validateInteractionType(response, browserCrypto, interactionType) {
|
|
13654
|
+
if (!response.state) {
|
|
13655
|
+
throw createBrowserAuthError(noStateInHash);
|
|
13656
|
+
}
|
|
13657
|
+
const platformStateObj = extractBrowserRequestState(browserCrypto, response.state);
|
|
13658
|
+
if (!platformStateObj) {
|
|
13659
|
+
throw createBrowserAuthError(unableToParseState);
|
|
13660
|
+
}
|
|
13661
|
+
if (platformStateObj.interactionType !== interactionType) {
|
|
13662
|
+
throw createBrowserAuthError(stateInteractionTypeMismatch);
|
|
13663
|
+
}
|
|
13664
|
+
}
|
|
13665
|
+
|
|
13735
13666
|
/*
|
|
13736
13667
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13737
13668
|
* Licensed under the MIT License.
|
|
@@ -13840,9 +13771,8 @@
|
|
|
13840
13771
|
const popupWindow = this.initiateAuthRequest(navigateUrl, popupParameters);
|
|
13841
13772
|
this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
|
|
13842
13773
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
13843
|
-
const
|
|
13844
|
-
|
|
13845
|
-
const serverParams = UrlString.getDeserializedHash(hash);
|
|
13774
|
+
const responseString = await this.monitorPopupForHash(popupWindow);
|
|
13775
|
+
const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.serverResponseType, this.logger);
|
|
13846
13776
|
// Remove throttle if it exists
|
|
13847
13777
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
|
|
13848
13778
|
if (serverParams.accountId) {
|
|
@@ -13866,7 +13796,7 @@
|
|
|
13866
13796
|
});
|
|
13867
13797
|
}
|
|
13868
13798
|
// Handle response from hash string.
|
|
13869
|
-
const result = await interactionHandler.
|
|
13799
|
+
const result = await interactionHandler.handleCodeResponse(serverParams, validRequest);
|
|
13870
13800
|
return result;
|
|
13871
13801
|
}
|
|
13872
13802
|
catch (e) {
|
|
@@ -13933,7 +13863,9 @@
|
|
|
13933
13863
|
popup,
|
|
13934
13864
|
});
|
|
13935
13865
|
this.eventHandler.emitEvent(EventType.POPUP_OPENED, exports.InteractionType.Popup, { popupWindow }, null);
|
|
13936
|
-
await this.
|
|
13866
|
+
await this.monitorPopupForHash(popupWindow).catch(() => {
|
|
13867
|
+
// Swallow any errors related to monitoring the window. Server logout is best effort
|
|
13868
|
+
});
|
|
13937
13869
|
if (mainWindowRedirectUri) {
|
|
13938
13870
|
const navigationOptions = {
|
|
13939
13871
|
apiId: ApiId.logoutPopup,
|
|
@@ -13989,25 +13921,16 @@
|
|
|
13989
13921
|
*/
|
|
13990
13922
|
monitorPopupForHash(popupWindow) {
|
|
13991
13923
|
return new Promise((resolve, reject) => {
|
|
13992
|
-
/*
|
|
13993
|
-
* Polling for popups needs to be tick-based,
|
|
13994
|
-
* since a non-trivial amount of time can be spent on interaction (which should not count against the timeout).
|
|
13995
|
-
*/
|
|
13996
|
-
const maxTicks = this.config.system.windowHashTimeout /
|
|
13997
|
-
this.config.system.pollIntervalMilliseconds;
|
|
13998
|
-
let ticks = 0;
|
|
13999
13924
|
this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");
|
|
14000
13925
|
const intervalId = setInterval(() => {
|
|
14001
13926
|
// Window is closed
|
|
14002
13927
|
if (popupWindow.closed) {
|
|
14003
13928
|
this.logger.error("PopupHandler.monitorPopupForHash - window closed");
|
|
14004
|
-
this.cleanPopup();
|
|
14005
13929
|
clearInterval(intervalId);
|
|
14006
13930
|
reject(createBrowserAuthError(userCancelled));
|
|
14007
13931
|
return;
|
|
14008
13932
|
}
|
|
14009
|
-
let href =
|
|
14010
|
-
let serverResponseString = Constants.EMPTY_STRING;
|
|
13933
|
+
let href = "";
|
|
14011
13934
|
try {
|
|
14012
13935
|
/*
|
|
14013
13936
|
* Will throw if cross origin,
|
|
@@ -14015,77 +13938,28 @@
|
|
|
14015
13938
|
* since we need the interval to keep running while on STS UI.
|
|
14016
13939
|
*/
|
|
14017
13940
|
href = popupWindow.location.href;
|
|
14018
|
-
serverResponseString =
|
|
14019
|
-
this.extractServerResponseStringFromPopup(popupWindow, href);
|
|
14020
13941
|
}
|
|
14021
13942
|
catch (e) { }
|
|
14022
13943
|
// Don't process blank pages or cross domain
|
|
14023
13944
|
if (!href || href === "about:blank") {
|
|
14024
13945
|
return;
|
|
14025
13946
|
}
|
|
14026
|
-
|
|
14027
|
-
|
|
14028
|
-
|
|
14029
|
-
|
|
14030
|
-
|
|
14031
|
-
|
|
14032
|
-
if (serverResponseString) {
|
|
14033
|
-
this.logger.verbose("PopupHandler.monitorPopupForHash - found hash in url");
|
|
14034
|
-
clearInterval(intervalId);
|
|
14035
|
-
this.cleanPopup(popupWindow);
|
|
14036
|
-
if (UrlString.hashContainsKnownProperties(serverResponseString)) {
|
|
14037
|
-
this.logger.verbose("PopupHandler.monitorPopupForHash - hash contains known properties, returning.");
|
|
14038
|
-
resolve(serverResponseString);
|
|
13947
|
+
clearInterval(intervalId);
|
|
13948
|
+
let responseString = "";
|
|
13949
|
+
const responseType = this.config.auth.OIDCOptions.serverResponseType;
|
|
13950
|
+
if (popupWindow) {
|
|
13951
|
+
if (responseType === ServerResponseType.QUERY) {
|
|
13952
|
+
responseString = popupWindow.location.search;
|
|
14039
13953
|
}
|
|
14040
13954
|
else {
|
|
14041
|
-
|
|
14042
|
-
this.logger.errorPii(`PopupHandler.monitorPopupForHash - hash found: ${serverResponseString}`);
|
|
14043
|
-
reject(createBrowserAuthError(hashDoesNotContainKnownProperties));
|
|
13955
|
+
responseString = popupWindow.location.hash;
|
|
14044
13956
|
}
|
|
14045
13957
|
}
|
|
14046
|
-
|
|
14047
|
-
|
|
14048
|
-
clearInterval(intervalId);
|
|
14049
|
-
reject(createBrowserAuthError(monitorPopupTimeout));
|
|
14050
|
-
}
|
|
14051
|
-
}, this.config.system.pollIntervalMilliseconds);
|
|
14052
|
-
});
|
|
14053
|
-
}
|
|
14054
|
-
/**
|
|
14055
|
-
* Waits for user interaction in logout popup window
|
|
14056
|
-
* @param popupWindow
|
|
14057
|
-
* @returns
|
|
14058
|
-
*/
|
|
14059
|
-
waitForLogoutPopup(popupWindow) {
|
|
14060
|
-
return new Promise((resolve) => {
|
|
14061
|
-
this.logger.verbose("PopupHandler.waitForLogoutPopup - polling started");
|
|
14062
|
-
const intervalId = setInterval(() => {
|
|
14063
|
-
// Window is closed
|
|
14064
|
-
if (popupWindow.closed) {
|
|
14065
|
-
this.logger.error("PopupHandler.waitForLogoutPopup - window closed");
|
|
14066
|
-
this.cleanPopup();
|
|
14067
|
-
clearInterval(intervalId);
|
|
14068
|
-
resolve();
|
|
14069
|
-
}
|
|
14070
|
-
let href = Constants.EMPTY_STRING;
|
|
14071
|
-
try {
|
|
14072
|
-
/*
|
|
14073
|
-
* Will throw if cross origin,
|
|
14074
|
-
* which should be caught and ignored
|
|
14075
|
-
* since we need the interval to keep running while on STS UI.
|
|
14076
|
-
*/
|
|
14077
|
-
href = popupWindow.location.href;
|
|
14078
|
-
}
|
|
14079
|
-
catch (e) { }
|
|
14080
|
-
// Don't process blank pages or cross domain
|
|
14081
|
-
if (!href || href === "about:blank") {
|
|
14082
|
-
return;
|
|
14083
|
-
}
|
|
14084
|
-
this.logger.verbose("PopupHandler.waitForLogoutPopup - popup window is on same origin as caller, closing.");
|
|
14085
|
-
clearInterval(intervalId);
|
|
14086
|
-
this.cleanPopup(popupWindow);
|
|
14087
|
-
resolve();
|
|
13958
|
+
this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller");
|
|
13959
|
+
resolve(responseString);
|
|
14088
13960
|
}, this.config.system.pollIntervalMilliseconds);
|
|
13961
|
+
}).finally(() => {
|
|
13962
|
+
this.cleanPopup(popupWindow);
|
|
14089
13963
|
});
|
|
14090
13964
|
}
|
|
14091
13965
|
/**
|
|
@@ -14220,20 +14094,6 @@
|
|
|
14220
14094
|
const homeAccountId = request.account && request.account.homeAccountId;
|
|
14221
14095
|
return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;
|
|
14222
14096
|
}
|
|
14223
|
-
/**
|
|
14224
|
-
* Extracts the server response from the popup window
|
|
14225
|
-
*/
|
|
14226
|
-
extractServerResponseStringFromPopup(popupWindow, href) {
|
|
14227
|
-
let serverResponseString;
|
|
14228
|
-
if (this.config.auth.OIDCOptions?.serverResponseType ===
|
|
14229
|
-
ServerResponseType.QUERY) {
|
|
14230
|
-
serverResponseString = UrlString.parseQueryServerResponse(href);
|
|
14231
|
-
}
|
|
14232
|
-
else {
|
|
14233
|
-
serverResponseString = popupWindow.location.hash;
|
|
14234
|
-
}
|
|
14235
|
-
return serverResponseString;
|
|
14236
|
-
}
|
|
14237
14097
|
}
|
|
14238
14098
|
|
|
14239
14099
|
/*
|
|
@@ -14302,12 +14162,8 @@
|
|
|
14302
14162
|
* Handle authorization code response in the window.
|
|
14303
14163
|
* @param hash
|
|
14304
14164
|
*/
|
|
14305
|
-
async
|
|
14165
|
+
async handleCodeResponse(response, state) {
|
|
14306
14166
|
this.logger.verbose("RedirectHandler.handleCodeResponse called");
|
|
14307
|
-
// Check that location hash isn't empty.
|
|
14308
|
-
if (!locationHash) {
|
|
14309
|
-
throw createBrowserAuthError(hashEmptyError);
|
|
14310
|
-
}
|
|
14311
14167
|
// Interaction is completed - remove interaction status.
|
|
14312
14168
|
this.browserStorage.setInteractionInProgress(false);
|
|
14313
14169
|
// Handle code response.
|
|
@@ -14318,7 +14174,7 @@
|
|
|
14318
14174
|
}
|
|
14319
14175
|
let authCodeResponse;
|
|
14320
14176
|
try {
|
|
14321
|
-
authCodeResponse = this.authModule.handleFragmentResponse(
|
|
14177
|
+
authCodeResponse = this.authModule.handleFragmentResponse(response, requestState);
|
|
14322
14178
|
}
|
|
14323
14179
|
catch (e) {
|
|
14324
14180
|
if (e instanceof ServerError &&
|
|
@@ -14447,22 +14303,10 @@
|
|
|
14447
14303
|
this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null.");
|
|
14448
14304
|
return null;
|
|
14449
14305
|
}
|
|
14450
|
-
const
|
|
14451
|
-
if (!
|
|
14306
|
+
const [serverParams, responseString] = this.getRedirectResponse(hash || "");
|
|
14307
|
+
if (!serverParams) {
|
|
14452
14308
|
// Not a recognized server response hash or hash not associated with a redirect request
|
|
14453
|
-
this.logger.info("handleRedirectPromise did not detect a response
|
|
14454
|
-
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
|
|
14455
|
-
return null;
|
|
14456
|
-
}
|
|
14457
|
-
let state;
|
|
14458
|
-
try {
|
|
14459
|
-
// Deserialize hash fragment response parameters.
|
|
14460
|
-
const serverParams = UrlString.getDeserializedHash(responseHash);
|
|
14461
|
-
state = this.validateAndExtractStateFromHash(serverParams, exports.InteractionType.Redirect);
|
|
14462
|
-
this.logger.verbose("State extracted from hash");
|
|
14463
|
-
}
|
|
14464
|
-
catch (e) {
|
|
14465
|
-
this.logger.info(`handleRedirectPromise was unable to extract state due to: ${e}`);
|
|
14309
|
+
this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache.");
|
|
14466
14310
|
this.browserStorage.cleanRequestByInteractionType(exports.InteractionType.Redirect);
|
|
14467
14311
|
return null;
|
|
14468
14312
|
}
|
|
@@ -14473,17 +14317,17 @@
|
|
|
14473
14317
|
if (loginRequestUrlNormalized === currentUrlNormalized &&
|
|
14474
14318
|
this.config.auth.navigateToLoginRequestUrl) {
|
|
14475
14319
|
// We are on the page we need to navigate to - handle hash
|
|
14476
|
-
this.logger.verbose("Current page is loginRequestUrl, handling
|
|
14477
|
-
const handleHashResult = await this.handleHash(responseHash, state, serverTelemetryManager);
|
|
14320
|
+
this.logger.verbose("Current page is loginRequestUrl, handling response");
|
|
14478
14321
|
if (loginRequestUrl.indexOf("#") > -1) {
|
|
14479
14322
|
// Replace current hash with non-msal hash, if present
|
|
14480
14323
|
replaceHash(loginRequestUrl);
|
|
14481
14324
|
}
|
|
14325
|
+
const handleHashResult = await this.handleResponse(serverParams, serverTelemetryManager);
|
|
14482
14326
|
return handleHashResult;
|
|
14483
14327
|
}
|
|
14484
14328
|
else if (!this.config.auth.navigateToLoginRequestUrl) {
|
|
14485
|
-
this.logger.verbose("NavigateToLoginRequestUrl set to false, handling
|
|
14486
|
-
return this.
|
|
14329
|
+
this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response");
|
|
14330
|
+
return this.handleResponse(serverParams, serverTelemetryManager);
|
|
14487
14331
|
}
|
|
14488
14332
|
else if (!isInIframe() ||
|
|
14489
14333
|
this.config.system.allowRedirectInIframe) {
|
|
@@ -14491,7 +14335,7 @@
|
|
|
14491
14335
|
* Returned from authority using redirect - need to perform navigation before processing response
|
|
14492
14336
|
* Cache the hash to be retrieved after the next redirect
|
|
14493
14337
|
*/
|
|
14494
|
-
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH,
|
|
14338
|
+
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseString, true);
|
|
14495
14339
|
const navigationOptions = {
|
|
14496
14340
|
apiId: ApiId.handleRedirectPromise,
|
|
14497
14341
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
@@ -14519,7 +14363,7 @@
|
|
|
14519
14363
|
}
|
|
14520
14364
|
// If navigateInternal implementation returns false, handle the hash now
|
|
14521
14365
|
if (!processHashOnRedirect) {
|
|
14522
|
-
return this.
|
|
14366
|
+
return this.handleResponse(serverParams, serverTelemetryManager);
|
|
14523
14367
|
}
|
|
14524
14368
|
}
|
|
14525
14369
|
return null;
|
|
@@ -14538,29 +14382,57 @@
|
|
|
14538
14382
|
* Returns null if interactionType in the state value is not "redirect" or the hash does not contain known properties
|
|
14539
14383
|
* @param hash
|
|
14540
14384
|
*/
|
|
14541
|
-
|
|
14385
|
+
getRedirectResponse(userProvidedResponse) {
|
|
14542
14386
|
this.logger.verbose("getRedirectResponseHash called");
|
|
14543
14387
|
// Get current location hash from window or cache.
|
|
14544
|
-
|
|
14545
|
-
if (
|
|
14388
|
+
let responseString = userProvidedResponse;
|
|
14389
|
+
if (!responseString) {
|
|
14390
|
+
if (this.config.auth.OIDCOptions.serverResponseType ===
|
|
14391
|
+
ServerResponseType.QUERY) {
|
|
14392
|
+
responseString = window.location.search;
|
|
14393
|
+
}
|
|
14394
|
+
else {
|
|
14395
|
+
responseString = window.location.hash;
|
|
14396
|
+
}
|
|
14397
|
+
}
|
|
14398
|
+
let response = getDeserializedResponse(responseString);
|
|
14399
|
+
if (response) {
|
|
14400
|
+
try {
|
|
14401
|
+
validateInteractionType(response, this.browserCrypto, exports.InteractionType.Redirect);
|
|
14402
|
+
}
|
|
14403
|
+
catch (e) {
|
|
14404
|
+
if (e instanceof AuthError) {
|
|
14405
|
+
this.logger.error(`Interaction type validation failed due to ${e.errorCode}: ${e.errorMessage}`);
|
|
14406
|
+
}
|
|
14407
|
+
return [null, ""];
|
|
14408
|
+
}
|
|
14546
14409
|
clearHash(window);
|
|
14547
14410
|
this.logger.verbose("Hash contains known properties, returning response hash");
|
|
14548
|
-
return
|
|
14411
|
+
return [response, responseString];
|
|
14549
14412
|
}
|
|
14550
14413
|
const cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
|
|
14551
14414
|
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
|
14552
|
-
|
|
14553
|
-
|
|
14415
|
+
if (cachedHash) {
|
|
14416
|
+
response = getDeserializedResponse(cachedHash);
|
|
14417
|
+
if (response) {
|
|
14418
|
+
this.logger.verbose("Hash does not contain known properties, returning cached hash");
|
|
14419
|
+
return [response, cachedHash];
|
|
14420
|
+
}
|
|
14421
|
+
}
|
|
14422
|
+
return [null, ""];
|
|
14554
14423
|
}
|
|
14555
14424
|
/**
|
|
14556
14425
|
* Checks if hash exists and handles in window.
|
|
14557
14426
|
* @param hash
|
|
14558
14427
|
* @param state
|
|
14559
14428
|
*/
|
|
14560
|
-
async
|
|
14429
|
+
async handleResponse(serverParams, serverTelemetryManager) {
|
|
14430
|
+
const state = serverParams.state;
|
|
14431
|
+
if (!state) {
|
|
14432
|
+
throw createBrowserAuthError(noStateInHash);
|
|
14433
|
+
}
|
|
14561
14434
|
const cachedRequest = this.browserStorage.getCachedRequest(state);
|
|
14562
|
-
this.logger.verbose("
|
|
14563
|
-
const serverParams = UrlString.getDeserializedHash(hash);
|
|
14435
|
+
this.logger.verbose("handleResponse called, retrieved cached request");
|
|
14564
14436
|
if (serverParams.accountId) {
|
|
14565
14437
|
this.logger.verbose("Account id found in hash, calling WAM for token");
|
|
14566
14438
|
if (!this.nativeMessageHandler) {
|
|
@@ -14586,7 +14458,7 @@
|
|
|
14586
14458
|
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, currentAuthority);
|
|
14587
14459
|
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);
|
|
14588
14460
|
const interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.performanceClient);
|
|
14589
|
-
return await interactionHandler.
|
|
14461
|
+
return await interactionHandler.handleCodeResponse(serverParams, state);
|
|
14590
14462
|
}
|
|
14591
14463
|
/**
|
|
14592
14464
|
* Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
|
|
@@ -14697,7 +14569,7 @@
|
|
|
14697
14569
|
* @param iframe
|
|
14698
14570
|
* @param timeout
|
|
14699
14571
|
*/
|
|
14700
|
-
async function monitorIframeForHash(iframe, timeout, pollIntervalMilliseconds, performanceClient, logger, correlationId) {
|
|
14572
|
+
async function monitorIframeForHash(iframe, timeout, pollIntervalMilliseconds, performanceClient, logger, correlationId, responseType) {
|
|
14701
14573
|
performanceClient.addQueueMeasurement(PerformanceEvents.SilentHandlerMonitorIframeForHash, correlationId);
|
|
14702
14574
|
return new Promise((resolve, reject) => {
|
|
14703
14575
|
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
@@ -14726,12 +14598,18 @@
|
|
|
14726
14598
|
if (!href || href === "about:blank") {
|
|
14727
14599
|
return;
|
|
14728
14600
|
}
|
|
14729
|
-
|
|
14730
|
-
|
|
14731
|
-
|
|
14601
|
+
let responseString = "";
|
|
14602
|
+
if (contentWindow) {
|
|
14603
|
+
if (responseType === ServerResponseType.QUERY) {
|
|
14604
|
+
responseString = contentWindow.location.search;
|
|
14605
|
+
}
|
|
14606
|
+
else {
|
|
14607
|
+
responseString = contentWindow.location.hash;
|
|
14608
|
+
}
|
|
14609
|
+
}
|
|
14732
14610
|
window.clearTimeout(timeoutId);
|
|
14733
14611
|
window.clearInterval(intervalId);
|
|
14734
|
-
resolve(
|
|
14612
|
+
resolve(responseString);
|
|
14735
14613
|
}, pollIntervalMilliseconds);
|
|
14736
14614
|
}).finally(() => {
|
|
14737
14615
|
invoke(removeHiddenIframe, PerformanceEvents.RemoveHiddenIframe, logger, performanceClient, correlationId)(iframe);
|
|
@@ -14874,20 +14752,10 @@
|
|
|
14874
14752
|
const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
|
14875
14753
|
// Get the frame handle for the silent request
|
|
14876
14754
|
const msalFrame = await invokeAsync(initiateAuthRequest, PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(navigateUrl, this.performanceClient, this.logger, correlationId, this.config.system.navigateFrameWait);
|
|
14755
|
+
const responseType = this.config.auth.OIDCOptions.serverResponseType;
|
|
14877
14756
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
14878
|
-
const
|
|
14879
|
-
|
|
14880
|
-
// No hash is present
|
|
14881
|
-
this.logger.error("The request has returned to the redirectUri but a hash is not present in the iframe. It's likely that the hash has been removed or the page has been redirected by code running on the redirectUri page.");
|
|
14882
|
-
throw createBrowserAuthError(hashEmptyError);
|
|
14883
|
-
}
|
|
14884
|
-
else if (!UrlString.hashContainsKnownProperties(hash)) {
|
|
14885
|
-
this.logger.error("A hash is present in the iframe but it does not contain known properties. It's likely that the hash has been replaced by code running on the redirectUri page.");
|
|
14886
|
-
this.logger.errorPii(`The hash detected in the iframe is: ${hash}`);
|
|
14887
|
-
throw createBrowserAuthError(hashDoesNotContainKnownProperties);
|
|
14888
|
-
}
|
|
14889
|
-
// Deserialize hash fragment response parameters.
|
|
14890
|
-
const serverParams = UrlString.getDeserializedHash(hash);
|
|
14757
|
+
const responseString = await invokeAsync(monitorIframeForHash, PerformanceEvents.SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(msalFrame, this.config.system.iframeHashTimeout, this.config.system.pollIntervalMilliseconds, this.performanceClient, this.logger, correlationId, responseType);
|
|
14758
|
+
const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, responseType, this.logger);
|
|
14891
14759
|
if (serverParams.accountId) {
|
|
14892
14760
|
this.logger.verbose("Account id found in hash, calling WAM for token");
|
|
14893
14761
|
if (!this.nativeMessageHandler) {
|
|
@@ -14902,7 +14770,7 @@
|
|
|
14902
14770
|
});
|
|
14903
14771
|
}
|
|
14904
14772
|
// Handle response from hash string
|
|
14905
|
-
return invokeAsync(interactionHandler.
|
|
14773
|
+
return invokeAsync(interactionHandler.handleCodeResponse.bind(interactionHandler), PerformanceEvents.HandleCodeResponse, this.logger, this.performanceClient, correlationId)(serverParams, silentRequest);
|
|
14906
14774
|
}
|
|
14907
14775
|
}
|
|
14908
14776
|
|
|
@@ -15373,12 +15241,6 @@
|
|
|
15373
15241
|
this.logger.verbose("handleRedirectPromise called");
|
|
15374
15242
|
// Block token acquisition before initialize has been called
|
|
15375
15243
|
blockAPICallsBeforeInitialize(this.initialized);
|
|
15376
|
-
let foundServerResponse = hash;
|
|
15377
|
-
if (this.config.auth.OIDCOptions?.serverResponseType ===
|
|
15378
|
-
ServerResponseType.QUERY) {
|
|
15379
|
-
const url = window.location.href;
|
|
15380
|
-
foundServerResponse = UrlString.parseQueryServerResponse(url);
|
|
15381
|
-
}
|
|
15382
15244
|
const loggedInAccounts = this.getAllAccounts();
|
|
15383
15245
|
if (this.isBrowserEnvironment) {
|
|
15384
15246
|
/**
|
|
@@ -15386,7 +15248,7 @@
|
|
|
15386
15248
|
* otherwise return the promise from the first invocation. Prevents race conditions when handleRedirectPromise is called
|
|
15387
15249
|
* several times concurrently.
|
|
15388
15250
|
*/
|
|
15389
|
-
const redirectResponseKey =
|
|
15251
|
+
const redirectResponseKey = hash || "";
|
|
15390
15252
|
let response = this.redirectResponse.get(redirectResponseKey);
|
|
15391
15253
|
if (typeof response === "undefined") {
|
|
15392
15254
|
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, exports.InteractionType.Redirect);
|
|
@@ -15396,7 +15258,7 @@
|
|
|
15396
15258
|
if (request &&
|
|
15397
15259
|
NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) &&
|
|
15398
15260
|
this.nativeExtensionProvider &&
|
|
15399
|
-
!
|
|
15261
|
+
!hash) {
|
|
15400
15262
|
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
|
|
15401
15263
|
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
|
|
15402
15264
|
redirectResponse = nativeClient.handleRedirectPromise();
|
|
@@ -15406,7 +15268,7 @@
|
|
|
15406
15268
|
const correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;
|
|
15407
15269
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
15408
15270
|
redirectResponse =
|
|
15409
|
-
redirectClient.handleRedirectPromise(
|
|
15271
|
+
redirectClient.handleRedirectPromise(hash);
|
|
15410
15272
|
}
|
|
15411
15273
|
response = redirectResponse
|
|
15412
15274
|
.then((result) => {
|
|
@@ -15471,19 +15333,19 @@
|
|
|
15471
15333
|
}
|
|
15472
15334
|
let result;
|
|
15473
15335
|
if (this.nativeExtensionProvider && this.canUseNative(request)) {
|
|
15474
|
-
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage,
|
|
15336
|
+
const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
|
|
15475
15337
|
result = nativeClient
|
|
15476
15338
|
.acquireTokenRedirect(request)
|
|
15477
15339
|
.catch((e) => {
|
|
15478
15340
|
if (e instanceof NativeAuthError &&
|
|
15479
15341
|
isFatalNativeAuthError(e)) {
|
|
15480
15342
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
15481
|
-
const redirectClient = this.createRedirectClient(
|
|
15343
|
+
const redirectClient = this.createRedirectClient(correlationId);
|
|
15482
15344
|
return redirectClient.acquireToken(request);
|
|
15483
15345
|
}
|
|
15484
15346
|
else if (e instanceof InteractionRequiredAuthError) {
|
|
15485
15347
|
this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
|
|
15486
|
-
const redirectClient = this.createRedirectClient(
|
|
15348
|
+
const redirectClient = this.createRedirectClient(correlationId);
|
|
15487
15349
|
return redirectClient.acquireToken(request);
|
|
15488
15350
|
}
|
|
15489
15351
|
this.getBrowserStorage().setInteractionInProgress(false);
|
|
@@ -15491,7 +15353,7 @@
|
|
|
15491
15353
|
});
|
|
15492
15354
|
}
|
|
15493
15355
|
else {
|
|
15494
|
-
const redirectClient = this.createRedirectClient(
|
|
15356
|
+
const redirectClient = this.createRedirectClient(correlationId);
|
|
15495
15357
|
result = redirectClient.acquireToken(request);
|
|
15496
15358
|
}
|
|
15497
15359
|
return result.catch((e) => {
|
|
@@ -15535,7 +15397,10 @@
|
|
|
15535
15397
|
}
|
|
15536
15398
|
let result;
|
|
15537
15399
|
if (this.canUseNative(request)) {
|
|
15538
|
-
result = this.acquireTokenNative(
|
|
15400
|
+
result = this.acquireTokenNative({
|
|
15401
|
+
...request,
|
|
15402
|
+
correlationId,
|
|
15403
|
+
}, ApiId.acquireTokenPopup)
|
|
15539
15404
|
.then((response) => {
|
|
15540
15405
|
this.getBrowserStorage().setInteractionInProgress(false);
|
|
15541
15406
|
atPopupMeasurement.end({
|
|
@@ -15549,12 +15414,12 @@
|
|
|
15549
15414
|
if (e instanceof NativeAuthError &&
|
|
15550
15415
|
isFatalNativeAuthError(e)) {
|
|
15551
15416
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
15552
|
-
const popupClient = this.createPopupClient(
|
|
15417
|
+
const popupClient = this.createPopupClient(correlationId);
|
|
15553
15418
|
return popupClient.acquireToken(request);
|
|
15554
15419
|
}
|
|
15555
15420
|
else if (e instanceof InteractionRequiredAuthError) {
|
|
15556
15421
|
this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");
|
|
15557
|
-
const popupClient = this.createPopupClient(
|
|
15422
|
+
const popupClient = this.createPopupClient(correlationId);
|
|
15558
15423
|
return popupClient.acquireToken(request);
|
|
15559
15424
|
}
|
|
15560
15425
|
this.getBrowserStorage().setInteractionInProgress(false);
|
|
@@ -15562,7 +15427,7 @@
|
|
|
15562
15427
|
});
|
|
15563
15428
|
}
|
|
15564
15429
|
else {
|
|
15565
|
-
const popupClient = this.createPopupClient(
|
|
15430
|
+
const popupClient = this.createPopupClient(correlationId);
|
|
15566
15431
|
result = popupClient.acquireToken(request);
|
|
15567
15432
|
}
|
|
15568
15433
|
return result
|
|
@@ -15705,7 +15570,7 @@
|
|
|
15705
15570
|
this.preflightBrowserEnvironmentCheck(exports.InteractionType.Silent);
|
|
15706
15571
|
this.logger.trace("acquireTokenByCode called", correlationId);
|
|
15707
15572
|
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, exports.InteractionType.Silent, request);
|
|
15708
|
-
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode,
|
|
15573
|
+
const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, correlationId);
|
|
15709
15574
|
try {
|
|
15710
15575
|
if (request.code && request.nativeAccountId) {
|
|
15711
15576
|
// Throw error in case server returns both spa_code and spa_accountid in exchange for auth code.
|
|
@@ -15747,14 +15612,17 @@
|
|
|
15747
15612
|
this.hybridAuthCodeResponses.set(hybridAuthCode, response);
|
|
15748
15613
|
}
|
|
15749
15614
|
else {
|
|
15750
|
-
this.logger.verbose("Existing acquireTokenByCode request found",
|
|
15615
|
+
this.logger.verbose("Existing acquireTokenByCode request found", correlationId);
|
|
15751
15616
|
atbcMeasurement.discard();
|
|
15752
15617
|
}
|
|
15753
15618
|
return response;
|
|
15754
15619
|
}
|
|
15755
15620
|
else if (request.nativeAccountId) {
|
|
15756
15621
|
if (this.canUseNative(request, request.nativeAccountId)) {
|
|
15757
|
-
return this.acquireTokenNative(
|
|
15622
|
+
return this.acquireTokenNative({
|
|
15623
|
+
...request,
|
|
15624
|
+
correlationId,
|
|
15625
|
+
}, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e) => {
|
|
15758
15626
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
15759
15627
|
if (e instanceof NativeAuthError &&
|
|
15760
15628
|
isFatalNativeAuthError(e)) {
|
|
@@ -16395,6 +16263,7 @@
|
|
|
16395
16263
|
resourceRequestUri: request.resourceRequestUri,
|
|
16396
16264
|
shrClaims: request.shrClaims,
|
|
16397
16265
|
sshKid: request.sshKid,
|
|
16266
|
+
shrOptions: request.shrOptions,
|
|
16398
16267
|
};
|
|
16399
16268
|
const silentRequestKey = JSON.stringify(thumbprint);
|
|
16400
16269
|
const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
|
|
@@ -18554,6 +18423,7 @@
|
|
|
18554
18423
|
exports.InteractionRequiredAuthErrorCodes = InteractionRequiredAuthErrorCodes;
|
|
18555
18424
|
exports.InteractionRequiredAuthErrorMessage = InteractionRequiredAuthErrorMessage;
|
|
18556
18425
|
exports.InteractionStatus = InteractionStatus;
|
|
18426
|
+
exports.JsonWebTokenTypes = JsonWebTokenTypes;
|
|
18557
18427
|
exports.Logger = Logger;
|
|
18558
18428
|
exports.MemoryStorage = MemoryStorage;
|
|
18559
18429
|
exports.NavigationClient = NavigationClient;
|