@azure/msal-common 14.6.0 → 14.6.2-alpha.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/account/AccountInfo.mjs +1 -1
- package/dist/account/AuthToken.mjs +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.d.ts +2 -2
- package/dist/authority/Authority.d.ts.map +1 -1
- package/dist/authority/Authority.mjs +8 -4
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.d.ts +12 -25
- package/dist/authority/AuthorityFactory.d.ts.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +23 -44
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.d.ts +9 -469
- package/dist/authority/AuthorityMetadata.d.ts.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +16 -482
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -1
- package/dist/authority/AuthorityType.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist/authority/ProtocolMode.mjs +1 -1
- package/dist/authority/RegionDiscovery.mjs +1 -1
- package/dist/cache/CacheManager.mjs +1 -1
- package/dist/cache/entities/AccountEntity.mjs +1 -1
- package/dist/cache/entities/CacheRecord.mjs +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +5 -5
- package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +3 -3
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/BaseClient.d.ts.map +1 -1
- package/dist/client/BaseClient.mjs +3 -3
- package/dist/client/BaseClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +4 -4
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.mjs +5 -5
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +1 -1
- package/dist/constants/AADServerParamKeys.mjs +1 -1
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +3 -3
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/index.cjs +116 -576
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +5 -3
- package/dist/index.mjs.map +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/NetworkManager.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.d.ts.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/RequestParameterBuilder.mjs +1 -1
- package/dist/request/RequestValidator.mjs +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +2 -2
- package/dist/response/ResponseHandler.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist/telemetry/performance/PerformanceEvent.mjs +1 -1
- package/dist/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist/telemetry/server/ServerTelemetryManager.mjs +1 -1
- package/dist/url/UrlString.mjs +1 -1
- package/dist/utils/Constants.mjs +1 -1
- package/dist/utils/FunctionWrappers.d.ts.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +11 -1
- package/dist/utils/FunctionWrappers.mjs.map +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.d.ts +23 -25
- package/dist/utils/TimeUtils.d.ts.map +1 -1
- package/dist/utils/TimeUtils.mjs +38 -40
- package/dist/utils/TimeUtils.mjs.map +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/package.json +3 -3
- package/src/authority/Authority.ts +12 -5
- package/src/authority/AuthorityFactory.ts +48 -92
- package/src/authority/AuthorityMetadata.ts +23 -526
- package/src/cache/utils/CacheHelpers.ts +1 -1
- package/src/client/AuthorizationCodeClient.ts +1 -1
- package/src/client/BaseClient.ts +10 -11
- package/src/client/RefreshTokenClient.ts +1 -1
- package/src/client/SilentFlowClient.ts +1 -1
- package/src/crypto/PopTokenGenerator.ts +1 -1
- package/src/index.ts +2 -2
- package/src/packageMetadata.ts +1 -1
- package/src/response/ResponseHandler.ts +1 -1
- package/src/utils/FunctionWrappers.ts +16 -0
- package/src/utils/TimeUtils.ts +37 -38
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-common v14.6.0 2024-01-
|
|
1
|
+
/*! @azure/msal-common v14.6.2-alpha.0 2024-01-30 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
@@ -943,7 +943,7 @@ class Logger {
|
|
|
943
943
|
|
|
944
944
|
/* eslint-disable header/header */
|
|
945
945
|
const name = "@azure/msal-common";
|
|
946
|
-
const version = "14.6.0";
|
|
946
|
+
const version = "14.6.2-alpha.0";
|
|
947
947
|
|
|
948
948
|
/*
|
|
949
949
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1035,46 +1035,52 @@ var AuthToken = /*#__PURE__*/Object.freeze({
|
|
|
1035
1035
|
* Licensed under the MIT License.
|
|
1036
1036
|
*/
|
|
1037
1037
|
/**
|
|
1038
|
-
* Utility
|
|
1038
|
+
* Utility functions for managing date and time operations.
|
|
1039
1039
|
*/
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
return cachedAtSec > TimeUtils.nowSeconds();
|
|
1068
|
-
}
|
|
1069
|
-
/**
|
|
1070
|
-
* Waits for t number of milliseconds
|
|
1071
|
-
* @param t number
|
|
1072
|
-
* @param value T
|
|
1073
|
-
*/
|
|
1074
|
-
static delay(t, value) {
|
|
1075
|
-
return new Promise((resolve) => setTimeout(() => resolve(value), t));
|
|
1076
|
-
}
|
|
1040
|
+
/**
|
|
1041
|
+
* return the current time in Unix time (seconds).
|
|
1042
|
+
*/
|
|
1043
|
+
function nowSeconds() {
|
|
1044
|
+
// Date.getTime() returns in milliseconds.
|
|
1045
|
+
return Math.round(new Date().getTime() / 1000.0);
|
|
1046
|
+
}
|
|
1047
|
+
/**
|
|
1048
|
+
* check if a token is expired based on given UTC time in seconds.
|
|
1049
|
+
* @param expiresOn
|
|
1050
|
+
*/
|
|
1051
|
+
function isTokenExpired(expiresOn, offset) {
|
|
1052
|
+
// check for access token expiry
|
|
1053
|
+
const expirationSec = Number(expiresOn) || 0;
|
|
1054
|
+
const offsetCurrentTimeSec = nowSeconds() + offset;
|
|
1055
|
+
// If current time + offset is greater than token expiration time, then token is expired.
|
|
1056
|
+
return offsetCurrentTimeSec > expirationSec;
|
|
1057
|
+
}
|
|
1058
|
+
/**
|
|
1059
|
+
* If the current time is earlier than the time that a token was cached at, we must discard the token
|
|
1060
|
+
* i.e. The system clock was turned back after acquiring the cached token
|
|
1061
|
+
* @param cachedAt
|
|
1062
|
+
* @param offset
|
|
1063
|
+
*/
|
|
1064
|
+
function wasClockTurnedBack(cachedAt) {
|
|
1065
|
+
const cachedAtSec = Number(cachedAt);
|
|
1066
|
+
return cachedAtSec > nowSeconds();
|
|
1077
1067
|
}
|
|
1068
|
+
/**
|
|
1069
|
+
* Waits for t number of milliseconds
|
|
1070
|
+
* @param t number
|
|
1071
|
+
* @param value T
|
|
1072
|
+
*/
|
|
1073
|
+
function delay(t, value) {
|
|
1074
|
+
return new Promise((resolve) => setTimeout(() => resolve(value), t));
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
var TimeUtils = /*#__PURE__*/Object.freeze({
|
|
1078
|
+
__proto__: null,
|
|
1079
|
+
delay: delay,
|
|
1080
|
+
isTokenExpired: isTokenExpired,
|
|
1081
|
+
nowSeconds: nowSeconds,
|
|
1082
|
+
wasClockTurnedBack: wasClockTurnedBack
|
|
1083
|
+
});
|
|
1078
1084
|
|
|
1079
1085
|
/*
|
|
1080
1086
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1132,7 +1138,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
|
|
|
1132
1138
|
homeAccountId: homeAccountId,
|
|
1133
1139
|
credentialType: CredentialType.ACCESS_TOKEN,
|
|
1134
1140
|
secret: accessToken,
|
|
1135
|
-
cachedAt:
|
|
1141
|
+
cachedAt: nowSeconds().toString(),
|
|
1136
1142
|
expiresOn: expiresOn.toString(),
|
|
1137
1143
|
extendedExpiresOn: extExpiresOn.toString(),
|
|
1138
1144
|
environment: environment,
|
|
@@ -1376,7 +1382,7 @@ function isAuthorityMetadataEntity(key, entity) {
|
|
|
1376
1382
|
* Reset the exiresAt value
|
|
1377
1383
|
*/
|
|
1378
1384
|
function generateAuthorityMetadataExpiresAt() {
|
|
1379
|
-
return (
|
|
1385
|
+
return (nowSeconds() +
|
|
1380
1386
|
AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS);
|
|
1381
1387
|
}
|
|
1382
1388
|
function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {
|
|
@@ -1398,7 +1404,7 @@ function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetw
|
|
|
1398
1404
|
* Returns whether or not the data needs to be refreshed
|
|
1399
1405
|
*/
|
|
1400
1406
|
function isAuthorityMetadataExpired(metadata) {
|
|
1401
|
-
return metadata.expiresAt <=
|
|
1407
|
+
return metadata.expiresAt <= nowSeconds();
|
|
1402
1408
|
}
|
|
1403
1409
|
|
|
1404
1410
|
var CacheHelpers = /*#__PURE__*/Object.freeze({
|
|
@@ -2514,496 +2520,30 @@ class UrlString {
|
|
|
2514
2520
|
*/
|
|
2515
2521
|
const rawMetdataJSON = {
|
|
2516
2522
|
endpointMetadata: {
|
|
2517
|
-
"
|
|
2518
|
-
token_endpoint: "https://login.microsoftonline.com/
|
|
2519
|
-
|
|
2520
|
-
"client_secret_post",
|
|
2521
|
-
"private_key_jwt",
|
|
2522
|
-
"client_secret_basic",
|
|
2523
|
-
],
|
|
2524
|
-
jwks_uri: "https://login.microsoftonline.com/common/discovery/v2.0/keys",
|
|
2525
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2526
|
-
subject_types_supported: ["pairwise"],
|
|
2527
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2528
|
-
response_types_supported: [
|
|
2529
|
-
"code",
|
|
2530
|
-
"id_token",
|
|
2531
|
-
"code id_token",
|
|
2532
|
-
"id_token token",
|
|
2533
|
-
],
|
|
2534
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2535
|
-
issuer: "https://login.microsoftonline.com/{tenantid}/v2.0",
|
|
2536
|
-
request_uri_parameter_supported: false,
|
|
2537
|
-
userinfo_endpoint: "https://graph.microsoft.com/oidc/userinfo",
|
|
2538
|
-
authorization_endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/authorize",
|
|
2539
|
-
device_authorization_endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/devicecode",
|
|
2540
|
-
http_logout_supported: true,
|
|
2541
|
-
frontchannel_logout_supported: true,
|
|
2542
|
-
end_session_endpoint: "https://login.microsoftonline.com/common/oauth2/v2.0/logout",
|
|
2543
|
-
claims_supported: [
|
|
2544
|
-
"sub",
|
|
2545
|
-
"iss",
|
|
2546
|
-
"cloud_instance_name",
|
|
2547
|
-
"cloud_instance_host_name",
|
|
2548
|
-
"cloud_graph_host_name",
|
|
2549
|
-
"msgraph_host",
|
|
2550
|
-
"aud",
|
|
2551
|
-
"exp",
|
|
2552
|
-
"iat",
|
|
2553
|
-
"auth_time",
|
|
2554
|
-
"acr",
|
|
2555
|
-
"nonce",
|
|
2556
|
-
"preferred_username",
|
|
2557
|
-
"name",
|
|
2558
|
-
"tid",
|
|
2559
|
-
"ver",
|
|
2560
|
-
"at_hash",
|
|
2561
|
-
"c_hash",
|
|
2562
|
-
"email",
|
|
2563
|
-
],
|
|
2564
|
-
kerberos_endpoint: "https://login.microsoftonline.com/common/kerberos",
|
|
2565
|
-
tenant_region_scope: null,
|
|
2566
|
-
cloud_instance_name: "microsoftonline.com",
|
|
2567
|
-
cloud_graph_host_name: "graph.windows.net",
|
|
2568
|
-
msgraph_host: "graph.microsoft.com",
|
|
2569
|
-
rbac_url: "https://pas.windows.net",
|
|
2570
|
-
},
|
|
2571
|
-
"https://login.chinacloudapi.cn/common/": {
|
|
2572
|
-
token_endpoint: "https://login.chinacloudapi.cn/common/oauth2/v2.0/token",
|
|
2573
|
-
token_endpoint_auth_methods_supported: [
|
|
2574
|
-
"client_secret_post",
|
|
2575
|
-
"private_key_jwt",
|
|
2576
|
-
"client_secret_basic",
|
|
2577
|
-
],
|
|
2578
|
-
jwks_uri: "https://login.chinacloudapi.cn/common/discovery/v2.0/keys",
|
|
2579
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2580
|
-
subject_types_supported: ["pairwise"],
|
|
2581
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2582
|
-
response_types_supported: [
|
|
2583
|
-
"code",
|
|
2584
|
-
"id_token",
|
|
2585
|
-
"code id_token",
|
|
2586
|
-
"id_token token",
|
|
2587
|
-
],
|
|
2588
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2589
|
-
issuer: "https://login.partner.microsoftonline.cn/{tenantid}/v2.0",
|
|
2590
|
-
request_uri_parameter_supported: false,
|
|
2591
|
-
userinfo_endpoint: "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",
|
|
2592
|
-
authorization_endpoint: "https://login.chinacloudapi.cn/common/oauth2/v2.0/authorize",
|
|
2593
|
-
device_authorization_endpoint: "https://login.chinacloudapi.cn/common/oauth2/v2.0/devicecode",
|
|
2594
|
-
http_logout_supported: true,
|
|
2595
|
-
frontchannel_logout_supported: true,
|
|
2596
|
-
end_session_endpoint: "https://login.chinacloudapi.cn/common/oauth2/v2.0/logout",
|
|
2597
|
-
claims_supported: [
|
|
2598
|
-
"sub",
|
|
2599
|
-
"iss",
|
|
2600
|
-
"cloud_instance_name",
|
|
2601
|
-
"cloud_instance_host_name",
|
|
2602
|
-
"cloud_graph_host_name",
|
|
2603
|
-
"msgraph_host",
|
|
2604
|
-
"aud",
|
|
2605
|
-
"exp",
|
|
2606
|
-
"iat",
|
|
2607
|
-
"auth_time",
|
|
2608
|
-
"acr",
|
|
2609
|
-
"nonce",
|
|
2610
|
-
"preferred_username",
|
|
2611
|
-
"name",
|
|
2612
|
-
"tid",
|
|
2613
|
-
"ver",
|
|
2614
|
-
"at_hash",
|
|
2615
|
-
"c_hash",
|
|
2616
|
-
"email",
|
|
2617
|
-
],
|
|
2618
|
-
kerberos_endpoint: "https://login.chinacloudapi.cn/common/kerberos",
|
|
2619
|
-
tenant_region_scope: null,
|
|
2620
|
-
cloud_instance_name: "partner.microsoftonline.cn",
|
|
2621
|
-
cloud_graph_host_name: "graph.chinacloudapi.cn",
|
|
2622
|
-
msgraph_host: "microsoftgraph.chinacloudapi.cn",
|
|
2623
|
-
rbac_url: "https://pas.chinacloudapi.cn",
|
|
2624
|
-
},
|
|
2625
|
-
"https://login.microsoftonline.us/common/": {
|
|
2626
|
-
token_endpoint: "https://login.microsoftonline.us/common/oauth2/v2.0/token",
|
|
2627
|
-
token_endpoint_auth_methods_supported: [
|
|
2628
|
-
"client_secret_post",
|
|
2629
|
-
"private_key_jwt",
|
|
2630
|
-
"client_secret_basic",
|
|
2631
|
-
],
|
|
2632
|
-
jwks_uri: "https://login.microsoftonline.us/common/discovery/v2.0/keys",
|
|
2633
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2634
|
-
subject_types_supported: ["pairwise"],
|
|
2635
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2636
|
-
response_types_supported: [
|
|
2637
|
-
"code",
|
|
2638
|
-
"id_token",
|
|
2639
|
-
"code id_token",
|
|
2640
|
-
"id_token token",
|
|
2641
|
-
],
|
|
2642
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2643
|
-
issuer: "https://login.microsoftonline.us/{tenantid}/v2.0",
|
|
2644
|
-
request_uri_parameter_supported: false,
|
|
2645
|
-
userinfo_endpoint: "https://graph.microsoft.com/oidc/userinfo",
|
|
2646
|
-
authorization_endpoint: "https://login.microsoftonline.us/common/oauth2/v2.0/authorize",
|
|
2647
|
-
device_authorization_endpoint: "https://login.microsoftonline.us/common/oauth2/v2.0/devicecode",
|
|
2648
|
-
http_logout_supported: true,
|
|
2649
|
-
frontchannel_logout_supported: true,
|
|
2650
|
-
end_session_endpoint: "https://login.microsoftonline.us/common/oauth2/v2.0/logout",
|
|
2651
|
-
claims_supported: [
|
|
2652
|
-
"sub",
|
|
2653
|
-
"iss",
|
|
2654
|
-
"cloud_instance_name",
|
|
2655
|
-
"cloud_instance_host_name",
|
|
2656
|
-
"cloud_graph_host_name",
|
|
2657
|
-
"msgraph_host",
|
|
2658
|
-
"aud",
|
|
2659
|
-
"exp",
|
|
2660
|
-
"iat",
|
|
2661
|
-
"auth_time",
|
|
2662
|
-
"acr",
|
|
2663
|
-
"nonce",
|
|
2664
|
-
"preferred_username",
|
|
2665
|
-
"name",
|
|
2666
|
-
"tid",
|
|
2667
|
-
"ver",
|
|
2668
|
-
"at_hash",
|
|
2669
|
-
"c_hash",
|
|
2670
|
-
"email",
|
|
2671
|
-
],
|
|
2672
|
-
kerberos_endpoint: "https://login.microsoftonline.us/common/kerberos",
|
|
2673
|
-
tenant_region_scope: null,
|
|
2674
|
-
cloud_instance_name: "microsoftonline.us",
|
|
2675
|
-
cloud_graph_host_name: "graph.windows.net",
|
|
2676
|
-
msgraph_host: "graph.microsoft.com",
|
|
2677
|
-
rbac_url: "https://pasff.usgovcloudapi.net",
|
|
2678
|
-
},
|
|
2679
|
-
"https://login.microsoftonline.com/consumers/": {
|
|
2680
|
-
token_endpoint: "https://login.microsoftonline.com/consumers/oauth2/v2.0/token",
|
|
2681
|
-
token_endpoint_auth_methods_supported: [
|
|
2682
|
-
"client_secret_post",
|
|
2683
|
-
"private_key_jwt",
|
|
2684
|
-
"client_secret_basic",
|
|
2685
|
-
],
|
|
2686
|
-
jwks_uri: "https://login.microsoftonline.com/consumers/discovery/v2.0/keys",
|
|
2687
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2688
|
-
subject_types_supported: ["pairwise"],
|
|
2689
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2690
|
-
response_types_supported: [
|
|
2691
|
-
"code",
|
|
2692
|
-
"id_token",
|
|
2693
|
-
"code id_token",
|
|
2694
|
-
"id_token token",
|
|
2695
|
-
],
|
|
2696
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2697
|
-
issuer: "https://login.microsoftonline.com/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",
|
|
2698
|
-
request_uri_parameter_supported: false,
|
|
2699
|
-
userinfo_endpoint: "https://graph.microsoft.com/oidc/userinfo",
|
|
2700
|
-
authorization_endpoint: "https://login.microsoftonline.com/consumers/oauth2/v2.0/authorize",
|
|
2701
|
-
device_authorization_endpoint: "https://login.microsoftonline.com/consumers/oauth2/v2.0/devicecode",
|
|
2702
|
-
http_logout_supported: true,
|
|
2703
|
-
frontchannel_logout_supported: true,
|
|
2704
|
-
end_session_endpoint: "https://login.microsoftonline.com/consumers/oauth2/v2.0/logout",
|
|
2705
|
-
claims_supported: [
|
|
2706
|
-
"sub",
|
|
2707
|
-
"iss",
|
|
2708
|
-
"cloud_instance_name",
|
|
2709
|
-
"cloud_instance_host_name",
|
|
2710
|
-
"cloud_graph_host_name",
|
|
2711
|
-
"msgraph_host",
|
|
2712
|
-
"aud",
|
|
2713
|
-
"exp",
|
|
2714
|
-
"iat",
|
|
2715
|
-
"auth_time",
|
|
2716
|
-
"acr",
|
|
2717
|
-
"nonce",
|
|
2718
|
-
"preferred_username",
|
|
2719
|
-
"name",
|
|
2720
|
-
"tid",
|
|
2721
|
-
"ver",
|
|
2722
|
-
"at_hash",
|
|
2723
|
-
"c_hash",
|
|
2724
|
-
"email",
|
|
2725
|
-
],
|
|
2726
|
-
kerberos_endpoint: "https://login.microsoftonline.com/consumers/kerberos",
|
|
2727
|
-
tenant_region_scope: null,
|
|
2728
|
-
cloud_instance_name: "microsoftonline.com",
|
|
2729
|
-
cloud_graph_host_name: "graph.windows.net",
|
|
2730
|
-
msgraph_host: "graph.microsoft.com",
|
|
2731
|
-
rbac_url: "https://pas.windows.net",
|
|
2732
|
-
},
|
|
2733
|
-
"https://login.chinacloudapi.cn/consumers/": {
|
|
2734
|
-
token_endpoint: "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/token",
|
|
2735
|
-
token_endpoint_auth_methods_supported: [
|
|
2736
|
-
"client_secret_post",
|
|
2737
|
-
"private_key_jwt",
|
|
2738
|
-
"client_secret_basic",
|
|
2739
|
-
],
|
|
2740
|
-
jwks_uri: "https://login.chinacloudapi.cn/consumers/discovery/v2.0/keys",
|
|
2741
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2742
|
-
subject_types_supported: ["pairwise"],
|
|
2743
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2744
|
-
response_types_supported: [
|
|
2745
|
-
"code",
|
|
2746
|
-
"id_token",
|
|
2747
|
-
"code id_token",
|
|
2748
|
-
"id_token token",
|
|
2749
|
-
],
|
|
2750
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2751
|
-
issuer: "https://login.partner.microsoftonline.cn/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",
|
|
2752
|
-
request_uri_parameter_supported: false,
|
|
2753
|
-
userinfo_endpoint: "https://microsoftgraph.chinacloudapi.cn/oidc/userinfo",
|
|
2754
|
-
authorization_endpoint: "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/authorize",
|
|
2755
|
-
device_authorization_endpoint: "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/devicecode",
|
|
2756
|
-
http_logout_supported: true,
|
|
2757
|
-
frontchannel_logout_supported: true,
|
|
2758
|
-
end_session_endpoint: "https://login.chinacloudapi.cn/consumers/oauth2/v2.0/logout",
|
|
2759
|
-
claims_supported: [
|
|
2760
|
-
"sub",
|
|
2761
|
-
"iss",
|
|
2762
|
-
"cloud_instance_name",
|
|
2763
|
-
"cloud_instance_host_name",
|
|
2764
|
-
"cloud_graph_host_name",
|
|
2765
|
-
"msgraph_host",
|
|
2766
|
-
"aud",
|
|
2767
|
-
"exp",
|
|
2768
|
-
"iat",
|
|
2769
|
-
"auth_time",
|
|
2770
|
-
"acr",
|
|
2771
|
-
"nonce",
|
|
2772
|
-
"preferred_username",
|
|
2773
|
-
"name",
|
|
2774
|
-
"tid",
|
|
2775
|
-
"ver",
|
|
2776
|
-
"at_hash",
|
|
2777
|
-
"c_hash",
|
|
2778
|
-
"email",
|
|
2779
|
-
],
|
|
2780
|
-
kerberos_endpoint: "https://login.chinacloudapi.cn/consumers/kerberos",
|
|
2781
|
-
tenant_region_scope: null,
|
|
2782
|
-
cloud_instance_name: "partner.microsoftonline.cn",
|
|
2783
|
-
cloud_graph_host_name: "graph.chinacloudapi.cn",
|
|
2784
|
-
msgraph_host: "microsoftgraph.chinacloudapi.cn",
|
|
2785
|
-
rbac_url: "https://pas.chinacloudapi.cn",
|
|
2786
|
-
},
|
|
2787
|
-
"https://login.microsoftonline.us/consumers/": {
|
|
2788
|
-
token_endpoint: "https://login.microsoftonline.us/consumers/oauth2/v2.0/token",
|
|
2789
|
-
token_endpoint_auth_methods_supported: [
|
|
2790
|
-
"client_secret_post",
|
|
2791
|
-
"private_key_jwt",
|
|
2792
|
-
"client_secret_basic",
|
|
2793
|
-
],
|
|
2794
|
-
jwks_uri: "https://login.microsoftonline.us/consumers/discovery/v2.0/keys",
|
|
2795
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2796
|
-
subject_types_supported: ["pairwise"],
|
|
2797
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2798
|
-
response_types_supported: [
|
|
2799
|
-
"code",
|
|
2800
|
-
"id_token",
|
|
2801
|
-
"code id_token",
|
|
2802
|
-
"id_token token",
|
|
2803
|
-
],
|
|
2804
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2805
|
-
issuer: "https://login.microsoftonline.us/9188040d-6c67-4c5b-b112-36a304b66dad/v2.0",
|
|
2806
|
-
request_uri_parameter_supported: false,
|
|
2807
|
-
userinfo_endpoint: "https://graph.microsoft.com/oidc/userinfo",
|
|
2808
|
-
authorization_endpoint: "https://login.microsoftonline.us/consumers/oauth2/v2.0/authorize",
|
|
2809
|
-
device_authorization_endpoint: "https://login.microsoftonline.us/consumers/oauth2/v2.0/devicecode",
|
|
2810
|
-
http_logout_supported: true,
|
|
2811
|
-
frontchannel_logout_supported: true,
|
|
2812
|
-
end_session_endpoint: "https://login.microsoftonline.us/consumers/oauth2/v2.0/logout",
|
|
2813
|
-
claims_supported: [
|
|
2814
|
-
"sub",
|
|
2815
|
-
"iss",
|
|
2816
|
-
"cloud_instance_name",
|
|
2817
|
-
"cloud_instance_host_name",
|
|
2818
|
-
"cloud_graph_host_name",
|
|
2819
|
-
"msgraph_host",
|
|
2820
|
-
"aud",
|
|
2821
|
-
"exp",
|
|
2822
|
-
"iat",
|
|
2823
|
-
"auth_time",
|
|
2824
|
-
"acr",
|
|
2825
|
-
"nonce",
|
|
2826
|
-
"preferred_username",
|
|
2827
|
-
"name",
|
|
2828
|
-
"tid",
|
|
2829
|
-
"ver",
|
|
2830
|
-
"at_hash",
|
|
2831
|
-
"c_hash",
|
|
2832
|
-
"email",
|
|
2833
|
-
],
|
|
2834
|
-
kerberos_endpoint: "https://login.microsoftonline.us/consumers/kerberos",
|
|
2835
|
-
tenant_region_scope: null,
|
|
2836
|
-
cloud_instance_name: "microsoftonline.us",
|
|
2837
|
-
cloud_graph_host_name: "graph.windows.net",
|
|
2838
|
-
msgraph_host: "graph.microsoft.com",
|
|
2839
|
-
rbac_url: "https://pasff.usgovcloudapi.net",
|
|
2840
|
-
},
|
|
2841
|
-
"https://login.microsoftonline.com/organizations/": {
|
|
2842
|
-
token_endpoint: "https://login.microsoftonline.com/organizations/oauth2/v2.0/token",
|
|
2843
|
-
token_endpoint_auth_methods_supported: [
|
|
2844
|
-
"client_secret_post",
|
|
2845
|
-
"private_key_jwt",
|
|
2846
|
-
"client_secret_basic",
|
|
2847
|
-
],
|
|
2848
|
-
jwks_uri: "https://login.microsoftonline.com/organizations/discovery/v2.0/keys",
|
|
2849
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2850
|
-
subject_types_supported: ["pairwise"],
|
|
2851
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2852
|
-
response_types_supported: [
|
|
2853
|
-
"code",
|
|
2854
|
-
"id_token",
|
|
2855
|
-
"code id_token",
|
|
2856
|
-
"id_token token",
|
|
2857
|
-
],
|
|
2858
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2523
|
+
"login.microsoftonline.com": {
|
|
2524
|
+
token_endpoint: "https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/token",
|
|
2525
|
+
jwks_uri: "https://login.microsoftonline.com/{tenantid}/discovery/v2.0/keys",
|
|
2859
2526
|
issuer: "https://login.microsoftonline.com/{tenantid}/v2.0",
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
authorization_endpoint: "https://login.microsoftonline.com/organizations/oauth2/v2.0/authorize",
|
|
2863
|
-
device_authorization_endpoint: "https://login.microsoftonline.com/organizations/oauth2/v2.0/devicecode",
|
|
2864
|
-
http_logout_supported: true,
|
|
2865
|
-
frontchannel_logout_supported: true,
|
|
2866
|
-
end_session_endpoint: "https://login.microsoftonline.com/organizations/oauth2/v2.0/logout",
|
|
2867
|
-
claims_supported: [
|
|
2868
|
-
"sub",
|
|
2869
|
-
"iss",
|
|
2870
|
-
"cloud_instance_name",
|
|
2871
|
-
"cloud_instance_host_name",
|
|
2872
|
-
"cloud_graph_host_name",
|
|
2873
|
-
"msgraph_host",
|
|
2874
|
-
"aud",
|
|
2875
|
-
"exp",
|
|
2876
|
-
"iat",
|
|
2877
|
-
"auth_time",
|
|
2878
|
-
"acr",
|
|
2879
|
-
"nonce",
|
|
2880
|
-
"preferred_username",
|
|
2881
|
-
"name",
|
|
2882
|
-
"tid",
|
|
2883
|
-
"ver",
|
|
2884
|
-
"at_hash",
|
|
2885
|
-
"c_hash",
|
|
2886
|
-
"email",
|
|
2887
|
-
],
|
|
2888
|
-
kerberos_endpoint: "https://login.microsoftonline.com/organizations/kerberos",
|
|
2889
|
-
tenant_region_scope: null,
|
|
2890
|
-
cloud_instance_name: "microsoftonline.com",
|
|
2891
|
-
cloud_graph_host_name: "graph.windows.net",
|
|
2892
|
-
msgraph_host: "graph.microsoft.com",
|
|
2893
|
-
rbac_url: "https://pas.windows.net",
|
|
2527
|
+
authorization_endpoint: "https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/authorize",
|
|
2528
|
+
end_session_endpoint: "https://login.microsoftonline.com/{tenantid}/oauth2/v2.0/logout",
|
|
2894
2529
|
},
|
|
2895
|
-
"
|
|
2896
|
-
token_endpoint: "https://login.chinacloudapi.cn/
|
|
2897
|
-
|
|
2898
|
-
"client_secret_post",
|
|
2899
|
-
"private_key_jwt",
|
|
2900
|
-
"client_secret_basic",
|
|
2901
|
-
],
|
|
2902
|
-
jwks_uri: "https://login.chinacloudapi.cn/organizations/discovery/v2.0/keys",
|
|
2903
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2904
|
-
subject_types_supported: ["pairwise"],
|
|
2905
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2906
|
-
response_types_supported: [
|
|
2907
|
-
"code",
|
|
2908
|
-
"id_token",
|
|
2909
|
-
"code id_token",
|
|
2910
|
-
"id_token token",
|
|
2911
|
-
],
|
|
2912
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2530
|
+
"login.chinacloudapi.cn": {
|
|
2531
|
+
token_endpoint: "https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/token",
|
|
2532
|
+
jwks_uri: "https://login.chinacloudapi.cn/{tenantid}/discovery/v2.0/keys",
|
|
2913
2533
|
issuer: "https://login.partner.microsoftonline.cn/{tenantid}/v2.0",
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
authorization_endpoint: "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/authorize",
|
|
2917
|
-
device_authorization_endpoint: "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/devicecode",
|
|
2918
|
-
http_logout_supported: true,
|
|
2919
|
-
frontchannel_logout_supported: true,
|
|
2920
|
-
end_session_endpoint: "https://login.chinacloudapi.cn/organizations/oauth2/v2.0/logout",
|
|
2921
|
-
claims_supported: [
|
|
2922
|
-
"sub",
|
|
2923
|
-
"iss",
|
|
2924
|
-
"cloud_instance_name",
|
|
2925
|
-
"cloud_instance_host_name",
|
|
2926
|
-
"cloud_graph_host_name",
|
|
2927
|
-
"msgraph_host",
|
|
2928
|
-
"aud",
|
|
2929
|
-
"exp",
|
|
2930
|
-
"iat",
|
|
2931
|
-
"auth_time",
|
|
2932
|
-
"acr",
|
|
2933
|
-
"nonce",
|
|
2934
|
-
"preferred_username",
|
|
2935
|
-
"name",
|
|
2936
|
-
"tid",
|
|
2937
|
-
"ver",
|
|
2938
|
-
"at_hash",
|
|
2939
|
-
"c_hash",
|
|
2940
|
-
"email",
|
|
2941
|
-
],
|
|
2942
|
-
kerberos_endpoint: "https://login.chinacloudapi.cn/organizations/kerberos",
|
|
2943
|
-
tenant_region_scope: null,
|
|
2944
|
-
cloud_instance_name: "partner.microsoftonline.cn",
|
|
2945
|
-
cloud_graph_host_name: "graph.chinacloudapi.cn",
|
|
2946
|
-
msgraph_host: "microsoftgraph.chinacloudapi.cn",
|
|
2947
|
-
rbac_url: "https://pas.chinacloudapi.cn",
|
|
2534
|
+
authorization_endpoint: "https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/authorize",
|
|
2535
|
+
end_session_endpoint: "https://login.chinacloudapi.cn/{tenantid}/oauth2/v2.0/logout",
|
|
2948
2536
|
},
|
|
2949
|
-
"
|
|
2950
|
-
token_endpoint: "https://login.microsoftonline.us/
|
|
2951
|
-
|
|
2952
|
-
"client_secret_post",
|
|
2953
|
-
"private_key_jwt",
|
|
2954
|
-
"client_secret_basic",
|
|
2955
|
-
],
|
|
2956
|
-
jwks_uri: "https://login.microsoftonline.us/organizations/discovery/v2.0/keys",
|
|
2957
|
-
response_modes_supported: ["query", "fragment", "form_post"],
|
|
2958
|
-
subject_types_supported: ["pairwise"],
|
|
2959
|
-
id_token_signing_alg_values_supported: ["RS256"],
|
|
2960
|
-
response_types_supported: [
|
|
2961
|
-
"code",
|
|
2962
|
-
"id_token",
|
|
2963
|
-
"code id_token",
|
|
2964
|
-
"id_token token",
|
|
2965
|
-
],
|
|
2966
|
-
scopes_supported: ["openid", "profile", "email", "offline_access"],
|
|
2537
|
+
"login.microsoftonline.us": {
|
|
2538
|
+
token_endpoint: "https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/token",
|
|
2539
|
+
jwks_uri: "https://login.microsoftonline.us/{tenantid}/discovery/v2.0/keys",
|
|
2967
2540
|
issuer: "https://login.microsoftonline.us/{tenantid}/v2.0",
|
|
2968
|
-
|
|
2969
|
-
|
|
2970
|
-
authorization_endpoint: "https://login.microsoftonline.us/organizations/oauth2/v2.0/authorize",
|
|
2971
|
-
device_authorization_endpoint: "https://login.microsoftonline.us/organizations/oauth2/v2.0/devicecode",
|
|
2972
|
-
http_logout_supported: true,
|
|
2973
|
-
frontchannel_logout_supported: true,
|
|
2974
|
-
end_session_endpoint: "https://login.microsoftonline.us/organizations/oauth2/v2.0/logout",
|
|
2975
|
-
claims_supported: [
|
|
2976
|
-
"sub",
|
|
2977
|
-
"iss",
|
|
2978
|
-
"cloud_instance_name",
|
|
2979
|
-
"cloud_instance_host_name",
|
|
2980
|
-
"cloud_graph_host_name",
|
|
2981
|
-
"msgraph_host",
|
|
2982
|
-
"aud",
|
|
2983
|
-
"exp",
|
|
2984
|
-
"iat",
|
|
2985
|
-
"auth_time",
|
|
2986
|
-
"acr",
|
|
2987
|
-
"nonce",
|
|
2988
|
-
"preferred_username",
|
|
2989
|
-
"name",
|
|
2990
|
-
"tid",
|
|
2991
|
-
"ver",
|
|
2992
|
-
"at_hash",
|
|
2993
|
-
"c_hash",
|
|
2994
|
-
"email",
|
|
2995
|
-
],
|
|
2996
|
-
kerberos_endpoint: "https://login.microsoftonline.us/organizations/kerberos",
|
|
2997
|
-
tenant_region_scope: null,
|
|
2998
|
-
cloud_instance_name: "microsoftonline.us",
|
|
2999
|
-
cloud_graph_host_name: "graph.windows.net",
|
|
3000
|
-
msgraph_host: "graph.microsoft.com",
|
|
3001
|
-
rbac_url: "https://pasff.usgovcloudapi.net",
|
|
2541
|
+
authorization_endpoint: "https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/authorize",
|
|
2542
|
+
end_session_endpoint: "https://login.microsoftonline.us/{tenantid}/oauth2/v2.0/logout",
|
|
3002
2543
|
},
|
|
3003
2544
|
},
|
|
3004
2545
|
instanceDiscoveryMetadata: {
|
|
3005
2546
|
tenant_discovery_endpoint: "https://{canonicalAuthority}/v2.0/.well-known/openid-configuration",
|
|
3006
|
-
"api-version": "1.1",
|
|
3007
2547
|
metadata: [
|
|
3008
2548
|
{
|
|
3009
2549
|
preferred_network: "login.microsoftonline.com",
|
|
@@ -5483,6 +5023,11 @@ const invoke = (callback, eventName, logger, telemetryClient, correlationId) =>
|
|
|
5483
5023
|
return (...args) => {
|
|
5484
5024
|
logger.trace(`Executing function ${eventName}`);
|
|
5485
5025
|
const inProgressEvent = telemetryClient?.startMeasurement(eventName, correlationId);
|
|
5026
|
+
if (correlationId) {
|
|
5027
|
+
// Track number of times this API is called in a single request
|
|
5028
|
+
const eventCount = eventName + "CallCount";
|
|
5029
|
+
telemetryClient?.incrementFields({ [eventCount]: 1 }, correlationId);
|
|
5030
|
+
}
|
|
5486
5031
|
try {
|
|
5487
5032
|
const result = callback(...args);
|
|
5488
5033
|
inProgressEvent?.end({
|
|
@@ -5523,6 +5068,11 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
5523
5068
|
return (...args) => {
|
|
5524
5069
|
logger.trace(`Executing function ${eventName}`);
|
|
5525
5070
|
const inProgressEvent = telemetryClient?.startMeasurement(eventName, correlationId);
|
|
5071
|
+
if (correlationId) {
|
|
5072
|
+
// Track number of times this API is called in a single request
|
|
5073
|
+
const eventCount = eventName + "CallCount";
|
|
5074
|
+
telemetryClient?.incrementFields({ [eventCount]: 1 }, correlationId);
|
|
5075
|
+
}
|
|
5526
5076
|
telemetryClient?.setPreQueueTime(eventName, correlationId);
|
|
5527
5077
|
return callback(...args)
|
|
5528
5078
|
.then((response) => {
|
|
@@ -5665,7 +5215,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
5665
5215
|
* @internal
|
|
5666
5216
|
*/
|
|
5667
5217
|
class Authority {
|
|
5668
|
-
constructor(authority, networkInterface, cacheManager, authorityOptions, logger,
|
|
5218
|
+
constructor(authority, networkInterface, cacheManager, authorityOptions, logger, correlationId, performanceClient) {
|
|
5669
5219
|
this.canonicalAuthority = authority;
|
|
5670
5220
|
this._canonicalAuthority.validateAsUri();
|
|
5671
5221
|
this.networkInterface = networkInterface;
|
|
@@ -5902,6 +5452,10 @@ class Authority {
|
|
|
5902
5452
|
this.updateCachedMetadata(metadataEntity, cloudDiscoverySource, {
|
|
5903
5453
|
source: endpointSource,
|
|
5904
5454
|
});
|
|
5455
|
+
this.performanceClient?.addFields({
|
|
5456
|
+
cloudDiscoverySource: cloudDiscoverySource,
|
|
5457
|
+
authorityEndpointSource: endpointSource,
|
|
5458
|
+
}, this.correlationId);
|
|
5905
5459
|
}
|
|
5906
5460
|
/**
|
|
5907
5461
|
* Returns metadata entity from cache if it exists, otherwiser returns a new metadata entity built
|
|
@@ -6093,8 +5647,8 @@ class Authority {
|
|
|
6093
5647
|
* Get OAuth endpoints for common authorities.
|
|
6094
5648
|
*/
|
|
6095
5649
|
getEndpointMetadataFromHardcodedValues() {
|
|
6096
|
-
if (this.
|
|
6097
|
-
return EndpointMetadata[this.
|
|
5650
|
+
if (this.hostnameAndPort in EndpointMetadata) {
|
|
5651
|
+
return EndpointMetadata[this.hostnameAndPort];
|
|
6098
5652
|
}
|
|
6099
5653
|
return null;
|
|
6100
5654
|
}
|
|
@@ -6486,50 +6040,36 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
6486
6040
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6487
6041
|
* Licensed under the MIT License.
|
|
6488
6042
|
*/
|
|
6489
|
-
/**
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
|
|
6495
|
-
|
|
6496
|
-
|
|
6497
|
-
|
|
6498
|
-
|
|
6499
|
-
|
|
6500
|
-
|
|
6501
|
-
|
|
6502
|
-
|
|
6503
|
-
|
|
6504
|
-
|
|
6505
|
-
|
|
6506
|
-
|
|
6507
|
-
|
|
6508
|
-
return acquireTokenAuthority;
|
|
6509
|
-
}
|
|
6510
|
-
catch (e) {
|
|
6511
|
-
throw createClientAuthError(endpointResolutionError);
|
|
6512
|
-
}
|
|
6043
|
+
/**
|
|
6044
|
+
* Create an authority object of the correct type based on the url
|
|
6045
|
+
* Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)
|
|
6046
|
+
*
|
|
6047
|
+
* Also performs endpoint discovery.
|
|
6048
|
+
*
|
|
6049
|
+
* @param authorityUri
|
|
6050
|
+
* @param networkClient
|
|
6051
|
+
* @param protocolMode
|
|
6052
|
+
* @internal
|
|
6053
|
+
*/
|
|
6054
|
+
async function createDiscoveredInstance(authorityUri, networkClient, cacheManager, authorityOptions, logger, correlationId, performanceClient) {
|
|
6055
|
+
performanceClient?.addQueueMeasurement(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, correlationId);
|
|
6056
|
+
const authorityUriFinal = Authority.transformCIAMAuthority(formatAuthorityUri(authorityUri));
|
|
6057
|
+
// Initialize authority and perform discovery endpoint check.
|
|
6058
|
+
const acquireTokenAuthority = new Authority(authorityUriFinal, networkClient, cacheManager, authorityOptions, logger, correlationId, performanceClient);
|
|
6059
|
+
try {
|
|
6060
|
+
await invokeAsync(acquireTokenAuthority.resolveEndpointsAsync.bind(acquireTokenAuthority), PerformanceEvents.AuthorityResolveEndpointsAsync, logger, performanceClient, correlationId)();
|
|
6061
|
+
return acquireTokenAuthority;
|
|
6513
6062
|
}
|
|
6514
|
-
|
|
6515
|
-
|
|
6516
|
-
* Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)
|
|
6517
|
-
*
|
|
6518
|
-
* Does not perform endpoint discovery.
|
|
6519
|
-
*
|
|
6520
|
-
* @param authorityUrl
|
|
6521
|
-
* @param networkInterface
|
|
6522
|
-
* @param protocolMode
|
|
6523
|
-
*/
|
|
6524
|
-
static createInstance(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId) {
|
|
6525
|
-
// Throw error if authority url is empty
|
|
6526
|
-
if (!authorityUrl) {
|
|
6527
|
-
throw createClientConfigurationError(urlEmptyError);
|
|
6528
|
-
}
|
|
6529
|
-
return new Authority(authorityUrl, networkInterface, cacheManager, authorityOptions, logger, performanceClient, correlationId);
|
|
6063
|
+
catch (e) {
|
|
6064
|
+
throw createClientAuthError(endpointResolutionError);
|
|
6530
6065
|
}
|
|
6531
6066
|
}
|
|
6532
6067
|
|
|
6068
|
+
var AuthorityFactory = /*#__PURE__*/Object.freeze({
|
|
6069
|
+
__proto__: null,
|
|
6070
|
+
createDiscoveredInstance: createDiscoveredInstance
|
|
6071
|
+
});
|
|
6072
|
+
|
|
6533
6073
|
/*
|
|
6534
6074
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6535
6075
|
* Licensed under the MIT License.
|
|
@@ -6615,7 +6155,7 @@ class BaseClient {
|
|
|
6615
6155
|
async updateAuthority(cloudInstanceHostname, correlationId) {
|
|
6616
6156
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.UpdateTokenEndpointAuthority, correlationId);
|
|
6617
6157
|
const cloudInstanceAuthorityUri = `https://${cloudInstanceHostname}/${this.authority.tenant}/`;
|
|
6618
|
-
const cloudInstanceAuthority = await
|
|
6158
|
+
const cloudInstanceAuthority = await createDiscoveredInstance(cloudInstanceAuthorityUri, this.networkClient, this.cacheManager, this.authority.options, this.logger, correlationId, this.performanceClient);
|
|
6619
6159
|
this.authority = cloudInstanceAuthority;
|
|
6620
6160
|
}
|
|
6621
6161
|
/**
|
|
@@ -6895,7 +6435,7 @@ class PopTokenGenerator {
|
|
|
6895
6435
|
const resourceUrlComponents = resourceUrlString?.getUrlComponents();
|
|
6896
6436
|
return this.cryptoUtils.signJwt({
|
|
6897
6437
|
at: payload,
|
|
6898
|
-
ts:
|
|
6438
|
+
ts: nowSeconds(),
|
|
6899
6439
|
m: resourceRequestMethod?.toUpperCase(),
|
|
6900
6440
|
u: resourceUrlComponents?.HostNameAndPort,
|
|
6901
6441
|
nonce: shrNonce || this.cryptoUtils.createNewGuid(),
|
|
@@ -7146,7 +6686,7 @@ class ResponseHandler {
|
|
|
7146
6686
|
? reqTimestamp + refreshIn
|
|
7147
6687
|
: undefined;
|
|
7148
6688
|
// non AAD scenarios can have empty realm
|
|
7149
|
-
cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant, responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);
|
|
6689
|
+
cachedAccessToken = createAccessTokenEntity(this.homeAccountIdentifier, env, serverTokenResponse.access_token, this.clientId, claimsTenantId || authority.tenant || "", responseScopes.printScopes(), tokenExpirationSeconds, extendedTokenExpirationSeconds, this.cryptoObj.base64Decode, refreshOnSeconds, serverTokenResponse.token_type, userAssertionHash, serverTokenResponse.key_id, request.claims, request.requestedClaimsHash);
|
|
7150
6690
|
}
|
|
7151
6691
|
// refreshToken
|
|
7152
6692
|
let cachedRefreshToken = null;
|
|
@@ -7327,7 +6867,7 @@ class AuthorizationCodeClient extends BaseClient {
|
|
|
7327
6867
|
if (!request.code) {
|
|
7328
6868
|
throw createClientAuthError(requestCannotBeMade);
|
|
7329
6869
|
}
|
|
7330
|
-
const reqTimestamp =
|
|
6870
|
+
const reqTimestamp = nowSeconds();
|
|
7331
6871
|
const response = await invokeAsync(this.executeTokenRequest.bind(this), PerformanceEvents.AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request);
|
|
7332
6872
|
// Retrieve requestId from response headers
|
|
7333
6873
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
@@ -7704,7 +7244,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7704
7244
|
}
|
|
7705
7245
|
async acquireToken(request) {
|
|
7706
7246
|
this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);
|
|
7707
|
-
const reqTimestamp =
|
|
7247
|
+
const reqTimestamp = nowSeconds();
|
|
7708
7248
|
const response = await invokeAsync(this.executeTokenRequest.bind(this), PerformanceEvents.RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
|
|
7709
7249
|
// Retrieve requestId from response headers
|
|
7710
7250
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
@@ -7765,7 +7305,7 @@ class RefreshTokenClient extends BaseClient {
|
|
|
7765
7305
|
throw createInteractionRequiredAuthError(noTokensFound);
|
|
7766
7306
|
}
|
|
7767
7307
|
if (refreshToken.expiresOn &&
|
|
7768
|
-
|
|
7308
|
+
isTokenExpired(refreshToken.expiresOn, request.refreshTokenExpirationOffsetSeconds ||
|
|
7769
7309
|
DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS)) {
|
|
7770
7310
|
throw createInteractionRequiredAuthError(refreshTokenExpired);
|
|
7771
7311
|
}
|
|
@@ -7963,14 +7503,14 @@ class SilentFlowClient extends BaseClient {
|
|
|
7963
7503
|
this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);
|
|
7964
7504
|
throw createClientAuthError(tokenRefreshRequired);
|
|
7965
7505
|
}
|
|
7966
|
-
else if (
|
|
7967
|
-
|
|
7506
|
+
else if (wasClockTurnedBack(cachedAccessToken.cachedAt) ||
|
|
7507
|
+
isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {
|
|
7968
7508
|
// must refresh due to the expires_in value
|
|
7969
7509
|
this.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED, request.correlationId);
|
|
7970
7510
|
throw createClientAuthError(tokenRefreshRequired);
|
|
7971
7511
|
}
|
|
7972
7512
|
else if (cachedAccessToken.refreshOn &&
|
|
7973
|
-
|
|
7513
|
+
isTokenExpired(cachedAccessToken.refreshOn, 0)) {
|
|
7974
7514
|
// must refresh (in the background) due to the refresh_in value
|
|
7975
7515
|
lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;
|
|
7976
7516
|
// don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
|