@azure/msal-common 16.8.0 → 16.10.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 +9 -3
- package/dist/account/AccountInfo.mjs.map +1 -1
- package/dist/account/AuthToken.mjs +9 -23
- package/dist/account/AuthToken.mjs.map +1 -1
- package/dist/account/CcsCredential.mjs +1 -1
- package/dist/account/ClientInfo.mjs +4 -4
- package/dist/account/ClientInfo.mjs.map +1 -1
- package/dist/account/TokenClaims.mjs +1 -1
- package/dist/authority/Authority.mjs +36 -37
- package/dist/authority/Authority.mjs.map +1 -1
- package/dist/authority/AuthorityFactory.mjs +3 -3
- package/dist/authority/AuthorityFactory.mjs.map +1 -1
- package/dist/authority/AuthorityMetadata.mjs +2 -2
- 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 +16 -10
- package/dist/authority/RegionDiscovery.mjs.map +1 -1
- package/dist/cache/CacheManager.mjs +62 -46
- package/dist/cache/CacheManager.mjs.map +1 -1
- package/dist/cache/persistence/TokenCacheContext.mjs +1 -1
- package/dist/cache/utils/AccountEntityUtils.mjs +23 -7
- package/dist/cache/utils/AccountEntityUtils.mjs.map +1 -1
- package/dist/cache/utils/CacheHelpers.mjs +12 -4
- package/dist/cache/utils/CacheHelpers.mjs.map +1 -1
- package/dist/client/AuthorizationCodeClient.mjs +7 -7
- package/dist/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist/client/RefreshTokenClient.mjs +8 -8
- package/dist/client/RefreshTokenClient.mjs.map +1 -1
- package/dist/client/SilentFlowClient.mjs +10 -18
- package/dist/client/SilentFlowClient.mjs.map +1 -1
- package/dist/config/ClientConfiguration.mjs +6 -5
- package/dist/config/ClientConfiguration.mjs.map +1 -1
- package/dist/constants/AADServerParamKeys.mjs +7 -3
- package/dist/constants/AADServerParamKeys.mjs.map +1 -1
- package/dist/crypto/ICrypto.mjs +11 -11
- package/dist/crypto/ICrypto.mjs.map +1 -1
- package/dist/crypto/JoseHeader.mjs +3 -3
- package/dist/crypto/JoseHeader.mjs.map +1 -1
- package/dist/crypto/PopTokenGenerator.mjs +2 -2
- package/dist/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist/error/AuthError.mjs +5 -7
- package/dist/error/AuthError.mjs.map +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 +5 -5
- package/dist/error/ClientAuthError.mjs.map +1 -1
- package/dist/error/ClientAuthErrorCodes.mjs +2 -4
- package/dist/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist/error/ClientConfigurationError.mjs +5 -5
- package/dist/error/ClientConfigurationError.mjs.map +1 -1
- package/dist/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist/error/InteractionRequiredAuthError.mjs +5 -6
- package/dist/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist/error/JoseHeaderError.mjs +5 -5
- package/dist/error/JoseHeaderError.mjs.map +1 -1
- package/dist/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist/error/NetworkError.mjs +2 -2
- package/dist/error/NetworkError.mjs.map +1 -1
- package/dist/error/PlatformBrokerError.mjs +3 -3
- package/dist/error/PlatformBrokerError.mjs.map +1 -1
- package/dist/error/ServerError.mjs +3 -3
- package/dist/error/ServerError.mjs.map +1 -1
- package/dist/index-node.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/logger/Logger.mjs +25 -11
- package/dist/logger/Logger.mjs.map +1 -1
- package/dist/network/INetworkModule.mjs +4 -3
- package/dist/network/INetworkModule.mjs.map +1 -1
- package/dist/network/RequestThumbprint.mjs +1 -1
- package/dist/network/ThrottlingUtils.mjs +2 -2
- package/dist/network/ThrottlingUtils.mjs.map +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/protocol/Authorize.mjs +18 -14
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/protocol/Token.mjs +4 -2
- package/dist/protocol/Token.mjs.map +1 -1
- package/dist/request/AuthenticationHeaderParser.mjs +4 -4
- package/dist/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist/request/BaseAuthRequest.mjs +3 -3
- package/dist/request/BaseAuthRequest.mjs.map +1 -1
- package/dist/request/RequestParameterBuilder.mjs +50 -31
- package/dist/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist/request/ScopeSet.mjs +13 -12
- package/dist/request/ScopeSet.mjs.map +1 -1
- package/dist/response/ResponseHandler.mjs +30 -27
- 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/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 +15 -14
- package/dist/url/UrlString.mjs.map +1 -1
- package/dist/utils/ClientAssertionUtils.mjs +3 -2
- package/dist/utils/ClientAssertionUtils.mjs.map +1 -1
- package/dist/utils/Constants.mjs +7 -3
- package/dist/utils/Constants.mjs.map +1 -1
- package/dist/utils/FunctionWrappers.mjs +1 -1
- package/dist/utils/ProtocolUtils.mjs +12 -9
- package/dist/utils/ProtocolUtils.mjs.map +1 -1
- package/dist/utils/StringUtils.mjs +1 -1
- package/dist/utils/TimeUtils.mjs +1 -1
- package/dist/utils/UrlUtils.mjs +4 -4
- package/dist/utils/UrlUtils.mjs.map +1 -1
- package/dist-browser/account/AccountInfo.mjs +9 -3
- package/dist-browser/account/AccountInfo.mjs.map +1 -1
- package/dist-browser/account/AuthToken.mjs +9 -23
- package/dist-browser/account/AuthToken.mjs.map +1 -1
- package/dist-browser/account/CcsCredential.mjs +1 -1
- package/dist-browser/account/ClientInfo.mjs +4 -4
- package/dist-browser/account/ClientInfo.mjs.map +1 -1
- package/dist-browser/account/TokenClaims.mjs +1 -1
- package/dist-browser/authority/Authority.mjs +52 -50
- package/dist-browser/authority/Authority.mjs.map +1 -1
- package/dist-browser/authority/AuthorityFactory.mjs +3 -3
- package/dist-browser/authority/AuthorityFactory.mjs.map +1 -1
- package/dist-browser/authority/AuthorityMetadata.mjs +8 -7
- package/dist-browser/authority/AuthorityMetadata.mjs.map +1 -1
- package/dist-browser/authority/AuthorityOptions.mjs +1 -1
- package/dist-browser/authority/AuthorityType.mjs +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 +16 -10
- package/dist-browser/authority/RegionDiscovery.mjs.map +1 -1
- package/dist-browser/cache/CacheManager.mjs +63 -47
- 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 +23 -7
- package/dist-browser/cache/utils/AccountEntityUtils.mjs.map +1 -1
- package/dist-browser/cache/utils/CacheHelpers.mjs +12 -4
- package/dist-browser/cache/utils/CacheHelpers.mjs.map +1 -1
- package/dist-browser/client/AuthorizationCodeClient.mjs +10 -10
- package/dist-browser/client/AuthorizationCodeClient.mjs.map +1 -1
- package/dist-browser/client/RefreshTokenClient.mjs +9 -9
- package/dist-browser/client/RefreshTokenClient.mjs.map +1 -1
- package/dist-browser/client/SilentFlowClient.mjs +11 -19
- package/dist-browser/client/SilentFlowClient.mjs.map +1 -1
- package/dist-browser/config/ClientConfiguration.mjs +6 -5
- package/dist-browser/config/ClientConfiguration.mjs.map +1 -1
- package/dist-browser/constants/AADServerParamKeys.mjs +7 -3
- package/dist-browser/constants/AADServerParamKeys.mjs.map +1 -1
- package/dist-browser/crypto/ICrypto.mjs +11 -11
- package/dist-browser/crypto/ICrypto.mjs.map +1 -1
- package/dist-browser/crypto/JoseHeader.mjs +3 -3
- package/dist-browser/crypto/JoseHeader.mjs.map +1 -1
- package/dist-browser/crypto/PopTokenGenerator.mjs +2 -2
- package/dist-browser/crypto/PopTokenGenerator.mjs.map +1 -1
- package/dist-browser/error/AuthError.mjs +5 -7
- package/dist-browser/error/AuthError.mjs.map +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 +5 -5
- package/dist-browser/error/ClientAuthError.mjs.map +1 -1
- package/dist-browser/error/ClientAuthErrorCodes.mjs +2 -4
- package/dist-browser/error/ClientAuthErrorCodes.mjs.map +1 -1
- package/dist-browser/error/ClientConfigurationError.mjs +5 -5
- package/dist-browser/error/ClientConfigurationError.mjs.map +1 -1
- package/dist-browser/error/ClientConfigurationErrorCodes.mjs +1 -1
- package/dist-browser/error/InteractionRequiredAuthError.mjs +5 -6
- package/dist-browser/error/InteractionRequiredAuthError.mjs.map +1 -1
- package/dist-browser/error/InteractionRequiredAuthErrorCodes.mjs +1 -1
- package/dist-browser/error/JoseHeaderError.mjs +5 -5
- package/dist-browser/error/JoseHeaderError.mjs.map +1 -1
- package/dist-browser/error/JoseHeaderErrorCodes.mjs +1 -1
- package/dist-browser/error/NetworkError.mjs +2 -2
- package/dist-browser/error/NetworkError.mjs.map +1 -1
- package/dist-browser/error/PlatformBrokerError.mjs +3 -3
- package/dist-browser/error/PlatformBrokerError.mjs.map +1 -1
- package/dist-browser/error/ServerError.mjs +3 -3
- package/dist-browser/error/ServerError.mjs.map +1 -1
- package/dist-browser/index-browser.mjs +1 -1
- package/dist-browser/index.mjs +1 -1
- package/dist-browser/log-strings-mapping.json +2 -2
- package/dist-browser/logger/Logger.mjs +25 -11
- package/dist-browser/logger/Logger.mjs.map +1 -1
- package/dist-browser/network/INetworkModule.mjs +4 -3
- package/dist-browser/network/INetworkModule.mjs.map +1 -1
- package/dist-browser/network/RequestThumbprint.mjs +1 -1
- package/dist-browser/network/ThrottlingUtils.mjs +2 -2
- package/dist-browser/network/ThrottlingUtils.mjs.map +1 -1
- package/dist-browser/packageMetadata.mjs +2 -2
- package/dist-browser/protocol/Authorize.mjs +18 -14
- package/dist-browser/protocol/Authorize.mjs.map +1 -1
- package/dist-browser/protocol/Token.mjs +5 -3
- package/dist-browser/protocol/Token.mjs.map +1 -1
- package/dist-browser/request/AuthenticationHeaderParser.mjs +4 -4
- package/dist-browser/request/AuthenticationHeaderParser.mjs.map +1 -1
- package/dist-browser/request/BaseAuthRequest.mjs +3 -3
- package/dist-browser/request/BaseAuthRequest.mjs.map +1 -1
- package/dist-browser/request/RequestParameterBuilder.mjs +50 -31
- package/dist-browser/request/RequestParameterBuilder.mjs.map +1 -1
- package/dist-browser/request/ScopeSet.mjs +13 -12
- package/dist-browser/request/ScopeSet.mjs.map +1 -1
- package/dist-browser/response/ResponseHandler.mjs +32 -29
- package/dist-browser/response/ResponseHandler.mjs.map +1 -1
- package/dist-browser/telemetry/performance/PerformanceClient.mjs +9 -9
- package/dist-browser/telemetry/performance/PerformanceClient.mjs.map +1 -1
- package/dist-browser/telemetry/performance/PerformanceEvent.mjs +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 +15 -14
- package/dist-browser/url/UrlString.mjs.map +1 -1
- package/dist-browser/utils/ClientAssertionUtils.mjs +3 -2
- package/dist-browser/utils/ClientAssertionUtils.mjs.map +1 -1
- package/dist-browser/utils/Constants.mjs +7 -3
- package/dist-browser/utils/Constants.mjs.map +1 -1
- package/dist-browser/utils/FunctionWrappers.mjs +7 -7
- package/dist-browser/utils/FunctionWrappers.mjs.map +1 -1
- package/dist-browser/utils/ProtocolUtils.mjs +12 -9
- package/dist-browser/utils/ProtocolUtils.mjs.map +1 -1
- package/dist-browser/utils/StringUtils.mjs +1 -1
- package/dist-browser/utils/TimeUtils.mjs +1 -1
- package/dist-browser/utils/UrlUtils.mjs +6 -6
- package/dist-browser/utils/UrlUtils.mjs.map +1 -1
- package/lib/index-browser.cjs +8 -8
- package/lib/index-browser.cjs.map +1 -1
- package/lib/{index-node-7wFgJ2eB.js → index-node-BSFEsmmC.js} +407 -325
- package/lib/index-node-BSFEsmmC.js.map +1 -0
- package/lib/index-node.cjs +2 -2
- package/lib/index.cjs +2 -2
- package/package.json +3 -5
- package/src/account/AccountInfo.ts +19 -1
- package/src/account/AuthToken.ts +19 -21
- package/src/account/ClientCredentials.ts +1 -0
- package/src/account/ClientInfo.ts +8 -3
- package/src/authority/Authority.ts +73 -38
- package/src/authority/AuthorityFactory.ts +4 -2
- package/src/authority/AuthorityMetadata.ts +2 -1
- package/src/authority/RegionDiscovery.ts +18 -11
- package/src/cache/CacheManager.ts +160 -57
- package/src/cache/entities/AccountEntity.ts +4 -0
- package/src/cache/entities/CredentialEntity.ts +2 -0
- package/src/cache/interface/ICacheManager.ts +1 -0
- package/src/cache/utils/AccountEntityUtils.ts +29 -3
- package/src/cache/utils/CacheHelpers.ts +18 -3
- package/src/cache/utils/CacheTypes.ts +2 -0
- package/src/client/AuthorizationCodeClient.ts +10 -4
- package/src/client/RefreshTokenClient.ts +12 -5
- package/src/client/SilentFlowClient.ts +17 -20
- package/src/config/ClientConfiguration.ts +14 -4
- package/src/constants/AADServerParamKeys.ts +5 -0
- package/src/crypto/ICrypto.ts +40 -10
- package/src/crypto/JoseHeader.ts +8 -2
- package/src/crypto/PopTokenGenerator.ts +1 -1
- package/src/error/AuthError.ts +9 -5
- package/src/error/ClientAuthError.ts +8 -3
- package/src/error/ClientAuthErrorCodes.ts +0 -2
- package/src/error/ClientConfigurationError.ts +5 -4
- package/src/error/InteractionRequiredAuthError.ts +9 -5
- package/src/error/JoseHeaderError.ts +11 -4
- package/src/error/NetworkError.ts +6 -1
- package/src/error/PlatformBrokerError.ts +2 -1
- package/src/error/ServerError.ts +3 -2
- package/src/logger/Logger.ts +25 -10
- package/src/network/INetworkModule.ts +3 -2
- package/src/network/ThrottlingUtils.ts +1 -0
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +23 -6
- package/src/protocol/Token.ts +6 -1
- package/src/request/AuthenticationHeaderParser.ts +6 -3
- package/src/request/BaseAuthRequest.ts +8 -2
- package/src/request/RequestParameterBuilder.ts +67 -43
- package/src/request/ScopeSet.ts +27 -11
- package/src/response/ImdsComputeResponse.ts +14 -0
- package/src/response/ResponseHandler.ts +46 -32
- package/src/url/UrlString.ts +32 -13
- package/src/utils/ClientAssertionUtils.ts +3 -1
- package/src/utils/Constants.ts +6 -3
- package/src/utils/ProtocolUtils.ts +26 -8
- package/src/utils/UrlUtils.ts +8 -3
- package/types/account/AccountInfo.d.ts +8 -2
- package/types/account/AccountInfo.d.ts.map +1 -1
- package/types/account/AuthToken.d.ts +2 -6
- package/types/account/AuthToken.d.ts.map +1 -1
- package/types/account/ClientCredentials.d.ts +1 -0
- package/types/account/ClientCredentials.d.ts.map +1 -1
- package/types/account/ClientInfo.d.ts.map +1 -1
- package/types/authority/Authority.d.ts +5 -5
- package/types/authority/Authority.d.ts.map +1 -1
- package/types/authority/AuthorityFactory.d.ts.map +1 -1
- package/types/authority/AuthorityMetadata.d.ts.map +1 -1
- package/types/authority/RegionDiscovery.d.ts +3 -2
- package/types/authority/RegionDiscovery.d.ts.map +1 -1
- package/types/cache/CacheManager.d.ts +0 -7
- package/types/cache/CacheManager.d.ts.map +1 -1
- package/types/cache/entities/AccountEntity.d.ts +4 -0
- package/types/cache/entities/AccountEntity.d.ts.map +1 -1
- package/types/cache/entities/CredentialEntity.d.ts +2 -0
- package/types/cache/entities/CredentialEntity.d.ts.map +1 -1
- package/types/cache/interface/ICacheManager.d.ts +1 -0
- package/types/cache/interface/ICacheManager.d.ts.map +1 -1
- package/types/cache/utils/AccountEntityUtils.d.ts +7 -1
- package/types/cache/utils/AccountEntityUtils.d.ts.map +1 -1
- package/types/cache/utils/CacheHelpers.d.ts +4 -1
- package/types/cache/utils/CacheHelpers.d.ts.map +1 -1
- package/types/cache/utils/CacheTypes.d.ts +2 -1
- package/types/cache/utils/CacheTypes.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 +4 -0
- package/types/config/ClientConfiguration.d.ts.map +1 -1
- package/types/constants/AADServerParamKeys.d.ts +4 -0
- package/types/constants/AADServerParamKeys.d.ts.map +1 -1
- package/types/crypto/ICrypto.d.ts.map +1 -1
- package/types/crypto/JoseHeader.d.ts.map +1 -1
- package/types/error/AuthError.d.ts +2 -3
- package/types/error/AuthError.d.ts.map +1 -1
- package/types/error/ClientAuthError.d.ts +2 -2
- package/types/error/ClientAuthError.d.ts.map +1 -1
- package/types/error/ClientAuthErrorCodes.d.ts +0 -2
- package/types/error/ClientAuthErrorCodes.d.ts.map +1 -1
- package/types/error/ClientConfigurationError.d.ts +2 -2
- package/types/error/ClientConfigurationError.d.ts.map +1 -1
- package/types/error/InteractionRequiredAuthError.d.ts +2 -2
- package/types/error/InteractionRequiredAuthError.d.ts.map +1 -1
- package/types/error/JoseHeaderError.d.ts +2 -2
- package/types/error/JoseHeaderError.d.ts.map +1 -1
- package/types/error/NetworkError.d.ts.map +1 -1
- package/types/error/PlatformBrokerError.d.ts +1 -1
- package/types/error/PlatformBrokerError.d.ts.map +1 -1
- package/types/error/ServerError.d.ts +1 -1
- package/types/error/ServerError.d.ts.map +1 -1
- package/types/logger/Logger.d.ts.map +1 -1
- package/types/network/INetworkModule.d.ts.map +1 -1
- package/types/network/ThrottlingUtils.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/packageMetadata.d.ts.map +1 -1
- package/types/protocol/Authorize.d.ts +6 -2
- package/types/protocol/Authorize.d.ts.map +1 -1
- package/types/protocol/Token.d.ts +2 -0
- package/types/protocol/Token.d.ts.map +1 -1
- package/types/request/AuthenticationHeaderParser.d.ts.map +1 -1
- package/types/request/BaseAuthRequest.d.ts +4 -0
- package/types/request/BaseAuthRequest.d.ts.map +1 -1
- package/types/request/RequestParameterBuilder.d.ts +13 -3
- package/types/request/RequestParameterBuilder.d.ts.map +1 -1
- package/types/request/ScopeSet.d.ts +4 -3
- package/types/request/ScopeSet.d.ts.map +1 -1
- package/types/response/ImdsComputeResponse.d.ts +10 -0
- package/types/response/ImdsComputeResponse.d.ts.map +1 -0
- package/types/response/ResponseHandler.d.ts +2 -1
- package/types/response/ResponseHandler.d.ts.map +1 -1
- package/types/url/UrlString.d.ts +5 -4
- package/types/url/UrlString.d.ts.map +1 -1
- package/types/utils/ClientAssertionUtils.d.ts +1 -1
- package/types/utils/ClientAssertionUtils.d.ts.map +1 -1
- package/types/utils/Constants.d.ts +6 -2
- package/types/utils/Constants.d.ts.map +1 -1
- package/types/utils/ProtocolUtils.d.ts +6 -3
- package/types/utils/ProtocolUtils.d.ts.map +1 -1
- package/types/utils/UrlUtils.d.ts.map +1 -1
- package/lib/index-node-7wFgJ2eB.js.map +0 -1
|
@@ -177,13 +177,15 @@ export class RefreshTokenClient {
|
|
|
177
177
|
// Cannot renew token if no request object is given.
|
|
178
178
|
if (!request) {
|
|
179
179
|
throw createClientConfigurationError(
|
|
180
|
-
ClientConfigurationErrorCodes.tokenRequestEmpty
|
|
180
|
+
ClientConfigurationErrorCodes.tokenRequestEmpty,
|
|
181
|
+
""
|
|
181
182
|
);
|
|
182
183
|
}
|
|
183
184
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
184
185
|
if (!request.account) {
|
|
185
186
|
throw createClientAuthError(
|
|
186
|
-
ClientAuthErrorCodes.noAccountInSilentRequest
|
|
187
|
+
ClientAuthErrorCodes.noAccountInSilentRequest,
|
|
188
|
+
request.correlationId
|
|
187
189
|
);
|
|
188
190
|
}
|
|
189
191
|
|
|
@@ -258,7 +260,8 @@ export class RefreshTokenClient {
|
|
|
258
260
|
|
|
259
261
|
if (!refreshToken) {
|
|
260
262
|
throw createInteractionRequiredAuthError(
|
|
261
|
-
InteractionRequiredAuthErrorCodes.noTokensFound
|
|
263
|
+
InteractionRequiredAuthErrorCodes.noTokensFound,
|
|
264
|
+
request.correlationId
|
|
262
265
|
);
|
|
263
266
|
}
|
|
264
267
|
|
|
@@ -276,7 +279,8 @@ export class RefreshTokenClient {
|
|
|
276
279
|
|
|
277
280
|
if (TimeUtils.isTokenExpired(refreshToken.expiresOn, offset)) {
|
|
278
281
|
throw createInteractionRequiredAuthError(
|
|
279
|
-
InteractionRequiredAuthErrorCodes.refreshTokenExpired
|
|
282
|
+
InteractionRequiredAuthErrorCodes.refreshTokenExpired,
|
|
283
|
+
request.correlationId
|
|
280
284
|
);
|
|
281
285
|
}
|
|
282
286
|
}
|
|
@@ -407,6 +411,7 @@ export class RefreshTokenClient {
|
|
|
407
411
|
RequestParameterBuilder.addScopes(
|
|
408
412
|
parameters,
|
|
409
413
|
request.scopes,
|
|
414
|
+
request.correlationId,
|
|
410
415
|
true,
|
|
411
416
|
this.config.authOptions.authority.options.OIDCOptions?.defaultScopes
|
|
412
417
|
);
|
|
@@ -497,7 +502,8 @@ export class RefreshTokenClient {
|
|
|
497
502
|
RequestParameterBuilder.addSshJwk(parameters, request.sshJwk);
|
|
498
503
|
} else {
|
|
499
504
|
throw createClientConfigurationError(
|
|
500
|
-
ClientConfigurationErrorCodes.missingSshJwk
|
|
505
|
+
ClientConfigurationErrorCodes.missingSshJwk,
|
|
506
|
+
request.correlationId
|
|
501
507
|
);
|
|
502
508
|
}
|
|
503
509
|
}
|
|
@@ -554,6 +560,7 @@ export class RefreshTokenClient {
|
|
|
554
560
|
|
|
555
561
|
RequestParameterBuilder.addClaims(
|
|
556
562
|
parameters,
|
|
563
|
+
request.correlationId,
|
|
557
564
|
request.claims,
|
|
558
565
|
this.config.authOptions.clientCapabilities,
|
|
559
566
|
request.skipBrokerClaims
|
|
@@ -20,7 +20,7 @@ import { CacheRecord } from "../cache/entities/CacheRecord.js";
|
|
|
20
20
|
import { CacheOutcome } from "../utils/Constants.js";
|
|
21
21
|
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
|
|
22
22
|
import { StringUtils } from "../utils/StringUtils.js";
|
|
23
|
-
import {
|
|
23
|
+
import { extractTokenClaims } from "../account/AuthToken.js";
|
|
24
24
|
import { TokenClaims } from "../account/TokenClaims.js";
|
|
25
25
|
import * as PerformanceEvents from "../telemetry/performance/PerformanceEvents.js";
|
|
26
26
|
import { invokeAsync } from "../utils/FunctionWrappers.js";
|
|
@@ -106,20 +106,25 @@ export class SilentFlowClient {
|
|
|
106
106
|
request.correlationId
|
|
107
107
|
);
|
|
108
108
|
throw createClientAuthError(
|
|
109
|
-
ClientAuthErrorCodes.tokenRefreshRequired
|
|
109
|
+
ClientAuthErrorCodes.tokenRefreshRequired,
|
|
110
|
+
request.correlationId
|
|
110
111
|
);
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
// We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases
|
|
114
115
|
if (!request.account) {
|
|
115
116
|
throw createClientAuthError(
|
|
116
|
-
ClientAuthErrorCodes.noAccountInSilentRequest
|
|
117
|
+
ClientAuthErrorCodes.noAccountInSilentRequest,
|
|
118
|
+
request.correlationId
|
|
117
119
|
);
|
|
118
120
|
}
|
|
119
121
|
|
|
120
122
|
const requestTenantId =
|
|
121
123
|
request.account.tenantId ||
|
|
122
|
-
getTenantFromAuthorityString(
|
|
124
|
+
getTenantFromAuthorityString(
|
|
125
|
+
request.authority,
|
|
126
|
+
request.correlationId
|
|
127
|
+
);
|
|
123
128
|
const tokenKeys = this.cacheManager.getTokenKeys();
|
|
124
129
|
const cachedAccessToken = this.cacheManager.getAccessToken(
|
|
125
130
|
request.account,
|
|
@@ -135,7 +140,8 @@ export class SilentFlowClient {
|
|
|
135
140
|
request.correlationId
|
|
136
141
|
);
|
|
137
142
|
throw createClientAuthError(
|
|
138
|
-
ClientAuthErrorCodes.tokenRefreshRequired
|
|
143
|
+
ClientAuthErrorCodes.tokenRefreshRequired,
|
|
144
|
+
request.correlationId
|
|
139
145
|
);
|
|
140
146
|
} else if (
|
|
141
147
|
TimeUtils.wasClockTurnedBack(cachedAccessToken.cachedAt) ||
|
|
@@ -150,7 +156,8 @@ export class SilentFlowClient {
|
|
|
150
156
|
request.correlationId
|
|
151
157
|
);
|
|
152
158
|
throw createClientAuthError(
|
|
153
|
-
ClientAuthErrorCodes.tokenRefreshRequired
|
|
159
|
+
ClientAuthErrorCodes.tokenRefreshRequired,
|
|
160
|
+
request.correlationId
|
|
154
161
|
);
|
|
155
162
|
} else if (request.resource) {
|
|
156
163
|
// cached access token must have a resource that matches the request resource for MCP scenarios
|
|
@@ -160,7 +167,8 @@ export class SilentFlowClient {
|
|
|
160
167
|
request.correlationId
|
|
161
168
|
);
|
|
162
169
|
throw createClientAuthError(
|
|
163
|
-
ClientAuthErrorCodes.tokenRefreshRequired
|
|
170
|
+
ClientAuthErrorCodes.tokenRefreshRequired,
|
|
171
|
+
request.correlationId
|
|
164
172
|
);
|
|
165
173
|
}
|
|
166
174
|
} else if (
|
|
@@ -243,22 +251,11 @@ export class SilentFlowClient {
|
|
|
243
251
|
if (cacheRecord.idToken) {
|
|
244
252
|
idTokenClaims = extractTokenClaims(
|
|
245
253
|
cacheRecord.idToken.secret,
|
|
246
|
-
this.config.cryptoInterface.base64Decode
|
|
254
|
+
this.config.cryptoInterface.base64Decode,
|
|
255
|
+
request.correlationId
|
|
247
256
|
);
|
|
248
257
|
}
|
|
249
258
|
|
|
250
|
-
// token max_age check
|
|
251
|
-
if (request.maxAge || request.maxAge === 0) {
|
|
252
|
-
const authTime = idTokenClaims?.auth_time;
|
|
253
|
-
if (!authTime) {
|
|
254
|
-
throw createClientAuthError(
|
|
255
|
-
ClientAuthErrorCodes.authTimeNotFound
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
checkMaxAge(authTime, request.maxAge);
|
|
260
|
-
}
|
|
261
|
-
|
|
262
259
|
return ResponseHandler.generateAuthenticationResult(
|
|
263
260
|
this.cryptoUtils,
|
|
264
261
|
this.authority,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,
|
|
12
12
|
SKU,
|
|
13
13
|
} from "../utils/Constants.js";
|
|
14
|
-
import { version } from "../packageMetadata.js";
|
|
14
|
+
import { version, name } from "../packageMetadata.js";
|
|
15
15
|
import type { Authority } from "../authority/Authority.js";
|
|
16
16
|
import { AzureCloudInstance } from "../authority/AuthorityOptions.js";
|
|
17
17
|
import { CacheManager, DefaultStorageClass } from "../cache/CacheManager.js";
|
|
@@ -56,6 +56,9 @@ export type ClientConfiguration = {
|
|
|
56
56
|
serializableCache?: ISerializableTokenCache | null;
|
|
57
57
|
};
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* @internal
|
|
61
|
+
*/
|
|
59
62
|
export type CommonClientConfiguration = {
|
|
60
63
|
authOptions: Required<AuthOptions>;
|
|
61
64
|
systemOptions: Required<SystemOptions>;
|
|
@@ -171,10 +174,16 @@ const DEFAULT_LOGGER_IMPLEMENTATION: Required<LoggerOptions> = {
|
|
|
171
174
|
|
|
172
175
|
const DEFAULT_NETWORK_IMPLEMENTATION: INetworkModule = {
|
|
173
176
|
async sendGetRequestAsync<T>(): Promise<T> {
|
|
174
|
-
throw createClientAuthError(
|
|
177
|
+
throw createClientAuthError(
|
|
178
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
179
|
+
""
|
|
180
|
+
);
|
|
175
181
|
},
|
|
176
182
|
async sendPostRequestAsync<T>(): Promise<T> {
|
|
177
|
-
throw createClientAuthError(
|
|
183
|
+
throw createClientAuthError(
|
|
184
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
185
|
+
""
|
|
186
|
+
);
|
|
178
187
|
},
|
|
179
188
|
};
|
|
180
189
|
|
|
@@ -208,6 +217,7 @@ const DEFAULT_TELEMETRY_OPTIONS: Required<TelemetryOptions> = {
|
|
|
208
217
|
* @param Configuration
|
|
209
218
|
*
|
|
210
219
|
* @returns Configuration
|
|
220
|
+
* @internal
|
|
211
221
|
*/
|
|
212
222
|
export function buildClientConfiguration({
|
|
213
223
|
authOptions: userAuthOptions,
|
|
@@ -237,7 +247,7 @@ export function buildClientConfiguration({
|
|
|
237
247
|
new DefaultStorageClass(
|
|
238
248
|
userAuthOptions.clientId,
|
|
239
249
|
DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
240
|
-
new Logger(loggerOptions),
|
|
250
|
+
new Logger(loggerOptions, name, version),
|
|
241
251
|
new StubPerformanceClient()
|
|
242
252
|
),
|
|
243
253
|
networkInterface:
|
|
@@ -63,3 +63,8 @@ export const EAR_JWK = "ear_jwk";
|
|
|
63
63
|
export const EAR_JWE_CRYPTO = "ear_jwe_crypto";
|
|
64
64
|
export const RESOURCE = "resource";
|
|
65
65
|
export const CLI_DATA = "clidata";
|
|
66
|
+
export const USER_FEDERATED_IDENTITY_CREDENTIAL =
|
|
67
|
+
"user_federated_identity_credential";
|
|
68
|
+
export const USERNAME = "username";
|
|
69
|
+
export const USER_ID = "user_id";
|
|
70
|
+
export const FMI_PATH = "fmi_path";
|
package/src/crypto/ICrypto.ts
CHANGED
|
@@ -96,33 +96,63 @@ export interface ICrypto {
|
|
|
96
96
|
|
|
97
97
|
export const DEFAULT_CRYPTO_IMPLEMENTATION: ICrypto = {
|
|
98
98
|
createNewGuid: (): string => {
|
|
99
|
-
throw createClientAuthError(
|
|
99
|
+
throw createClientAuthError(
|
|
100
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
101
|
+
""
|
|
102
|
+
);
|
|
100
103
|
},
|
|
101
104
|
base64Decode: (): string => {
|
|
102
|
-
throw createClientAuthError(
|
|
105
|
+
throw createClientAuthError(
|
|
106
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
107
|
+
""
|
|
108
|
+
);
|
|
103
109
|
},
|
|
104
110
|
base64Encode: (): string => {
|
|
105
|
-
throw createClientAuthError(
|
|
111
|
+
throw createClientAuthError(
|
|
112
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
113
|
+
""
|
|
114
|
+
);
|
|
106
115
|
},
|
|
107
116
|
base64UrlEncode: (): string => {
|
|
108
|
-
throw createClientAuthError(
|
|
117
|
+
throw createClientAuthError(
|
|
118
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
119
|
+
""
|
|
120
|
+
);
|
|
109
121
|
},
|
|
110
122
|
encodeKid: (): string => {
|
|
111
|
-
throw createClientAuthError(
|
|
123
|
+
throw createClientAuthError(
|
|
124
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
125
|
+
""
|
|
126
|
+
);
|
|
112
127
|
},
|
|
113
128
|
async getPublicKeyThumbprint(): Promise<string> {
|
|
114
|
-
throw createClientAuthError(
|
|
129
|
+
throw createClientAuthError(
|
|
130
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
131
|
+
""
|
|
132
|
+
);
|
|
115
133
|
},
|
|
116
134
|
async removeTokenBindingKey(): Promise<void> {
|
|
117
|
-
throw createClientAuthError(
|
|
135
|
+
throw createClientAuthError(
|
|
136
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
137
|
+
""
|
|
138
|
+
);
|
|
118
139
|
},
|
|
119
140
|
async clearKeystore(): Promise<boolean> {
|
|
120
|
-
throw createClientAuthError(
|
|
141
|
+
throw createClientAuthError(
|
|
142
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
143
|
+
""
|
|
144
|
+
);
|
|
121
145
|
},
|
|
122
146
|
async signJwt(): Promise<string> {
|
|
123
|
-
throw createClientAuthError(
|
|
147
|
+
throw createClientAuthError(
|
|
148
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
149
|
+
""
|
|
150
|
+
);
|
|
124
151
|
},
|
|
125
152
|
async hashString(): Promise<string> {
|
|
126
|
-
throw createClientAuthError(
|
|
153
|
+
throw createClientAuthError(
|
|
154
|
+
ClientAuthErrorCodes.methodNotImplemented,
|
|
155
|
+
""
|
|
156
|
+
);
|
|
127
157
|
},
|
|
128
158
|
};
|
package/src/crypto/JoseHeader.ts
CHANGED
|
@@ -38,12 +38,18 @@ export class JoseHeader {
|
|
|
38
38
|
static getShrHeaderString(shrHeaderOptions: JoseHeaderOptions): string {
|
|
39
39
|
// KeyID is required on the SHR header
|
|
40
40
|
if (!shrHeaderOptions.kid) {
|
|
41
|
-
throw createJoseHeaderError(
|
|
41
|
+
throw createJoseHeaderError(
|
|
42
|
+
JoseHeaderErrorCodes.missingKidError,
|
|
43
|
+
""
|
|
44
|
+
);
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
// Alg is required on the SHR header
|
|
45
48
|
if (!shrHeaderOptions.alg) {
|
|
46
|
-
throw createJoseHeaderError(
|
|
49
|
+
throw createJoseHeaderError(
|
|
50
|
+
JoseHeaderErrorCodes.missingAlgError,
|
|
51
|
+
""
|
|
52
|
+
);
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
const shrHeader = new JoseHeader({
|
|
@@ -125,7 +125,7 @@ export class PopTokenGenerator {
|
|
|
125
125
|
} = request;
|
|
126
126
|
|
|
127
127
|
const resourceUrlString = resourceRequestUri
|
|
128
|
-
? new UrlString(resourceRequestUri)
|
|
128
|
+
? new UrlString(resourceRequestUri, request.correlationId)
|
|
129
129
|
: undefined;
|
|
130
130
|
const resourceUrlComponents = resourceUrlString?.getUrlComponents();
|
|
131
131
|
return this.cryptoUtils.signJwt(
|
package/src/error/AuthError.ts
CHANGED
|
@@ -40,7 +40,12 @@ export class AuthError extends Error {
|
|
|
40
40
|
*/
|
|
41
41
|
platformBrokerError?: PlatformBrokerError;
|
|
42
42
|
|
|
43
|
-
constructor(
|
|
43
|
+
constructor(
|
|
44
|
+
errorCode: string,
|
|
45
|
+
correlationId: string,
|
|
46
|
+
errorMessage?: string,
|
|
47
|
+
suberror?: string
|
|
48
|
+
) {
|
|
44
49
|
const message =
|
|
45
50
|
errorMessage ||
|
|
46
51
|
(errorCode ? getDefaultErrorMessage(errorCode) : "");
|
|
@@ -51,20 +56,19 @@ export class AuthError extends Error {
|
|
|
51
56
|
this.errorCode = errorCode || "";
|
|
52
57
|
this.errorMessage = message || "";
|
|
53
58
|
this.subError = suberror || "";
|
|
54
|
-
this.name = "AuthError";
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
setCorrelationId(correlationId: string): void {
|
|
58
59
|
this.correlationId = correlationId;
|
|
60
|
+
this.name = "AuthError";
|
|
59
61
|
}
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
export function createAuthError(
|
|
63
65
|
code: string,
|
|
66
|
+
correlationId: string,
|
|
64
67
|
additionalMessage?: string
|
|
65
68
|
): AuthError {
|
|
66
69
|
return new AuthError(
|
|
67
70
|
code,
|
|
71
|
+
correlationId,
|
|
68
72
|
additionalMessage || getDefaultErrorMessage(code)
|
|
69
73
|
);
|
|
70
74
|
}
|
|
@@ -15,8 +15,12 @@ export { ClientAuthErrorCodes }; // Allow importing as "ClientAuthErrorCodes";
|
|
|
15
15
|
* Error thrown when there is an error in the client code running on the browser.
|
|
16
16
|
*/
|
|
17
17
|
export class ClientAuthError extends AuthError {
|
|
18
|
-
constructor(
|
|
19
|
-
|
|
18
|
+
constructor(
|
|
19
|
+
errorCode: string,
|
|
20
|
+
correlationId: string,
|
|
21
|
+
additionalMessage?: string
|
|
22
|
+
) {
|
|
23
|
+
super(errorCode, correlationId, additionalMessage);
|
|
20
24
|
this.name = "ClientAuthError";
|
|
21
25
|
|
|
22
26
|
Object.setPrototypeOf(this, ClientAuthError.prototype);
|
|
@@ -25,7 +29,8 @@ export class ClientAuthError extends AuthError {
|
|
|
25
29
|
|
|
26
30
|
export function createClientAuthError(
|
|
27
31
|
errorCode: string,
|
|
32
|
+
correlationId: string,
|
|
28
33
|
additionalMessage?: string
|
|
29
34
|
): ClientAuthError {
|
|
30
|
-
return new ClientAuthError(errorCode, additionalMessage);
|
|
35
|
+
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
31
36
|
}
|
|
@@ -15,8 +15,6 @@ export const invalidState = "invalid_state";
|
|
|
15
15
|
export const stateMismatch = "state_mismatch";
|
|
16
16
|
export const stateNotFound = "state_not_found";
|
|
17
17
|
export const nonceMismatch = "nonce_mismatch";
|
|
18
|
-
export const authTimeNotFound = "auth_time_not_found";
|
|
19
|
-
export const maxAgeTranspired = "max_age_transpired";
|
|
20
18
|
export const multipleMatchingTokens = "multiple_matching_tokens";
|
|
21
19
|
export const multipleMatchingAppMetadata = "multiple_matching_appMetadata";
|
|
22
20
|
export const requestCannotBeMade = "request_cannot_be_made";
|
|
@@ -11,15 +11,16 @@ export { ClientConfigurationErrorCodes };
|
|
|
11
11
|
* Error thrown when there is an error in configuration of the MSAL.js library.
|
|
12
12
|
*/
|
|
13
13
|
export class ClientConfigurationError extends AuthError {
|
|
14
|
-
constructor(errorCode: string) {
|
|
15
|
-
super(errorCode);
|
|
14
|
+
constructor(errorCode: string, correlationId: string) {
|
|
15
|
+
super(errorCode, correlationId);
|
|
16
16
|
this.name = "ClientConfigurationError";
|
|
17
17
|
Object.setPrototypeOf(this, ClientConfigurationError.prototype);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export function createClientConfigurationError(
|
|
22
|
-
errorCode: string
|
|
22
|
+
errorCode: string,
|
|
23
|
+
correlationId: string
|
|
23
24
|
): ClientConfigurationError {
|
|
24
|
-
return new ClientConfigurationError(errorCode);
|
|
25
|
+
return new ClientConfigurationError(errorCode, correlationId);
|
|
25
26
|
}
|
|
@@ -61,21 +61,20 @@ export class InteractionRequiredAuthError extends AuthError {
|
|
|
61
61
|
readonly errorNo?: string;
|
|
62
62
|
|
|
63
63
|
constructor(
|
|
64
|
-
errorCode
|
|
64
|
+
errorCode: string,
|
|
65
|
+
correlationId: string,
|
|
65
66
|
errorMessage?: string,
|
|
66
67
|
subError?: string,
|
|
67
68
|
timestamp?: string,
|
|
68
69
|
traceId?: string,
|
|
69
|
-
correlationId?: string,
|
|
70
70
|
claims?: string,
|
|
71
71
|
errorNo?: string
|
|
72
72
|
) {
|
|
73
|
-
super(errorCode, errorMessage, subError);
|
|
73
|
+
super(errorCode, correlationId, errorMessage, subError);
|
|
74
74
|
Object.setPrototypeOf(this, InteractionRequiredAuthError.prototype);
|
|
75
75
|
|
|
76
76
|
this.timestamp = timestamp || "";
|
|
77
77
|
this.traceId = traceId || "";
|
|
78
|
-
this.correlationId = correlationId || "";
|
|
79
78
|
this.claims = claims || "";
|
|
80
79
|
this.name = "InteractionRequiredAuthError";
|
|
81
80
|
this.errorNo = errorNo;
|
|
@@ -117,7 +116,12 @@ export function isInteractionRequiredError(
|
|
|
117
116
|
*/
|
|
118
117
|
export function createInteractionRequiredAuthError(
|
|
119
118
|
errorCode: string,
|
|
119
|
+
correlationId: string,
|
|
120
120
|
errorMessage?: string
|
|
121
121
|
): InteractionRequiredAuthError {
|
|
122
|
-
return new InteractionRequiredAuthError(
|
|
122
|
+
return new InteractionRequiredAuthError(
|
|
123
|
+
errorCode,
|
|
124
|
+
correlationId,
|
|
125
|
+
errorMessage
|
|
126
|
+
);
|
|
123
127
|
}
|
|
@@ -11,8 +11,12 @@ export { JoseHeaderErrorCodes };
|
|
|
11
11
|
* Error thrown when there is an error in the client code running on the browser.
|
|
12
12
|
*/
|
|
13
13
|
export class JoseHeaderError extends AuthError {
|
|
14
|
-
constructor(
|
|
15
|
-
|
|
14
|
+
constructor(
|
|
15
|
+
errorCode: string,
|
|
16
|
+
correlationId: string,
|
|
17
|
+
errorMessage?: string
|
|
18
|
+
) {
|
|
19
|
+
super(errorCode, correlationId, errorMessage);
|
|
16
20
|
this.name = "JoseHeaderError";
|
|
17
21
|
|
|
18
22
|
Object.setPrototypeOf(this, JoseHeaderError.prototype);
|
|
@@ -20,6 +24,9 @@ export class JoseHeaderError extends AuthError {
|
|
|
20
24
|
}
|
|
21
25
|
|
|
22
26
|
/** Returns JoseHeaderError object */
|
|
23
|
-
export function createJoseHeaderError(
|
|
24
|
-
|
|
27
|
+
export function createJoseHeaderError(
|
|
28
|
+
code: string,
|
|
29
|
+
correlationId: string
|
|
30
|
+
): JoseHeaderError {
|
|
31
|
+
return new JoseHeaderError(code, correlationId);
|
|
25
32
|
}
|
|
@@ -18,7 +18,12 @@ export class NetworkError extends AuthError {
|
|
|
18
18
|
httpStatus?: number,
|
|
19
19
|
responseHeaders?: Record<string, string>
|
|
20
20
|
) {
|
|
21
|
-
super(
|
|
21
|
+
super(
|
|
22
|
+
error.errorCode,
|
|
23
|
+
error.correlationId,
|
|
24
|
+
error.errorMessage,
|
|
25
|
+
error.subError
|
|
26
|
+
);
|
|
22
27
|
|
|
23
28
|
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
24
29
|
this.name = "NetworkError";
|
|
@@ -49,6 +49,7 @@ export class PlatformBrokerError extends AuthError {
|
|
|
49
49
|
|
|
50
50
|
constructor(
|
|
51
51
|
errorStatus: string,
|
|
52
|
+
correlationId: string,
|
|
52
53
|
errorContext: string,
|
|
53
54
|
errorCode: number,
|
|
54
55
|
errorTag: number
|
|
@@ -58,7 +59,7 @@ export class PlatformBrokerError extends AuthError {
|
|
|
58
59
|
? `${errorContext} (Error Code: ${errorCode}, Tag: ${tagString})`
|
|
59
60
|
: `(Error Code: ${errorCode}, Tag: ${tagString})`;
|
|
60
61
|
|
|
61
|
-
super(errorStatus, enhancedErrorContext);
|
|
62
|
+
super(errorStatus, correlationId, enhancedErrorContext);
|
|
62
63
|
this.name = "PlatformBrokerError";
|
|
63
64
|
this.statusCode = errorCode;
|
|
64
65
|
this.tag = tagString;
|
package/src/error/ServerError.ts
CHANGED
|
@@ -20,13 +20,14 @@ export class ServerError extends AuthError {
|
|
|
20
20
|
readonly status?: number;
|
|
21
21
|
|
|
22
22
|
constructor(
|
|
23
|
-
errorCode
|
|
23
|
+
errorCode: string,
|
|
24
|
+
correlationId: string,
|
|
24
25
|
errorMessage?: string,
|
|
25
26
|
subError?: string,
|
|
26
27
|
errorNo?: string,
|
|
27
28
|
status?: number
|
|
28
29
|
) {
|
|
29
|
-
super(errorCode, errorMessage, subError);
|
|
30
|
+
super(errorCode, correlationId, errorMessage, subError);
|
|
30
31
|
this.name = "ServerError";
|
|
31
32
|
this.errorNo = errorNo;
|
|
32
33
|
this.status = status;
|
package/src/logger/Logger.ts
CHANGED
|
@@ -147,25 +147,40 @@ export function getCachedCorrelationIds(): string[] {
|
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
/**
|
|
150
|
-
*
|
|
150
|
+
* Extracts the leading minification hash from a log message, if present.
|
|
151
|
+
*
|
|
152
|
+
* Minified messages are produced by the logger-minify rollup plugin and are
|
|
153
|
+
* either a bare 6-character alphanumeric hash, or that hash followed by a space
|
|
154
|
+
* and runtime variables appended for local (console) logging, e.g.
|
|
155
|
+
* "abc123 user-1 popup". Only the leading hash is returned so that telemetry
|
|
156
|
+
* never captures the appended variables. Returns null when the message is not
|
|
157
|
+
* a minified message.
|
|
151
158
|
*/
|
|
152
|
-
function
|
|
153
|
-
if (str.length
|
|
154
|
-
return
|
|
159
|
+
function getMessageHash(str: string): string | null {
|
|
160
|
+
if (str.length < 6) {
|
|
161
|
+
return null;
|
|
155
162
|
}
|
|
156
163
|
|
|
157
|
-
|
|
164
|
+
/*
|
|
165
|
+
* If the message is longer than the hash, the hash must be delimited by a
|
|
166
|
+
* space (the separator the plugin inserts before appended variables).
|
|
167
|
+
*/
|
|
168
|
+
if (str.length > 6 && str[6] !== " ") {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
for (let i = 0; i < 6; i++) {
|
|
158
173
|
const char = str[i];
|
|
159
174
|
const isAlphaNumeric =
|
|
160
175
|
(char >= "a" && char <= "z") ||
|
|
161
176
|
(char >= "A" && char <= "Z") ||
|
|
162
177
|
(char >= "0" && char <= "9");
|
|
163
178
|
if (!isAlphaNumeric) {
|
|
164
|
-
return
|
|
179
|
+
return null;
|
|
165
180
|
}
|
|
166
181
|
}
|
|
167
182
|
|
|
168
|
-
return
|
|
183
|
+
return str.substring(0, 6);
|
|
169
184
|
}
|
|
170
185
|
|
|
171
186
|
/**
|
|
@@ -241,11 +256,11 @@ export class Logger {
|
|
|
241
256
|
options: LoggerMessageOptions
|
|
242
257
|
): void {
|
|
243
258
|
const correlationId = options.correlationId;
|
|
244
|
-
const
|
|
259
|
+
const messageHash = getMessageHash(logMessage);
|
|
245
260
|
|
|
246
|
-
if (
|
|
261
|
+
if (messageHash) {
|
|
247
262
|
const loggedMessage: LoggedMessage = {
|
|
248
|
-
hash:
|
|
263
|
+
hash: messageHash,
|
|
249
264
|
level: options.logLevel,
|
|
250
265
|
containsPii: options.containsPii || false,
|
|
251
266
|
milliseconds: 0, // Will be calculated in addLogToCache
|
|
@@ -46,14 +46,15 @@ export interface INetworkModule {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
export const StubbedNetworkModule: INetworkModule = {
|
|
49
|
+
// Module-level singleton: no per-request correlationId available
|
|
49
50
|
sendGetRequestAsync: () => {
|
|
50
51
|
return Promise.reject(
|
|
51
|
-
createClientAuthError(ClientAuthErrorCodes.methodNotImplemented)
|
|
52
|
+
createClientAuthError(ClientAuthErrorCodes.methodNotImplemented, "")
|
|
52
53
|
);
|
|
53
54
|
},
|
|
54
55
|
sendPostRequestAsync: () => {
|
|
55
56
|
return Promise.reject(
|
|
56
|
-
createClientAuthError(ClientAuthErrorCodes.methodNotImplemented)
|
|
57
|
+
createClientAuthError(ClientAuthErrorCodes.methodNotImplemented, "")
|
|
57
58
|
);
|
|
58
59
|
},
|
|
59
60
|
};
|
package/src/packageMetadata.ts
CHANGED