@azure/msal-browser 5.18.0 → 5.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +9 -12
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +6 -6
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/CacheHelpers.mjs +1 -1
- package/dist/cache/CacheKeys.mjs +1 -1
- package/dist/cache/CookieStorage.mjs +1 -1
- package/dist/cache/DatabaseStorage.mjs +1 -1
- package/dist/cache/EncryptedData.mjs +1 -1
- package/dist/cache/LocalStorage.mjs +15 -5
- package/dist/cache/LocalStorage.mjs.map +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +3 -2
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.mjs +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +8 -4
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
- package/dist/controllers/StandardController.mjs +24 -18
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +19 -19
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.mjs +62 -103
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +4 -2
- package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
- package/dist/crypto/TokenBindingKeyManager.mjs +157 -0
- package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -0
- package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +2 -2
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
- package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
- package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
- package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
- package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +4 -4
- package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +4 -3
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
- package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
- package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
- package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
- package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +2 -1
- package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs.map +1 -1
- package/dist/custom_auth/index.mjs +1 -1
- package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
- package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +5 -2
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +6 -2
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs +6 -6
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +9 -5
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +8 -3
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +6 -3
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +8 -5
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +4 -2
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +2 -1
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +243 -247
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +27 -32
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +52 -25
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/popup_relay/constants.mjs +1 -1
- package/dist/popup_relay/index.mjs +1 -1
- package/dist/popup_relay/relayClient.mjs +1 -1
- package/dist/protocol/Authorize.mjs +12 -16
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/redirect_bridge/index.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +71 -10
- package/dist/request/RequestHelpers.mjs.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceEvents.mjs +5 -5
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs +64 -0
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs.map +1 -0
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +39 -0
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs.map +1 -0
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +58 -0
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs.map +1 -0
- package/lib/custom-auth-path/log-strings-mapping.json +39 -43
- package/lib/custom-auth-path/msal-custom-auth.cjs +2873 -2249
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +2873 -2249
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +11 -15
- package/lib/msal-browser.cjs +1243 -503
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +1243 -503
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
- package/lib/popup-relay/msal-popup-relay.js +2 -2
- package/lib/popup-relay/msal-popup-relay.js.map +1 -1
- package/lib/popup-relay/msal-popup-relay.min.js +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
- package/package.json +2 -2
- package/src/cache/AsyncMemoryStorage.ts +7 -13
- package/src/cache/BrowserCacheManager.ts +12 -4
- package/src/cache/LocalStorage.ts +14 -4
- package/src/cache/TokenCache.ts +3 -1
- package/src/controllers/NestedAppAuthController.ts +10 -2
- package/src/controllers/StandardController.ts +46 -16
- package/src/controllers/UnknownOperatingContextController.ts +11 -2
- package/src/crypto/BrowserCrypto.ts +10 -8
- package/src/crypto/CryptoOps.ts +138 -178
- package/src/crypto/SignedHttpRequest.ts +3 -0
- package/src/crypto/TokenBindingKeyManager.ts +299 -0
- package/src/custom_auth/controller/CustomAuthStandardController.ts +2 -1
- package/src/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.ts +8 -3
- package/src/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.ts +7 -3
- package/src/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.ts +1 -0
- package/src/error/BrowserAuthErrorCodes.ts +6 -0
- package/src/index.ts +1 -0
- package/src/interaction_client/BaseInteractionClient.ts +8 -1
- package/src/interaction_client/PlatformAuthInteractionClient.ts +9 -3
- package/src/interaction_client/PopupClient.ts +24 -4
- package/src/interaction_client/RedirectClient.ts +20 -2
- package/src/interaction_client/SilentAuthCodeClient.ts +13 -2
- package/src/interaction_client/SilentIframeClient.ts +16 -7
- package/src/interaction_client/SilentRefreshClient.ts +11 -1
- package/src/interaction_client/StandardInteractionClient.ts +1 -0
- package/src/naa/BridgeProxy.ts +38 -44
- package/src/naa/mapping/NestedAppAuthAdapter.ts +57 -55
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +15 -24
- package/src/request/RequestHelpers.ts +124 -13
- package/src/telemetry/BrowserPerformanceEvents.ts +4 -4
- package/src/webBrokerBridge/PendingRequestRegistry.ts +2 -5
- package/src/webBrokerBridge/adapter/CrossVersionRequestAdapter.ts +186 -0
- package/src/webBrokerBridge/index.ts +11 -0
- package/types/cache/AsyncMemoryStorage.d.ts +1 -2
- package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/types/cache/BrowserCacheManager.d.ts +3 -3
- package/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/types/cache/LocalStorage.d.ts.map +1 -1
- package/types/cache/TokenCache.d.ts.map +1 -1
- package/types/controllers/NestedAppAuthController.d.ts.map +1 -1
- package/types/controllers/StandardController.d.ts +2 -1
- package/types/controllers/StandardController.d.ts.map +1 -1
- package/types/controllers/UnknownOperatingContextController.d.ts.map +1 -1
- package/types/crypto/BrowserCrypto.d.ts +2 -2
- package/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/types/crypto/CryptoOps.d.ts +7 -21
- package/types/crypto/CryptoOps.d.ts.map +1 -1
- package/types/crypto/SignedHttpRequest.d.ts.map +1 -1
- package/types/crypto/TokenBindingKeyManager.d.ts +83 -0
- package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -0
- package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts +2 -2
- package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts +4 -3
- package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts.map +1 -1
- package/types/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.d.ts.map +1 -1
- package/types/error/BrowserAuthErrorCodes.d.ts +3 -0
- package/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/types/index.d.ts +3 -0
- package/types/index.d.ts.map +1 -1
- package/types/interaction_client/BaseInteractionClient.d.ts +3 -2
- package/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts +2 -2
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/PopupClient.d.ts +2 -2
- package/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/types/interaction_client/RedirectClient.d.ts +2 -2
- package/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/types/interaction_client/SilentAuthCodeClient.d.ts +2 -2
- package/types/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/types/interaction_client/SilentIframeClient.d.ts +2 -2
- package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/types/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/types/naa/BridgeProxy.d.ts +14 -2
- package/types/naa/BridgeProxy.d.ts.map +1 -1
- package/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/protocol/Authorize.d.ts.map +1 -1
- package/types/request/RequestHelpers.d.ts +11 -1
- package/types/request/RequestHelpers.d.ts.map +1 -1
- package/types/telemetry/BrowserPerformanceEvents.d.ts +4 -4
- package/types/webBrokerBridge/PendingRequestRegistry.d.ts +2 -2
- package/types/webBrokerBridge/PendingRequestRegistry.d.ts.map +1 -1
- package/types/webBrokerBridge/adapter/CrossVersionRequestAdapter.d.ts +66 -0
- package/types/webBrokerBridge/adapter/CrossVersionRequestAdapter.d.ts.map +1 -0
- package/types/webBrokerBridge/index.d.ts +2 -0
- package/types/webBrokerBridge/index.d.ts.map +1 -1
- package/src/naa/BridgeRequest.ts +0 -16
- package/types/naa/BridgeRequest.d.ts +0 -8
- package/types/naa/BridgeRequest.d.ts.map +0 -1
|
@@ -31,6 +31,8 @@ import {
|
|
|
31
31
|
enforceResourceParameter,
|
|
32
32
|
CacheHelpers,
|
|
33
33
|
TimeUtils,
|
|
34
|
+
DEFAULT_TOKEN_BINDING_KEY_MANAGER,
|
|
35
|
+
ITokenBindingKeyManager,
|
|
34
36
|
} from "@azure/msal-common/browser";
|
|
35
37
|
import * as BrowserPerformanceEvents from "../telemetry/BrowserPerformanceEvents.js";
|
|
36
38
|
import * as BrowserRootPerformanceEvents from "../telemetry/BrowserRootPerformanceEvents.js";
|
|
@@ -97,6 +99,7 @@ import {
|
|
|
97
99
|
import { IPlatformAuthHandler } from "../broker/nativeBroker/IPlatformAuthHandler.js";
|
|
98
100
|
import { collectInstanceStats } from "../utils/MsalFrameStatsUtils.js";
|
|
99
101
|
import { HandleRedirectPromiseOptions } from "../request/HandleRedirectPromiseOptions.js";
|
|
102
|
+
import { TokenBindingKeyManager } from "../crypto/TokenBindingKeyManager.js";
|
|
100
103
|
|
|
101
104
|
function preflightCheck(
|
|
102
105
|
initialized: boolean,
|
|
@@ -120,6 +123,9 @@ export class StandardController implements IController {
|
|
|
120
123
|
// Crypto interface implementation
|
|
121
124
|
protected readonly browserCrypto: ICrypto;
|
|
122
125
|
|
|
126
|
+
// Token-binding key lifecycle implementation
|
|
127
|
+
protected readonly tokenBindingKeyManager: ITokenBindingKeyManager;
|
|
128
|
+
|
|
123
129
|
// Storage interface implementation
|
|
124
130
|
protected readonly browserStorage: BrowserCacheManager;
|
|
125
131
|
|
|
@@ -222,10 +228,20 @@ export class StandardController implements IController {
|
|
|
222
228
|
// Initialize performance client
|
|
223
229
|
this.performanceClient = this.config.telemetry.client;
|
|
224
230
|
|
|
225
|
-
// Initialize
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
231
|
+
// Initialize environment-specific crypto and token-binding services.
|
|
232
|
+
if (this.isBrowserEnvironment) {
|
|
233
|
+
this.browserCrypto = new CryptoOps(
|
|
234
|
+
this.logger,
|
|
235
|
+
this.performanceClient
|
|
236
|
+
);
|
|
237
|
+
this.tokenBindingKeyManager = new TokenBindingKeyManager(
|
|
238
|
+
this.logger,
|
|
239
|
+
this.performanceClient
|
|
240
|
+
);
|
|
241
|
+
} else {
|
|
242
|
+
this.browserCrypto = DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
243
|
+
this.tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER;
|
|
244
|
+
}
|
|
229
245
|
|
|
230
246
|
this.eventHandler = new EventHandler(this.logger);
|
|
231
247
|
|
|
@@ -238,13 +254,16 @@ export class StandardController implements IController {
|
|
|
238
254
|
this.logger,
|
|
239
255
|
this.performanceClient,
|
|
240
256
|
this.eventHandler,
|
|
241
|
-
buildStaticAuthorityOptions(this.config.auth)
|
|
257
|
+
buildStaticAuthorityOptions(this.config.auth),
|
|
258
|
+
this.tokenBindingKeyManager
|
|
242
259
|
)
|
|
243
260
|
: DEFAULT_BROWSER_CACHE_MANAGER(
|
|
244
261
|
this.config.auth.clientId,
|
|
245
262
|
this.logger,
|
|
246
263
|
this.performanceClient,
|
|
247
|
-
this.eventHandler
|
|
264
|
+
this.eventHandler,
|
|
265
|
+
undefined,
|
|
266
|
+
this.tokenBindingKeyManager
|
|
248
267
|
);
|
|
249
268
|
|
|
250
269
|
// initialize in memory storage for native flows
|
|
@@ -258,7 +277,9 @@ export class StandardController implements IController {
|
|
|
258
277
|
this.browserCrypto,
|
|
259
278
|
this.logger,
|
|
260
279
|
this.performanceClient,
|
|
261
|
-
this.eventHandler
|
|
280
|
+
this.eventHandler,
|
|
281
|
+
undefined,
|
|
282
|
+
this.tokenBindingKeyManager
|
|
262
283
|
);
|
|
263
284
|
|
|
264
285
|
this.activeSilentTokenRequests = new Map();
|
|
@@ -510,7 +531,8 @@ export class StandardController implements IController {
|
|
|
510
531
|
this.platformAuthProvider,
|
|
511
532
|
platformBrokerRequest.accountId,
|
|
512
533
|
this.nativeInternalStorage,
|
|
513
|
-
platformBrokerRequest.correlationId
|
|
534
|
+
platformBrokerRequest.correlationId,
|
|
535
|
+
this.tokenBindingKeyManager
|
|
514
536
|
);
|
|
515
537
|
|
|
516
538
|
redirectResponse = invokeAsync(
|
|
@@ -718,7 +740,8 @@ export class StandardController implements IController {
|
|
|
718
740
|
this.platformAuthProvider,
|
|
719
741
|
this.getNativeAccountId(request),
|
|
720
742
|
this.nativeInternalStorage,
|
|
721
|
-
correlationId
|
|
743
|
+
correlationId,
|
|
744
|
+
this.tokenBindingKeyManager
|
|
722
745
|
);
|
|
723
746
|
result = invokeAsync(
|
|
724
747
|
nativeClient.acquireTokenRedirect.bind(nativeClient),
|
|
@@ -1826,7 +1849,8 @@ export class StandardController implements IController {
|
|
|
1826
1849
|
this.platformAuthProvider,
|
|
1827
1850
|
accountId || this.getNativeAccountId(request),
|
|
1828
1851
|
this.nativeInternalStorage,
|
|
1829
|
-
correlationId
|
|
1852
|
+
correlationId,
|
|
1853
|
+
this.tokenBindingKeyManager
|
|
1830
1854
|
);
|
|
1831
1855
|
|
|
1832
1856
|
return invokeAsync(
|
|
@@ -1939,7 +1963,8 @@ export class StandardController implements IController {
|
|
|
1939
1963
|
this.nativeInternalStorage,
|
|
1940
1964
|
correlationId,
|
|
1941
1965
|
this.platformAuthProvider,
|
|
1942
|
-
this.operatingContext.getResponseHandlers()?.waitForPopupResponse
|
|
1966
|
+
this.operatingContext.getResponseHandlers()?.waitForPopupResponse,
|
|
1967
|
+
this.tokenBindingKeyManager
|
|
1943
1968
|
);
|
|
1944
1969
|
}
|
|
1945
1970
|
|
|
@@ -1958,7 +1983,8 @@ export class StandardController implements IController {
|
|
|
1958
1983
|
this.performanceClient,
|
|
1959
1984
|
this.nativeInternalStorage,
|
|
1960
1985
|
correlationId,
|
|
1961
|
-
this.platformAuthProvider
|
|
1986
|
+
this.platformAuthProvider,
|
|
1987
|
+
this.tokenBindingKeyManager
|
|
1962
1988
|
);
|
|
1963
1989
|
}
|
|
1964
1990
|
|
|
@@ -1979,7 +2005,8 @@ export class StandardController implements IController {
|
|
|
1979
2005
|
this.nativeInternalStorage,
|
|
1980
2006
|
correlationId,
|
|
1981
2007
|
this.platformAuthProvider,
|
|
1982
|
-
this.operatingContext.getResponseHandlers()?.waitForIframeResponse
|
|
2008
|
+
this.operatingContext.getResponseHandlers()?.waitForIframeResponse,
|
|
2009
|
+
this.tokenBindingKeyManager
|
|
1983
2010
|
);
|
|
1984
2011
|
}
|
|
1985
2012
|
|
|
@@ -1998,7 +2025,8 @@ export class StandardController implements IController {
|
|
|
1998
2025
|
this.navigationClient,
|
|
1999
2026
|
this.performanceClient,
|
|
2000
2027
|
correlationId,
|
|
2001
|
-
this.platformAuthProvider
|
|
2028
|
+
this.platformAuthProvider,
|
|
2029
|
+
this.tokenBindingKeyManager
|
|
2002
2030
|
);
|
|
2003
2031
|
}
|
|
2004
2032
|
|
|
@@ -2017,7 +2045,8 @@ export class StandardController implements IController {
|
|
|
2017
2045
|
this.navigationClient,
|
|
2018
2046
|
this.performanceClient,
|
|
2019
2047
|
correlationId,
|
|
2020
|
-
this.platformAuthProvider
|
|
2048
|
+
this.platformAuthProvider,
|
|
2049
|
+
this.tokenBindingKeyManager
|
|
2021
2050
|
);
|
|
2022
2051
|
}
|
|
2023
2052
|
|
|
@@ -2037,7 +2066,8 @@ export class StandardController implements IController {
|
|
|
2037
2066
|
ApiId.acquireTokenByCode,
|
|
2038
2067
|
this.performanceClient,
|
|
2039
2068
|
correlationId,
|
|
2040
|
-
this.platformAuthProvider
|
|
2069
|
+
this.platformAuthProvider,
|
|
2070
|
+
this.tokenBindingKeyManager
|
|
2041
2071
|
);
|
|
2042
2072
|
}
|
|
2043
2073
|
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
ICrypto,
|
|
12
12
|
IPerformanceClient,
|
|
13
13
|
DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
14
|
+
DEFAULT_TOKEN_BINDING_KEY_MANAGER,
|
|
14
15
|
AccountFilter,
|
|
15
16
|
} from "@azure/msal-common/browser";
|
|
16
17
|
import { BrowserConfiguration } from "../config/Configuration.js";
|
|
@@ -31,6 +32,7 @@ import { WrapperSKU } from "../utils/BrowserConstants.js";
|
|
|
31
32
|
import { IController } from "./IController.js";
|
|
32
33
|
import { UnknownOperatingContext } from "../operatingcontext/UnknownOperatingContext.js";
|
|
33
34
|
import { CryptoOps } from "../crypto/CryptoOps.js";
|
|
35
|
+
import { TokenBindingKeyManager } from "../crypto/TokenBindingKeyManager.js";
|
|
34
36
|
import {
|
|
35
37
|
blockAPICallsBeforeInitialize,
|
|
36
38
|
blockNonBrowserEnvironment,
|
|
@@ -100,6 +102,9 @@ export class UnknownOperatingContextController implements IController {
|
|
|
100
102
|
this.browserCrypto = this.isBrowserEnvironment
|
|
101
103
|
? new CryptoOps(this.logger, this.performanceClient)
|
|
102
104
|
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
105
|
+
const tokenBindingKeyManager = this.isBrowserEnvironment
|
|
106
|
+
? new TokenBindingKeyManager(this.logger, this.performanceClient)
|
|
107
|
+
: DEFAULT_TOKEN_BINDING_KEY_MANAGER;
|
|
103
108
|
|
|
104
109
|
this.eventHandler = new EventHandler(this.logger);
|
|
105
110
|
|
|
@@ -111,13 +116,17 @@ export class UnknownOperatingContextController implements IController {
|
|
|
111
116
|
this.browserCrypto,
|
|
112
117
|
this.logger,
|
|
113
118
|
this.performanceClient,
|
|
114
|
-
this.eventHandler
|
|
119
|
+
this.eventHandler,
|
|
120
|
+
undefined,
|
|
121
|
+
tokenBindingKeyManager
|
|
115
122
|
)
|
|
116
123
|
: DEFAULT_BROWSER_CACHE_MANAGER(
|
|
117
124
|
this.config.auth.clientId,
|
|
118
125
|
this.logger,
|
|
119
126
|
this.performanceClient,
|
|
120
|
-
this.eventHandler
|
|
127
|
+
this.eventHandler,
|
|
128
|
+
undefined,
|
|
129
|
+
tokenBindingKeyManager
|
|
121
130
|
);
|
|
122
131
|
}
|
|
123
132
|
|
|
@@ -237,7 +237,7 @@ export async function importJwk(
|
|
|
237
237
|
*/
|
|
238
238
|
export async function sign(
|
|
239
239
|
key: CryptoKey,
|
|
240
|
-
data:
|
|
240
|
+
data: BufferSource,
|
|
241
241
|
algorithm: AlgorithmIdentifier
|
|
242
242
|
): Promise<ArrayBuffer> {
|
|
243
243
|
return window.crypto.subtle.sign(
|
|
@@ -463,13 +463,14 @@ const JWK_THUMBPRINT_REQUIRED_MEMBERS: Record<string, Array<string>> = {
|
|
|
463
463
|
};
|
|
464
464
|
|
|
465
465
|
function getJwkThumbprintMembers(
|
|
466
|
-
publicJwk: JsonWebKey
|
|
466
|
+
publicJwk: JsonWebKey,
|
|
467
|
+
correlationId: string
|
|
467
468
|
): Record<string, string> {
|
|
468
469
|
const kty = publicJwk.kty;
|
|
469
470
|
if (typeof kty !== "string" || kty.length === 0) {
|
|
470
471
|
throw createBrowserAuthError(
|
|
471
472
|
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
472
|
-
|
|
473
|
+
correlationId,
|
|
473
474
|
MISSING_JWK_KTY_SUBERROR
|
|
474
475
|
);
|
|
475
476
|
}
|
|
@@ -478,7 +479,7 @@ function getJwkThumbprintMembers(
|
|
|
478
479
|
if (!requiredMembers) {
|
|
479
480
|
throw createBrowserAuthError(
|
|
480
481
|
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
481
|
-
|
|
482
|
+
correlationId,
|
|
482
483
|
UNSUPPORTED_JWK_KTY_SUBERROR
|
|
483
484
|
);
|
|
484
485
|
}
|
|
@@ -488,7 +489,7 @@ function getJwkThumbprintMembers(
|
|
|
488
489
|
if (typeof memberValue !== "string") {
|
|
489
490
|
throw createBrowserAuthError(
|
|
490
491
|
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
491
|
-
|
|
492
|
+
correlationId,
|
|
492
493
|
MISSING_JWK_MEMBER_SUBERROR
|
|
493
494
|
);
|
|
494
495
|
}
|
|
@@ -496,7 +497,7 @@ function getJwkThumbprintMembers(
|
|
|
496
497
|
if (memberValue.length === 0) {
|
|
497
498
|
throw createBrowserAuthError(
|
|
498
499
|
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
499
|
-
|
|
500
|
+
correlationId,
|
|
500
501
|
EMPTY_JWK_MEMBER_SUBERROR
|
|
501
502
|
);
|
|
502
503
|
}
|
|
@@ -513,9 +514,10 @@ function getJwkThumbprintMembers(
|
|
|
513
514
|
* @internal
|
|
514
515
|
*/
|
|
515
516
|
export async function computeJwkThumbprint(
|
|
516
|
-
publicJwk: JsonWebKey
|
|
517
|
+
publicJwk: JsonWebKey,
|
|
518
|
+
correlationId: string
|
|
517
519
|
): Promise<string> {
|
|
518
|
-
const thumbprintMembers = getJwkThumbprintMembers(publicJwk);
|
|
520
|
+
const thumbprintMembers = getJwkThumbprintMembers(publicJwk, correlationId);
|
|
519
521
|
// RFC 7638 §3.3: use only required members, sorted lexicographically
|
|
520
522
|
const thumbprintJson = JSON.stringify(
|
|
521
523
|
thumbprintMembers,
|
package/src/crypto/CryptoOps.ts
CHANGED
|
@@ -4,15 +4,11 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import {
|
|
7
|
-
ClientAuthErrorCodes,
|
|
8
|
-
createClientAuthError,
|
|
9
7
|
ICrypto,
|
|
10
8
|
IPerformanceClient,
|
|
9
|
+
JsonWebTokenAlgorithms,
|
|
11
10
|
JoseHeader,
|
|
12
11
|
Logger,
|
|
13
|
-
ShrOptions,
|
|
14
|
-
SignedHttpRequest,
|
|
15
|
-
SignedHttpRequestParameters,
|
|
16
12
|
} from "@azure/msal-common/browser";
|
|
17
13
|
import * as BrowserPerformanceEvents from "../telemetry/BrowserPerformanceEvents.js";
|
|
18
14
|
import {
|
|
@@ -23,17 +19,14 @@ import {
|
|
|
23
19
|
import { base64Decode } from "../encode/Base64Decode.js";
|
|
24
20
|
import * as BrowserCrypto from "./BrowserCrypto.js";
|
|
25
21
|
import {
|
|
26
|
-
|
|
22
|
+
CachedKeyPair,
|
|
23
|
+
TokenBindingKeyTelemetry,
|
|
24
|
+
TokenBindingKeyManager,
|
|
25
|
+
} from "./TokenBindingKeyManager.js";
|
|
26
|
+
import {
|
|
27
27
|
BrowserAuthErrorCodes,
|
|
28
|
+
createBrowserAuthError,
|
|
28
29
|
} from "../error/BrowserAuthError.js";
|
|
29
|
-
import { AsyncMemoryStorage } from "../cache/AsyncMemoryStorage.js";
|
|
30
|
-
|
|
31
|
-
export type CachedKeyPair = {
|
|
32
|
-
publicKey: CryptoKey;
|
|
33
|
-
privateKey: CryptoKey;
|
|
34
|
-
requestMethod?: string;
|
|
35
|
-
requestUri?: string;
|
|
36
|
-
};
|
|
37
30
|
|
|
38
31
|
/**
|
|
39
32
|
* This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and
|
|
@@ -47,10 +40,7 @@ export class CryptoOps implements ICrypto {
|
|
|
47
40
|
* meaning there won't be a performance manager available.
|
|
48
41
|
*/
|
|
49
42
|
private performanceClient: IPerformanceClient | undefined;
|
|
50
|
-
|
|
51
|
-
private static POP_KEY_USAGES: Array<KeyUsage> = ["sign", "verify"];
|
|
52
|
-
private static EXTRACTABLE: boolean = true;
|
|
53
|
-
private cache: AsyncMemoryStorage<CachedKeyPair>;
|
|
43
|
+
private tokenBindingKeyManager: TokenBindingKeyManager;
|
|
54
44
|
|
|
55
45
|
constructor(
|
|
56
46
|
logger: Logger,
|
|
@@ -62,8 +52,11 @@ export class CryptoOps implements ICrypto {
|
|
|
62
52
|
BrowserCrypto.validateCryptoAvailable(
|
|
63
53
|
skipValidateSubtleCrypto ?? false
|
|
64
54
|
);
|
|
65
|
-
this.cache = new AsyncMemoryStorage<CachedKeyPair>(this.logger);
|
|
66
55
|
this.performanceClient = performanceClient;
|
|
56
|
+
this.tokenBindingKeyManager = new TokenBindingKeyManager(
|
|
57
|
+
this.logger,
|
|
58
|
+
this.performanceClient
|
|
59
|
+
);
|
|
67
60
|
}
|
|
68
61
|
|
|
69
62
|
/**
|
|
@@ -107,69 +100,6 @@ export class CryptoOps implements ICrypto {
|
|
|
107
100
|
return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
|
|
108
101
|
}
|
|
109
102
|
|
|
110
|
-
/**
|
|
111
|
-
* Generates a keypair, stores it and returns a thumbprint
|
|
112
|
-
* @param request
|
|
113
|
-
*/
|
|
114
|
-
async getPublicKeyThumbprint(
|
|
115
|
-
request: SignedHttpRequestParameters
|
|
116
|
-
): Promise<string> {
|
|
117
|
-
const publicKeyThumbMeasurement =
|
|
118
|
-
this.performanceClient?.startMeasurement(
|
|
119
|
-
BrowserPerformanceEvents.CryptoOptsGetPublicKeyThumbprint,
|
|
120
|
-
request.correlationId
|
|
121
|
-
);
|
|
122
|
-
|
|
123
|
-
// Generate Keypair
|
|
124
|
-
const keyPair: CryptoKeyPair = await BrowserCrypto.generateKeyPair(
|
|
125
|
-
CryptoOps.EXTRACTABLE,
|
|
126
|
-
CryptoOps.POP_KEY_USAGES,
|
|
127
|
-
BrowserCrypto.RSA_KEYGEN_ALGORITHM_OPTIONS
|
|
128
|
-
);
|
|
129
|
-
|
|
130
|
-
// Generate Thumbprint for Public Key
|
|
131
|
-
const publicKeyJwk: JsonWebKey = await BrowserCrypto.exportJwk(
|
|
132
|
-
keyPair.publicKey
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
const publicJwkHash = await BrowserCrypto.computeJwkThumbprint(
|
|
136
|
-
publicKeyJwk
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
// Generate Thumbprint for Private Key
|
|
140
|
-
const privateKeyJwk: JsonWebKey = await BrowserCrypto.exportJwk(
|
|
141
|
-
keyPair.privateKey
|
|
142
|
-
);
|
|
143
|
-
// Re-import private key to make it unextractable
|
|
144
|
-
const unextractablePrivateKey: CryptoKey =
|
|
145
|
-
await BrowserCrypto.importJwk(
|
|
146
|
-
privateKeyJwk,
|
|
147
|
-
false,
|
|
148
|
-
["sign"],
|
|
149
|
-
BrowserCrypto.RSA_KEYGEN_ALGORITHM_OPTIONS
|
|
150
|
-
);
|
|
151
|
-
|
|
152
|
-
// Store Keypair data in keystore
|
|
153
|
-
await this.cache.setItem(
|
|
154
|
-
publicJwkHash,
|
|
155
|
-
{
|
|
156
|
-
privateKey: unextractablePrivateKey,
|
|
157
|
-
publicKey: keyPair.publicKey,
|
|
158
|
-
requestMethod: request.resourceRequestMethod,
|
|
159
|
-
requestUri: request.resourceRequestUri,
|
|
160
|
-
},
|
|
161
|
-
request.correlationId
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
if (publicKeyThumbMeasurement) {
|
|
165
|
-
publicKeyThumbMeasurement.end({
|
|
166
|
-
success: true,
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return publicJwkHash;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
103
|
/**
|
|
174
104
|
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
175
105
|
* @param kid
|
|
@@ -179,14 +109,10 @@ export class CryptoOps implements ICrypto {
|
|
|
179
109
|
kid: string,
|
|
180
110
|
correlationId: string
|
|
181
111
|
): Promise<void> {
|
|
182
|
-
await this.
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
ClientAuthErrorCodes.bindingKeyNotRemoved,
|
|
187
|
-
correlationId
|
|
188
|
-
);
|
|
189
|
-
}
|
|
112
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(
|
|
113
|
+
kid,
|
|
114
|
+
correlationId
|
|
115
|
+
);
|
|
190
116
|
}
|
|
191
117
|
|
|
192
118
|
/**
|
|
@@ -194,115 +120,149 @@ export class CryptoOps implements ICrypto {
|
|
|
194
120
|
* @param correlationId
|
|
195
121
|
*/
|
|
196
122
|
async clearKeystore(correlationId: string): Promise<boolean> {
|
|
197
|
-
|
|
198
|
-
|
|
123
|
+
return this.tokenBindingKeyManager.clearKeystore(correlationId);
|
|
124
|
+
}
|
|
199
125
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
126
|
+
/** @internal */
|
|
127
|
+
async signTokenBindingJwt(
|
|
128
|
+
header: JoseHeader,
|
|
129
|
+
payload: object,
|
|
130
|
+
kid: string,
|
|
131
|
+
correlationId: string
|
|
132
|
+
): Promise<string> {
|
|
133
|
+
let telemetry: TokenBindingKeyTelemetry = {};
|
|
134
|
+
const signTokenBindingJwtMeasurement =
|
|
135
|
+
this.performanceClient?.startMeasurement(
|
|
136
|
+
BrowserPerformanceEvents.CryptoOptsSignJwt,
|
|
137
|
+
correlationId
|
|
138
|
+
);
|
|
204
139
|
try {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
if (e instanceof Error) {
|
|
209
|
-
this.logger.error(
|
|
210
|
-
`Clearing keystore failed with error: '${e.message}'`,
|
|
211
|
-
correlationId
|
|
212
|
-
);
|
|
213
|
-
} else {
|
|
214
|
-
this.logger.error(
|
|
215
|
-
"Clearing keystore failed with unknown error",
|
|
140
|
+
const cachedKeyPair =
|
|
141
|
+
await this.tokenBindingKeyManager.getTokenBindingKeyPair(
|
|
142
|
+
kid,
|
|
216
143
|
correlationId
|
|
217
144
|
);
|
|
218
|
-
|
|
145
|
+
await this.validateTokenBindingJwtHeaderKey(
|
|
146
|
+
header,
|
|
147
|
+
kid,
|
|
148
|
+
correlationId
|
|
149
|
+
);
|
|
150
|
+
telemetry = this.tokenBindingKeyManager.getTokenBindingKeyTelemetry(
|
|
151
|
+
cachedKeyPair,
|
|
152
|
+
header.alg
|
|
153
|
+
);
|
|
219
154
|
|
|
220
|
-
|
|
155
|
+
const signingAlgorithm = this.getTokenBindingKeySigningAlgorithm(
|
|
156
|
+
cachedKeyPair,
|
|
157
|
+
header.alg,
|
|
158
|
+
correlationId
|
|
159
|
+
);
|
|
160
|
+
|
|
161
|
+
const tokenString = `${urlEncode(
|
|
162
|
+
JSON.stringify(header)
|
|
163
|
+
)}.${urlEncode(JSON.stringify(payload))}`;
|
|
164
|
+
const encodedSignature = await this.signInput(
|
|
165
|
+
cachedKeyPair,
|
|
166
|
+
tokenString,
|
|
167
|
+
signingAlgorithm
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
signTokenBindingJwtMeasurement?.end({
|
|
171
|
+
success: true,
|
|
172
|
+
...telemetry,
|
|
173
|
+
});
|
|
174
|
+
return `${tokenString}.${encodedSignature}`;
|
|
175
|
+
} catch (e) {
|
|
176
|
+
signTokenBindingJwtMeasurement?.end({
|
|
177
|
+
success: false,
|
|
178
|
+
...telemetry,
|
|
179
|
+
});
|
|
180
|
+
throw e;
|
|
221
181
|
}
|
|
222
182
|
}
|
|
223
183
|
|
|
224
184
|
/**
|
|
225
|
-
*
|
|
226
|
-
* @param
|
|
227
|
-
* @param kid
|
|
185
|
+
* Returns the SHA-256 hash of an input string
|
|
186
|
+
* @param plainText
|
|
228
187
|
*/
|
|
229
|
-
async
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
188
|
+
async hashString(plainText: string): Promise<string> {
|
|
189
|
+
return BrowserCrypto.hashString(plainText);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
private async signInput(
|
|
193
|
+
cachedKeyPair: CachedKeyPair,
|
|
194
|
+
signingInput: string,
|
|
195
|
+
algorithm: AlgorithmIdentifier
|
|
234
196
|
): Promise<string> {
|
|
235
|
-
const
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
kid,
|
|
241
|
-
correlationId || ""
|
|
197
|
+
const encoder = new TextEncoder();
|
|
198
|
+
const signatureBuffer = await BrowserCrypto.sign(
|
|
199
|
+
cachedKeyPair.privateKey,
|
|
200
|
+
encoder.encode(signingInput),
|
|
201
|
+
algorithm
|
|
242
202
|
);
|
|
243
203
|
|
|
244
|
-
|
|
204
|
+
return urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
private getTokenBindingKeySigningAlgorithm(
|
|
208
|
+
cachedKeyPair: CachedKeyPair,
|
|
209
|
+
requestedAlgorithm: string,
|
|
210
|
+
correlationId: string
|
|
211
|
+
): AlgorithmIdentifier {
|
|
212
|
+
const keyAlgorithm = cachedKeyPair.privateKey.algorithm;
|
|
213
|
+
if (
|
|
214
|
+
requestedAlgorithm === JsonWebTokenAlgorithms.RS256 &&
|
|
215
|
+
keyAlgorithm.name === BrowserCrypto.RSA_SIGN_ALGORITHM_OPTIONS.name
|
|
216
|
+
) {
|
|
217
|
+
return BrowserCrypto.RSA_SIGN_ALGORITHM_OPTIONS;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
if (
|
|
221
|
+
requestedAlgorithm === JsonWebTokenAlgorithms.ES256 &&
|
|
222
|
+
keyAlgorithm.name ===
|
|
223
|
+
BrowserCrypto.ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS.name &&
|
|
224
|
+
(keyAlgorithm as EcKeyAlgorithm).namedCurve ===
|
|
225
|
+
BrowserCrypto.ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS.namedCurve
|
|
226
|
+
) {
|
|
227
|
+
return BrowserCrypto.ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
if (
|
|
231
|
+
requestedAlgorithm === JsonWebTokenAlgorithms.RS256 ||
|
|
232
|
+
requestedAlgorithm === JsonWebTokenAlgorithms.ES256
|
|
233
|
+
) {
|
|
245
234
|
throw createBrowserAuthError(
|
|
246
|
-
BrowserAuthErrorCodes.
|
|
247
|
-
correlationId
|
|
235
|
+
BrowserAuthErrorCodes.unsupportedTokenBindingAlgorithm,
|
|
236
|
+
correlationId,
|
|
237
|
+
BrowserAuthErrorCodes.tokenBindingKeyAlgorithmMismatch
|
|
248
238
|
);
|
|
249
239
|
}
|
|
250
240
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
241
|
+
throw createBrowserAuthError(
|
|
242
|
+
BrowserAuthErrorCodes.unsupportedTokenBindingAlgorithm,
|
|
243
|
+
correlationId
|
|
254
244
|
);
|
|
255
|
-
|
|
256
|
-
// Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
|
|
257
|
-
const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
|
|
258
|
-
// Generate header
|
|
259
|
-
const shrHeader = JoseHeader.getShrHeaderString({
|
|
260
|
-
...shrOptions?.header,
|
|
261
|
-
alg: publicKeyJwk.alg,
|
|
262
|
-
kid: encodedKeyIdThumbprint,
|
|
263
|
-
});
|
|
264
|
-
|
|
265
|
-
const encodedShrHeader = urlEncode(shrHeader);
|
|
266
|
-
|
|
267
|
-
// Generate payload
|
|
268
|
-
payload.cnf = {
|
|
269
|
-
jwk: JSON.parse(publicKeyJwkString),
|
|
270
|
-
};
|
|
271
|
-
const encodedPayload = urlEncode(JSON.stringify(payload));
|
|
245
|
+
}
|
|
272
246
|
|
|
273
|
-
|
|
274
|
-
|
|
247
|
+
private async validateTokenBindingJwtHeaderKey(
|
|
248
|
+
header: JoseHeader,
|
|
249
|
+
kid: string,
|
|
250
|
+
correlationId: string
|
|
251
|
+
): Promise<void> {
|
|
252
|
+
if (!header.jwk) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
275
255
|
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
const signatureBuffer = await BrowserCrypto.sign(
|
|
280
|
-
cachedKeyPair.privateKey,
|
|
281
|
-
tokenBuffer,
|
|
282
|
-
BrowserCrypto.RSA_SIGN_ALGORITHM_OPTIONS
|
|
256
|
+
const headerKeyId = await BrowserCrypto.computeJwkThumbprint(
|
|
257
|
+
header.jwk,
|
|
258
|
+
correlationId
|
|
283
259
|
);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
success: true,
|
|
291
|
-
});
|
|
260
|
+
if (headerKeyId !== kid) {
|
|
261
|
+
throw createBrowserAuthError(
|
|
262
|
+
BrowserAuthErrorCodes.invalidPublicJwk,
|
|
263
|
+
correlationId,
|
|
264
|
+
BrowserAuthErrorCodes.tokenBindingKeyJwkThumbprintMismatch
|
|
265
|
+
);
|
|
292
266
|
}
|
|
293
|
-
|
|
294
|
-
return signedJwt;
|
|
295
267
|
}
|
|
296
|
-
|
|
297
|
-
/**
|
|
298
|
-
* Returns the SHA-256 hash of an input string
|
|
299
|
-
* @param plainText
|
|
300
|
-
*/
|
|
301
|
-
async hashString(plainText: string): Promise<string> {
|
|
302
|
-
return BrowserCrypto.hashString(plainText);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
function getSortedObjectString(obj: object): string {
|
|
307
|
-
return JSON.stringify(obj, Object.keys(obj).sort());
|
|
308
268
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { CryptoOps } from "./CryptoOps.js";
|
|
7
|
+
import { TokenBindingKeyManager } from "./TokenBindingKeyManager.js";
|
|
7
8
|
import {
|
|
8
9
|
Logger,
|
|
9
10
|
LoggerOptions,
|
|
@@ -30,8 +31,10 @@ export class SignedHttpRequest {
|
|
|
30
31
|
const loggerOptions = (shrOptions && shrOptions.loggerOptions) || {};
|
|
31
32
|
this.logger = new Logger(loggerOptions, name, version);
|
|
32
33
|
this.cryptoOps = new CryptoOps(this.logger);
|
|
34
|
+
const tokenBindingKeyManager = new TokenBindingKeyManager(this.logger);
|
|
33
35
|
this.popTokenGenerator = new PopTokenGenerator(
|
|
34
36
|
this.cryptoOps,
|
|
37
|
+
tokenBindingKeyManager,
|
|
35
38
|
new StubPerformanceClient()
|
|
36
39
|
);
|
|
37
40
|
this.shrParameters = shrParameters;
|