@azure/msal-common 16.13.0 → 16.14.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.mjs +2 -4
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +1 -1
- package/dist/authority/AuthorityMetadata.mjs +1 -10
- package/dist/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist/authority/AuthorityOptions.mjs +1 -3
- package/dist/authority/AuthorityOptions.mjs.map +1 -1
- package/dist/authority/AuthorityType.mjs +1 -2
- package/dist/authority/AuthorityType.mjs.map +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 +22 -17
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/AccountEntityUtils.mjs +3 -3
- package/dist/cache/utils/AccountEntityUtils.mjs.map +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +3 -2
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +10 -2
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.mjs +18 -2
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +4 -3
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/constants/AADServerParamKeys.mjs +3 -2
- package/dist/constants/AADServerParamKeys.mjs.map +1 -1
- package/dist/crypto/DpopProofGenerator.mjs +153 -0
- package/dist/crypto/DpopProofGenerator.mjs.map +1 -0
- package/dist/crypto/ICrypto.mjs +1 -1
- package/dist/crypto/ITokenBindingKeyManager.mjs +1 -1
- package/dist/crypto/ITokenBindingKeyManager.mjs.map +1 -1
- package/dist/crypto/JoseHeader.mjs +1 -1
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +1 -1
- package/dist/error/AuthError.mjs +1 -1
- package/dist/error/AuthErrorCodes.mjs +1 -1
- package/dist/error/CacheError.mjs +1 -1
- package/dist/error/CacheErrorCodes.mjs +1 -1
- package/dist/error/ClientAuthError.mjs +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +3 -2
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +5 -3
- package/dist/error/ClientConfigurationErrorCodes.mjs.map +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/NetworkError.mjs +1 -1
- package/dist/error/PlatformBrokerError.mjs +1 -1
- package/dist/error/ServerError.mjs +1 -1
- package/dist/index-node.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/logger/Logger.mjs +1 -1
- package/dist/network/INetworkModule.mjs +1 -1
- package/dist/network/RequestThumbprint.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +1 -1
- package/dist/protocol/Token.mjs +22 -4
- package/dist/protocol/Token.mjs.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist/request/BaseAuthRequest.mjs +1 -1
- package/dist/request/BaseAuthRequest.mjs.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +8 -4
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +1 -1
- package/dist/response/ResponseHandler.mjs +46 -4
- 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/PerformanceEvent.mjs.map +1 -1
- package/dist/telemetry/performance/PerformanceEvents.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/ClientAssertionUtils.mjs +1 -1
- package/dist/utils/Constants.mjs +5 -3
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ObjectUtils.mjs +1 -1
- package/dist/utils/ProtocolUtils.mjs +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.mjs +1 -1
- package/dist-browser/account/AccountInfo.mjs +1 -1
- package/dist-browser/account/AuthToken.mjs +1 -1
- package/dist-browser/account/CcsCredential.mjs +1 -1
- package/dist-browser/account/ClientInfo.mjs +1 -1
- package/dist-browser/account/TokenClaims.mjs +1 -1
- package/dist-browser/authority/Authority.mjs +2 -4
- package/dist-browser/authority/Authority.mjs.map +1 -1
- package/dist-browser/authority/AuthorityFactory.mjs +1 -1
- package/dist-browser/authority/AuthorityMetadata.mjs +1 -10
- package/dist-browser/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist-browser/authority/AuthorityOptions.mjs +1 -3
- package/dist-browser/authority/AuthorityOptions.mjs.map +1 -1
- package/dist-browser/authority/AuthorityType.mjs +1 -2
- package/dist-browser/authority/AuthorityType.mjs.map +1 -1
- package/dist-browser/authority/CloudInstanceDiscoveryErrorResponse.mjs +1 -1
- package/dist-browser/authority/CloudInstanceDiscoveryResponse.mjs +1 -1
- package/dist-browser/authority/OpenIdConfigResponse.mjs +1 -1
- package/dist-browser/authority/ProtocolMode.mjs +1 -1
- package/dist-browser/authority/RegionDiscovery.mjs +1 -1
- package/dist-browser/cache/CacheManager.mjs +22 -17
- package/dist-browser/cache/CacheManager.mjs.map +1 -1
- package/dist-browser/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist-browser/cache/utils/AccountEntityUtils.mjs +3 -3
- package/dist-browser/cache/utils/AccountEntityUtils.mjs.map +1 -1
- package/dist-browser/cache/utils/CacheHelpers.mjs +1 -1
- package/dist-browser/client/AuthorizationCodeClient.mjs +3 -2
- package/dist-browser/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist-browser/client/RefreshTokenClient.mjs +10 -2
- package/dist-browser/client/RefreshTokenClient.mjs.map +1 -1
- package/dist-browser/client/SilentFlowClient.mjs +18 -2
- package/dist-browser/client/SilentFlowClient.mjs.map +1 -1
- package/dist-browser/config/ClientConfiguration.mjs +4 -3
- package/dist-browser/config/ClientConfiguration.mjs.map +1 -1
- package/dist-browser/constants/AADServerParamKeys.mjs +3 -2
- package/dist-browser/constants/AADServerParamKeys.mjs.map +1 -1
- package/dist-browser/crypto/DpopProofGenerator.mjs +153 -0
- package/dist-browser/crypto/DpopProofGenerator.mjs.map +1 -0
- package/dist-browser/crypto/ICrypto.mjs +1 -1
- package/dist-browser/crypto/ITokenBindingKeyManager.mjs +1 -1
- package/dist-browser/crypto/ITokenBindingKeyManager.mjs.map +1 -1
- package/dist-browser/crypto/JoseHeader.mjs +1 -1
- package/dist-browser/crypto/JoseHeader.mjs.map +1 -1
- package/dist-browser/crypto/PopTokenGenerator.mjs +1 -1
- package/dist-browser/error/AuthError.mjs +1 -1
- package/dist-browser/error/AuthErrorCodes.mjs +1 -1
- package/dist-browser/error/CacheError.mjs +1 -1
- package/dist-browser/error/CacheErrorCodes.mjs +1 -1
- package/dist-browser/error/ClientAuthError.mjs +1 -1
- package/dist-browser/error/ClientAuthErrorCodes.mjs +3 -2
- package/dist-browser/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist-browser/error/ClientConfigurationError.mjs +1 -1
- package/dist-browser/error/ClientConfigurationErrorCodes.mjs +5 -3
- package/dist-browser/error/ClientConfigurationErrorCodes.mjs.map +1 -1
- package/dist-browser/error/InteractionRequiredAuthError.mjs +1 -1
- package/dist-browser/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist-browser/error/JoseHeaderError.mjs +1 -1
- package/dist-browser/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist-browser/error/NetworkError.mjs +1 -1
- package/dist-browser/error/PlatformBrokerError.mjs +1 -1
- package/dist-browser/error/ServerError.mjs +1 -1
- package/dist-browser/index-browser.mjs +1 -1
- package/dist-browser/index.mjs +1 -1
- package/dist-browser/log-strings-mapping.json +13 -5
- package/dist-browser/logger/Logger.mjs +1 -1
- package/dist-browser/network/INetworkModule.mjs +1 -1
- package/dist-browser/network/RequestThumbprint.mjs +1 -1
- package/dist-browser/network/ThrottlingUtils.mjs +1 -1
- package/dist-browser/packageMetadata.mjs +2 -2
- package/dist-browser/protocol/Authorize.mjs +1 -1
- package/dist-browser/protocol/Token.mjs +22 -4
- package/dist-browser/protocol/Token.mjs.map +1 -1
- package/dist-browser/request/AuthenticationHeaderParser.mjs +1 -1
- package/dist-browser/request/BaseAuthRequest.mjs +1 -1
- package/dist-browser/request/BaseAuthRequest.mjs.map +1 -1
- package/dist-browser/request/RequestParameterBuilder.mjs +8 -4
- package/dist-browser/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist-browser/request/ScopeSet.mjs +1 -1
- package/dist-browser/response/ResponseHandler.mjs +46 -4
- package/dist-browser/response/ResponseHandler.mjs.map +1 -1
- package/dist-browser/telemetry/performance/PerformanceClient.mjs +1 -1
- package/dist-browser/telemetry/performance/PerformanceEvent.mjs +1 -1
- package/dist-browser/telemetry/performance/PerformanceEvent.mjs.map +1 -1
- package/dist-browser/telemetry/performance/PerformanceEvents.mjs +1 -1
- package/dist-browser/telemetry/performance/StubPerformanceClient.mjs +1 -1
- package/dist-browser/telemetry/server/ServerTelemetryManager.mjs +1 -1
- package/dist-browser/url/UrlString.mjs +1 -1
- package/dist-browser/utils/ClientAssertionUtils.mjs +1 -1
- package/dist-browser/utils/Constants.mjs +5 -3
- package/dist-browser/utils/Constants.mjs.map +1 -1
- package/dist-browser/utils/FunctionWrappers.mjs +1 -1
- package/dist-browser/utils/ObjectUtils.mjs +1 -1
- package/dist-browser/utils/ProtocolUtils.mjs +1 -1
- package/dist-browser/utils/StringUtils.mjs +1 -1
- package/dist-browser/utils/TimeUtils.mjs +1 -1
- package/dist-browser/utils/UrlUtils.mjs +1 -1
- package/lib/index-browser.cjs +2 -2
- package/lib/{index-node-BaODPZEy.js → index-node-l_NIe8t5.js} +276 -45
- package/lib/index-node-l_NIe8t5.js.map +1 -0
- package/lib/index-node.cjs +2 -2
- package/lib/index.cjs +2 -2
- package/package.json +1 -1
- package/src/authority/Authority.ts +0 -2
- package/src/authority/AuthorityMetadata.ts +0 -9
- package/src/authority/AuthorityOptions.ts +0 -3
- package/src/authority/AuthorityType.ts +0 -1
- package/src/cache/CacheManager.ts +32 -27
- package/src/cache/utils/AccountEntityUtils.ts +2 -2
- package/src/client/AuthorizationCodeClient.ts +8 -0
- package/src/client/RefreshTokenClient.ts +22 -0
- package/src/client/SilentFlowClient.ts +40 -1
- package/src/config/ClientConfiguration.ts +6 -3
- package/src/constants/AADServerParamKeys.ts +1 -0
- package/src/crypto/DpopProofGenerator.ts +44 -5
- package/src/crypto/ITokenBindingKeyManager.ts +3 -2
- package/src/crypto/JoseHeader.ts +3 -2
- package/src/crypto/PublicJsonWebKey.ts +24 -0
- package/src/error/ClientAuthErrorCodes.ts +1 -0
- package/src/error/ClientConfigurationErrorCodes.ts +2 -0
- package/src/exports-common.ts +1 -0
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Token.ts +44 -1
- package/src/request/BaseAuthRequest.ts +5 -0
- package/src/request/CommonAuthorizationUrlRequest.ts +5 -0
- package/src/request/RequestParameterBuilder.ts +7 -3
- package/src/response/AuthenticationResult.ts +2 -0
- package/src/response/ResponseHandler.ts +72 -2
- package/src/telemetry/performance/PerformanceEvent.ts +12 -0
- package/src/utils/Constants.ts +3 -1
- package/types/authority/Authority.d.ts.map +1 -1
- package/types/authority/AuthorityMetadata.d.ts.map +1 -1
- package/types/authority/AuthorityOptions.d.ts +0 -1
- package/types/authority/AuthorityOptions.d.ts.map +1 -1
- package/types/authority/AuthorityType.d.ts +0 -1
- package/types/authority/AuthorityType.d.ts.map +1 -1
- package/types/cache/CacheManager.d.ts +3 -1
- package/types/cache/CacheManager.d.ts.map +1 -1
- package/types/client/AuthorizationCodeClient.d.ts.map +1 -1
- package/types/client/RefreshTokenClient.d.ts.map +1 -1
- package/types/client/SilentFlowClient.d.ts.map +1 -1
- package/types/config/ClientConfiguration.d.ts.map +1 -1
- package/types/constants/AADServerParamKeys.d.ts +1 -0
- package/types/constants/AADServerParamKeys.d.ts.map +1 -1
- package/types/crypto/DpopProofGenerator.d.ts +8 -2
- package/types/crypto/DpopProofGenerator.d.ts.map +1 -1
- package/types/crypto/ITokenBindingKeyManager.d.ts +2 -1
- package/types/crypto/ITokenBindingKeyManager.d.ts.map +1 -1
- package/types/crypto/JoseHeader.d.ts +3 -2
- package/types/crypto/JoseHeader.d.ts.map +1 -1
- package/types/crypto/PublicJsonWebKey.d.ts +20 -0
- package/types/crypto/PublicJsonWebKey.d.ts.map +1 -0
- package/types/error/ClientAuthErrorCodes.d.ts +1 -0
- package/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/types/error/ClientConfigurationErrorCodes.d.ts +2 -0
- package/types/error/ClientConfigurationErrorCodes.d.ts.map +1 -1
- package/types/exports-common.d.ts +1 -0
- package/types/exports-common.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/protocol/Token.d.ts +7 -0
- package/types/protocol/Token.d.ts.map +1 -1
- package/types/request/BaseAuthRequest.d.ts +5 -0
- package/types/request/BaseAuthRequest.d.ts.map +1 -1
- package/types/request/CommonAuthorizationUrlRequest.d.ts +5 -0
- package/types/request/CommonAuthorizationUrlRequest.d.ts.map +1 -1
- package/types/request/RequestParameterBuilder.d.ts +2 -2
- package/types/request/RequestParameterBuilder.d.ts.map +1 -1
- package/types/response/AuthenticationResult.d.ts +2 -0
- package/types/response/AuthenticationResult.d.ts.map +1 -1
- package/types/response/ResponseHandler.d.ts.map +1 -1
- package/types/telemetry/performance/PerformanceEvent.d.ts +10 -0
- package/types/telemetry/performance/PerformanceEvent.d.ts.map +1 -1
- package/types/utils/Constants.d.ts +3 -1
- package/types/utils/Constants.d.ts.map +1 -1
- package/lib/index-node-BaODPZEy.js.map +0 -1
|
@@ -102,15 +102,6 @@ export const rawMetdataJSON: RawMetadata = {
|
|
|
102
102
|
preferred_cache: "login.sovcloud-identity.sg",
|
|
103
103
|
aliases: ["login.sovcloud-identity.sg"],
|
|
104
104
|
},
|
|
105
|
-
{
|
|
106
|
-
preferred_network: "login.windows-ppe.net",
|
|
107
|
-
preferred_cache: "login.windows-ppe.net",
|
|
108
|
-
aliases: [
|
|
109
|
-
"login.windows-ppe.net",
|
|
110
|
-
"sts.windows-ppe.net",
|
|
111
|
-
"login.microsoft-ppe.com",
|
|
112
|
-
],
|
|
113
|
-
},
|
|
114
105
|
],
|
|
115
106
|
},
|
|
116
107
|
};
|
|
@@ -32,9 +32,6 @@ export const AzureCloudInstance = {
|
|
|
32
32
|
// Microsoft Azure public cloud
|
|
33
33
|
AzurePublic: "https://login.microsoftonline.com",
|
|
34
34
|
|
|
35
|
-
// Microsoft PPE
|
|
36
|
-
AzurePpe: "https://login.windows-ppe.net",
|
|
37
|
-
|
|
38
35
|
// Microsoft Chinese national/regional cloud
|
|
39
36
|
AzureChina: "https://login.chinacloudapi.cn",
|
|
40
37
|
|
|
@@ -13,6 +13,7 @@ import { TokenClaims } from "../account/TokenClaims.js";
|
|
|
13
13
|
import { getAliasesFromStaticSources } from "../authority/AuthorityMetadata.js";
|
|
14
14
|
import { StaticAuthorityOptions } from "../authority/AuthorityOptions.js";
|
|
15
15
|
import { ICrypto } from "../crypto/ICrypto.js";
|
|
16
|
+
import { ITokenBindingKeyManager } from "../crypto/ITokenBindingKeyManager.js";
|
|
16
17
|
import { AuthError } from "../error/AuthError.js";
|
|
17
18
|
import { createCacheError } from "../error/CacheError.js";
|
|
18
19
|
import {
|
|
@@ -56,6 +57,7 @@ import {
|
|
|
56
57
|
export abstract class CacheManager implements ICacheManager {
|
|
57
58
|
protected clientId: string;
|
|
58
59
|
protected cryptoImpl: ICrypto;
|
|
60
|
+
protected tokenBindingKeyManager: ITokenBindingKeyManager;
|
|
59
61
|
// Instance of logger for functions defined in the msal-common layer
|
|
60
62
|
private commonLogger: Logger;
|
|
61
63
|
private staticAuthorityOptions?: StaticAuthorityOptions;
|
|
@@ -66,10 +68,12 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
66
68
|
cryptoImpl: ICrypto,
|
|
67
69
|
logger: Logger,
|
|
68
70
|
performanceClient: IPerformanceClient,
|
|
69
|
-
staticAuthorityOptions
|
|
71
|
+
staticAuthorityOptions: StaticAuthorityOptions | undefined,
|
|
72
|
+
tokenBindingKeyManager: ITokenBindingKeyManager
|
|
70
73
|
) {
|
|
71
74
|
this.clientId = clientId;
|
|
72
75
|
this.cryptoImpl = cryptoImpl;
|
|
76
|
+
this.tokenBindingKeyManager = tokenBindingKeyManager;
|
|
73
77
|
this.commonLogger = logger.clone(name, version);
|
|
74
78
|
this.staticAuthorityOptions = staticAuthorityOptions;
|
|
75
79
|
this.performanceClient = performanceClient;
|
|
@@ -1107,29 +1111,34 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1107
1111
|
correlationId
|
|
1108
1112
|
);
|
|
1109
1113
|
|
|
1110
|
-
// Remove Token Binding Key from key store for
|
|
1114
|
+
// Remove Token Binding Key from key store for token-bound access token credentials
|
|
1111
1115
|
if (
|
|
1112
1116
|
credential.credentialType.toLowerCase() ===
|
|
1113
1117
|
Constants.CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()
|
|
1114
1118
|
) {
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1119
|
+
const tokenType = credential.tokenType?.toLowerCase();
|
|
1120
|
+
switch (tokenType) {
|
|
1121
|
+
case Constants.AuthenticationScheme.POP:
|
|
1122
|
+
case Constants.AuthenticationScheme.DPOP.toLowerCase(): {
|
|
1123
|
+
const accessTokenWithAuthSchemeEntity =
|
|
1124
|
+
credential as AccessTokenEntity;
|
|
1125
|
+
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
1126
|
+
|
|
1127
|
+
if (kid) {
|
|
1128
|
+
void this.tokenBindingKeyManager
|
|
1129
|
+
.removeTokenBindingKey(kid, correlationId)
|
|
1130
|
+
.catch(() => {
|
|
1131
|
+
this.commonLogger.error(
|
|
1132
|
+
"Failed to remove token binding key",
|
|
1133
|
+
correlationId
|
|
1134
|
+
);
|
|
1135
|
+
this.performanceClient?.incrementFields(
|
|
1136
|
+
{ removeTokenBindingKeyFailure: 1 },
|
|
1137
|
+
correlationId
|
|
1138
|
+
);
|
|
1139
|
+
});
|
|
1140
|
+
}
|
|
1141
|
+
break;
|
|
1133
1142
|
}
|
|
1134
1143
|
}
|
|
1135
1144
|
}
|
|
@@ -1368,7 +1377,6 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1368
1377
|
attribute_tokens: attributeTokenPartition,
|
|
1369
1378
|
}
|
|
1370
1379
|
: undefined;
|
|
1371
|
-
|
|
1372
1380
|
const accessTokenFilter: CredentialFilter = {
|
|
1373
1381
|
homeAccountId: account.homeAccountId,
|
|
1374
1382
|
environment: account.environment,
|
|
@@ -1383,7 +1391,6 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1383
1391
|
: undefined,
|
|
1384
1392
|
additionalCacheKeyComponents: additionalCacheKeyComponents,
|
|
1385
1393
|
};
|
|
1386
|
-
|
|
1387
1394
|
const accessTokenKeys =
|
|
1388
1395
|
(tokenKeys && tokenKeys.accessToken) ||
|
|
1389
1396
|
this.getTokenKeys().accessToken;
|
|
@@ -1986,9 +1993,8 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1986
1993
|
|
|
1987
1994
|
switch (normalizedFilterTokenType) {
|
|
1988
1995
|
case "dpop":
|
|
1989
|
-
return this.matchKeyBoundAccessToken(entity, filter, true);
|
|
1990
1996
|
case Constants.AuthenticationScheme.SSH:
|
|
1991
|
-
return this.matchKeyBoundAccessToken(entity, filter
|
|
1997
|
+
return this.matchKeyBoundAccessToken(entity, filter);
|
|
1992
1998
|
default:
|
|
1993
1999
|
return true;
|
|
1994
2000
|
}
|
|
@@ -1996,11 +2002,10 @@ export abstract class CacheManager implements ICacheManager {
|
|
|
1996
2002
|
|
|
1997
2003
|
private matchKeyBoundAccessToken(
|
|
1998
2004
|
entity: CredentialEntity,
|
|
1999
|
-
filter: CredentialFilter
|
|
2000
|
-
requireKeyId: boolean
|
|
2005
|
+
filter: CredentialFilter
|
|
2001
2006
|
): boolean {
|
|
2002
2007
|
if (!filter.keyId) {
|
|
2003
|
-
return
|
|
2008
|
+
return true;
|
|
2004
2009
|
}
|
|
2005
2010
|
|
|
2006
2011
|
return this.matchKeyId(entity, filter.keyId);
|
|
@@ -276,8 +276,8 @@ export function generateHomeAccountId(
|
|
|
276
276
|
correlationId: string,
|
|
277
277
|
idTokenClaims?: TokenClaims
|
|
278
278
|
): string {
|
|
279
|
-
//
|
|
280
|
-
if (
|
|
279
|
+
// ADFS does not have tid and does not set client_info
|
|
280
|
+
if (authType !== AuthorityType.Adfs) {
|
|
281
281
|
// for cases where there is clientInfo
|
|
282
282
|
if (serverClientInfo) {
|
|
283
283
|
try {
|
|
@@ -44,6 +44,7 @@ import { ClientAssertion } from "../account/ClientCredentials.js";
|
|
|
44
44
|
import { getClientAssertion } from "../utils/ClientAssertionUtils.js";
|
|
45
45
|
import { getRequestThumbprint } from "../network/RequestThumbprint.js";
|
|
46
46
|
import {
|
|
47
|
+
addDpopTokenProofHeader,
|
|
47
48
|
createTokenQueryParameters,
|
|
48
49
|
createTokenRequestHeaders,
|
|
49
50
|
executePostToTokenEndpoint,
|
|
@@ -272,6 +273,13 @@ export class AuthorizationCodeClient {
|
|
|
272
273
|
this.config.systemOptions.preventCorsPreflight,
|
|
273
274
|
ccsCredential || request.ccsCredential
|
|
274
275
|
);
|
|
276
|
+
await addDpopTokenProofHeader(
|
|
277
|
+
headers,
|
|
278
|
+
request,
|
|
279
|
+
endpoint,
|
|
280
|
+
this.cryptoUtils,
|
|
281
|
+
this.config.tokenBindingKeyManager
|
|
282
|
+
);
|
|
275
283
|
|
|
276
284
|
const thumbprint = getRequestThumbprint(
|
|
277
285
|
this.config.authOptions.clientId,
|
|
@@ -19,6 +19,7 @@ import * as AADServerParamKeys from "../constants/AADServerParamKeys.js";
|
|
|
19
19
|
import { ResponseHandler } from "../response/ResponseHandler.js";
|
|
20
20
|
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
|
21
21
|
import { PopTokenGenerator } from "../crypto/PopTokenGenerator.js";
|
|
22
|
+
import { DpopProofGenerator } from "../crypto/DpopProofGenerator.js";
|
|
22
23
|
import { NetworkResponse } from "../network/NetworkResponse.js";
|
|
23
24
|
import { CommonSilentFlowRequest } from "../request/CommonSilentFlowRequest.js";
|
|
24
25
|
import {
|
|
@@ -46,6 +47,7 @@ import { ClientAssertion } from "../account/ClientCredentials.js";
|
|
|
46
47
|
import { getClientAssertion } from "../utils/ClientAssertionUtils.js";
|
|
47
48
|
import { getRequestThumbprint } from "../network/RequestThumbprint.js";
|
|
48
49
|
import {
|
|
50
|
+
addDpopTokenProofHeader,
|
|
49
51
|
createTokenQueryParameters,
|
|
50
52
|
createTokenRequestHeaders,
|
|
51
53
|
executePostToTokenEndpoint,
|
|
@@ -298,6 +300,19 @@ export class RefreshTokenClient {
|
|
|
298
300
|
type: CcsCredentialType.HOME_ACCOUNT_ID,
|
|
299
301
|
},
|
|
300
302
|
};
|
|
303
|
+
if (
|
|
304
|
+
refreshTokenRequest.authenticationScheme ===
|
|
305
|
+
Constants.AuthenticationScheme.DPOP &&
|
|
306
|
+
!refreshTokenRequest.dpopJkt
|
|
307
|
+
) {
|
|
308
|
+
const dpopProofGenerator = new DpopProofGenerator(
|
|
309
|
+
this.cryptoUtils,
|
|
310
|
+
this.config.tokenBindingKeyManager
|
|
311
|
+
);
|
|
312
|
+
refreshTokenRequest.dpopJkt = await dpopProofGenerator.generateJkt(
|
|
313
|
+
request.correlationId
|
|
314
|
+
);
|
|
315
|
+
}
|
|
301
316
|
|
|
302
317
|
try {
|
|
303
318
|
return await invokeAsync(
|
|
@@ -360,6 +375,13 @@ export class RefreshTokenClient {
|
|
|
360
375
|
this.config.systemOptions.preventCorsPreflight,
|
|
361
376
|
request.ccsCredential
|
|
362
377
|
);
|
|
378
|
+
await addDpopTokenProofHeader(
|
|
379
|
+
headers,
|
|
380
|
+
request,
|
|
381
|
+
endpoint,
|
|
382
|
+
this.cryptoUtils,
|
|
383
|
+
this.config.tokenBindingKeyManager
|
|
384
|
+
);
|
|
363
385
|
|
|
364
386
|
const thumbprint = getRequestThumbprint(
|
|
365
387
|
this.config.authOptions.clientId,
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "../error/ClientAuthError.js";
|
|
18
18
|
import { ResponseHandler } from "../response/ResponseHandler.js";
|
|
19
19
|
import { CacheRecord } from "../cache/entities/CacheRecord.js";
|
|
20
|
-
import { CacheOutcome } from "../utils/Constants.js";
|
|
20
|
+
import { AuthenticationScheme, CacheOutcome } from "../utils/Constants.js";
|
|
21
21
|
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
|
|
22
22
|
import { StringUtils } from "../utils/StringUtils.js";
|
|
23
23
|
import { extractTokenClaims } from "../account/AuthToken.js";
|
|
@@ -181,6 +181,45 @@ export class SilentFlowClient {
|
|
|
181
181
|
// don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead
|
|
182
182
|
}
|
|
183
183
|
|
|
184
|
+
const cachedAccessTokenType =
|
|
185
|
+
cachedAccessToken.tokenType?.toLowerCase();
|
|
186
|
+
if (cachedAccessTokenType === AuthenticationScheme.DPOP.toLowerCase()) {
|
|
187
|
+
if (!cachedAccessToken.keyId) {
|
|
188
|
+
this.logger.info(
|
|
189
|
+
"SilentFlowClient:acquireCachedToken - Cached DPoP access token is missing keyId; refresh required",
|
|
190
|
+
request.correlationId
|
|
191
|
+
);
|
|
192
|
+
this.setCacheOutcome(
|
|
193
|
+
CacheOutcome.NO_CACHED_ACCESS_TOKEN,
|
|
194
|
+
request.correlationId
|
|
195
|
+
);
|
|
196
|
+
throw createClientAuthError(
|
|
197
|
+
ClientAuthErrorCodes.tokenRefreshRequired,
|
|
198
|
+
request.correlationId
|
|
199
|
+
);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
await this.config.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(
|
|
204
|
+
cachedAccessToken.keyId,
|
|
205
|
+
request.correlationId
|
|
206
|
+
);
|
|
207
|
+
} catch {
|
|
208
|
+
this.logger.info(
|
|
209
|
+
"SilentFlowClient:acquireCachedToken - Local DPoP key was not found for cached access token; refresh required",
|
|
210
|
+
request.correlationId
|
|
211
|
+
);
|
|
212
|
+
this.setCacheOutcome(
|
|
213
|
+
CacheOutcome.NO_CACHED_ACCESS_TOKEN,
|
|
214
|
+
request.correlationId
|
|
215
|
+
);
|
|
216
|
+
throw createClientAuthError(
|
|
217
|
+
ClientAuthErrorCodes.tokenRefreshRequired,
|
|
218
|
+
request.correlationId
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
184
223
|
const environment =
|
|
185
224
|
request.authority || this.authority.getPreferredCache();
|
|
186
225
|
const cacheRecord: CacheRecord = {
|
|
@@ -245,6 +245,8 @@ export function buildClientConfiguration({
|
|
|
245
245
|
...DEFAULT_LOGGER_IMPLEMENTATION,
|
|
246
246
|
...userLoggerOption,
|
|
247
247
|
};
|
|
248
|
+
const resolvedTokenBindingKeyManager =
|
|
249
|
+
tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER;
|
|
248
250
|
|
|
249
251
|
return {
|
|
250
252
|
authOptions: buildAuthOptions(userAuthOptions),
|
|
@@ -256,13 +258,14 @@ export function buildClientConfiguration({
|
|
|
256
258
|
userAuthOptions.clientId,
|
|
257
259
|
DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
258
260
|
new Logger(loggerOptions, name, version),
|
|
259
|
-
new StubPerformanceClient()
|
|
261
|
+
new StubPerformanceClient(),
|
|
262
|
+
undefined,
|
|
263
|
+
resolvedTokenBindingKeyManager
|
|
260
264
|
),
|
|
261
265
|
networkInterface:
|
|
262
266
|
networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
|
|
263
267
|
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
264
|
-
tokenBindingKeyManager:
|
|
265
|
-
tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER,
|
|
268
|
+
tokenBindingKeyManager: resolvedTokenBindingKeyManager,
|
|
266
269
|
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
267
270
|
libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
|
|
268
271
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
|
|
@@ -44,6 +44,7 @@ export const CLIENT_ASSERTION = "client_assertion";
|
|
|
44
44
|
export const CLIENT_ASSERTION_TYPE = "client_assertion_type";
|
|
45
45
|
export const TOKEN_TYPE = "token_type";
|
|
46
46
|
export const REQ_CNF = "req_cnf";
|
|
47
|
+
export const DPOP_JKT = "dpop_jkt";
|
|
47
48
|
export const OBO_ASSERTION = "assertion";
|
|
48
49
|
export const REQUESTED_TOKEN_USE = "requested_token_use";
|
|
49
50
|
export const ON_BEHALF_OF = "on_behalf_of";
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ClientConfigurationErrorCodes,
|
|
12
12
|
} from "../error/ClientConfigurationError.js";
|
|
13
13
|
import { JoseHeader } from "./JoseHeader.js";
|
|
14
|
+
import type { PublicJsonWebKey } from "./PublicJsonWebKey.js";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* RFC 9449 DPoP proof JWT payload claims.
|
|
@@ -40,18 +41,25 @@ export type DpopTokenProofParams = {
|
|
|
40
41
|
* @internal
|
|
41
42
|
*/
|
|
42
43
|
export type DpopResourceProofParams = {
|
|
43
|
-
|
|
44
|
+
htu: string;
|
|
44
45
|
htm: string;
|
|
45
46
|
ath: string;
|
|
46
47
|
nonce?: string;
|
|
47
48
|
};
|
|
48
49
|
|
|
50
|
+
export type GenerateDpopResourceProofParams = {
|
|
51
|
+
htu?: string;
|
|
52
|
+
htm?: string;
|
|
53
|
+
nonce?: string;
|
|
54
|
+
accessToken: string;
|
|
55
|
+
};
|
|
56
|
+
|
|
49
57
|
const DPOP_HTM_REGEX = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
50
58
|
const DPOP_TOKEN_BINDING_KEY_TYPE = "dpop";
|
|
51
59
|
const DPOP_JWT_HEADER_ALGORITHM = JsonWebTokenAlgorithms.ES256;
|
|
52
60
|
|
|
53
61
|
function buildProofHeader(
|
|
54
|
-
publicJwk:
|
|
62
|
+
publicJwk: PublicJsonWebKey,
|
|
55
63
|
correlationId: string
|
|
56
64
|
): JoseHeader {
|
|
57
65
|
return JoseHeader.getDpopHeader(
|
|
@@ -108,6 +116,18 @@ function normalizeHtu(url: string, correlationId: string): string {
|
|
|
108
116
|
return parsedUrl.href;
|
|
109
117
|
}
|
|
110
118
|
|
|
119
|
+
function validateDpopNonce(
|
|
120
|
+
nonce: string | undefined,
|
|
121
|
+
correlationId: string
|
|
122
|
+
): void {
|
|
123
|
+
if (nonce !== undefined && nonce.trim().length === 0) {
|
|
124
|
+
throw createClientConfigurationError(
|
|
125
|
+
ClientConfigurationErrorCodes.invalidDpopNonce,
|
|
126
|
+
correlationId
|
|
127
|
+
);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
111
131
|
/**
|
|
112
132
|
* Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
|
|
113
133
|
* resource-endpoint proof bindings.
|
|
@@ -153,6 +173,7 @@ export class DpopProofGenerator {
|
|
|
153
173
|
params: DpopTokenProofParams,
|
|
154
174
|
correlationId: string = ""
|
|
155
175
|
): DpopProofClaims {
|
|
176
|
+
validateDpopNonce(params.nonce, correlationId);
|
|
156
177
|
const claims: DpopProofClaims = {
|
|
157
178
|
jti: this.cryptoUtils.createNewGuid(),
|
|
158
179
|
htm: "POST",
|
|
@@ -191,10 +212,11 @@ export class DpopProofGenerator {
|
|
|
191
212
|
params: DpopResourceProofParams,
|
|
192
213
|
correlationId: string = ""
|
|
193
214
|
): DpopProofClaims {
|
|
215
|
+
validateDpopNonce(params.nonce, correlationId);
|
|
194
216
|
const claims: DpopProofClaims = {
|
|
195
217
|
jti: this.cryptoUtils.createNewGuid(),
|
|
196
218
|
htm: normalizeHtm(params.htm, correlationId),
|
|
197
|
-
htu: normalizeHtu(params.
|
|
219
|
+
htu: normalizeHtu(params.htu, correlationId),
|
|
198
220
|
ath: params.ath,
|
|
199
221
|
iat: TimeUtils.nowSeconds(),
|
|
200
222
|
};
|
|
@@ -208,12 +230,29 @@ export class DpopProofGenerator {
|
|
|
208
230
|
* Builds and signs a compact DPoP proof JWT for a resource request.
|
|
209
231
|
*/
|
|
210
232
|
async generateResourceProof(
|
|
211
|
-
params:
|
|
233
|
+
params: GenerateDpopResourceProofParams,
|
|
212
234
|
keyId: string,
|
|
213
235
|
correlationId: string = ""
|
|
214
236
|
): Promise<string> {
|
|
237
|
+
const { htu, htm, nonce } = params;
|
|
238
|
+
if (!htu || !htm) {
|
|
239
|
+
throw createClientConfigurationError(
|
|
240
|
+
ClientConfigurationErrorCodes.dpopMissingResourceContext,
|
|
241
|
+
correlationId
|
|
242
|
+
);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
const ath = await this.cryptoUtils.hashString(params.accessToken);
|
|
215
246
|
return this.generateProof(
|
|
216
|
-
this.buildResourceProofClaims(
|
|
247
|
+
this.buildResourceProofClaims(
|
|
248
|
+
{
|
|
249
|
+
htu,
|
|
250
|
+
htm,
|
|
251
|
+
ath,
|
|
252
|
+
nonce,
|
|
253
|
+
},
|
|
254
|
+
correlationId
|
|
255
|
+
),
|
|
217
256
|
keyId,
|
|
218
257
|
correlationId
|
|
219
258
|
);
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
ClientAuthErrorCodes,
|
|
8
8
|
createClientAuthError,
|
|
9
9
|
} from "../error/ClientAuthError.js";
|
|
10
|
+
import type { PublicJsonWebKey } from "./PublicJsonWebKey.js";
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Parameters used by token-binding key managers to provision browser-managed
|
|
@@ -46,7 +47,7 @@ export interface ITokenBindingKeyManager {
|
|
|
46
47
|
getTokenBindingPublicKeyJwk(
|
|
47
48
|
kid: string,
|
|
48
49
|
correlationId: string
|
|
49
|
-
): Promise<
|
|
50
|
+
): Promise<PublicJsonWebKey>;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
/**
|
|
@@ -75,7 +76,7 @@ export const DEFAULT_TOKEN_BINDING_KEY_MANAGER: ITokenBindingKeyManager = {
|
|
|
75
76
|
async getTokenBindingPublicKeyJwk(
|
|
76
77
|
_kid: string,
|
|
77
78
|
correlationId: string
|
|
78
|
-
): Promise<
|
|
79
|
+
): Promise<PublicJsonWebKey> {
|
|
79
80
|
throw createClientAuthError(
|
|
80
81
|
ClientAuthErrorCodes.methodNotImplemented,
|
|
81
82
|
correlationId
|
package/src/crypto/JoseHeader.ts
CHANGED
|
@@ -9,12 +9,13 @@ import {
|
|
|
9
9
|
} from "../error/JoseHeaderError.js";
|
|
10
10
|
import { isPlainObject } from "../utils/ObjectUtils.js";
|
|
11
11
|
import { JsonWebTokenTypes } from "../utils/Constants.js";
|
|
12
|
+
import type { PublicJsonWebKey } from "./PublicJsonWebKey.js";
|
|
12
13
|
|
|
13
14
|
export type JoseHeaderOptions = {
|
|
14
15
|
typ?: JsonWebTokenTypes;
|
|
15
16
|
alg?: string;
|
|
16
17
|
kid?: string;
|
|
17
|
-
jwk?:
|
|
18
|
+
jwk?: PublicJsonWebKey;
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
/** @internal */
|
|
@@ -22,7 +23,7 @@ export class JoseHeader {
|
|
|
22
23
|
public typ?: JsonWebTokenTypes;
|
|
23
24
|
public alg: string;
|
|
24
25
|
public kid?: string;
|
|
25
|
-
public jwk?:
|
|
26
|
+
public jwk?: PublicJsonWebKey;
|
|
26
27
|
|
|
27
28
|
constructor(
|
|
28
29
|
options: JoseHeaderOptions & { alg: string },
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Environment-neutral representation of the public asymmetric JWK fields
|
|
8
|
+
* used by token-binding implementations.
|
|
9
|
+
*
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export type PublicJsonWebKey = {
|
|
13
|
+
alg?: string;
|
|
14
|
+
crv?: string;
|
|
15
|
+
e?: string;
|
|
16
|
+
ext?: boolean;
|
|
17
|
+
key_ops?: string[];
|
|
18
|
+
kid?: string;
|
|
19
|
+
kty?: string;
|
|
20
|
+
n?: string;
|
|
21
|
+
use?: string;
|
|
22
|
+
x?: string;
|
|
23
|
+
y?: string;
|
|
24
|
+
};
|
|
@@ -27,6 +27,7 @@ export const invalidCacheEnvironment = "invalid_cache_environment";
|
|
|
27
27
|
export const noAccountFound = "no_account_found";
|
|
28
28
|
export const noCryptoObject = "no_crypto_object";
|
|
29
29
|
export const unexpectedCredentialType = "unexpected_credential_type";
|
|
30
|
+
export const dpopTokenTypeMismatch = "dpop_token_type_mismatch";
|
|
30
31
|
export const tokenRefreshRequired = "token_refresh_required";
|
|
31
32
|
export const tokenClaimsCnfRequiredForSignedJwt =
|
|
32
33
|
"token_claims_cnf_required_for_signedjwt";
|
|
@@ -34,3 +34,5 @@ export const issuerValidationFailed = "issuer_validation_failed";
|
|
|
34
34
|
export const invalidResponseMode = "invalid_response_mode";
|
|
35
35
|
export const invalidDpopHtm = "invalid_dpop_htm";
|
|
36
36
|
export const invalidDpopHtu = "invalid_dpop_htu";
|
|
37
|
+
export const invalidDpopNonce = "invalid_dpop_nonce";
|
|
38
|
+
export const dpopMissingResourceContext = "dpop_missing_resource_context";
|
package/src/exports-common.ts
CHANGED
|
@@ -111,6 +111,7 @@ export {
|
|
|
111
111
|
DEFAULT_TOKEN_BINDING_KEY_MANAGER,
|
|
112
112
|
TokenBindingKeyProvisioningParameters,
|
|
113
113
|
} from "./crypto/ITokenBindingKeyManager.js";
|
|
114
|
+
export { PublicJsonWebKey } from "./crypto/PublicJsonWebKey.js";
|
|
114
115
|
|
|
115
116
|
export * as AuthorizeProtocol from "./protocol/Authorize.js";
|
|
116
117
|
export * as TokenProtocol from "./protocol/Token.js";
|
package/src/packageMetadata.ts
CHANGED
package/src/protocol/Token.ts
CHANGED
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
import { CcsCredential, CcsCredentialType } from "../account/CcsCredential.js";
|
|
7
7
|
import { buildClientInfoFromHomeAccountId } from "../account/ClientInfo.js";
|
|
8
|
+
import { DpopProofGenerator } from "../crypto/DpopProofGenerator.js";
|
|
8
9
|
import { Logger } from "../logger/Logger.js";
|
|
9
10
|
import { BaseAuthRequest } from "../request/BaseAuthRequest.js";
|
|
10
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
AuthenticationScheme,
|
|
13
|
+
HeaderNames,
|
|
14
|
+
URL_FORM_CONTENT_TYPE,
|
|
15
|
+
} from "../utils/Constants.js";
|
|
11
16
|
import * as RequestParameterBuilder from "../request/RequestParameterBuilder.js";
|
|
12
17
|
import * as UrlUtils from "../utils/UrlUtils.js";
|
|
13
18
|
import { IPerformanceClient } from "../exports-browser-only.js";
|
|
@@ -29,6 +34,8 @@ import { invokeAsync } from "../utils/FunctionWrappers.js";
|
|
|
29
34
|
import * as PerformanceEvents from "../telemetry/performance/PerformanceEvents.js";
|
|
30
35
|
import { CacheManager } from "../cache/CacheManager.js";
|
|
31
36
|
import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
|
|
37
|
+
import { ICrypto } from "../crypto/ICrypto.js";
|
|
38
|
+
import { ITokenBindingKeyManager } from "../crypto/ITokenBindingKeyManager.js";
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* Creates default headers for requests to token endpoint
|
|
@@ -65,6 +72,42 @@ export function createTokenRequestHeaders(
|
|
|
65
72
|
return headers;
|
|
66
73
|
}
|
|
67
74
|
|
|
75
|
+
/**
|
|
76
|
+
* Adds the DPoP proof header for token endpoint requests when DPoP is requested.
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
export async function addDpopTokenProofHeader(
|
|
80
|
+
headers: Record<string, string>,
|
|
81
|
+
request: BaseAuthRequest,
|
|
82
|
+
tokenEndpoint: string,
|
|
83
|
+
cryptoUtils: ICrypto,
|
|
84
|
+
tokenBindingKeyManager: ITokenBindingKeyManager
|
|
85
|
+
): Promise<void> {
|
|
86
|
+
if (request.authenticationScheme !== AuthenticationScheme.DPOP) {
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
const dpopProofGenerator = new DpopProofGenerator(
|
|
91
|
+
cryptoUtils,
|
|
92
|
+
tokenBindingKeyManager
|
|
93
|
+
);
|
|
94
|
+
const keyId = request.dpopJkt;
|
|
95
|
+
if (!keyId?.trim()) {
|
|
96
|
+
throw createClientAuthError(
|
|
97
|
+
ClientAuthErrorCodes.keyIdMissing,
|
|
98
|
+
request.correlationId
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
headers[HeaderNames.DPOP] = await dpopProofGenerator.generateTokenProof(
|
|
103
|
+
{
|
|
104
|
+
tokenEndpoint,
|
|
105
|
+
},
|
|
106
|
+
keyId,
|
|
107
|
+
request.correlationId
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
|
|
68
111
|
/**
|
|
69
112
|
* Creates query string for the /token request
|
|
70
113
|
* @param request
|
|
@@ -87,6 +87,11 @@ export type BaseAuthRequest = {
|
|
|
87
87
|
* Key ID to identify the public key for PoP token request
|
|
88
88
|
*/
|
|
89
89
|
popKid?: string;
|
|
90
|
+
/**
|
|
91
|
+
* JWK thumbprint for the browser-managed DPoP key bound to this request.
|
|
92
|
+
* @internal
|
|
93
|
+
*/
|
|
94
|
+
dpopJkt?: string;
|
|
90
95
|
/**
|
|
91
96
|
* Embedded client id. When specified, broker client id (brk_client_id) and redirect uri (brk_redirect_uri) params are set with values from the config, overriding the corresponding extra parameters, if present.
|
|
92
97
|
*/
|
|
@@ -73,4 +73,9 @@ export type CommonAuthorizationUrlRequest = BaseAuthRequest & {
|
|
|
73
73
|
* Indicates whether this authorization request is being initiated by a platform authentication broker instead of a standard web flow.
|
|
74
74
|
*/
|
|
75
75
|
platformBroker?: boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Precomputed req_cnf value for platform-broker PoP authorization requests.
|
|
78
|
+
* @internal
|
|
79
|
+
*/
|
|
80
|
+
reqCnf?: string;
|
|
76
81
|
};
|