@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
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
AuthError,
|
|
11
11
|
IPerformanceClient,
|
|
12
12
|
PerformanceEvents,
|
|
13
|
+
ITokenBindingKeyManager,
|
|
13
14
|
invokeAsync,
|
|
14
15
|
CommonAuthorizationUrlRequest,
|
|
15
16
|
} from "@azure/msal-common/browser";
|
|
@@ -17,6 +18,7 @@ import {
|
|
|
17
18
|
initializeAuthorizationRequest,
|
|
18
19
|
StandardInteractionClient,
|
|
19
20
|
} from "./StandardInteractionClient.js";
|
|
21
|
+
import { getTokenBindingRequestParams } from "../request/RequestHelpers.js";
|
|
20
22
|
import * as BrowserPerformanceEvents from "../telemetry/BrowserPerformanceEvents.js";
|
|
21
23
|
import { BrowserConfiguration } from "../config/Configuration.js";
|
|
22
24
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
|
@@ -47,7 +49,8 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
47
49
|
apiId: ApiId,
|
|
48
50
|
performanceClient: IPerformanceClient,
|
|
49
51
|
correlationId: string,
|
|
50
|
-
platformAuthProvider?: IPlatformAuthHandler
|
|
52
|
+
platformAuthProvider?: IPlatformAuthHandler,
|
|
53
|
+
tokenBindingKeyManager?: ITokenBindingKeyManager
|
|
51
54
|
) {
|
|
52
55
|
super(
|
|
53
56
|
config,
|
|
@@ -58,7 +61,8 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
58
61
|
navigationClient,
|
|
59
62
|
performanceClient,
|
|
60
63
|
correlationId,
|
|
61
|
-
platformAuthProvider
|
|
64
|
+
platformAuthProvider,
|
|
65
|
+
tokenBindingKeyManager
|
|
62
66
|
);
|
|
63
67
|
this.apiId = apiId;
|
|
64
68
|
}
|
|
@@ -111,10 +115,17 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
111
115
|
);
|
|
112
116
|
|
|
113
117
|
try {
|
|
118
|
+
const tokenBindingParams = await getTokenBindingRequestParams(
|
|
119
|
+
silentRequest,
|
|
120
|
+
this.tokenBindingKeyManager,
|
|
121
|
+
this.logger,
|
|
122
|
+
this.performanceClient
|
|
123
|
+
);
|
|
114
124
|
// Create auth code request (PKCE not needed)
|
|
115
125
|
const authCodeRequest: CommonAuthorizationCodeRequest = {
|
|
116
126
|
...silentRequest,
|
|
117
127
|
code: request.code,
|
|
128
|
+
...tokenBindingParams,
|
|
118
129
|
};
|
|
119
130
|
|
|
120
131
|
// Initialize the client
|
|
@@ -17,11 +17,13 @@ import {
|
|
|
17
17
|
CommonAuthorizationUrlRequest,
|
|
18
18
|
AuthorizeProtocol,
|
|
19
19
|
PkceCodes,
|
|
20
|
+
ITokenBindingKeyManager,
|
|
20
21
|
} from "@azure/msal-common/browser";
|
|
21
22
|
import {
|
|
22
23
|
initializeAuthorizationRequest,
|
|
23
24
|
StandardInteractionClient,
|
|
24
25
|
} from "./StandardInteractionClient.js";
|
|
26
|
+
import { getTokenBindingRequestParams } from "../request/RequestHelpers.js";
|
|
25
27
|
import * as BrowserPerformanceEvents from "../telemetry/BrowserPerformanceEvents.js";
|
|
26
28
|
import { BrowserConfiguration } from "../config/Configuration.js";
|
|
27
29
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
|
@@ -99,7 +101,8 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
99
101
|
nativeStorageImpl: BrowserCacheManager,
|
|
100
102
|
correlationId: string,
|
|
101
103
|
platformAuthProvider?: IPlatformAuthHandler,
|
|
102
|
-
waitForIframeResponseHook?: WaitForIframeResponseFn
|
|
104
|
+
waitForIframeResponseHook?: WaitForIframeResponseFn,
|
|
105
|
+
tokenBindingKeyManager?: ITokenBindingKeyManager
|
|
103
106
|
) {
|
|
104
107
|
super(
|
|
105
108
|
config,
|
|
@@ -110,7 +113,8 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
110
113
|
navigationClient,
|
|
111
114
|
performanceClient,
|
|
112
115
|
correlationId,
|
|
113
|
-
platformAuthProvider
|
|
116
|
+
platformAuthProvider,
|
|
117
|
+
tokenBindingKeyManager
|
|
114
118
|
);
|
|
115
119
|
this.apiId = apiId;
|
|
116
120
|
this.nativeStorage = nativeStorageImpl;
|
|
@@ -540,10 +544,8 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
540
544
|
authClient: AuthorizationCodeClient,
|
|
541
545
|
request: CommonAuthorizationUrlRequest
|
|
542
546
|
): Promise<AuthenticationResult> {
|
|
543
|
-
const { serverParams, pkceCodes } =
|
|
544
|
-
authClient,
|
|
545
|
-
request
|
|
546
|
-
);
|
|
547
|
+
const { serverParams, pkceCodes, silentRequest } =
|
|
548
|
+
await this.silentAuthorizeHelper(authClient, request);
|
|
547
549
|
|
|
548
550
|
return invokeAsync(
|
|
549
551
|
Authorize.handleResponseCode,
|
|
@@ -552,7 +554,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
552
554
|
this.performanceClient,
|
|
553
555
|
request.correlationId
|
|
554
556
|
)(
|
|
555
|
-
|
|
557
|
+
silentRequest,
|
|
556
558
|
serverParams,
|
|
557
559
|
pkceCodes.verifier,
|
|
558
560
|
this.apiId,
|
|
@@ -590,9 +592,16 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
590
592
|
correlationId
|
|
591
593
|
)(this.performanceClient, this.logger, correlationId);
|
|
592
594
|
|
|
595
|
+
const tokenBindingParams = await getTokenBindingRequestParams(
|
|
596
|
+
request,
|
|
597
|
+
this.tokenBindingKeyManager,
|
|
598
|
+
this.logger,
|
|
599
|
+
this.performanceClient
|
|
600
|
+
);
|
|
593
601
|
const silentRequest = {
|
|
594
602
|
...request,
|
|
595
603
|
codeChallenge: pkceCodes.challenge,
|
|
604
|
+
...tokenBindingParams,
|
|
596
605
|
};
|
|
597
606
|
|
|
598
607
|
// Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
|
|
@@ -21,7 +21,10 @@ import {
|
|
|
21
21
|
BrowserAuthErrorCodes,
|
|
22
22
|
} from "../error/BrowserAuthError.js";
|
|
23
23
|
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
initializeBaseRequest,
|
|
26
|
+
getTokenBindingRequestParams,
|
|
27
|
+
} from "../request/RequestHelpers.js";
|
|
25
28
|
import {
|
|
26
29
|
getRedirectUri,
|
|
27
30
|
initializeServerTelemetryManager,
|
|
@@ -48,9 +51,16 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
48
51
|
this.logger,
|
|
49
52
|
this.correlationId
|
|
50
53
|
);
|
|
54
|
+
const tokenBindingParams = await getTokenBindingRequestParams(
|
|
55
|
+
baseRequest,
|
|
56
|
+
this.tokenBindingKeyManager,
|
|
57
|
+
this.logger,
|
|
58
|
+
this.performanceClient
|
|
59
|
+
);
|
|
51
60
|
const silentRequest: CommonSilentFlowRequest = {
|
|
52
61
|
...request,
|
|
53
62
|
...baseRequest,
|
|
63
|
+
...tokenBindingParams,
|
|
54
64
|
};
|
|
55
65
|
|
|
56
66
|
if (request.redirectUri) {
|
|
@@ -293,6 +293,7 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
293
293
|
correlationId: this.correlationId,
|
|
294
294
|
},
|
|
295
295
|
cryptoInterface: this.browserCrypto,
|
|
296
|
+
tokenBindingKeyManager: this.tokenBindingKeyManager,
|
|
296
297
|
networkInterface: this.networkClient,
|
|
297
298
|
storageInterface: this.browserStorage,
|
|
298
299
|
serverTelemetryManager: serverTelemetryManager,
|
package/src/naa/BridgeProxy.ts
CHANGED
|
@@ -8,7 +8,6 @@ import { AuthResult } from "./AuthResult.js";
|
|
|
8
8
|
import { BridgeCapabilities } from "./BridgeCapabilities.js";
|
|
9
9
|
import { AccountContext } from "./BridgeAccountContext.js";
|
|
10
10
|
import { BridgeError } from "./BridgeError.js";
|
|
11
|
-
import { BridgeRequest } from "./BridgeRequest.js";
|
|
12
11
|
import {
|
|
13
12
|
BridgeRequestEnvelope,
|
|
14
13
|
BridgeMethods,
|
|
@@ -21,6 +20,8 @@ import { TokenRequest } from "./TokenRequest.js";
|
|
|
21
20
|
import * as BrowserCrypto from "../crypto/BrowserCrypto.js";
|
|
22
21
|
import { BrowserConstants } from "../utils/BrowserConstants.js";
|
|
23
22
|
import { version } from "../packageMetadata.js";
|
|
23
|
+
import { IWebBrokerBridgeMessage } from "../webBrokerBridge/IWebBrokerBridgeMessage.js";
|
|
24
|
+
import { PendingRequestRegistry } from "../webBrokerBridge/PendingRequestRegistry.js";
|
|
24
25
|
|
|
25
26
|
declare global {
|
|
26
27
|
interface Window {
|
|
@@ -34,7 +35,12 @@ declare global {
|
|
|
34
35
|
* platform broker
|
|
35
36
|
*/
|
|
36
37
|
export class BridgeProxy implements IBridgeProxy {
|
|
37
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Correlates outbound bridge requests with inbound responses by
|
|
40
|
+
* `requestId`
|
|
41
|
+
*/
|
|
42
|
+
static pendingRegistry =
|
|
43
|
+
new PendingRequestRegistry<BridgeResponseEnvelope>();
|
|
38
44
|
sdkName: string;
|
|
39
45
|
sdkVersion: string;
|
|
40
46
|
capabilities?: BridgeCapabilities;
|
|
@@ -62,39 +68,22 @@ export class BridgeProxy implements IBridgeProxy {
|
|
|
62
68
|
typeof response === "string" ? response : response.data;
|
|
63
69
|
const responseEnvelope: BridgeResponseEnvelope =
|
|
64
70
|
JSON.parse(responsePayload);
|
|
65
|
-
|
|
66
|
-
(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
if (responseEnvelope.success) {
|
|
72
|
+
BridgeProxy.pendingRegistry.resolve(
|
|
73
|
+
responseEnvelope.requestId,
|
|
74
|
+
responseEnvelope
|
|
75
|
+
);
|
|
76
|
+
} else {
|
|
77
|
+
BridgeProxy.pendingRegistry.reject(
|
|
78
|
+
responseEnvelope.requestId,
|
|
79
|
+
responseEnvelope.error
|
|
73
80
|
);
|
|
74
|
-
if (responseEnvelope.success) {
|
|
75
|
-
request.resolve(responseEnvelope);
|
|
76
|
-
} else {
|
|
77
|
-
request.reject(responseEnvelope.error);
|
|
78
|
-
}
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
);
|
|
82
84
|
|
|
83
|
-
const bridgeResponse = await
|
|
84
|
-
(
|
|
85
|
-
const message = BridgeProxy.buildRequest("GetInitContext");
|
|
86
|
-
|
|
87
|
-
const request: BridgeRequest = {
|
|
88
|
-
requestId: message.requestId,
|
|
89
|
-
method: message.method,
|
|
90
|
-
resolve: resolve,
|
|
91
|
-
reject: reject,
|
|
92
|
-
};
|
|
93
|
-
BridgeProxy.bridgeRequests.push(request);
|
|
94
|
-
window.nestedAppAuthBridge.postMessage(
|
|
95
|
-
JSON.stringify(message)
|
|
96
|
-
);
|
|
97
|
-
}
|
|
85
|
+
const bridgeResponse = await BridgeProxy.sendRequestViaRegistry(
|
|
86
|
+
BridgeProxy.buildRequest("GetInitContext")
|
|
98
87
|
);
|
|
99
88
|
|
|
100
89
|
return BridgeProxy.validateBridgeResultOrThrow(
|
|
@@ -169,22 +158,27 @@ export class BridgeProxy implements IBridgeProxy {
|
|
|
169
158
|
method: BridgeMethods,
|
|
170
159
|
requestParams?: Partial<BridgeRequestEnvelope>
|
|
171
160
|
): Promise<BridgeResponseEnvelope> {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
const promise = new Promise<BridgeResponseEnvelope>(
|
|
175
|
-
(resolve, reject) => {
|
|
176
|
-
const request: BridgeRequest = {
|
|
177
|
-
requestId: message.requestId,
|
|
178
|
-
method: message.method,
|
|
179
|
-
resolve: resolve,
|
|
180
|
-
reject: reject,
|
|
181
|
-
};
|
|
182
|
-
BridgeProxy.bridgeRequests.push(request);
|
|
183
|
-
window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
|
|
184
|
-
}
|
|
161
|
+
return BridgeProxy.sendRequestViaRegistry(
|
|
162
|
+
BridgeProxy.buildRequest(method, requestParams)
|
|
185
163
|
);
|
|
164
|
+
}
|
|
186
165
|
|
|
187
|
-
|
|
166
|
+
/**
|
|
167
|
+
* Registers `message.requestId` with the shared pending-request
|
|
168
|
+
* registry, then posts the envelope over the host bridge. Resolves
|
|
169
|
+
* with the matching response envelope; rejects with the raw
|
|
170
|
+
* `BridgeError` payload.
|
|
171
|
+
*/
|
|
172
|
+
private static sendRequestViaRegistry(
|
|
173
|
+
message: BridgeRequestEnvelope
|
|
174
|
+
): Promise<BridgeResponseEnvelope> {
|
|
175
|
+
const correlationKey: IWebBrokerBridgeMessage = {
|
|
176
|
+
requestId: message.requestId,
|
|
177
|
+
type: message.method,
|
|
178
|
+
};
|
|
179
|
+
return BridgeProxy.pendingRegistry.sendAndAwait(correlationKey, () => {
|
|
180
|
+
window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
|
|
181
|
+
});
|
|
188
182
|
}
|
|
189
183
|
|
|
190
184
|
private static validateBridgeResultOrThrow<T>(input: T | undefined): T {
|
|
@@ -32,13 +32,18 @@ import {
|
|
|
32
32
|
Constants,
|
|
33
33
|
CacheHelpers,
|
|
34
34
|
} from "@azure/msal-common/browser";
|
|
35
|
-
import { isBridgeError } from "../BridgeError.js";
|
|
35
|
+
import { isBridgeError, BridgeError } from "../BridgeError.js";
|
|
36
36
|
import { BridgeStatusCode } from "../BridgeStatusCode.js";
|
|
37
37
|
import { AuthenticationResult } from "../../response/AuthenticationResult.js";
|
|
38
38
|
import {} from "../../error/BrowserAuthErrorCodes.js";
|
|
39
39
|
import { AuthResult } from "../AuthResult.js";
|
|
40
40
|
import { SsoSilentRequest } from "../../request/SsoSilentRequest.js";
|
|
41
41
|
import { SilentRequest } from "../../request/SilentRequest.js";
|
|
42
|
+
import {
|
|
43
|
+
WebBrokerBridgeError,
|
|
44
|
+
WebBrokerBridgeErrorCode,
|
|
45
|
+
} from "../../webBrokerBridge/WebBrokerBridgeError.js";
|
|
46
|
+
import { toAuthError } from "../../webBrokerBridge/WebBrokerBridgeErrorMap.js";
|
|
42
47
|
|
|
43
48
|
export class NestedAppAuthAdapter {
|
|
44
49
|
protected crypto: ICrypto;
|
|
@@ -271,61 +276,9 @@ export class NestedAppAuthAdapter {
|
|
|
271
276
|
| ServerError
|
|
272
277
|
| InteractionRequiredAuthError {
|
|
273
278
|
if (isBridgeError(error)) {
|
|
274
|
-
|
|
275
|
-
case BridgeStatusCode.UserCancel:
|
|
276
|
-
return new ClientAuthError(
|
|
277
|
-
ClientAuthErrorCodes.userCanceled,
|
|
278
|
-
""
|
|
279
|
-
);
|
|
280
|
-
case BridgeStatusCode.NoNetwork:
|
|
281
|
-
return new ClientAuthError(
|
|
282
|
-
ClientAuthErrorCodes.noNetworkConnectivity,
|
|
283
|
-
""
|
|
284
|
-
);
|
|
285
|
-
case BridgeStatusCode.AccountUnavailable:
|
|
286
|
-
return new ClientAuthError(
|
|
287
|
-
ClientAuthErrorCodes.noAccountFound,
|
|
288
|
-
""
|
|
289
|
-
);
|
|
290
|
-
case BridgeStatusCode.Disabled:
|
|
291
|
-
return new ClientAuthError(
|
|
292
|
-
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled,
|
|
293
|
-
""
|
|
294
|
-
);
|
|
295
|
-
case BridgeStatusCode.NestedAppAuthUnavailable:
|
|
296
|
-
return new ClientAuthError(
|
|
297
|
-
error.code ||
|
|
298
|
-
ClientAuthErrorCodes.nestedAppAuthBridgeDisabled,
|
|
299
|
-
"",
|
|
300
|
-
error.description
|
|
301
|
-
);
|
|
302
|
-
case BridgeStatusCode.TransientError:
|
|
303
|
-
case BridgeStatusCode.PersistentError:
|
|
304
|
-
return new ServerError(
|
|
305
|
-
error.code || "",
|
|
306
|
-
"",
|
|
307
|
-
error.description
|
|
308
|
-
);
|
|
309
|
-
case BridgeStatusCode.UserInteractionRequired:
|
|
310
|
-
return new InteractionRequiredAuthError(
|
|
311
|
-
error.code || "",
|
|
312
|
-
"",
|
|
313
|
-
error.description
|
|
314
|
-
);
|
|
315
|
-
default:
|
|
316
|
-
return new AuthError(
|
|
317
|
-
error.code || "",
|
|
318
|
-
"",
|
|
319
|
-
error.description
|
|
320
|
-
);
|
|
321
|
-
}
|
|
322
|
-
} else {
|
|
323
|
-
return new AuthError(
|
|
324
|
-
"unknown_error",
|
|
325
|
-
"",
|
|
326
|
-
"An unknown error occurred"
|
|
327
|
-
);
|
|
279
|
+
return toAuthError(bridgeErrorToWebBrokerBridgeError(error));
|
|
328
280
|
}
|
|
281
|
+
return new AuthError("unknown_error", "", "An unknown error occurred");
|
|
329
282
|
}
|
|
330
283
|
|
|
331
284
|
/**
|
|
@@ -383,3 +336,52 @@ export class NestedAppAuthAdapter {
|
|
|
383
336
|
return authenticationResult;
|
|
384
337
|
}
|
|
385
338
|
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* Converts NAA `BridgeError` into the shared `WebBrokerBridgeError`
|
|
342
|
+
* taxonomy.
|
|
343
|
+
*/
|
|
344
|
+
function bridgeErrorToWebBrokerBridgeError(
|
|
345
|
+
error: BridgeError
|
|
346
|
+
): WebBrokerBridgeError {
|
|
347
|
+
switch (error.status) {
|
|
348
|
+
case BridgeStatusCode.UserCancel:
|
|
349
|
+
return { code: WebBrokerBridgeErrorCode.UserCanceled };
|
|
350
|
+
case BridgeStatusCode.NoNetwork:
|
|
351
|
+
return { code: WebBrokerBridgeErrorCode.NoNetwork };
|
|
352
|
+
case BridgeStatusCode.AccountUnavailable:
|
|
353
|
+
return { code: WebBrokerBridgeErrorCode.AccountUnavailable };
|
|
354
|
+
case BridgeStatusCode.Disabled:
|
|
355
|
+
return { code: WebBrokerBridgeErrorCode.BridgeDisabled };
|
|
356
|
+
case BridgeStatusCode.NestedAppAuthUnavailable:
|
|
357
|
+
return {
|
|
358
|
+
code: WebBrokerBridgeErrorCode.BridgeUnavailable,
|
|
359
|
+
innerErrorCode: error.code,
|
|
360
|
+
description: error.description,
|
|
361
|
+
};
|
|
362
|
+
case BridgeStatusCode.TransientError:
|
|
363
|
+
return {
|
|
364
|
+
code: WebBrokerBridgeErrorCode.TransientError,
|
|
365
|
+
innerErrorCode: error.code,
|
|
366
|
+
description: error.description,
|
|
367
|
+
};
|
|
368
|
+
case BridgeStatusCode.PersistentError:
|
|
369
|
+
return {
|
|
370
|
+
code: WebBrokerBridgeErrorCode.PersistentError,
|
|
371
|
+
innerErrorCode: error.code,
|
|
372
|
+
description: error.description,
|
|
373
|
+
};
|
|
374
|
+
case BridgeStatusCode.UserInteractionRequired:
|
|
375
|
+
return {
|
|
376
|
+
code: WebBrokerBridgeErrorCode.UserInteractionRequired,
|
|
377
|
+
innerErrorCode: error.code,
|
|
378
|
+
description: error.description,
|
|
379
|
+
};
|
|
380
|
+
default:
|
|
381
|
+
return {
|
|
382
|
+
code: WebBrokerBridgeErrorCode.Unknown,
|
|
383
|
+
innerErrorCode: error.code,
|
|
384
|
+
description: error.description,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
}
|
package/src/packageMetadata.ts
CHANGED
|
@@ -13,7 +13,6 @@ import {
|
|
|
13
13
|
IPerformanceClient,
|
|
14
14
|
Logger,
|
|
15
15
|
PerformanceEvents,
|
|
16
|
-
PopTokenGenerator,
|
|
17
16
|
ProtocolMode,
|
|
18
17
|
RequestParameterBuilder,
|
|
19
18
|
CommonAuthorizationCodeRequest,
|
|
@@ -26,6 +25,7 @@ import {
|
|
|
26
25
|
AuthorizationCodePayload,
|
|
27
26
|
ServerAuthorizationTokenResponse,
|
|
28
27
|
Constants,
|
|
28
|
+
AADServerParamKeys,
|
|
29
29
|
} from "@azure/msal-common/browser";
|
|
30
30
|
import * as BrowserPerformanceEvents from "../telemetry/BrowserPerformanceEvents.js";
|
|
31
31
|
import { BrowserConfiguration } from "../config/Configuration.js";
|
|
@@ -43,6 +43,7 @@ import { PlatformAuthInteractionClient } from "../interaction_client/PlatformAut
|
|
|
43
43
|
import { EventHandler } from "../event/EventHandler.js";
|
|
44
44
|
import { decryptEarResponse } from "../crypto/BrowserCrypto.js";
|
|
45
45
|
import { IPlatformAuthHandler } from "../broker/nativeBroker/IPlatformAuthHandler.js";
|
|
46
|
+
import { TokenBindingKeyManager } from "../crypto/TokenBindingKeyManager.js";
|
|
46
47
|
|
|
47
48
|
/**
|
|
48
49
|
* Parsed representation of the clientdata response parameter from the /authorize endpoint.
|
|
@@ -186,32 +187,21 @@ async function getStandardParameters(
|
|
|
186
187
|
|
|
187
188
|
// pass the req_cnf for POP
|
|
188
189
|
if (
|
|
189
|
-
request.authenticationScheme ===
|
|
190
|
+
request.authenticationScheme ===
|
|
191
|
+
Constants.AuthenticationScheme.POP &&
|
|
192
|
+
request.reqCnf
|
|
190
193
|
) {
|
|
191
|
-
|
|
192
|
-
const popTokenGenerator = new PopTokenGenerator(
|
|
193
|
-
cryptoOps,
|
|
194
|
-
performanceClient
|
|
195
|
-
);
|
|
196
|
-
|
|
197
|
-
// req_cnf is always sent as a string for SPAs
|
|
198
|
-
let reqCnfData;
|
|
199
|
-
if (!request.popKid) {
|
|
200
|
-
const generatedReqCnfData = await invokeAsync(
|
|
201
|
-
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
202
|
-
PerformanceEvents.PopTokenGenerateCnf,
|
|
203
|
-
logger,
|
|
204
|
-
performanceClient,
|
|
205
|
-
request.correlationId
|
|
206
|
-
)(request, logger);
|
|
207
|
-
reqCnfData = generatedReqCnfData.reqCnfString;
|
|
208
|
-
} else {
|
|
209
|
-
reqCnfData = cryptoOps.encodeKid(request.popKid);
|
|
210
|
-
}
|
|
211
|
-
RequestParameterBuilder.addPopToken(parameters, reqCnfData);
|
|
194
|
+
RequestParameterBuilder.addPopToken(parameters, request.reqCnf);
|
|
212
195
|
}
|
|
213
196
|
}
|
|
214
197
|
|
|
198
|
+
if (
|
|
199
|
+
request.authenticationScheme === Constants.AuthenticationScheme.DPOP &&
|
|
200
|
+
request.dpopJkt
|
|
201
|
+
) {
|
|
202
|
+
parameters.set(AADServerParamKeys.DPOP_JKT, request.dpopJkt);
|
|
203
|
+
}
|
|
204
|
+
|
|
215
205
|
RequestParameterBuilder.instrumentBrokerParams(
|
|
216
206
|
parameters,
|
|
217
207
|
request.correlationId,
|
|
@@ -709,7 +699,8 @@ export async function handleResponseEAR(
|
|
|
709
699
|
logger,
|
|
710
700
|
performanceClient,
|
|
711
701
|
null,
|
|
712
|
-
null
|
|
702
|
+
null,
|
|
703
|
+
new TokenBindingKeyManager(logger, performanceClient)
|
|
713
704
|
);
|
|
714
705
|
|
|
715
706
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
@@ -8,10 +8,15 @@ import {
|
|
|
8
8
|
Constants,
|
|
9
9
|
BaseAuthRequest,
|
|
10
10
|
ClientConfigurationErrorCodes,
|
|
11
|
+
CommonAuthorizationUrlRequest,
|
|
11
12
|
CommonSilentFlowRequest,
|
|
12
13
|
IPerformanceClient,
|
|
14
|
+
ITokenBindingKeyManager,
|
|
13
15
|
Logger,
|
|
14
16
|
ProtocolMode,
|
|
17
|
+
JsonWebTokenAlgorithms,
|
|
18
|
+
PerformanceEvents,
|
|
19
|
+
PopTokenGenerator,
|
|
15
20
|
createClientConfigurationError,
|
|
16
21
|
invokeAsync,
|
|
17
22
|
} from "@azure/msal-common/browser";
|
|
@@ -20,6 +25,109 @@ import { BrowserConfiguration } from "../config/Configuration.js";
|
|
|
20
25
|
import { SilentRequest } from "./SilentRequest.js";
|
|
21
26
|
import { PopupRequest } from "./PopupRequest.js";
|
|
22
27
|
import { RedirectRequest } from "./RedirectRequest.js";
|
|
28
|
+
import { CryptoOps } from "../crypto/CryptoOps.js";
|
|
29
|
+
|
|
30
|
+
const SUPPORTED_AUTHENTICATION_SCHEMES = new Set<string>([
|
|
31
|
+
Constants.AuthenticationScheme.BEARER,
|
|
32
|
+
Constants.AuthenticationScheme.POP,
|
|
33
|
+
Constants.AuthenticationScheme.DPOP,
|
|
34
|
+
Constants.AuthenticationScheme.SSH,
|
|
35
|
+
]);
|
|
36
|
+
|
|
37
|
+
function validateSshRequest(
|
|
38
|
+
request: Partial<BaseAuthRequest>,
|
|
39
|
+
correlationId: string
|
|
40
|
+
): void {
|
|
41
|
+
if (!request.sshJwk) {
|
|
42
|
+
throw createClientConfigurationError(
|
|
43
|
+
ClientConfigurationErrorCodes.missingSshJwk,
|
|
44
|
+
correlationId
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (!request.sshKid) {
|
|
48
|
+
throw createClientConfigurationError(
|
|
49
|
+
ClientConfigurationErrorCodes.missingSshKid,
|
|
50
|
+
correlationId
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function validateDpopRequest(
|
|
56
|
+
request: Partial<BaseAuthRequest>,
|
|
57
|
+
correlationId: string
|
|
58
|
+
): void {
|
|
59
|
+
if (
|
|
60
|
+
!request.resourceRequestMethod?.trim() ||
|
|
61
|
+
!request.resourceRequestUri?.trim()
|
|
62
|
+
) {
|
|
63
|
+
throw createClientConfigurationError(
|
|
64
|
+
ClientConfigurationErrorCodes.dpopMissingResourceContext,
|
|
65
|
+
correlationId
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Resolves the token-binding parameters needed before building authorize or token requests.
|
|
72
|
+
* Public PCA DPoP requests use a dpopJkt thumbprint, while platform broker PoP requests use
|
|
73
|
+
* a reqCnf confirmation claim. Requests that do not require request-time token binding return
|
|
74
|
+
* no additional parameters.
|
|
75
|
+
*/
|
|
76
|
+
export async function getTokenBindingRequestParams(
|
|
77
|
+
request: Partial<BaseAuthRequest> & {
|
|
78
|
+
correlationId: string;
|
|
79
|
+
platformBroker?: boolean;
|
|
80
|
+
},
|
|
81
|
+
tokenBindingKeyManager: ITokenBindingKeyManager,
|
|
82
|
+
logger: Logger,
|
|
83
|
+
performanceClient: IPerformanceClient
|
|
84
|
+
): Promise<Pick<CommonAuthorizationUrlRequest, "dpopJkt" | "reqCnf">> {
|
|
85
|
+
switch (request.authenticationScheme) {
|
|
86
|
+
case Constants.AuthenticationScheme.DPOP:
|
|
87
|
+
if (request.platformBroker) {
|
|
88
|
+
return {};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (request.dpopJkt) {
|
|
92
|
+
return { dpopJkt: request.dpopJkt };
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
|
|
97
|
+
tokenBindingKeyType:
|
|
98
|
+
Constants.AuthenticationScheme.DPOP.toLowerCase(),
|
|
99
|
+
tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
|
|
100
|
+
correlationId: request.correlationId,
|
|
101
|
+
}),
|
|
102
|
+
};
|
|
103
|
+
case Constants.AuthenticationScheme.POP:
|
|
104
|
+
if (!request.platformBroker) {
|
|
105
|
+
return {};
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
const cryptoOps = new CryptoOps(logger, performanceClient);
|
|
109
|
+
if (request.popKid) {
|
|
110
|
+
return { reqCnf: cryptoOps.encodeKid(request.popKid) };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const popTokenGenerator = new PopTokenGenerator(
|
|
114
|
+
cryptoOps,
|
|
115
|
+
tokenBindingKeyManager,
|
|
116
|
+
performanceClient
|
|
117
|
+
);
|
|
118
|
+
const generatedReqCnfData = await invokeAsync(
|
|
119
|
+
popTokenGenerator.generateCnf.bind(popTokenGenerator),
|
|
120
|
+
PerformanceEvents.PopTokenGenerateCnf,
|
|
121
|
+
logger,
|
|
122
|
+
performanceClient,
|
|
123
|
+
request.correlationId
|
|
124
|
+
)(request, logger);
|
|
125
|
+
|
|
126
|
+
return { reqCnf: generatedReqCnfData.reqCnfString };
|
|
127
|
+
default:
|
|
128
|
+
return {};
|
|
129
|
+
}
|
|
130
|
+
}
|
|
23
131
|
|
|
24
132
|
/**
|
|
25
133
|
* Initializer function for all request APIs
|
|
@@ -57,20 +165,23 @@ export async function initializeBaseRequest(
|
|
|
57
165
|
);
|
|
58
166
|
} else {
|
|
59
167
|
if (
|
|
60
|
-
|
|
61
|
-
|
|
168
|
+
!SUPPORTED_AUTHENTICATION_SCHEMES.has(
|
|
169
|
+
validatedRequest.authenticationScheme
|
|
170
|
+
)
|
|
62
171
|
) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
172
|
+
throw createClientConfigurationError(
|
|
173
|
+
ClientConfigurationErrorCodes.unsupportedAuthenticationScheme,
|
|
174
|
+
correlationId
|
|
175
|
+
);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
switch (validatedRequest.authenticationScheme) {
|
|
179
|
+
case Constants.AuthenticationScheme.SSH:
|
|
180
|
+
validateSshRequest(request, correlationId);
|
|
181
|
+
break;
|
|
182
|
+
case Constants.AuthenticationScheme.DPOP: {
|
|
183
|
+
validateDpopRequest(request, correlationId);
|
|
184
|
+
break;
|
|
74
185
|
}
|
|
75
186
|
}
|
|
76
187
|
logger.verbose(
|