@azure/msal-browser 5.26.0 → 5.28.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/README.md +2 -0
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +54 -14
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +9 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +7 -6
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +4 -2
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +21 -7
- package/dist/broker/nativeBroker/PlatformAuthRequest.mjs.map +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +14 -1
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +9 -2
- 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 +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/SessionStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.mjs +32 -4
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.mjs +100 -11
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +1 -1
- package/dist/crypto/CryptoOps.mjs +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/crypto/TokenBindingKeyManager.mjs +14 -1
- package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -1
- package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +14 -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/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +68 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +3 -2
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +87 -0
- package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs.map +1 -0
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +5 -3
- package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +14 -2
- package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +4 -3
- package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +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 +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +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/interaction_client/v2/FlowInteractionClientV2.mjs +246 -73
- package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +10 -2
- package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +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/custom_auth_api/v2/ApiClientConstantsV2.mjs +10 -2
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +118 -25
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +2 -2
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +2 -12
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +2 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +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/FlowApiIdHelperV2.mjs +17 -3
- package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -1
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +9 -3
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +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 +1 -1
- package/dist/custom_auth/index.mjs +3 -1
- package/dist/custom_auth/index.mjs.map +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/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +32 -13
- package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +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/auth_flow/v2/state/PasswordRequiredStateV2.mjs +14 -2
- package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.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/auth_flow/v2/state/AttributesRequiredStateV2.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +9 -2
- package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +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 +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/interaction_client/BaseInteractionClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs +504 -75
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +54 -20
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +30 -16
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +44 -32
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +7 -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 +79 -19
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +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 +43 -25
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/redirect_bridge/index.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +35 -11
- package/dist/request/RequestHelpers.mjs.map +1 -1
- package/dist/request/SilentRequestHelpers.mjs +6 -6
- package/dist/request/SilentRequestHelpers.mjs.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceEvents.mjs +3 -2
- package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserDetection.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +7 -2
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/IframeMonitor.mjs +81 -0
- package/dist/utils/IframeMonitor.mjs.map +1 -0
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/utils/PopupMonitor.mjs +119 -0
- package/dist/utils/PopupMonitor.mjs.map +1 -0
- package/dist/utils/PopupOriginCheck.mjs +88 -0
- package/dist/utils/PopupOriginCheck.mjs.map +1 -0
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
- package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
- package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
- package/dist/webBrokerBridge/index.mjs +1 -1
- package/lib/custom-auth-path/log-strings-mapping.json +71 -11
- package/lib/custom-auth-path/msal-custom-auth.cjs +2085 -451
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +2085 -451
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +39 -11
- package/lib/msal-browser.cjs +1461 -320
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +1461 -320
- 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/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +108 -8
- package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +15 -0
- package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +6 -21
- package/src/broker/nativeBroker/PlatformAuthProvider.ts +3 -1
- package/src/broker/nativeBroker/PlatformAuthRequest.ts +12 -8
- package/src/broker/nativeBroker/PlatformAuthResponse.ts +31 -0
- package/src/cache/AsyncMemoryStorage.ts +16 -0
- package/src/cache/BrowserCacheManager.ts +19 -1
- package/src/config/Configuration.ts +63 -6
- package/src/controllers/StandardController.ts +153 -14
- package/src/crypto/TokenBindingKeyManager.ts +21 -0
- package/src/custom_auth/controller/CustomAuthStandardController.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.ts +15 -0
- package/src/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.ts +23 -0
- package/src/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.ts +26 -0
- package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +1 -1
- package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +2 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.ts +94 -0
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +7 -2
- package/src/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.ts +132 -0
- package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +8 -2
- package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +18 -0
- package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +13 -0
- package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +8 -2
- package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +1 -0
- package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +445 -91
- package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +25 -0
- package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +34 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +9 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +262 -43
- package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +4 -7
- package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +21 -0
- package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +41 -2
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +44 -19
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +4 -6
- package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +6 -1
- package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +25 -1
- package/src/custom_auth/core/telemetry/PublicApiId.ts +6 -0
- package/src/custom_auth/index.ts +11 -0
- package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -7
- package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +47 -15
- package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +2 -0
- package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +2 -0
- package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +18 -0
- package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +2 -0
- package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +13 -0
- package/src/interaction_client/PlatformAuthInteractionClient.ts +851 -128
- package/src/interaction_client/PopupClient.ts +140 -83
- package/src/interaction_client/RedirectClient.ts +88 -35
- package/src/interaction_client/SilentIframeClient.ts +121 -95
- package/src/interaction_client/StandardInteractionClient.ts +6 -0
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +80 -46
- package/src/request/RequestHelpers.ts +64 -11
- package/src/request/SilentRequestHelpers.ts +8 -9
- package/src/telemetry/BrowserPerformanceEvents.ts +1 -0
- package/src/utils/BrowserUtils.ts +8 -1
- package/src/utils/IframeMonitor.ts +98 -0
- package/src/utils/PopupMonitor.ts +158 -0
- package/src/utils/PopupOriginCheck.ts +94 -0
- package/types/app/PublicClientApplication.d.ts +6 -4
- package/types/app/PublicClientApplication.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +6 -1
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +21 -0
- package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
- package/types/cache/AsyncMemoryStorage.d.ts +5 -0
- package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/types/cache/BrowserCacheManager.d.ts +4 -0
- package/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/types/config/Configuration.d.ts +16 -0
- package/types/config/Configuration.d.ts.map +1 -1
- package/types/controllers/StandardController.d.ts +5 -0
- package/types/controllers/StandardController.d.ts.map +1 -1
- package/types/crypto/TokenBindingKeyManager.d.ts +9 -0
- package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -1
- 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/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts +11 -0
- package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts +14 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts +15 -0
- package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +1 -1
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +2 -1
- package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts +22 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts +28 -0
- package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts.map +1 -0
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +3 -2
- package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +9 -0
- package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
- package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +1 -0
- package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +12 -5
- package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +17 -0
- package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +18 -2
- package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +8 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +8 -2
- package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +3 -3
- package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +12 -0
- package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +29 -2
- package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +30 -17
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +3 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +3 -2
- package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -1
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +6 -1
- package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -1
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts +6 -0
- package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
- package/types/custom_auth/index.d.ts +5 -0
- package/types/custom_auth/index.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +6 -8
- package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +4 -4
- package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +2 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +2 -1
- package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +2 -1
- package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
- package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -1
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts +106 -5
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/PopupClient.d.ts +12 -0
- package/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/protocol/Authorize.d.ts +4 -4
- package/types/protocol/Authorize.d.ts.map +1 -1
- package/types/request/RequestHelpers.d.ts +21 -3
- package/types/request/RequestHelpers.d.ts.map +1 -1
- package/types/request/SilentRequestHelpers.d.ts.map +1 -1
- package/types/telemetry/BrowserPerformanceEvents.d.ts +1 -0
- package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
- package/types/utils/BrowserUtils.d.ts +2 -1
- package/types/utils/BrowserUtils.d.ts.map +1 -1
- package/types/utils/IframeMonitor.d.ts +17 -0
- package/types/utils/IframeMonitor.d.ts.map +1 -0
- package/types/utils/PopupMonitor.d.ts +37 -0
- package/types/utils/PopupMonitor.d.ts.map +1 -0
- package/types/utils/PopupOriginCheck.d.ts +27 -0
- package/types/utils/PopupOriginCheck.d.ts.map +1 -0
package/lib/msal-browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v5.
|
|
1
|
+
/*! @azure/msal-browser v5.28.0 2026-11-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v16.
|
|
9
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -58,9 +58,15 @@
|
|
|
58
58
|
const EAR_JWE_CRYPTO = "ear_jwe_crypto";
|
|
59
59
|
const RESOURCE = "resource";
|
|
60
60
|
const CLI_DATA = "clidata";
|
|
61
|
-
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
61
|
+
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
62
|
+
/**
|
|
63
|
+
* Popup-origin-check-done. Signals to the STS that the client verified the
|
|
64
|
+
* popup cannot be reached by an untrusted window, so the
|
|
65
|
+
* Cross-Origin-Opener-Policy response header may be omitted.
|
|
66
|
+
*/
|
|
67
|
+
const POPUP_ORIGIN_CHECK_DONE = "pocd";
|
|
62
68
|
|
|
63
|
-
/*! @azure/msal-common v16.
|
|
69
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
64
70
|
/*
|
|
65
71
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
66
72
|
* Licensed under the MIT License.
|
|
@@ -299,7 +305,7 @@
|
|
|
299
305
|
// Token renewal offset default in seconds
|
|
300
306
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
301
307
|
|
|
302
|
-
/*! @azure/msal-common v16.
|
|
308
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
303
309
|
/*
|
|
304
310
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
305
311
|
* Licensed under the MIT License.
|
|
@@ -328,7 +334,7 @@
|
|
|
328
334
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
|
|
329
335
|
}
|
|
330
336
|
|
|
331
|
-
/*! @azure/msal-common v16.
|
|
337
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
332
338
|
|
|
333
339
|
/*
|
|
334
340
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -351,7 +357,7 @@
|
|
|
351
357
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
352
358
|
}
|
|
353
359
|
|
|
354
|
-
/*! @azure/msal-common v16.
|
|
360
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
355
361
|
/*
|
|
356
362
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
357
363
|
* Licensed under the MIT License.
|
|
@@ -437,7 +443,7 @@
|
|
|
437
443
|
userCanceled: userCanceled
|
|
438
444
|
});
|
|
439
445
|
|
|
440
|
-
/*! @azure/msal-common v16.
|
|
446
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
441
447
|
|
|
442
448
|
/*
|
|
443
449
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -475,7 +481,7 @@
|
|
|
475
481
|
};
|
|
476
482
|
}
|
|
477
483
|
|
|
478
|
-
/*! @azure/msal-common v16.
|
|
484
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
479
485
|
|
|
480
486
|
/*
|
|
481
487
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -541,7 +547,7 @@
|
|
|
541
547
|
return matches[2];
|
|
542
548
|
}
|
|
543
549
|
|
|
544
|
-
/*! @azure/msal-common v16.
|
|
550
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
545
551
|
|
|
546
552
|
/*
|
|
547
553
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -629,7 +635,7 @@
|
|
|
629
635
|
return updatedAccountInfo;
|
|
630
636
|
}
|
|
631
637
|
|
|
632
|
-
/*! @azure/msal-common v16.
|
|
638
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
633
639
|
/*
|
|
634
640
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
635
641
|
* Licensed under the MIT License.
|
|
@@ -643,7 +649,7 @@
|
|
|
643
649
|
Ciam: 3,
|
|
644
650
|
};
|
|
645
651
|
|
|
646
|
-
/*! @azure/msal-common v16.
|
|
652
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
647
653
|
/*
|
|
648
654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
649
655
|
* Licensed under the MIT License.
|
|
@@ -665,7 +671,7 @@
|
|
|
665
671
|
return null;
|
|
666
672
|
}
|
|
667
673
|
|
|
668
|
-
/*! @azure/msal-common v16.
|
|
674
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
669
675
|
/*
|
|
670
676
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
671
677
|
* Licensed under the MIT License.
|
|
@@ -689,7 +695,7 @@
|
|
|
689
695
|
EAR: "EAR",
|
|
690
696
|
};
|
|
691
697
|
|
|
692
|
-
/*! @azure/msal-common v16.
|
|
698
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
693
699
|
/**
|
|
694
700
|
* Returns the AccountInfo interface for this account.
|
|
695
701
|
* @internal
|
|
@@ -878,7 +884,7 @@
|
|
|
878
884
|
entity.hasOwnProperty("authorityType"));
|
|
879
885
|
}
|
|
880
886
|
|
|
881
|
-
/*! @azure/msal-common v16.
|
|
887
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
882
888
|
/*
|
|
883
889
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
884
890
|
* Licensed under the MIT License.
|
|
@@ -895,7 +901,7 @@
|
|
|
895
901
|
unexpectedError: unexpectedError
|
|
896
902
|
});
|
|
897
903
|
|
|
898
|
-
/*! @azure/msal-common v16.
|
|
904
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
899
905
|
|
|
900
906
|
/*
|
|
901
907
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -915,7 +921,47 @@
|
|
|
915
921
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
916
922
|
}
|
|
917
923
|
|
|
918
|
-
/*! @azure/msal-common v16.
|
|
924
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
925
|
+
/*
|
|
926
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
927
|
+
* Licensed under the MIT License.
|
|
928
|
+
*/
|
|
929
|
+
// Track only our normalized copies, never caller-owned mutable inputs.
|
|
930
|
+
const normalizedHeaderRecords = new WeakSet();
|
|
931
|
+
/**
|
|
932
|
+
* Creates a lowercase-keyed snapshot without changing header values or the input.
|
|
933
|
+
* Reuses snapshots produced by this function to avoid repeated normalization.
|
|
934
|
+
* @internal
|
|
935
|
+
*/
|
|
936
|
+
function normalizeResponseHeaders(headers) {
|
|
937
|
+
if (normalizedHeaderRecords.has(headers)) {
|
|
938
|
+
return headers;
|
|
939
|
+
}
|
|
940
|
+
const normalized = Object.fromEntries(Object.entries(headers).map(([name, value]) => [
|
|
941
|
+
name.toLowerCase(),
|
|
942
|
+
value,
|
|
943
|
+
]));
|
|
944
|
+
normalizedHeaderRecords.add(normalized);
|
|
945
|
+
return normalized;
|
|
946
|
+
}
|
|
947
|
+
/**
|
|
948
|
+
* Reads a response header case-insensitively.
|
|
949
|
+
* Normalized snapshots are never scanned, even when a header is missing.
|
|
950
|
+
* @internal
|
|
951
|
+
*/
|
|
952
|
+
function getResponseHeader(headers, name) {
|
|
953
|
+
const key = name.toLowerCase();
|
|
954
|
+
if (Object.prototype.hasOwnProperty.call(headers, key)) {
|
|
955
|
+
return headers[key];
|
|
956
|
+
}
|
|
957
|
+
if (normalizedHeaderRecords.has(headers)) {
|
|
958
|
+
return undefined;
|
|
959
|
+
}
|
|
960
|
+
const headerName = Object.keys(headers).find((header) => header.toLowerCase() === key);
|
|
961
|
+
return headerName === undefined ? undefined : headers[headerName];
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
919
965
|
/*
|
|
920
966
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
921
967
|
* Licensed under the MIT License.
|
|
@@ -985,7 +1031,7 @@
|
|
|
985
1031
|
urlParseError: urlParseError
|
|
986
1032
|
});
|
|
987
1033
|
|
|
988
|
-
/*! @azure/msal-common v16.
|
|
1034
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
989
1035
|
|
|
990
1036
|
/*
|
|
991
1037
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -996,8 +1042,9 @@
|
|
|
996
1042
|
* header challenge values that can be used outside the basic authorization flows.
|
|
997
1043
|
*/
|
|
998
1044
|
class AuthenticationHeaderParser {
|
|
1045
|
+
/** Captures a case-insensitive snapshot of the response headers. */
|
|
999
1046
|
constructor(headers) {
|
|
1000
|
-
this.headers = headers;
|
|
1047
|
+
this.headers = normalizeResponseHeaders(headers);
|
|
1001
1048
|
}
|
|
1002
1049
|
/**
|
|
1003
1050
|
* This method parses the SHR nonce value out of either the Authentication-Info or WWW-Authenticate authentication headers.
|
|
@@ -1005,7 +1052,7 @@
|
|
|
1005
1052
|
*/
|
|
1006
1053
|
getShrNonce() {
|
|
1007
1054
|
// Attempt to parse nonce from Authentiacation-Info
|
|
1008
|
-
const authenticationInfo = this.headers
|
|
1055
|
+
const authenticationInfo = getResponseHeader(this.headers, HeaderNames.AuthenticationInfo);
|
|
1009
1056
|
if (authenticationInfo) {
|
|
1010
1057
|
const authenticationInfoChallenges = this.parseChallenges(authenticationInfo);
|
|
1011
1058
|
if (authenticationInfoChallenges.nextnonce) {
|
|
@@ -1014,7 +1061,7 @@
|
|
|
1014
1061
|
throw createClientConfigurationError(invalidAuthenticationHeader, "");
|
|
1015
1062
|
}
|
|
1016
1063
|
// Attempt to parse nonce from WWW-Authenticate
|
|
1017
|
-
const wwwAuthenticate = this.headers
|
|
1064
|
+
const wwwAuthenticate = getResponseHeader(this.headers, HeaderNames.WWWAuthenticate);
|
|
1018
1065
|
if (wwwAuthenticate) {
|
|
1019
1066
|
const wwwAuthenticateChallenges = this.parseChallenges(wwwAuthenticate);
|
|
1020
1067
|
if (wwwAuthenticateChallenges.nonce) {
|
|
@@ -1043,7 +1090,7 @@
|
|
|
1043
1090
|
}
|
|
1044
1091
|
}
|
|
1045
1092
|
|
|
1046
|
-
/*! @azure/msal-common v16.
|
|
1093
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1047
1094
|
/*
|
|
1048
1095
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1049
1096
|
* Licensed under the MIT License.
|
|
@@ -1055,7 +1102,7 @@
|
|
|
1055
1102
|
response.hasOwnProperty("jwks_uri"));
|
|
1056
1103
|
}
|
|
1057
1104
|
|
|
1058
|
-
/*! @azure/msal-common v16.
|
|
1105
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1059
1106
|
/*
|
|
1060
1107
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1061
1108
|
* Licensed under the MIT License.
|
|
@@ -1135,7 +1182,7 @@
|
|
|
1135
1182
|
}
|
|
1136
1183
|
}
|
|
1137
1184
|
|
|
1138
|
-
/*! @azure/msal-common v16.
|
|
1185
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1139
1186
|
|
|
1140
1187
|
/*
|
|
1141
1188
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1293,7 +1340,7 @@
|
|
|
1293
1340
|
}
|
|
1294
1341
|
}
|
|
1295
1342
|
|
|
1296
|
-
/*! @azure/msal-common v16.
|
|
1343
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1297
1344
|
|
|
1298
1345
|
/*
|
|
1299
1346
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1447,7 +1494,7 @@
|
|
|
1447
1494
|
return null;
|
|
1448
1495
|
}
|
|
1449
1496
|
|
|
1450
|
-
/*! @azure/msal-common v16.
|
|
1497
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1451
1498
|
/*
|
|
1452
1499
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1453
1500
|
* Licensed under the MIT License.
|
|
@@ -1465,7 +1512,7 @@
|
|
|
1465
1512
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1466
1513
|
};
|
|
1467
1514
|
|
|
1468
|
-
/*! @azure/msal-common v16.
|
|
1515
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1469
1516
|
/*
|
|
1470
1517
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1471
1518
|
* Licensed under the MIT License.
|
|
@@ -1475,7 +1522,7 @@
|
|
|
1475
1522
|
response.hasOwnProperty("metadata"));
|
|
1476
1523
|
}
|
|
1477
1524
|
|
|
1478
|
-
/*! @azure/msal-common v16.
|
|
1525
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1479
1526
|
/*
|
|
1480
1527
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1481
1528
|
* Licensed under the MIT License.
|
|
@@ -1485,7 +1532,7 @@
|
|
|
1485
1532
|
response.hasOwnProperty("error_description"));
|
|
1486
1533
|
}
|
|
1487
1534
|
|
|
1488
|
-
/*! @azure/msal-common v16.
|
|
1535
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1489
1536
|
/*
|
|
1490
1537
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1491
1538
|
* Licensed under the MIT License.
|
|
@@ -1556,7 +1603,7 @@
|
|
|
1556
1603
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1557
1604
|
const SetUserData = "setUserData";
|
|
1558
1605
|
|
|
1559
|
-
/*! @azure/msal-common v16.
|
|
1606
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1560
1607
|
/*
|
|
1561
1608
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1562
1609
|
* Licensed under the MIT License.
|
|
@@ -1649,7 +1696,7 @@
|
|
|
1649
1696
|
};
|
|
1650
1697
|
};
|
|
1651
1698
|
|
|
1652
|
-
/*! @azure/msal-common v16.
|
|
1699
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1653
1700
|
|
|
1654
1701
|
/*
|
|
1655
1702
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1760,7 +1807,7 @@
|
|
|
1760
1807
|
},
|
|
1761
1808
|
};
|
|
1762
1809
|
|
|
1763
|
-
/*! @azure/msal-common v16.
|
|
1810
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1764
1811
|
/*
|
|
1765
1812
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1766
1813
|
* Licensed under the MIT License.
|
|
@@ -1825,7 +1872,7 @@
|
|
|
1825
1872
|
return cachedAtSec > nowSeconds();
|
|
1826
1873
|
}
|
|
1827
1874
|
|
|
1828
|
-
/*! @azure/msal-common v16.
|
|
1875
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1829
1876
|
|
|
1830
1877
|
/*
|
|
1831
1878
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2112,7 +2159,7 @@
|
|
|
2112
2159
|
return [...attributeTokens].sort().join(" ");
|
|
2113
2160
|
}
|
|
2114
2161
|
|
|
2115
|
-
/*! @azure/msal-common v16.
|
|
2162
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
2116
2163
|
|
|
2117
2164
|
/*
|
|
2118
2165
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3080,7 +3127,7 @@
|
|
|
3080
3127
|
};
|
|
3081
3128
|
}
|
|
3082
3129
|
|
|
3083
|
-
/*! @azure/msal-common v16.
|
|
3130
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3084
3131
|
|
|
3085
3132
|
/*
|
|
3086
3133
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3114,7 +3161,7 @@
|
|
|
3114
3161
|
}
|
|
3115
3162
|
}
|
|
3116
3163
|
|
|
3117
|
-
/*! @azure/msal-common v16.
|
|
3164
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3118
3165
|
|
|
3119
3166
|
/*
|
|
3120
3167
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3310,7 +3357,7 @@
|
|
|
3310
3357
|
}
|
|
3311
3358
|
}
|
|
3312
3359
|
|
|
3313
|
-
/*! @azure/msal-common v16.
|
|
3360
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3314
3361
|
|
|
3315
3362
|
/*
|
|
3316
3363
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3591,6 +3638,20 @@
|
|
|
3591
3638
|
parameters.set(INSTANCE_AWARE, "true");
|
|
3592
3639
|
}
|
|
3593
3640
|
}
|
|
3641
|
+
/**
|
|
3642
|
+
* Adds `pocd=1`, telling the STS that the client verified the popup driving
|
|
3643
|
+
* this request cannot be reached by an untrusted window, so the
|
|
3644
|
+
* Cross-Origin-Opener-Policy response header may be omitted.
|
|
3645
|
+
*
|
|
3646
|
+
* Only ever added when the check passed — a negative result is signalled by
|
|
3647
|
+
* omitting the parameter, which keeps the STS default (apply COOP) and stays
|
|
3648
|
+
* compatible with library versions that never send it.
|
|
3649
|
+
*/
|
|
3650
|
+
function addPopupOriginCheckDone(parameters) {
|
|
3651
|
+
if (!parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
|
|
3652
|
+
parameters.set(POPUP_ORIGIN_CHECK_DONE, "1");
|
|
3653
|
+
}
|
|
3654
|
+
}
|
|
3594
3655
|
/**
|
|
3595
3656
|
* Add extraParameters
|
|
3596
3657
|
* @param extraParams - String dictionary containing extra parameters to be added.
|
|
@@ -3796,7 +3857,7 @@
|
|
|
3796
3857
|
}
|
|
3797
3858
|
}
|
|
3798
3859
|
|
|
3799
|
-
/*! @azure/msal-common v16.
|
|
3860
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3800
3861
|
|
|
3801
3862
|
/*
|
|
3802
3863
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3817,7 +3878,8 @@
|
|
|
3817
3878
|
return responseString;
|
|
3818
3879
|
}
|
|
3819
3880
|
/**
|
|
3820
|
-
* Returns
|
|
3881
|
+
* Returns flat fragment or query parameters as an authorization response.
|
|
3882
|
+
* Application routes and unrecognized responses return null.
|
|
3821
3883
|
*/
|
|
3822
3884
|
function getDeserializedResponse(responseString) {
|
|
3823
3885
|
// Check if given hash is empty
|
|
@@ -3827,7 +3889,15 @@
|
|
|
3827
3889
|
try {
|
|
3828
3890
|
// Strip the # or ? symbol if present
|
|
3829
3891
|
const normalizedResponse = stripLeadingHashOrQuery(responseString);
|
|
3830
|
-
|
|
3892
|
+
/*
|
|
3893
|
+
* Require a flat parameter name, not an application route.
|
|
3894
|
+
* Reject routes like #/dashboard?tab=orders&code=... and
|
|
3895
|
+
* #/dashboard/orders&state=..., where ?, /, or # appears before
|
|
3896
|
+
* the first = or &. These characters are allowed in parameter values.
|
|
3897
|
+
*/
|
|
3898
|
+
if (!/^[^=&?#/]+(?:=|&|$)/.test(normalizedResponse)) {
|
|
3899
|
+
return null;
|
|
3900
|
+
}
|
|
3831
3901
|
const deserializedHash = Object.fromEntries(new URLSearchParams(normalizedResponse));
|
|
3832
3902
|
// Check for known response properties
|
|
3833
3903
|
if (deserializedHash.code ||
|
|
@@ -3918,7 +3988,7 @@
|
|
|
3918
3988
|
}
|
|
3919
3989
|
}
|
|
3920
3990
|
|
|
3921
|
-
/*! @azure/msal-common v16.
|
|
3991
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3922
3992
|
|
|
3923
3993
|
/*
|
|
3924
3994
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3966,7 +4036,7 @@
|
|
|
3966
4036
|
},
|
|
3967
4037
|
};
|
|
3968
4038
|
|
|
3969
|
-
/*! @azure/msal-common v16.
|
|
4039
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3970
4040
|
|
|
3971
4041
|
/*
|
|
3972
4042
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3989,7 +4059,7 @@
|
|
|
3989
4059
|
},
|
|
3990
4060
|
};
|
|
3991
4061
|
|
|
3992
|
-
/*! @azure/msal-common v16.
|
|
4062
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3993
4063
|
/*
|
|
3994
4064
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3995
4065
|
* Licensed under the MIT License.
|
|
@@ -4278,12 +4348,12 @@
|
|
|
4278
4348
|
}
|
|
4279
4349
|
}
|
|
4280
4350
|
|
|
4281
|
-
/*! @azure/msal-common v16.
|
|
4351
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4282
4352
|
/* eslint-disable header/header */
|
|
4283
4353
|
const name$1 = "@azure/msal-common";
|
|
4284
|
-
const version$1 = "16.
|
|
4354
|
+
const version$1 = "16.16.0";
|
|
4285
4355
|
|
|
4286
|
-
/*! @azure/msal-common v16.
|
|
4356
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4287
4357
|
/*
|
|
4288
4358
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4289
4359
|
* Licensed under the MIT License.
|
|
@@ -4291,7 +4361,7 @@
|
|
|
4291
4361
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4292
4362
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4293
4363
|
|
|
4294
|
-
/*! @azure/msal-common v16.
|
|
4364
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4295
4365
|
|
|
4296
4366
|
/*
|
|
4297
4367
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4329,7 +4399,7 @@
|
|
|
4329
4399
|
}
|
|
4330
4400
|
}
|
|
4331
4401
|
|
|
4332
|
-
/*! @azure/msal-common v16.
|
|
4402
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4333
4403
|
|
|
4334
4404
|
/*
|
|
4335
4405
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4578,6 +4648,7 @@
|
|
|
4578
4648
|
};
|
|
4579
4649
|
const tokenKeys = this.getTokenKeys();
|
|
4580
4650
|
const currentScopes = ScopeSet.fromString(credential.target, correlationId);
|
|
4651
|
+
const accessTokenKeysToRemove = [];
|
|
4581
4652
|
tokenKeys.accessToken.forEach((key) => {
|
|
4582
4653
|
if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
|
|
4583
4654
|
return;
|
|
@@ -4587,10 +4658,13 @@
|
|
|
4587
4658
|
this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
|
|
4588
4659
|
const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
|
|
4589
4660
|
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
|
|
4590
|
-
|
|
4661
|
+
accessTokenKeysToRemove.push(key);
|
|
4591
4662
|
}
|
|
4592
4663
|
}
|
|
4593
4664
|
});
|
|
4665
|
+
for (const key of accessTokenKeysToRemove) {
|
|
4666
|
+
await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
|
|
4667
|
+
}
|
|
4594
4668
|
await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
|
|
4595
4669
|
}
|
|
4596
4670
|
/**
|
|
@@ -4826,12 +4900,32 @@
|
|
|
4826
4900
|
* @param correlationId
|
|
4827
4901
|
*/
|
|
4828
4902
|
removeAccessToken(key, correlationId) {
|
|
4903
|
+
const credential = this.removeAccessTokenCredential(key, correlationId);
|
|
4904
|
+
if (credential) {
|
|
4905
|
+
void this.removeTokenBindingKeyForCredential(credential, correlationId);
|
|
4906
|
+
}
|
|
4907
|
+
}
|
|
4908
|
+
/**
|
|
4909
|
+
* Removes an access token and waits for any unreferenced token-binding key
|
|
4910
|
+
* cleanup. Internal callers that require deterministic cleanup should use
|
|
4911
|
+
* this method instead of the synchronous public cache contract.
|
|
4912
|
+
*/
|
|
4913
|
+
async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId) {
|
|
4914
|
+
const credential = this.removeAccessTokenCredential(key, correlationId);
|
|
4915
|
+
if (credential) {
|
|
4916
|
+
await this.removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId);
|
|
4917
|
+
}
|
|
4918
|
+
}
|
|
4919
|
+
removeAccessTokenCredential(key, correlationId) {
|
|
4829
4920
|
const credential = this.getAccessTokenCredential(key, correlationId);
|
|
4830
4921
|
if (!credential) {
|
|
4831
|
-
return;
|
|
4922
|
+
return null;
|
|
4832
4923
|
}
|
|
4833
4924
|
this.removeItem(key, correlationId);
|
|
4834
4925
|
this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
|
|
4926
|
+
return credential;
|
|
4927
|
+
}
|
|
4928
|
+
async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
|
|
4835
4929
|
// Remove Token Binding Key from key store for token-bound access token credentials
|
|
4836
4930
|
if (credential.credentialType.toLowerCase() ===
|
|
4837
4931
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
|
|
@@ -4841,19 +4935,28 @@
|
|
|
4841
4935
|
case AuthenticationScheme$1.DPOP.toLowerCase(): {
|
|
4842
4936
|
const accessTokenWithAuthSchemeEntity = credential;
|
|
4843
4937
|
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
4844
|
-
if (kid
|
|
4845
|
-
|
|
4846
|
-
|
|
4847
|
-
|
|
4938
|
+
if (kid &&
|
|
4939
|
+
kid !== preservedKeyId &&
|
|
4940
|
+
!this.isTokenBindingKeyReferenced(kid, correlationId)) {
|
|
4941
|
+
try {
|
|
4942
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
|
|
4943
|
+
}
|
|
4944
|
+
catch {
|
|
4848
4945
|
this.commonLogger.error("0id34f", correlationId);
|
|
4849
4946
|
this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
|
|
4850
|
-
}
|
|
4947
|
+
}
|
|
4851
4948
|
}
|
|
4852
4949
|
break;
|
|
4853
4950
|
}
|
|
4854
4951
|
}
|
|
4855
4952
|
}
|
|
4856
4953
|
}
|
|
4954
|
+
isTokenBindingKeyReferenced(keyId, correlationId) {
|
|
4955
|
+
return this.getTokenKeys().accessToken.some((accessTokenKey) => {
|
|
4956
|
+
const accessToken = this.getAccessTokenCredential(accessTokenKey, correlationId);
|
|
4957
|
+
return accessToken?.keyId === keyId;
|
|
4958
|
+
});
|
|
4959
|
+
}
|
|
4857
4960
|
/**
|
|
4858
4961
|
* Removes all app metadata objects from cache.
|
|
4859
4962
|
*/
|
|
@@ -4992,6 +5095,7 @@
|
|
|
4992
5095
|
const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
|
|
4993
5096
|
const authScheme = request.authenticationScheme ||
|
|
4994
5097
|
AuthenticationScheme$1.BEARER;
|
|
5098
|
+
const normalizedAuthScheme = authScheme.toLowerCase();
|
|
4995
5099
|
/*
|
|
4996
5100
|
* Distinguish between Bearer and PoP/SSH token cache types
|
|
4997
5101
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
@@ -5017,7 +5121,10 @@
|
|
|
5017
5121
|
tokenType: authScheme,
|
|
5018
5122
|
keyId: authScheme === AuthenticationScheme$1.SSH
|
|
5019
5123
|
? request.sshKid
|
|
5020
|
-
:
|
|
5124
|
+
: normalizedAuthScheme ===
|
|
5125
|
+
AuthenticationScheme$1.DPOP.toLowerCase()
|
|
5126
|
+
? request.popKid || request.dpopJkt
|
|
5127
|
+
: undefined,
|
|
5021
5128
|
additionalCacheKeyComponents: additionalCacheKeyComponents,
|
|
5022
5129
|
};
|
|
5023
5130
|
const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
|
|
@@ -5517,7 +5624,7 @@
|
|
|
5517
5624
|
}
|
|
5518
5625
|
}
|
|
5519
5626
|
|
|
5520
|
-
/*! @azure/msal-common v16.
|
|
5627
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5521
5628
|
/*
|
|
5522
5629
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5523
5630
|
* Licensed under the MIT License.
|
|
@@ -5582,7 +5689,7 @@
|
|
|
5582
5689
|
"fetchRetryCount",
|
|
5583
5690
|
]);
|
|
5584
5691
|
|
|
5585
|
-
/*! @azure/msal-common v16.
|
|
5692
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5586
5693
|
|
|
5587
5694
|
/*
|
|
5588
5695
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5640,7 +5747,7 @@
|
|
|
5640
5747
|
}
|
|
5641
5748
|
}
|
|
5642
5749
|
|
|
5643
|
-
/*! @azure/msal-common v16.
|
|
5750
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5644
5751
|
|
|
5645
5752
|
/*
|
|
5646
5753
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5738,7 +5845,7 @@
|
|
|
5738
5845
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5739
5846
|
}
|
|
5740
5847
|
|
|
5741
|
-
/*! @azure/msal-common v16.
|
|
5848
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5742
5849
|
/*
|
|
5743
5850
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5744
5851
|
* Licensed under the MIT License.
|
|
@@ -5765,7 +5872,7 @@
|
|
|
5765
5872
|
}
|
|
5766
5873
|
}
|
|
5767
5874
|
|
|
5768
|
-
/*! @azure/msal-common v16.
|
|
5875
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5769
5876
|
|
|
5770
5877
|
/*
|
|
5771
5878
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5786,7 +5893,7 @@
|
|
|
5786
5893
|
return new JoseHeaderError(code, correlationId);
|
|
5787
5894
|
}
|
|
5788
5895
|
|
|
5789
|
-
/*! @azure/msal-common v16.
|
|
5896
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5790
5897
|
/*
|
|
5791
5898
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5792
5899
|
* Licensed under the MIT License.
|
|
@@ -5811,7 +5918,7 @@
|
|
|
5811
5918
|
return Object.getPrototypeOf(value) === proto;
|
|
5812
5919
|
}
|
|
5813
5920
|
|
|
5814
|
-
/*! @azure/msal-common v16.
|
|
5921
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5815
5922
|
/*
|
|
5816
5923
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5817
5924
|
* Licensed under the MIT License.
|
|
@@ -5821,7 +5928,7 @@
|
|
|
5821
5928
|
const missingJwkError = "missing_jwk_error";
|
|
5822
5929
|
const invalidJwkError = "invalid_jwk_error";
|
|
5823
5930
|
|
|
5824
|
-
/*! @azure/msal-common v16.
|
|
5931
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5825
5932
|
|
|
5826
5933
|
/*
|
|
5827
5934
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5887,7 +5994,7 @@
|
|
|
5887
5994
|
}
|
|
5888
5995
|
}
|
|
5889
5996
|
|
|
5890
|
-
/*! @azure/msal-common v16.
|
|
5997
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5891
5998
|
|
|
5892
5999
|
/*
|
|
5893
6000
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5988,7 +6095,7 @@
|
|
|
5988
6095
|
}
|
|
5989
6096
|
}
|
|
5990
6097
|
|
|
5991
|
-
/*! @azure/msal-common v16.
|
|
6098
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5992
6099
|
|
|
5993
6100
|
/*
|
|
5994
6101
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6038,13 +6145,22 @@
|
|
|
6038
6145
|
throw createClientConfigurationError(invalidDpopNonce, correlationId);
|
|
6039
6146
|
}
|
|
6040
6147
|
}
|
|
6148
|
+
/**
|
|
6149
|
+
* Validates and normalizes the HTTP resource context for a DPoP-bound request.
|
|
6150
|
+
* @internal
|
|
6151
|
+
*/
|
|
6152
|
+
function normalizeDpopResourceRequestContext(context, correlationId = "") {
|
|
6153
|
+
return {
|
|
6154
|
+
htm: normalizeHtm(context.htm, correlationId),
|
|
6155
|
+
htu: normalizeHtu(context.htu, correlationId),
|
|
6156
|
+
};
|
|
6157
|
+
}
|
|
6041
6158
|
/**
|
|
6042
6159
|
* Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
|
|
6043
6160
|
* resource-endpoint proof bindings.
|
|
6044
6161
|
*
|
|
6045
|
-
*
|
|
6046
|
-
* This helper
|
|
6047
|
-
* in a subsequent work item.
|
|
6162
|
+
* Exported from package entry points for use by MSAL Browser.
|
|
6163
|
+
* This helper remains an unsupported internal API for direct consumers.
|
|
6048
6164
|
*
|
|
6049
6165
|
* DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
|
|
6050
6166
|
* @internal
|
|
@@ -6099,10 +6215,11 @@
|
|
|
6099
6215
|
*/
|
|
6100
6216
|
buildResourceProofClaims(params, correlationId = "") {
|
|
6101
6217
|
validateDpopNonce(params.nonce, correlationId);
|
|
6218
|
+
const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
|
|
6102
6219
|
const claims = {
|
|
6103
6220
|
jti: this.cryptoUtils.createNewGuid(),
|
|
6104
|
-
htm:
|
|
6105
|
-
htu:
|
|
6221
|
+
htm: resourceContext.htm,
|
|
6222
|
+
htu: resourceContext.htu,
|
|
6106
6223
|
ath: params.ath,
|
|
6107
6224
|
iat: nowSeconds(),
|
|
6108
6225
|
};
|
|
@@ -6133,7 +6250,7 @@
|
|
|
6133
6250
|
}
|
|
6134
6251
|
}
|
|
6135
6252
|
|
|
6136
|
-
/*! @azure/msal-common v16.
|
|
6253
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6137
6254
|
/*
|
|
6138
6255
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6139
6256
|
* Licensed under the MIT License.
|
|
@@ -6197,7 +6314,7 @@
|
|
|
6197
6314
|
uiNotAllowed: uiNotAllowed
|
|
6198
6315
|
});
|
|
6199
6316
|
|
|
6200
|
-
/*! @azure/msal-common v16.
|
|
6317
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6201
6318
|
|
|
6202
6319
|
/*
|
|
6203
6320
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6264,7 +6381,7 @@
|
|
|
6264
6381
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
6265
6382
|
}
|
|
6266
6383
|
|
|
6267
|
-
/*! @azure/msal-common v16.
|
|
6384
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6268
6385
|
|
|
6269
6386
|
/*
|
|
6270
6387
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6283,7 +6400,7 @@
|
|
|
6283
6400
|
}
|
|
6284
6401
|
}
|
|
6285
6402
|
|
|
6286
|
-
/*! @azure/msal-common v16.
|
|
6403
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6287
6404
|
|
|
6288
6405
|
/*
|
|
6289
6406
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6354,7 +6471,7 @@
|
|
|
6354
6471
|
}
|
|
6355
6472
|
}
|
|
6356
6473
|
|
|
6357
|
-
/*! @azure/msal-common v16.
|
|
6474
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6358
6475
|
|
|
6359
6476
|
/*
|
|
6360
6477
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6782,7 +6899,7 @@
|
|
|
6782
6899
|
return baseAccount;
|
|
6783
6900
|
}
|
|
6784
6901
|
|
|
6785
|
-
/*! @azure/msal-common v16.
|
|
6902
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6786
6903
|
/*
|
|
6787
6904
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6788
6905
|
* Licensed under the MIT License.
|
|
@@ -6792,7 +6909,7 @@
|
|
|
6792
6909
|
UPN: "UPN",
|
|
6793
6910
|
};
|
|
6794
6911
|
|
|
6795
|
-
/*! @azure/msal-common v16.
|
|
6912
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6796
6913
|
/*
|
|
6797
6914
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6798
6915
|
* Licensed under the MIT License.
|
|
@@ -6811,7 +6928,7 @@
|
|
|
6811
6928
|
}
|
|
6812
6929
|
}
|
|
6813
6930
|
|
|
6814
|
-
/*! @azure/msal-common v16.
|
|
6931
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6815
6932
|
|
|
6816
6933
|
/*
|
|
6817
6934
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6835,7 +6952,7 @@
|
|
|
6835
6952
|
};
|
|
6836
6953
|
}
|
|
6837
6954
|
|
|
6838
|
-
/*! @azure/msal-common v16.
|
|
6955
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6839
6956
|
|
|
6840
6957
|
/*
|
|
6841
6958
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6870,13 +6987,14 @@
|
|
|
6870
6987
|
* Performs necessary throttling checks after a network request.
|
|
6871
6988
|
* @param cacheManager
|
|
6872
6989
|
* @param thumbprint
|
|
6873
|
-
* @param response
|
|
6990
|
+
* @param response - Token response with case-insensitive header names.
|
|
6874
6991
|
*/
|
|
6875
6992
|
static postProcess(cacheManager, thumbprint, response, correlationId) {
|
|
6993
|
+
const retryAfter = getRetryAfterHeader(response);
|
|
6876
6994
|
if (ThrottlingUtils.checkResponseStatus(response) ||
|
|
6877
|
-
|
|
6995
|
+
retryAfter !== undefined) {
|
|
6878
6996
|
const thumbprintValue = {
|
|
6879
|
-
throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(
|
|
6997
|
+
throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(retryAfter || "")),
|
|
6880
6998
|
error: response.body.error,
|
|
6881
6999
|
errorCodes: response.body.error_codes,
|
|
6882
7000
|
errorMessage: response.body.error_description,
|
|
@@ -6895,14 +7013,10 @@
|
|
|
6895
7013
|
}
|
|
6896
7014
|
/**
|
|
6897
7015
|
* Checks a NetworkResponse object's RetryAfter header
|
|
6898
|
-
* @param response
|
|
7016
|
+
* @param response - Token response with case-insensitive header names.
|
|
6899
7017
|
*/
|
|
6900
7018
|
static checkResponseForRetryAfter(response) {
|
|
6901
|
-
|
|
6902
|
-
return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
|
|
6903
|
-
(response.status < 200 || response.status >= 300));
|
|
6904
|
-
}
|
|
6905
|
-
return false;
|
|
7019
|
+
return getRetryAfterHeader(response) !== undefined;
|
|
6906
7020
|
}
|
|
6907
7021
|
/**
|
|
6908
7022
|
* Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
|
|
@@ -6919,9 +7033,16 @@
|
|
|
6919
7033
|
const key = this.generateThrottlingStorageKey(thumbprint);
|
|
6920
7034
|
cacheManager.removeItem(key, request.correlationId);
|
|
6921
7035
|
}
|
|
7036
|
+
}
|
|
7037
|
+
/** Reads Retry-After only for non-success responses. */
|
|
7038
|
+
function getRetryAfterHeader(response) {
|
|
7039
|
+
if ((response.status < 200 || response.status >= 300) && response.headers) {
|
|
7040
|
+
return getResponseHeader(response.headers, HeaderNames.RETRY_AFTER);
|
|
7041
|
+
}
|
|
7042
|
+
return undefined;
|
|
6922
7043
|
}
|
|
6923
7044
|
|
|
6924
|
-
/*! @azure/msal-common v16.
|
|
7045
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6925
7046
|
|
|
6926
7047
|
/*
|
|
6927
7048
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6952,7 +7073,7 @@
|
|
|
6952
7073
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6953
7074
|
}
|
|
6954
7075
|
|
|
6955
|
-
/*! @azure/msal-common v16.
|
|
7076
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6956
7077
|
|
|
6957
7078
|
/*
|
|
6958
7079
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7050,7 +7171,8 @@
|
|
|
7050
7171
|
let response;
|
|
7051
7172
|
try {
|
|
7052
7173
|
response = await invokeAsync((networkClient.sendPostRequestAsync.bind(networkClient)), NetworkClientSendPostRequestAsync, logger, performanceClient, correlationId)(tokenEndpoint, { ...options, correlationId, performanceClient });
|
|
7053
|
-
const responseHeaders = response.headers || {};
|
|
7174
|
+
const responseHeaders = normalizeResponseHeaders(response.headers || {});
|
|
7175
|
+
response = { ...response, headers: responseHeaders };
|
|
7054
7176
|
performanceClient?.addFields({
|
|
7055
7177
|
refreshTokenSize: response.body.refresh_token?.length || 0,
|
|
7056
7178
|
httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
|
|
@@ -7059,16 +7181,16 @@
|
|
|
7059
7181
|
}
|
|
7060
7182
|
catch (e) {
|
|
7061
7183
|
if (e instanceof NetworkError) {
|
|
7062
|
-
const responseHeaders = e.responseHeaders
|
|
7184
|
+
const responseHeaders = e.responseHeaders
|
|
7185
|
+
? normalizeResponseHeaders(e.responseHeaders)
|
|
7186
|
+
: undefined;
|
|
7063
7187
|
if (responseHeaders) {
|
|
7064
7188
|
performanceClient?.addFields({
|
|
7065
7189
|
httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] ||
|
|
7066
7190
|
"",
|
|
7067
7191
|
requestId: responseHeaders[HeaderNames.X_MS_REQUEST_ID] || "",
|
|
7068
|
-
contentTypeHeader: responseHeaders
|
|
7069
|
-
|
|
7070
|
-
contentLengthHeader: responseHeaders[HeaderNames.CONTENT_LENGTH] ||
|
|
7071
|
-
undefined,
|
|
7192
|
+
contentTypeHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_TYPE) || undefined,
|
|
7193
|
+
contentLengthHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_LENGTH) || undefined,
|
|
7072
7194
|
httpStatus: e.httpStatus,
|
|
7073
7195
|
}, correlationId);
|
|
7074
7196
|
}
|
|
@@ -7085,7 +7207,7 @@
|
|
|
7085
7207
|
return response;
|
|
7086
7208
|
}
|
|
7087
7209
|
|
|
7088
|
-
/*! @azure/msal-common v16.
|
|
7210
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7089
7211
|
|
|
7090
7212
|
/*
|
|
7091
7213
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7329,6 +7451,9 @@
|
|
|
7329
7451
|
if (request.logoutHint) {
|
|
7330
7452
|
addLogoutHint(parameters, request.logoutHint);
|
|
7331
7453
|
}
|
|
7454
|
+
if (request.popupOriginCheckDone) {
|
|
7455
|
+
addPopupOriginCheckDone(parameters);
|
|
7456
|
+
}
|
|
7332
7457
|
if (request.extraQueryParameters) {
|
|
7333
7458
|
addExtraParameters(parameters, request.extraQueryParameters);
|
|
7334
7459
|
}
|
|
@@ -7349,7 +7474,7 @@
|
|
|
7349
7474
|
}
|
|
7350
7475
|
}
|
|
7351
7476
|
|
|
7352
|
-
/*! @azure/msal-common v16.
|
|
7477
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7353
7478
|
|
|
7354
7479
|
/*
|
|
7355
7480
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7484,6 +7609,9 @@
|
|
|
7484
7609
|
!Object.keys(request.extraQueryParameters).includes(INSTANCE_AWARE))) {
|
|
7485
7610
|
addInstanceAware(parameters);
|
|
7486
7611
|
}
|
|
7612
|
+
if (request.popupOriginCheckDone) {
|
|
7613
|
+
addPopupOriginCheckDone(parameters);
|
|
7614
|
+
}
|
|
7487
7615
|
return parameters;
|
|
7488
7616
|
}
|
|
7489
7617
|
/**
|
|
@@ -7576,7 +7704,7 @@
|
|
|
7576
7704
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
7577
7705
|
}
|
|
7578
7706
|
|
|
7579
|
-
/*! @azure/msal-common v16.
|
|
7707
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7580
7708
|
|
|
7581
7709
|
/*
|
|
7582
7710
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8125,7 +8253,7 @@
|
|
|
8125
8253
|
}
|
|
8126
8254
|
}
|
|
8127
8255
|
|
|
8128
|
-
/*! @azure/msal-common v16.
|
|
8256
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8129
8257
|
|
|
8130
8258
|
/*
|
|
8131
8259
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8360,7 +8488,7 @@
|
|
|
8360
8488
|
}
|
|
8361
8489
|
}
|
|
8362
8490
|
|
|
8363
|
-
/*! @azure/msal-common v16.
|
|
8491
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8364
8492
|
|
|
8365
8493
|
/*
|
|
8366
8494
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8653,7 +8781,7 @@
|
|
|
8653
8781
|
clearNativeBrokerErrorCode() { }
|
|
8654
8782
|
}
|
|
8655
8783
|
|
|
8656
|
-
/*! @azure/msal-common v16.
|
|
8784
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8657
8785
|
|
|
8658
8786
|
/*
|
|
8659
8787
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8780,7 +8908,7 @@
|
|
|
8780
8908
|
}
|
|
8781
8909
|
}
|
|
8782
8910
|
|
|
8783
|
-
/*! @azure/msal-common v16.
|
|
8911
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8784
8912
|
|
|
8785
8913
|
/*
|
|
8786
8914
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8796,7 +8924,7 @@
|
|
|
8796
8924
|
},
|
|
8797
8925
|
};
|
|
8798
8926
|
|
|
8799
|
-
/*! @azure/msal-common v16.
|
|
8927
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8800
8928
|
|
|
8801
8929
|
/*
|
|
8802
8930
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8945,6 +9073,7 @@
|
|
|
8945
9073
|
const PlatformAuthHandleNativeResponse = "platformAuthHandleNativeResponse";
|
|
8946
9074
|
const PlatformAuthCacheAccount = "platformAuthCacheAccount";
|
|
8947
9075
|
const PlatformAuthCacheNativeTokens = "platformAuthCacheNativeTokens";
|
|
9076
|
+
const PlatformAuthDpopKeyCleanup = "platformAuthDpopKeyCleanup";
|
|
8948
9077
|
const RemoveHiddenIframe = "removeHiddenIframe";
|
|
8949
9078
|
const ImportExistingCache = "importExistingCache";
|
|
8950
9079
|
/**
|
|
@@ -9874,9 +10003,14 @@
|
|
|
9874
10003
|
};
|
|
9875
10004
|
}
|
|
9876
10005
|
/**
|
|
9877
|
-
* Clears
|
|
10006
|
+
* Clears a recognized authentication response fragment, preserving the query string.
|
|
10007
|
+
* Assigns an empty hash, then removes the trailing # when history updates are available.
|
|
9878
10008
|
*/
|
|
9879
10009
|
function clearHash(contentWindow) {
|
|
10010
|
+
const serverParams = getDeserializedResponse(contentWindow.location.hash);
|
|
10011
|
+
if (!serverParams) {
|
|
10012
|
+
return;
|
|
10013
|
+
}
|
|
9880
10014
|
// Office.js sets history.replaceState to null
|
|
9881
10015
|
contentWindow.location.hash = "";
|
|
9882
10016
|
if (typeof contentWindow.history.replaceState === "function") {
|
|
@@ -10500,6 +10634,19 @@
|
|
|
10500
10634
|
return cacheKeys;
|
|
10501
10635
|
}
|
|
10502
10636
|
}
|
|
10637
|
+
/**
|
|
10638
|
+
* Returns whether a key is available in persistent storage. Unlike
|
|
10639
|
+
* containsKey, this does not consult the in-memory fallback.
|
|
10640
|
+
*/
|
|
10641
|
+
async containsKeyInPersistentStorage(key, correlationId) {
|
|
10642
|
+
try {
|
|
10643
|
+
return await this.indexedDBCache.containsKey(key);
|
|
10644
|
+
}
|
|
10645
|
+
catch (e) {
|
|
10646
|
+
this.handleDatabaseAccessError(e, correlationId);
|
|
10647
|
+
return false;
|
|
10648
|
+
}
|
|
10649
|
+
}
|
|
10503
10650
|
/**
|
|
10504
10651
|
* Returns true or false if the given key is present in the cache.
|
|
10505
10652
|
* @param key
|
|
@@ -10605,6 +10752,12 @@
|
|
|
10605
10752
|
throw createClientAuthError(bindingKeyNotRemoved, correlationId);
|
|
10606
10753
|
}
|
|
10607
10754
|
}
|
|
10755
|
+
/**
|
|
10756
|
+
* Returns whether a browser token-binding key is available.
|
|
10757
|
+
*/
|
|
10758
|
+
async hasTokenBindingKey(keyId, correlationId) {
|
|
10759
|
+
return this.cache.containsKey(keyId, correlationId);
|
|
10760
|
+
}
|
|
10608
10761
|
/**
|
|
10609
10762
|
* Clears browser token-binding keys from memory and persistent storage.
|
|
10610
10763
|
* @param correlationId - Request correlation identifier.
|
|
@@ -10666,6 +10819,13 @@
|
|
|
10666
10819
|
}
|
|
10667
10820
|
return cachedKeyPair;
|
|
10668
10821
|
}
|
|
10822
|
+
/**
|
|
10823
|
+
* Returns whether a browser token-binding key survived in persistent
|
|
10824
|
+
* storage and can be restored after a redirect navigation.
|
|
10825
|
+
*/
|
|
10826
|
+
async isTokenBindingKeyPersisted(keyId, correlationId) {
|
|
10827
|
+
return this.cache.containsKeyInPersistentStorage(keyId, correlationId);
|
|
10828
|
+
}
|
|
10669
10829
|
/** @internal */
|
|
10670
10830
|
getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
|
|
10671
10831
|
return {
|
|
@@ -11499,7 +11659,7 @@
|
|
|
11499
11659
|
|
|
11500
11660
|
/* eslint-disable header/header */
|
|
11501
11661
|
const name = "@azure/msal-browser";
|
|
11502
|
-
const version = "5.
|
|
11662
|
+
const version = "5.28.0";
|
|
11503
11663
|
|
|
11504
11664
|
/*
|
|
11505
11665
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -12131,7 +12291,7 @@
|
|
|
12131
12291
|
throw cacheError;
|
|
12132
12292
|
}
|
|
12133
12293
|
// When cache quota is exceeded, start removing access tokens until we can successfully set the item
|
|
12134
|
-
this.
|
|
12294
|
+
await this.removeAccessTokenAndTokenBindingKey(accessTokenKeys[i], correlationId, undefined, false // Don't save token keys yet, do it at the end
|
|
12135
12295
|
);
|
|
12136
12296
|
}
|
|
12137
12297
|
else {
|
|
@@ -12273,6 +12433,13 @@
|
|
|
12273
12433
|
super.removeAccessToken(key, correlationId);
|
|
12274
12434
|
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
|
|
12275
12435
|
}
|
|
12436
|
+
/**
|
|
12437
|
+
* Removes an access token and awaits token-binding key cleanup.
|
|
12438
|
+
*/
|
|
12439
|
+
async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId, updateTokenKeys = true) {
|
|
12440
|
+
await super.removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId);
|
|
12441
|
+
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
|
|
12442
|
+
}
|
|
12276
12443
|
/**
|
|
12277
12444
|
* Remove access token key from the key map
|
|
12278
12445
|
* @param key
|
|
@@ -13007,6 +13174,116 @@
|
|
|
13007
13174
|
return browserStorage.getActiveAccount(correlationId);
|
|
13008
13175
|
}
|
|
13009
13176
|
|
|
13177
|
+
/*
|
|
13178
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13179
|
+
* Licensed under the MIT License.
|
|
13180
|
+
*/
|
|
13181
|
+
const POPUP_POLL_INTERVAL_MS = 30;
|
|
13182
|
+
let activePopupPoller;
|
|
13183
|
+
/**
|
|
13184
|
+
* Cancels legacy popup polling when an interaction is superseded.
|
|
13185
|
+
*
|
|
13186
|
+
* @internal
|
|
13187
|
+
* @param logger Logger for the interaction.
|
|
13188
|
+
*/
|
|
13189
|
+
function cancelPendingPopupPollingResponse(logger) {
|
|
13190
|
+
if (activePopupPoller) {
|
|
13191
|
+
logger.verbose("0g9n3p", activePopupPoller.correlationId);
|
|
13192
|
+
activePopupPoller.cancel();
|
|
13193
|
+
}
|
|
13194
|
+
}
|
|
13195
|
+
/**
|
|
13196
|
+
* Monitors a popup window for a URL change to the same origin as the parent application.
|
|
13197
|
+
* Polls the popup at a specified interval until it is redirected back to the application,
|
|
13198
|
+
* closed by the user, or a navigation to a same-origin URL is detected. Once a same-origin
|
|
13199
|
+
* URL is detected, extracts the response string (query or hash) and resolves the promise.
|
|
13200
|
+
*
|
|
13201
|
+
* @param popupWindow - The popup window to monitor for navigation.
|
|
13202
|
+
* @param popupWindowParent - The parent window that opened the popup.
|
|
13203
|
+
* @param responseMode - Response mode (`"query"` | `"fragment"`) determines whether
|
|
13204
|
+
* to read `location.search` or `location.hash` from the popup once on the same
|
|
13205
|
+
* origin. Any value other than `"query"` is treated as fragment.
|
|
13206
|
+
* @param logger - Logger instance.
|
|
13207
|
+
* @param unloadWindow - Event handler to remove from the parent window on cleanup.
|
|
13208
|
+
* @param correlationId
|
|
13209
|
+
*/
|
|
13210
|
+
async function monitorPopupForHash(popupWindow, popupWindowParent, responseMode, logger, unloadWindow, correlationId) {
|
|
13211
|
+
let poller;
|
|
13212
|
+
return new Promise((resolve, reject) => {
|
|
13213
|
+
logger.verbose("0cp91u", correlationId);
|
|
13214
|
+
const intervalId = window.setInterval(() => {
|
|
13215
|
+
if (popupWindow.closed) {
|
|
13216
|
+
logger.error("0n69wb", correlationId);
|
|
13217
|
+
window.clearInterval(intervalId);
|
|
13218
|
+
reject(new BrowserAuthError(userCancelled, correlationId));
|
|
13219
|
+
return;
|
|
13220
|
+
}
|
|
13221
|
+
let href = "";
|
|
13222
|
+
try {
|
|
13223
|
+
/*
|
|
13224
|
+
* Will throw if cross origin,
|
|
13225
|
+
* which should be caught and ignored
|
|
13226
|
+
* since we need the interval to keep running while on STS UI.
|
|
13227
|
+
*/
|
|
13228
|
+
href = popupWindow.location.href;
|
|
13229
|
+
}
|
|
13230
|
+
catch (e) { }
|
|
13231
|
+
// Don't process blank pages or cross domain
|
|
13232
|
+
if (!href || href === "about:blank") {
|
|
13233
|
+
return;
|
|
13234
|
+
}
|
|
13235
|
+
window.clearInterval(intervalId);
|
|
13236
|
+
let responseString;
|
|
13237
|
+
if (responseMode === ResponseMode$1.QUERY) {
|
|
13238
|
+
responseString = popupWindow.location.search;
|
|
13239
|
+
}
|
|
13240
|
+
else {
|
|
13241
|
+
responseString = popupWindow.location.hash;
|
|
13242
|
+
}
|
|
13243
|
+
logger.verbose("0po9er", correlationId);
|
|
13244
|
+
resolve(responseString);
|
|
13245
|
+
}, POPUP_POLL_INTERVAL_MS);
|
|
13246
|
+
poller = {
|
|
13247
|
+
correlationId,
|
|
13248
|
+
cancel: () => {
|
|
13249
|
+
window.clearInterval(intervalId);
|
|
13250
|
+
if (activePopupPoller === poller) {
|
|
13251
|
+
activePopupPoller = undefined;
|
|
13252
|
+
}
|
|
13253
|
+
reject(new BrowserAuthError(interactionInProgressCancelled, correlationId));
|
|
13254
|
+
},
|
|
13255
|
+
};
|
|
13256
|
+
activePopupPoller = poller;
|
|
13257
|
+
}).finally(() => {
|
|
13258
|
+
if (poller && activePopupPoller === poller) {
|
|
13259
|
+
activePopupPoller = undefined;
|
|
13260
|
+
}
|
|
13261
|
+
cleanPopup(popupWindow, popupWindowParent, unloadWindow);
|
|
13262
|
+
});
|
|
13263
|
+
}
|
|
13264
|
+
/**
|
|
13265
|
+
* Performs cleanup operations after popup authentication.
|
|
13266
|
+
* Strips auth-response params (code/state) from the popup URL while it is still
|
|
13267
|
+
* open, closes the popup window, and removes the 'beforeunload' event listener
|
|
13268
|
+
* from the parent window.
|
|
13269
|
+
*
|
|
13270
|
+
* @param popupWindow - The popup window to be closed.
|
|
13271
|
+
* @param popupWindowParent - The parent window from which the event listener will be removed.
|
|
13272
|
+
* @param unloadWindow - The event handler function to remove.
|
|
13273
|
+
*/
|
|
13274
|
+
function cleanPopup(popupWindow, popupWindowParent, unloadWindow) {
|
|
13275
|
+
if (!popupWindow.closed) {
|
|
13276
|
+
try {
|
|
13277
|
+
clearAuthResponseFromUrl(popupWindow);
|
|
13278
|
+
}
|
|
13279
|
+
catch {
|
|
13280
|
+
// Popup may have become cross-origin or otherwise inaccessible; ignore.
|
|
13281
|
+
}
|
|
13282
|
+
}
|
|
13283
|
+
popupWindow.close();
|
|
13284
|
+
popupWindowParent.removeEventListener("beforeunload", unloadWindow);
|
|
13285
|
+
}
|
|
13286
|
+
|
|
13010
13287
|
/*
|
|
13011
13288
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13012
13289
|
* Licensed under the MIT License.
|
|
@@ -13276,19 +13553,13 @@
|
|
|
13276
13553
|
}
|
|
13277
13554
|
/**
|
|
13278
13555
|
* Resolves the token-binding parameters needed before building authorize or token requests.
|
|
13279
|
-
*
|
|
13280
|
-
*
|
|
13281
|
-
*
|
|
13556
|
+
* DPoP requests provision a browser key for token endpoint redemption. Platform broker
|
|
13557
|
+
* authorization requests retain the key for auth-code fallback but suppress dpop_jkt on
|
|
13558
|
+
* /authorize. Platform broker PoP requests use a reqCnf confirmation claim.
|
|
13282
13559
|
*/
|
|
13283
13560
|
async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
|
|
13284
13561
|
switch (request.authenticationScheme) {
|
|
13285
13562
|
case AuthenticationScheme$1.DPOP:
|
|
13286
|
-
if (request.platformBroker) {
|
|
13287
|
-
return {};
|
|
13288
|
-
}
|
|
13289
|
-
if (request.dpopJkt) {
|
|
13290
|
-
return { dpopJkt: request.dpopJkt };
|
|
13291
|
-
}
|
|
13292
13563
|
return {
|
|
13293
13564
|
dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
|
|
13294
13565
|
tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
|
|
@@ -13311,6 +13582,36 @@
|
|
|
13311
13582
|
return {};
|
|
13312
13583
|
}
|
|
13313
13584
|
}
|
|
13585
|
+
/**
|
|
13586
|
+
* Removes a DPoP key that was provisioned for an authorization attempt which
|
|
13587
|
+
* did not complete. Cleanup failures are recorded without replacing the
|
|
13588
|
+
* original authorization error.
|
|
13589
|
+
*/
|
|
13590
|
+
async function removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient) {
|
|
13591
|
+
if (request.authenticationScheme !== AuthenticationScheme$1.DPOP ||
|
|
13592
|
+
!request.dpopJkt) {
|
|
13593
|
+
return;
|
|
13594
|
+
}
|
|
13595
|
+
try {
|
|
13596
|
+
await tokenBindingKeyManager.removeTokenBindingKey(request.dpopJkt, request.correlationId);
|
|
13597
|
+
}
|
|
13598
|
+
catch {
|
|
13599
|
+
logger.error("1su7ne", request.correlationId);
|
|
13600
|
+
performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, request.correlationId);
|
|
13601
|
+
}
|
|
13602
|
+
}
|
|
13603
|
+
/**
|
|
13604
|
+
* Returns whether an MSAL-owned DPoP key is available in persistent storage
|
|
13605
|
+
* before a redirect navigation. Custom managers without a persistence probe
|
|
13606
|
+
* retain their existing behavior.
|
|
13607
|
+
*/
|
|
13608
|
+
async function isTokenBindingKeyPersistedForRedirect(request, tokenBindingKeyManager) {
|
|
13609
|
+
const keyId = request.dpopJkt ?? request.keyId;
|
|
13610
|
+
if (!keyId || !tokenBindingKeyManager.isTokenBindingKeyPersisted) {
|
|
13611
|
+
return true;
|
|
13612
|
+
}
|
|
13613
|
+
return tokenBindingKeyManager.isTokenBindingKeyPersisted(keyId, request.correlationId);
|
|
13614
|
+
}
|
|
13314
13615
|
/**
|
|
13315
13616
|
* Initializer function for all request APIs
|
|
13316
13617
|
* @param request
|
|
@@ -13386,6 +13687,90 @@
|
|
|
13386
13687
|
return httpMethod;
|
|
13387
13688
|
}
|
|
13388
13689
|
|
|
13690
|
+
/*
|
|
13691
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13692
|
+
* Licensed under the MIT License.
|
|
13693
|
+
*/
|
|
13694
|
+
/**
|
|
13695
|
+
* `window.origin` of a document with an opaque origin, e.g. one sandboxed
|
|
13696
|
+
* without `allow-same-origin`. Read from `window.origin`, not
|
|
13697
|
+
* `location.origin`, which reports the real host even when sandboxed.
|
|
13698
|
+
*/
|
|
13699
|
+
const OPAQUE_ORIGIN = "null";
|
|
13700
|
+
/**
|
|
13701
|
+
* Returns `true` when every ancestor browsing context is same-origin with
|
|
13702
|
+
* `win`. A top-level document has no ancestors, so it always passes.
|
|
13703
|
+
*/
|
|
13704
|
+
function allAncestorsSameOrigin(win) {
|
|
13705
|
+
try {
|
|
13706
|
+
// Sandboxed: no origin to compare ancestors against.
|
|
13707
|
+
if (win.origin === OPAQUE_ORIGIN) {
|
|
13708
|
+
return false;
|
|
13709
|
+
}
|
|
13710
|
+
let current = win;
|
|
13711
|
+
// `window.parent` is self-referential at the top level, never falsy.
|
|
13712
|
+
while (current !== current.parent) {
|
|
13713
|
+
current = current.parent;
|
|
13714
|
+
// Throws SecurityError if this ancestor is cross-origin.
|
|
13715
|
+
void current.location.href;
|
|
13716
|
+
}
|
|
13717
|
+
return true;
|
|
13718
|
+
}
|
|
13719
|
+
catch {
|
|
13720
|
+
return false;
|
|
13721
|
+
}
|
|
13722
|
+
}
|
|
13723
|
+
/**
|
|
13724
|
+
* Returns `true` when the top-level window has no opener, or one that is
|
|
13725
|
+
* same-origin with it.
|
|
13726
|
+
*
|
|
13727
|
+
* Reads the opener from `win.top`, not `win`: a framed document always reports
|
|
13728
|
+
* `window.opener === null` and would pass while the top window's untrusted
|
|
13729
|
+
* opener still holds a handle on it.
|
|
13730
|
+
*/
|
|
13731
|
+
function topOpenerIsSameOriginOrAbsent(win) {
|
|
13732
|
+
try {
|
|
13733
|
+
const top = win.top;
|
|
13734
|
+
if (!top) {
|
|
13735
|
+
// Detached from its browsing context; treat as unsafe.
|
|
13736
|
+
return false;
|
|
13737
|
+
}
|
|
13738
|
+
const opener = top.opener;
|
|
13739
|
+
if (!opener || opener === top) {
|
|
13740
|
+
return true;
|
|
13741
|
+
}
|
|
13742
|
+
// Throws SecurityError if the opener is cross-origin.
|
|
13743
|
+
void opener.location.href;
|
|
13744
|
+
return true;
|
|
13745
|
+
}
|
|
13746
|
+
catch {
|
|
13747
|
+
return false;
|
|
13748
|
+
}
|
|
13749
|
+
}
|
|
13750
|
+
/**
|
|
13751
|
+
* Computes the `pocd` ("popup origin check done") authorize parameter value.
|
|
13752
|
+
*
|
|
13753
|
+
* `1` means no untrusted window can reach the popup, which is what lets Entra
|
|
13754
|
+
* omit the `Cross-Origin-Opener-Policy` response header for the request.
|
|
13755
|
+
*
|
|
13756
|
+
* @param config Resolved browser configuration.
|
|
13757
|
+
* @param win Window whose hosting environment is being checked. Defaults to the app window.
|
|
13758
|
+
* @returns `1` when the check passes, otherwise `0`.
|
|
13759
|
+
*/
|
|
13760
|
+
function computePocd(config, win = typeof window !== "undefined" ? window : undefined) {
|
|
13761
|
+
/*
|
|
13762
|
+
* Only an explicit false opts out; anything else computes the check, so an
|
|
13763
|
+
* unresolved config fails closed rather than asserting pocd=1.
|
|
13764
|
+
*/
|
|
13765
|
+
if (config.auth.originCheck === false) {
|
|
13766
|
+
return 1;
|
|
13767
|
+
}
|
|
13768
|
+
if (!win || !allAncestorsSameOrigin(win)) {
|
|
13769
|
+
return 0;
|
|
13770
|
+
}
|
|
13771
|
+
return topOpenerIsSameOriginOrAbsent(win) ? 1 : 0;
|
|
13772
|
+
}
|
|
13773
|
+
|
|
13389
13774
|
/*
|
|
13390
13775
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13391
13776
|
* Licensed under the MIT License.
|
|
@@ -13403,6 +13788,11 @@
|
|
|
13403
13788
|
const validLogoutRequest = {
|
|
13404
13789
|
correlationId: this.correlationId,
|
|
13405
13790
|
...logoutRequest,
|
|
13791
|
+
/*
|
|
13792
|
+
* Computed here rather than per flow so every end-session request
|
|
13793
|
+
* carries it, matching the authorize path.
|
|
13794
|
+
*/
|
|
13795
|
+
popupOriginCheckDone: computePocd(this.config) === 1,
|
|
13406
13796
|
};
|
|
13407
13797
|
/**
|
|
13408
13798
|
* Set logout_hint to be login_hint from ID Token Claims if present
|
|
@@ -13909,12 +14299,26 @@
|
|
|
13909
14299
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13910
14300
|
* Licensed under the MIT License.
|
|
13911
14301
|
*/
|
|
14302
|
+
/**
|
|
14303
|
+
* Key storage enclaves supported by the platform broker.
|
|
14304
|
+
*/
|
|
14305
|
+
const PlatformAuthEnclave = {
|
|
14306
|
+
/**
|
|
14307
|
+
* Persisted software key using MS_KEY_STORAGE_PROVIDER.
|
|
14308
|
+
*/
|
|
14309
|
+
SOFTWARE: "sw"};
|
|
13912
14310
|
/**
|
|
13913
14311
|
* Token types supported by the platform broker request contract.
|
|
13914
14312
|
*/
|
|
13915
14313
|
const PlatformAuthTokenType = {
|
|
13916
14314
|
DPOP_WITH_PROOF: "dpop+proof",
|
|
13917
14315
|
};
|
|
14316
|
+
/**
|
|
14317
|
+
* Token binding preferences supported by the platform broker.
|
|
14318
|
+
*/
|
|
14319
|
+
const PlatformAuthBindingPreference = {
|
|
14320
|
+
ATTESTED: "attested",
|
|
14321
|
+
};
|
|
13918
14322
|
const PROOF_OF_POSSESSION_TOKEN_TYPES = [
|
|
13919
14323
|
AuthenticationScheme$1.POP,
|
|
13920
14324
|
AuthenticationScheme$1.DPOP,
|
|
@@ -13930,19 +14334,19 @@
|
|
|
13930
14334
|
/**
|
|
13931
14335
|
* Adds canonical proof request fields to the broker no-cache property bag.
|
|
13932
14336
|
*/
|
|
13933
|
-
function createPlatformAuthExtraParametersNoCache(
|
|
13934
|
-
if (!
|
|
13935
|
-
return
|
|
14337
|
+
function createPlatformAuthExtraParametersNoCache(tokenType, resourceRequestMethod, resourceRequestUri, dpopNonce) {
|
|
14338
|
+
if (!isProofOfPossessionTokenType(tokenType)) {
|
|
14339
|
+
return undefined;
|
|
13936
14340
|
}
|
|
13937
14341
|
return {
|
|
13938
|
-
...extraParametersNoCache,
|
|
13939
14342
|
...(resourceRequestMethod && {
|
|
13940
14343
|
pop_method: resourceRequestMethod,
|
|
13941
14344
|
}),
|
|
13942
14345
|
...(resourceRequestUri && {
|
|
13943
14346
|
pop_url: resourceRequestUri,
|
|
13944
14347
|
}),
|
|
13945
|
-
...(
|
|
14348
|
+
...(tokenType === PlatformAuthTokenType.DPOP_WITH_PROOF &&
|
|
14349
|
+
dpopNonce && {
|
|
13946
14350
|
pop_nonce: dpopNonce,
|
|
13947
14351
|
}),
|
|
13948
14352
|
};
|
|
@@ -14090,6 +14494,7 @@
|
|
|
14090
14494
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14091
14495
|
* Licensed under the MIT License.
|
|
14092
14496
|
*/
|
|
14497
|
+
const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
|
|
14093
14498
|
class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
14094
14499
|
constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
|
|
14095
14500
|
super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
|
|
@@ -14148,17 +14553,9 @@
|
|
|
14148
14553
|
throw e;
|
|
14149
14554
|
}
|
|
14150
14555
|
// check if the tokens can be retrieved from internal cache
|
|
14556
|
+
let cachedResult;
|
|
14151
14557
|
try {
|
|
14152
|
-
|
|
14153
|
-
// Served from the native internal cache; token did not come directly from the broker
|
|
14154
|
-
nativeATMeasurement.add({
|
|
14155
|
-
isNativeBroker: false,
|
|
14156
|
-
});
|
|
14157
|
-
nativeATMeasurement.end({
|
|
14158
|
-
success: true,
|
|
14159
|
-
fromCache: true,
|
|
14160
|
-
});
|
|
14161
|
-
return result;
|
|
14558
|
+
cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
|
|
14162
14559
|
}
|
|
14163
14560
|
catch (e) {
|
|
14164
14561
|
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
@@ -14169,13 +14566,28 @@
|
|
|
14169
14566
|
nativeATMeasurement.end({
|
|
14170
14567
|
success: false,
|
|
14171
14568
|
});
|
|
14569
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14172
14570
|
throw e;
|
|
14173
14571
|
}
|
|
14174
14572
|
// continue with a native call for any and all errors
|
|
14175
14573
|
this.logger.info("0957j1", this.correlationId);
|
|
14176
14574
|
}
|
|
14575
|
+
if (cachedResult) {
|
|
14576
|
+
// Served from the native internal cache; token did not come directly from the broker
|
|
14577
|
+
nativeATMeasurement.add({
|
|
14578
|
+
isNativeBroker: false,
|
|
14579
|
+
});
|
|
14580
|
+
nativeATMeasurement.end({
|
|
14581
|
+
success: true,
|
|
14582
|
+
fromCache: true,
|
|
14583
|
+
});
|
|
14584
|
+
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
14585
|
+
return cachedResult;
|
|
14586
|
+
}
|
|
14177
14587
|
// dispatch the request to the broker
|
|
14178
14588
|
try {
|
|
14589
|
+
await this.prepareDpopBrokerRequest(nativeRequest);
|
|
14590
|
+
this.addDpopBrokerAttemptTelemetry(nativeRequest);
|
|
14179
14591
|
const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
|
|
14180
14592
|
const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
|
|
14181
14593
|
nativeATMeasurement.end({
|
|
@@ -14193,6 +14605,7 @@
|
|
|
14193
14605
|
success: false,
|
|
14194
14606
|
}, e);
|
|
14195
14607
|
this.setBrokerErrorTelemetry(e);
|
|
14608
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14196
14609
|
throw e;
|
|
14197
14610
|
}
|
|
14198
14611
|
}
|
|
@@ -14227,6 +14640,7 @@
|
|
|
14227
14640
|
scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
|
|
14228
14641
|
account: cachedAccount,
|
|
14229
14642
|
forceRefresh: false,
|
|
14643
|
+
...this.createSilentCacheTokenBindingParameters(request),
|
|
14230
14644
|
resource: request.extraParameters?.resource,
|
|
14231
14645
|
};
|
|
14232
14646
|
// Preserve FMI partition semantics for silent cache filtering.
|
|
@@ -14235,6 +14649,29 @@
|
|
|
14235
14649
|
}
|
|
14236
14650
|
return silentRequest;
|
|
14237
14651
|
}
|
|
14652
|
+
/**
|
|
14653
|
+
* Maps platform-broker token-binding state to silent-cache request fields.
|
|
14654
|
+
* @param request
|
|
14655
|
+
*/
|
|
14656
|
+
createSilentCacheTokenBindingParameters(request) {
|
|
14657
|
+
const authenticationScheme = this.isDpopBrokerRequest(request)
|
|
14658
|
+
? AuthenticationScheme$1.DPOP
|
|
14659
|
+
: request.tokenType;
|
|
14660
|
+
if (authenticationScheme !== AuthenticationScheme$1.DPOP &&
|
|
14661
|
+
authenticationScheme !== AuthenticationScheme$1.POP) {
|
|
14662
|
+
return { authenticationScheme };
|
|
14663
|
+
}
|
|
14664
|
+
return {
|
|
14665
|
+
authenticationScheme,
|
|
14666
|
+
...(authenticationScheme === AuthenticationScheme$1.DPOP &&
|
|
14667
|
+
request.keyId && { dpopJkt: request.keyId }),
|
|
14668
|
+
...(authenticationScheme === AuthenticationScheme$1.POP &&
|
|
14669
|
+
request.signPopToken === false &&
|
|
14670
|
+
request.keyId && { popKid: request.keyId }),
|
|
14671
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
14672
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
14673
|
+
};
|
|
14674
|
+
}
|
|
14238
14675
|
/**
|
|
14239
14676
|
* Fetches the tokens from the cache if un-expired
|
|
14240
14677
|
* @param nativeAccountId
|
|
@@ -14283,10 +14720,22 @@
|
|
|
14283
14720
|
const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
|
|
14284
14721
|
const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
|
|
14285
14722
|
try {
|
|
14286
|
-
await this.
|
|
14723
|
+
await this.prepareDpopBrokerRequest(nativeRequest);
|
|
14724
|
+
this.addDpopBrokerAttemptTelemetry(nativeRequest);
|
|
14725
|
+
const response = await this.platformAuthProvider.sendMessage(nativeRequest);
|
|
14726
|
+
const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
|
|
14727
|
+
if (dpopBrokerOutcome === "L3") {
|
|
14728
|
+
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
14729
|
+
}
|
|
14287
14730
|
}
|
|
14288
14731
|
catch (e) {
|
|
14289
|
-
|
|
14732
|
+
/*
|
|
14733
|
+
* Raw persistent/transient broker errors are retrieved again in
|
|
14734
|
+
* phase two. Availability errors are thrown for controller-managed
|
|
14735
|
+
* web fallback, while translated cancellation, network, and
|
|
14736
|
+
* interaction-required errors are surfaced without being swallowed.
|
|
14737
|
+
*/
|
|
14738
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14290
14739
|
if (e instanceof NativeAuthError) {
|
|
14291
14740
|
const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
|
|
14292
14741
|
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
@@ -14301,6 +14750,16 @@
|
|
|
14301
14750
|
throw e;
|
|
14302
14751
|
}
|
|
14303
14752
|
}
|
|
14753
|
+
else if (this.isDpopBrokerRequest(nativeRequest)) {
|
|
14754
|
+
throw e;
|
|
14755
|
+
}
|
|
14756
|
+
}
|
|
14757
|
+
try {
|
|
14758
|
+
await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
|
|
14759
|
+
}
|
|
14760
|
+
catch (e) {
|
|
14761
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14762
|
+
throw e;
|
|
14304
14763
|
}
|
|
14305
14764
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
|
|
14306
14765
|
...nativeRequest,
|
|
@@ -14315,7 +14774,14 @@
|
|
|
14315
14774
|
? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
|
|
14316
14775
|
: getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
|
|
14317
14776
|
rootMeasurement.end({ success: true });
|
|
14318
|
-
|
|
14777
|
+
try {
|
|
14778
|
+
await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
|
|
14779
|
+
}
|
|
14780
|
+
catch (e) {
|
|
14781
|
+
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
14782
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14783
|
+
throw e;
|
|
14784
|
+
}
|
|
14319
14785
|
}
|
|
14320
14786
|
/**
|
|
14321
14787
|
* If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
|
|
@@ -14348,6 +14814,8 @@
|
|
|
14348
14814
|
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
14349
14815
|
const reqTimestamp = nowSeconds();
|
|
14350
14816
|
try {
|
|
14817
|
+
await this.prepareDpopBrokerRequest(request, true);
|
|
14818
|
+
this.addDpopBrokerAttemptTelemetry(request);
|
|
14351
14819
|
this.logger.verbose("003x5a", this.correlationId);
|
|
14352
14820
|
const response = await this.platformAuthProvider.sendMessage(request);
|
|
14353
14821
|
const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
|
|
@@ -14356,7 +14824,12 @@
|
|
|
14356
14824
|
return authResult;
|
|
14357
14825
|
}
|
|
14358
14826
|
catch (e) {
|
|
14827
|
+
if (e instanceof NativeAuthError) {
|
|
14828
|
+
const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
|
|
14829
|
+
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
14830
|
+
}
|
|
14359
14831
|
this.setBrokerErrorTelemetry(e);
|
|
14832
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(request);
|
|
14360
14833
|
throw e;
|
|
14361
14834
|
}
|
|
14362
14835
|
}
|
|
@@ -14376,6 +14849,7 @@
|
|
|
14376
14849
|
*/
|
|
14377
14850
|
async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
|
|
14378
14851
|
this.logger.trace("1bojln", this.correlationId);
|
|
14852
|
+
const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
|
|
14379
14853
|
// generate identifiers
|
|
14380
14854
|
const idTokenClaims = extractTokenClaims(response.id_token, base64Decode, this.correlationId);
|
|
14381
14855
|
const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
|
|
@@ -14401,10 +14875,17 @@
|
|
|
14401
14875
|
response.expires_in = Number(response.expires_in);
|
|
14402
14876
|
// generate authenticationResult
|
|
14403
14877
|
const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
|
|
14878
|
+
const isL3DpopResponse = dpopBrokerOutcome === "L3";
|
|
14404
14879
|
// cache accounts and tokens in the appropriate storage
|
|
14405
|
-
|
|
14880
|
+
const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
|
|
14881
|
+
(this.isDpopBrokerRequest(request) &&
|
|
14882
|
+
storeInCache?.accessToken === false);
|
|
14883
|
+
if (shouldRemoveGeneratedDpopKey) {
|
|
14884
|
+
await this.resetGeneratedDpopRequestKey(request);
|
|
14885
|
+
}
|
|
14886
|
+
await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims), !isL3DpopResponse);
|
|
14406
14887
|
await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
|
|
14407
|
-
storeInCache);
|
|
14888
|
+
storeInCache, dpopBrokerOutcome);
|
|
14408
14889
|
return result;
|
|
14409
14890
|
}
|
|
14410
14891
|
/**
|
|
@@ -14480,7 +14961,7 @@
|
|
|
14480
14961
|
*/
|
|
14481
14962
|
async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
|
|
14482
14963
|
// Add Native Broker fields to Telemetry
|
|
14483
|
-
const mats = this.addTelemetryFromNativeResponse(response.properties
|
|
14964
|
+
const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
|
|
14484
14965
|
// If scopes not returned in server response, use request scopes
|
|
14485
14966
|
const responseScopes = this.generateScopes(request.scope, response.scope);
|
|
14486
14967
|
const accountProperties = response.account.properties || {};
|
|
@@ -14506,9 +14987,17 @@
|
|
|
14506
14987
|
}
|
|
14507
14988
|
// generate PoP token as needed
|
|
14508
14989
|
const responseAccessToken = await this.generatePopAccessToken(response, request);
|
|
14509
|
-
const
|
|
14510
|
-
|
|
14511
|
-
|
|
14990
|
+
const isDpopRequest = this.isDpopBrokerRequest(request);
|
|
14991
|
+
let tokenType = AuthenticationScheme$1.BEARER;
|
|
14992
|
+
if (isDpopRequest) {
|
|
14993
|
+
tokenType = AuthenticationScheme$1.DPOP;
|
|
14994
|
+
}
|
|
14995
|
+
else if (request.tokenType === AuthenticationScheme$1.POP) {
|
|
14996
|
+
tokenType = AuthenticationScheme$1.POP;
|
|
14997
|
+
}
|
|
14998
|
+
const dpopProof = isDpopRequest
|
|
14999
|
+
? await this.generateDpopProof(response, request)
|
|
15000
|
+
: undefined;
|
|
14512
15001
|
const result = {
|
|
14513
15002
|
authority: authority,
|
|
14514
15003
|
uniqueId: uid,
|
|
@@ -14522,6 +15011,7 @@
|
|
|
14522
15011
|
// Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
|
|
14523
15012
|
expiresOn: toDateFromSeconds(reqTimestamp + response.expires_in),
|
|
14524
15013
|
tokenType: tokenType,
|
|
15014
|
+
dpopProof,
|
|
14525
15015
|
correlationId: this.correlationId,
|
|
14526
15016
|
state: response.state,
|
|
14527
15017
|
fromPlatformBroker: true,
|
|
@@ -14535,11 +15025,13 @@
|
|
|
14535
15025
|
* cache the account entity in browser storage
|
|
14536
15026
|
* @param accountEntity
|
|
14537
15027
|
*/
|
|
14538
|
-
async cacheAccount(accountEntity, kmsi) {
|
|
15028
|
+
async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
|
|
14539
15029
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
14540
15030
|
await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
|
|
14541
15031
|
// Remove any existing cached tokens for this account in browser storage
|
|
14542
|
-
|
|
15032
|
+
if (clearExistingTokens) {
|
|
15033
|
+
this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
|
|
15034
|
+
}
|
|
14543
15035
|
}
|
|
14544
15036
|
/**
|
|
14545
15037
|
* Stores the access_token and id_token in inmemory storage
|
|
@@ -14551,29 +15043,35 @@
|
|
|
14551
15043
|
* @param tenantId
|
|
14552
15044
|
* @param reqTimestamp
|
|
14553
15045
|
*/
|
|
14554
|
-
async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
|
|
15046
|
+
async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
|
|
14555
15047
|
const cachedIdToken = createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
|
|
14556
|
-
//
|
|
14557
|
-
|
|
14558
|
-
|
|
14559
|
-
|
|
14560
|
-
|
|
14561
|
-
|
|
15048
|
+
// save idtoken credential in configured browser storage
|
|
15049
|
+
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
15050
|
+
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
15051
|
+
}
|
|
15052
|
+
if (dpopBrokerOutcome === "L3") {
|
|
15053
|
+
return;
|
|
15054
|
+
}
|
|
15055
|
+
if (storeInCache?.accessToken === false) {
|
|
15056
|
+
return;
|
|
15057
|
+
}
|
|
15058
|
+
// cache accessToken in inmemory storage
|
|
15059
|
+
const expiresIn = request.tokenType === AuthenticationScheme$1.POP
|
|
15060
|
+
? SHR_NONCE_VALIDITY
|
|
15061
|
+
: (typeof response.expires_in === "string"
|
|
15062
|
+
? parseInt(response.expires_in, 10)
|
|
15063
|
+
: response.expires_in) || 0;
|
|
14562
15064
|
const tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
14563
15065
|
const responseScopes = this.generateScopes(response.scope, request.scope);
|
|
14564
15066
|
const additionalCacheKeyComponents = request.attributeTokens
|
|
14565
|
-
? {
|
|
14566
|
-
attribute_tokens: request.attributeTokens,
|
|
14567
|
-
}
|
|
15067
|
+
? { attribute_tokens: request.attributeTokens }
|
|
14568
15068
|
: undefined;
|
|
14569
|
-
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined,
|
|
15069
|
+
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
|
|
15070
|
+
? AuthenticationScheme$1.DPOP
|
|
15071
|
+
: request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
|
|
14570
15072
|
if (request.extraParameters?.resource) {
|
|
14571
15073
|
cachedAccessToken.resource = request.extraParameters.resource;
|
|
14572
15074
|
}
|
|
14573
|
-
// save idtoken credential in configured browser storage
|
|
14574
|
-
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
14575
|
-
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
14576
|
-
}
|
|
14577
15075
|
// save access token credential in memory storage
|
|
14578
15076
|
const nativeCacheRecord = {
|
|
14579
15077
|
accessToken: cachedAccessToken,
|
|
@@ -14650,11 +15148,7 @@
|
|
|
14650
15148
|
const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
|
|
14651
15149
|
? undefined
|
|
14652
15150
|
: this.config.auth.clientCapabilities;
|
|
14653
|
-
|
|
14654
|
-
* scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
|
|
14655
|
-
* attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
|
|
14656
|
-
*/
|
|
14657
|
-
const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
|
|
15151
|
+
const { scopes, claims, dpopNonce } = request;
|
|
14658
15152
|
const scopeSet = new ScopeSet([...(scopes || []), ...OIDC_DEFAULT_SCOPES$1], this.correlationId);
|
|
14659
15153
|
const mergedClaims = buildMergedClaims$1(claims, configClaims?.length ? configClaims : undefined);
|
|
14660
15154
|
const hasAttributeTokens = !!request.attributeTokens?.length;
|
|
@@ -14678,57 +15172,391 @@
|
|
|
14678
15172
|
loginHint: request.loginHint,
|
|
14679
15173
|
extraParameters: {
|
|
14680
15174
|
...request.extraParameters,
|
|
14681
|
-
|
|
15175
|
+
// Native broker resource is set for MCP scenarios.
|
|
15176
|
+
...(request.resource && { resource: request.resource }),
|
|
14682
15177
|
},
|
|
14683
15178
|
extendedExpiryToken: false,
|
|
14684
15179
|
keyId: request.popKid,
|
|
14685
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
14686
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
14687
|
-
shrClaims: request.shrClaims,
|
|
14688
|
-
shrNonce: request.shrNonce,
|
|
14689
|
-
extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
|
|
14690
15180
|
};
|
|
14691
15181
|
if (hasAttributeTokens) {
|
|
14692
15182
|
validatedRequest.attributeTokens =
|
|
14693
15183
|
serializeAttributeTokens(request.attributeTokens);
|
|
14694
15184
|
}
|
|
14695
|
-
// Check for PoP token requests: signPopToken should only be set to true if popKid is not set
|
|
14696
|
-
if (validatedRequest.signPopToken && !!request.popKid) {
|
|
14697
|
-
throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
|
|
14698
|
-
}
|
|
14699
15185
|
this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
|
|
14700
15186
|
validatedRequest.extraParameters =
|
|
14701
15187
|
validatedRequest.extraParameters || {};
|
|
14702
15188
|
validatedRequest.extraParameters.telemetry =
|
|
14703
15189
|
PlatformAuthConstants.MATS_TELEMETRY;
|
|
14704
15190
|
if (request.authenticationScheme === AuthenticationScheme$1.POP) {
|
|
14705
|
-
// add POP request type
|
|
14706
15191
|
const shrParameters = {
|
|
14707
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
14708
15192
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
15193
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
14709
15194
|
shrClaims: request.shrClaims,
|
|
14710
15195
|
shrNonce: request.shrNonce,
|
|
14711
15196
|
correlationId: this.correlationId,
|
|
14712
15197
|
};
|
|
14713
15198
|
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
|
|
14714
|
-
// generate reqCnf if not provided in the request
|
|
14715
|
-
let reqCnfData;
|
|
14716
15199
|
if (!validatedRequest.keyId) {
|
|
14717
15200
|
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
|
|
14718
|
-
|
|
15201
|
+
validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
|
|
14719
15202
|
validatedRequest.keyId = generatedReqCnfData.kid;
|
|
14720
15203
|
validatedRequest.signPopToken = true;
|
|
14721
15204
|
}
|
|
14722
15205
|
else {
|
|
14723
|
-
|
|
15206
|
+
validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
|
|
14724
15207
|
validatedRequest.signPopToken = false;
|
|
14725
15208
|
}
|
|
14726
|
-
|
|
14727
|
-
|
|
15209
|
+
validatedRequest.resourceRequestMethod =
|
|
15210
|
+
request.resourceRequestMethod;
|
|
15211
|
+
validatedRequest.resourceRequestUri = request.resourceRequestUri;
|
|
15212
|
+
validatedRequest.shrClaims = request.shrClaims;
|
|
15213
|
+
validatedRequest.shrNonce = request.shrNonce;
|
|
14728
15214
|
}
|
|
15215
|
+
else if (request.authenticationScheme === AuthenticationScheme$1.DPOP) {
|
|
15216
|
+
Object.assign(validatedRequest, this.createDpopRequestParameters(request));
|
|
15217
|
+
}
|
|
15218
|
+
validatedRequest.extraParametersNoCache =
|
|
15219
|
+
createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
|
|
14729
15220
|
this.addRequestSKUs(validatedRequest);
|
|
14730
15221
|
return validatedRequest;
|
|
14731
15222
|
}
|
|
15223
|
+
/**
|
|
15224
|
+
* Creates and validates the broker-specific parameters for a DPoP request.
|
|
15225
|
+
* @param request - Developer-provided token request.
|
|
15226
|
+
* @returns Broker parameters for a DPoP token and resource proof.
|
|
15227
|
+
*/
|
|
15228
|
+
createDpopRequestParameters(request) {
|
|
15229
|
+
if (request.popKid) {
|
|
15230
|
+
throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
|
|
15231
|
+
}
|
|
15232
|
+
if (!request.resourceRequestMethod?.trim() ||
|
|
15233
|
+
!request.resourceRequestUri?.trim()) {
|
|
15234
|
+
throw createClientConfigurationError(dpopMissingResourceContext, this.correlationId);
|
|
15235
|
+
}
|
|
15236
|
+
const resourceContext = normalizeDpopResourceRequestContext({
|
|
15237
|
+
htm: request.resourceRequestMethod,
|
|
15238
|
+
htu: request.resourceRequestUri,
|
|
15239
|
+
}, this.correlationId);
|
|
15240
|
+
return {
|
|
15241
|
+
tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
|
|
15242
|
+
preferBinding: PlatformAuthBindingPreference.ATTESTED,
|
|
15243
|
+
keyId: request.dpopJkt,
|
|
15244
|
+
resourceRequestMethod: resourceContext.htm,
|
|
15245
|
+
resourceRequestUri: resourceContext.htu,
|
|
15246
|
+
};
|
|
15247
|
+
}
|
|
15248
|
+
/**
|
|
15249
|
+
* Provisions the local key and confirmation data for a DPoP broker request.
|
|
15250
|
+
* @param request - Broker request to prepare.
|
|
15251
|
+
* @param reuseExistingKey - Whether a complete existing key binding may be reused.
|
|
15252
|
+
*/
|
|
15253
|
+
async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
|
|
15254
|
+
if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
|
|
15255
|
+
return;
|
|
15256
|
+
}
|
|
15257
|
+
/*
|
|
15258
|
+
* Phase one clears both fields after an L3 response or non-fatal broker
|
|
15259
|
+
* error. In that case phase two must provision a replacement. If either
|
|
15260
|
+
* field remains, treat it as a retained binding and validate it fully.
|
|
15261
|
+
*/
|
|
15262
|
+
if (reuseExistingKey && (request.keyId || request.reqCnf)) {
|
|
15263
|
+
if (!request.keyId || !request.reqCnf) {
|
|
15264
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
|
|
15265
|
+
}
|
|
15266
|
+
const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
|
|
15267
|
+
if (request.reqCnf !== expectedReqCnf) {
|
|
15268
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
|
|
15269
|
+
}
|
|
15270
|
+
const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
|
|
15271
|
+
? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
|
|
15272
|
+
: await this.tokenBindingKeyManager
|
|
15273
|
+
.getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
|
|
15274
|
+
.then(() => true, () => false);
|
|
15275
|
+
if (!hasKey) {
|
|
15276
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
|
|
15277
|
+
}
|
|
15278
|
+
return;
|
|
15279
|
+
}
|
|
15280
|
+
if (request.reqCnf) {
|
|
15281
|
+
throw createAuthError(unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
|
|
15282
|
+
}
|
|
15283
|
+
if (!request.keyId) {
|
|
15284
|
+
request.keyId =
|
|
15285
|
+
await this.tokenBindingKeyManager.provisionTokenBindingKey({
|
|
15286
|
+
tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
|
|
15287
|
+
tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
|
|
15288
|
+
correlationId: this.correlationId,
|
|
15289
|
+
});
|
|
15290
|
+
}
|
|
15291
|
+
request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
|
|
15292
|
+
}
|
|
15293
|
+
/**
|
|
15294
|
+
* Creates the confirmation claim for an MSAL-owned broker DPoP key.
|
|
15295
|
+
* @param keyId - Browser-managed DPoP key identifier.
|
|
15296
|
+
* @returns Encoded broker confirmation claim.
|
|
15297
|
+
*/
|
|
15298
|
+
createDpopBrokerReqCnf(keyId) {
|
|
15299
|
+
return this.browserCrypto.base64UrlEncode(JSON.stringify({
|
|
15300
|
+
kid: keyId,
|
|
15301
|
+
xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
|
|
15302
|
+
}));
|
|
15303
|
+
}
|
|
15304
|
+
/**
|
|
15305
|
+
* Ensures an owned DPoP key can survive redirect navigation before the
|
|
15306
|
+
* request metadata is persisted for phase two.
|
|
15307
|
+
*/
|
|
15308
|
+
async ensureRedirectDpopKeyIsPersisted(request) {
|
|
15309
|
+
if (!this.isDpopBrokerRequest(request) || !request.keyId) {
|
|
15310
|
+
return;
|
|
15311
|
+
}
|
|
15312
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
|
|
15313
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
|
|
15314
|
+
}
|
|
15315
|
+
}
|
|
15316
|
+
/**
|
|
15317
|
+
* Validates and normalizes the DPoP binding outcome returned by the broker.
|
|
15318
|
+
* @param response - Broker response to validate.
|
|
15319
|
+
* @param request - Broker request associated with the response.
|
|
15320
|
+
* @returns The validated DPoP binding level, or `none` for non-DPoP requests.
|
|
15321
|
+
*/
|
|
15322
|
+
validateDpopBrokerOutcome(response, request) {
|
|
15323
|
+
const isDpopRequest = this.isDpopBrokerRequest(request);
|
|
15324
|
+
const normalizedResponse = this.normalizeDpopBrokerResponse(response);
|
|
15325
|
+
const normalizedRequestTokenType = request.tokenType
|
|
15326
|
+
?.trim()
|
|
15327
|
+
.toLowerCase();
|
|
15328
|
+
const bindingPreferenceSent = request.bindingPreferenceSent ??
|
|
15329
|
+
request.preferBinding !== undefined;
|
|
15330
|
+
const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
|
|
15331
|
+
normalizedResponse.proof !== undefined ||
|
|
15332
|
+
normalizedResponse.hasBindingAttested;
|
|
15333
|
+
if (!isDpopRequest) {
|
|
15334
|
+
if (hasDpopResponse) {
|
|
15335
|
+
this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
|
|
15336
|
+
}
|
|
15337
|
+
return "none";
|
|
15338
|
+
}
|
|
15339
|
+
if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
|
|
15340
|
+
this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
|
|
15341
|
+
}
|
|
15342
|
+
this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
|
|
15343
|
+
if (normalizedResponse.tokenType ===
|
|
15344
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
|
|
15345
|
+
return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
|
|
15346
|
+
}
|
|
15347
|
+
return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
|
|
15348
|
+
}
|
|
15349
|
+
/**
|
|
15350
|
+
* Normalizes the canonical DPoP fields returned under response properties.
|
|
15351
|
+
*/
|
|
15352
|
+
normalizeDpopBrokerResponse(response) {
|
|
15353
|
+
const responseProperties = response.properties;
|
|
15354
|
+
const rawTokenType = responseProperties?.token_type;
|
|
15355
|
+
const tokenType = typeof rawTokenType === "string"
|
|
15356
|
+
? rawTokenType.trim().toLowerCase()
|
|
15357
|
+
: undefined;
|
|
15358
|
+
const rawBindingAttested = responseProperties?.binding_attested;
|
|
15359
|
+
let bindingAttested;
|
|
15360
|
+
if (typeof rawBindingAttested === "string") {
|
|
15361
|
+
const normalizedBindingAttested = rawBindingAttested
|
|
15362
|
+
.trim()
|
|
15363
|
+
.toLowerCase();
|
|
15364
|
+
if (normalizedBindingAttested === "true") {
|
|
15365
|
+
bindingAttested = true;
|
|
15366
|
+
}
|
|
15367
|
+
else if (normalizedBindingAttested === "false") {
|
|
15368
|
+
bindingAttested = false;
|
|
15369
|
+
}
|
|
15370
|
+
}
|
|
15371
|
+
return {
|
|
15372
|
+
tokenType,
|
|
15373
|
+
proof: responseProperties?.DPoP,
|
|
15374
|
+
bindingAttested,
|
|
15375
|
+
hasBindingAttested: rawBindingAttested !== undefined,
|
|
15376
|
+
hasMalformedBindingAttested: rawBindingAttested !== undefined &&
|
|
15377
|
+
bindingAttested === undefined,
|
|
15378
|
+
};
|
|
15379
|
+
}
|
|
15380
|
+
/**
|
|
15381
|
+
* Validates normalized fields shared by L1 and L3 broker DPoP responses.
|
|
15382
|
+
*/
|
|
15383
|
+
validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
|
|
15384
|
+
if (normalizedResponse.hasMalformedBindingAttested) {
|
|
15385
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
|
|
15386
|
+
}
|
|
15387
|
+
if (bindingPreferenceSent &&
|
|
15388
|
+
normalizedResponse.bindingAttested === undefined) {
|
|
15389
|
+
this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
|
|
15390
|
+
}
|
|
15391
|
+
}
|
|
15392
|
+
/**
|
|
15393
|
+
* Validates a broker-returned L3 DPoP proof outcome.
|
|
15394
|
+
*/
|
|
15395
|
+
validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
|
|
15396
|
+
const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
|
|
15397
|
+
if (typeof normalizedResponse.proof !== "string" ||
|
|
15398
|
+
normalizedResponse.proof.trim().length === 0) {
|
|
15399
|
+
this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
|
|
15400
|
+
}
|
|
15401
|
+
if (normalizedResponse.bindingAttested !== true) {
|
|
15402
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
|
|
15403
|
+
}
|
|
15404
|
+
if (normalizedRequestTokenType !== dpopWithProofTokenType ||
|
|
15405
|
+
normalizedResponse.tokenType !== dpopWithProofTokenType) {
|
|
15406
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
|
|
15407
|
+
}
|
|
15408
|
+
this.performanceClient.addFields({
|
|
15409
|
+
"ext.brokerDpopOutcome": "l3",
|
|
15410
|
+
"ext.brokerDpopBindingLevel": "L3",
|
|
15411
|
+
}, this.correlationId);
|
|
15412
|
+
return "L3";
|
|
15413
|
+
}
|
|
15414
|
+
/**
|
|
15415
|
+
* Validates an L1 DPoP outcome that MSAL will sign with its local key.
|
|
15416
|
+
*/
|
|
15417
|
+
validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
|
|
15418
|
+
if (normalizedResponse.proof !== undefined) {
|
|
15419
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
|
|
15420
|
+
}
|
|
15421
|
+
if (normalizedRequestTokenType !==
|
|
15422
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
|
|
15423
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
|
|
15424
|
+
}
|
|
15425
|
+
if (normalizedResponse.bindingAttested !== false &&
|
|
15426
|
+
!(!bindingPreferenceSent &&
|
|
15427
|
+
normalizedResponse.bindingAttested === undefined)) {
|
|
15428
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
|
|
15429
|
+
}
|
|
15430
|
+
if (!request.reqCnf || !request.keyId) {
|
|
15431
|
+
this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
|
|
15432
|
+
}
|
|
15433
|
+
this.performanceClient.addFields({
|
|
15434
|
+
"ext.brokerDpopOutcome": "l1",
|
|
15435
|
+
"ext.brokerDpopBindingLevel": "L1",
|
|
15436
|
+
}, this.correlationId);
|
|
15437
|
+
return "L1";
|
|
15438
|
+
}
|
|
15439
|
+
/**
|
|
15440
|
+
* Emits bounded failure telemetry and rejects an invalid DPoP response.
|
|
15441
|
+
*/
|
|
15442
|
+
throwInvalidDpopResponse(failureReason, message) {
|
|
15443
|
+
this.performanceClient.addFields({
|
|
15444
|
+
"ext.brokerDpopOutcome": "invalid_response",
|
|
15445
|
+
"ext.brokerDpopFailureReason": failureReason,
|
|
15446
|
+
}, this.correlationId);
|
|
15447
|
+
throw createAuthError(unexpectedError, this.correlationId, message);
|
|
15448
|
+
}
|
|
15449
|
+
/**
|
|
15450
|
+
* Returns the broker proof or signs an L1 resource proof with the local key.
|
|
15451
|
+
* @param response - Broker response containing the access token and optional proof.
|
|
15452
|
+
* @param request - Broker request containing the proof context and local key.
|
|
15453
|
+
* @returns The resource proof for the broker access token.
|
|
15454
|
+
*/
|
|
15455
|
+
async generateDpopProof(response, request) {
|
|
15456
|
+
const brokerProof = response.properties?.DPoP;
|
|
15457
|
+
if (brokerProof !== undefined) {
|
|
15458
|
+
return brokerProof;
|
|
15459
|
+
}
|
|
15460
|
+
const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
|
|
15461
|
+
return dpopProofGenerator.generateResourceProof({
|
|
15462
|
+
htu: request.resourceRequestUri,
|
|
15463
|
+
htm: request.resourceRequestMethod,
|
|
15464
|
+
accessToken: response.access_token,
|
|
15465
|
+
nonce: request.extraParametersNoCache?.pop_nonce,
|
|
15466
|
+
}, request.keyId, this.correlationId);
|
|
15467
|
+
}
|
|
15468
|
+
/**
|
|
15469
|
+
* Removes a generated DPoP request key and clears its request metadata.
|
|
15470
|
+
* @param request - Broker request whose generated key should be removed.
|
|
15471
|
+
*/
|
|
15472
|
+
async resetGeneratedDpopRequestKey(request) {
|
|
15473
|
+
if (!this.isDpopBrokerRequest(request) || !request.keyId) {
|
|
15474
|
+
return;
|
|
15475
|
+
}
|
|
15476
|
+
const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
|
|
15477
|
+
this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
|
|
15478
|
+
try {
|
|
15479
|
+
if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
|
|
15480
|
+
throw createAuthError(unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
|
|
15481
|
+
}
|
|
15482
|
+
this.performanceClient.addFields({
|
|
15483
|
+
"ext.brokerDpopKeyCleanupOutcome": "succeeded",
|
|
15484
|
+
}, this.correlationId);
|
|
15485
|
+
cleanupMeasurement.end({ success: true });
|
|
15486
|
+
request.keyId = undefined;
|
|
15487
|
+
request.reqCnf = undefined;
|
|
15488
|
+
}
|
|
15489
|
+
catch (error) {
|
|
15490
|
+
this.performanceClient.addFields({
|
|
15491
|
+
"ext.brokerDpopKeyCleanupOutcome": "failed",
|
|
15492
|
+
}, this.correlationId);
|
|
15493
|
+
this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
|
|
15494
|
+
cleanupMeasurement.end({ success: false }, error);
|
|
15495
|
+
throw error;
|
|
15496
|
+
}
|
|
15497
|
+
}
|
|
15498
|
+
/**
|
|
15499
|
+
* Attempts to remove a generated DPoP request key without replacing an
|
|
15500
|
+
* existing operation error with a cleanup failure.
|
|
15501
|
+
* @param request - Broker request whose generated key should be removed.
|
|
15502
|
+
*/
|
|
15503
|
+
async resetGeneratedDpopRequestKeyBestEffort(request) {
|
|
15504
|
+
try {
|
|
15505
|
+
await this.resetGeneratedDpopRequestKey(request);
|
|
15506
|
+
}
|
|
15507
|
+
catch {
|
|
15508
|
+
this.logger.error("1kxxak", this.correlationId);
|
|
15509
|
+
this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
|
|
15510
|
+
request.keyId = undefined;
|
|
15511
|
+
request.reqCnf = undefined;
|
|
15512
|
+
}
|
|
15513
|
+
}
|
|
15514
|
+
/**
|
|
15515
|
+
* Records that a DPoP request is about to be dispatched to the platform broker.
|
|
15516
|
+
* @param request - Broker request about to cross the provider boundary.
|
|
15517
|
+
*/
|
|
15518
|
+
addDpopBrokerAttemptTelemetry(request) {
|
|
15519
|
+
if (!this.isDpopBrokerRequest(request)) {
|
|
15520
|
+
return;
|
|
15521
|
+
}
|
|
15522
|
+
this.performanceClient.addFields({
|
|
15523
|
+
"ext.brokerDpopAttempted": 1,
|
|
15524
|
+
}, this.correlationId);
|
|
15525
|
+
}
|
|
15526
|
+
/**
|
|
15527
|
+
* Determines whether a request uses the DPoP broker protocol.
|
|
15528
|
+
* @param request - Broker request to inspect.
|
|
15529
|
+
* @returns Whether the request uses a DPoP token type.
|
|
15530
|
+
*/
|
|
15531
|
+
isDpopBrokerRequest(request) {
|
|
15532
|
+
return this.isDpopBrokerTokenType(request.tokenType);
|
|
15533
|
+
}
|
|
15534
|
+
/**
|
|
15535
|
+
* Determines whether a token type represents a DPoP broker request.
|
|
15536
|
+
* @param tokenType - Token type to inspect.
|
|
15537
|
+
* @returns Whether the token type is a supported DPoP broker token type.
|
|
15538
|
+
*/
|
|
15539
|
+
isDpopBrokerTokenType(tokenType) {
|
|
15540
|
+
const normalizedTokenType = tokenType?.trim().toLowerCase();
|
|
15541
|
+
return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
|
|
15542
|
+
normalizedTokenType ===
|
|
15543
|
+
AuthenticationScheme$1.DPOP.toLowerCase());
|
|
15544
|
+
}
|
|
15545
|
+
/**
|
|
15546
|
+
* Removes a DPoP key while reporting cleanup failures.
|
|
15547
|
+
* @param keyId - Identifier of the DPoP key to remove.
|
|
15548
|
+
* @returns Whether the key was removed successfully.
|
|
15549
|
+
*/
|
|
15550
|
+
async removeDpopKey(keyId) {
|
|
15551
|
+
try {
|
|
15552
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
|
|
15553
|
+
return true;
|
|
15554
|
+
}
|
|
15555
|
+
catch {
|
|
15556
|
+
this.logger.error("1w60e4", this.correlationId);
|
|
15557
|
+
return false;
|
|
15558
|
+
}
|
|
15559
|
+
}
|
|
14732
15560
|
async getCanonicalAuthority(request) {
|
|
14733
15561
|
const requestAuthority = request.authority || this.config.auth.authority;
|
|
14734
15562
|
const { azureCloudOptions, account } = request;
|
|
@@ -14767,29 +15595,28 @@
|
|
|
14767
15595
|
}
|
|
14768
15596
|
}
|
|
14769
15597
|
/**
|
|
14770
|
-
* Handles extra broker request parameters
|
|
14771
|
-
* @param request
|
|
14772
|
-
* @
|
|
15598
|
+
* Handles extra broker request parameters.
|
|
15599
|
+
* @param request - Platform broker request.
|
|
15600
|
+
* @param embeddedClientId - Embedded application client identifier.
|
|
14773
15601
|
*/
|
|
14774
15602
|
handleExtraBrokerParams(request, embeddedClientId) {
|
|
14775
|
-
const
|
|
14776
|
-
|
|
14777
|
-
|
|
14778
|
-
|
|
15603
|
+
const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
|
|
15604
|
+
const hasExtraBrokerParams = hasOwnParameter(BROKER_CLIENT_ID) &&
|
|
15605
|
+
hasOwnParameter(BROKER_REDIRECT_URI) &&
|
|
15606
|
+
hasOwnParameter(CLIENT_ID);
|
|
14779
15607
|
if (!embeddedClientId && !hasExtraBrokerParams) {
|
|
14780
15608
|
return;
|
|
14781
15609
|
}
|
|
14782
|
-
|
|
14783
|
-
const
|
|
15610
|
+
const childRedirectUri = request.redirectUri;
|
|
15611
|
+
const childClientId = embeddedClientId ||
|
|
15612
|
+
request.extraParameters?.[CLIENT_ID] ||
|
|
15613
|
+
"";
|
|
14784
15614
|
if (embeddedClientId) {
|
|
14785
15615
|
request.redirectUri = this.config.auth.redirectUri;
|
|
14786
|
-
child_client_id = embeddedClientId;
|
|
14787
15616
|
}
|
|
14788
15617
|
else if (request.extraParameters) {
|
|
14789
15618
|
request.redirectUri =
|
|
14790
15619
|
request.extraParameters[BROKER_REDIRECT_URI];
|
|
14791
|
-
child_client_id =
|
|
14792
|
-
request.extraParameters[CLIENT_ID];
|
|
14793
15620
|
}
|
|
14794
15621
|
const {
|
|
14795
15622
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -14800,15 +15627,20 @@
|
|
|
14800
15627
|
[CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
|
|
14801
15628
|
request.extraParameters = {
|
|
14802
15629
|
...remainingExtraParameters,
|
|
14803
|
-
child_client_id,
|
|
14804
|
-
child_redirect_uri,
|
|
15630
|
+
child_client_id: childClientId,
|
|
15631
|
+
child_redirect_uri: childRedirectUri,
|
|
14805
15632
|
};
|
|
14806
15633
|
this.performanceClient?.addFields({
|
|
14807
|
-
embeddedClientId:
|
|
14808
|
-
embeddedRedirectUri:
|
|
15634
|
+
embeddedClientId: childClientId,
|
|
15635
|
+
embeddedRedirectUri: childRedirectUri,
|
|
14809
15636
|
}, this.correlationId);
|
|
14810
15637
|
}
|
|
14811
|
-
}
|
|
15638
|
+
}
|
|
15639
|
+
/**
|
|
15640
|
+
* Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
|
|
15641
|
+
* This does not constrain the binding selected by the platform broker.
|
|
15642
|
+
*/
|
|
15643
|
+
PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
|
|
14812
15644
|
|
|
14813
15645
|
/*
|
|
14814
15646
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -14880,7 +15712,16 @@
|
|
|
14880
15712
|
* @returns
|
|
14881
15713
|
*/
|
|
14882
15714
|
async function getStandardParameters(config, authority, request, logger, performanceClient) {
|
|
14883
|
-
const parameters = getStandardAuthorizeRequestParameters({ ...config.auth, authority: authority },
|
|
15715
|
+
const parameters = getStandardAuthorizeRequestParameters({ ...config.auth, authority: authority }, {
|
|
15716
|
+
...request,
|
|
15717
|
+
/*
|
|
15718
|
+
* Computed here rather than per flow so every authorize request
|
|
15719
|
+
* carries it — GET, POST and EAR, interactive and silent alike.
|
|
15720
|
+
* A request may assert it instead when the topology, rather than
|
|
15721
|
+
* the current window, is what makes the popup unreachable.
|
|
15722
|
+
*/
|
|
15723
|
+
popupOriginCheckDone: request.popupOriginCheckDone ?? computePocd(config) === 1,
|
|
15724
|
+
}, logger, performanceClient);
|
|
14884
15725
|
addLibraryInfo(parameters, {
|
|
14885
15726
|
sku: BrowserConstants.MSAL_SKU,
|
|
14886
15727
|
version: version,
|
|
@@ -14905,6 +15746,7 @@
|
|
|
14905
15746
|
}
|
|
14906
15747
|
}
|
|
14907
15748
|
if (request.authenticationScheme === AuthenticationScheme$1.DPOP &&
|
|
15749
|
+
!request.platformBroker &&
|
|
14908
15750
|
request.dpopJkt) {
|
|
14909
15751
|
parameters.set(DPOP_JKT, request.dpopJkt);
|
|
14910
15752
|
}
|
|
@@ -14934,6 +15776,15 @@
|
|
|
14934
15776
|
});
|
|
14935
15777
|
return getAuthorizeUrl(authority, parameters);
|
|
14936
15778
|
}
|
|
15779
|
+
function getAuthorizeFormAction(authority, request, parameters) {
|
|
15780
|
+
const queryParams = new Map();
|
|
15781
|
+
addExtraParameters(queryParams, request.extraQueryParameters || {});
|
|
15782
|
+
if (parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
|
|
15783
|
+
queryParams.delete(POPUP_ORIGIN_CHECK_DONE);
|
|
15784
|
+
}
|
|
15785
|
+
addCorrelationId(queryParams, request.correlationId);
|
|
15786
|
+
return getAuthorizeUrl(authority, queryParams);
|
|
15787
|
+
}
|
|
14937
15788
|
/**
|
|
14938
15789
|
* Builds the action URL + POST-body fields for the EAR /authorize form.
|
|
14939
15790
|
*/
|
|
@@ -14949,11 +15800,7 @@
|
|
|
14949
15800
|
addExtraParameters(parameters, {
|
|
14950
15801
|
...request.extraParameters,
|
|
14951
15802
|
});
|
|
14952
|
-
const
|
|
14953
|
-
addExtraParameters(queryParams, request.extraQueryParameters || {});
|
|
14954
|
-
// Add correlationId to query params so gateway can propagate it to IDPs
|
|
14955
|
-
addCorrelationId(queryParams, request.correlationId);
|
|
14956
|
-
const action = getAuthorizeUrl(authority, queryParams);
|
|
15803
|
+
const action = getAuthorizeFormAction(authority, request, parameters);
|
|
14957
15804
|
return { action, fields: Object.fromEntries(parameters) };
|
|
14958
15805
|
}
|
|
14959
15806
|
/**
|
|
@@ -14974,12 +15821,7 @@
|
|
|
14974
15821
|
addExtraParameters(parameters, {
|
|
14975
15822
|
...request.extraParameters,
|
|
14976
15823
|
});
|
|
14977
|
-
|
|
14978
|
-
const queryParams = new Map();
|
|
14979
|
-
addExtraParameters(queryParams, request.extraQueryParameters || {});
|
|
14980
|
-
// Add correlationId to query params so gateway can propagate it to IDPs
|
|
14981
|
-
addCorrelationId(queryParams, request.correlationId);
|
|
14982
|
-
const action = getAuthorizeUrl(authority, queryParams);
|
|
15824
|
+
const action = getAuthorizeFormAction(authority, request, parameters);
|
|
14983
15825
|
return { action, fields: Object.fromEntries(parameters) };
|
|
14984
15826
|
}
|
|
14985
15827
|
/**
|
|
@@ -15028,19 +15870,25 @@
|
|
|
15028
15870
|
* @param nativeMessageHandler
|
|
15029
15871
|
* @returns
|
|
15030
15872
|
*/
|
|
15031
|
-
async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
15873
|
+
async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
15032
15874
|
logger.verbose("11qcow", request.correlationId);
|
|
15033
15875
|
if (!platformAuthProvider) {
|
|
15034
15876
|
throw createBrowserAuthError(nativeConnectionNotEstablished, request.correlationId);
|
|
15035
15877
|
}
|
|
15036
15878
|
const browserCrypto = new CryptoOps(logger, performanceClient);
|
|
15037
|
-
const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId);
|
|
15879
|
+
const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
|
|
15038
15880
|
const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
|
|
15039
|
-
|
|
15040
|
-
|
|
15041
|
-
|
|
15042
|
-
|
|
15043
|
-
|
|
15881
|
+
try {
|
|
15882
|
+
return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
|
|
15883
|
+
...request,
|
|
15884
|
+
state: userRequestState,
|
|
15885
|
+
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
15886
|
+
});
|
|
15887
|
+
}
|
|
15888
|
+
catch (e) {
|
|
15889
|
+
await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
|
|
15890
|
+
throw e;
|
|
15891
|
+
}
|
|
15044
15892
|
}
|
|
15045
15893
|
/**
|
|
15046
15894
|
* Response handler when server returns code on the /authorize request
|
|
@@ -15053,13 +15901,13 @@
|
|
|
15053
15901
|
* @param performanceClient
|
|
15054
15902
|
* @returns
|
|
15055
15903
|
*/
|
|
15056
|
-
async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
15904
|
+
async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
15057
15905
|
// Remove throttle if it exists
|
|
15058
15906
|
ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
|
|
15059
15907
|
// Instrument clientdata telemetry fields from the authorize response
|
|
15060
15908
|
instrumentClientData(response, request.correlationId, performanceClient);
|
|
15061
15909
|
if (response.accountId) {
|
|
15062
|
-
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
|
|
15910
|
+
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
|
|
15063
15911
|
}
|
|
15064
15912
|
const authCodeRequest = {
|
|
15065
15913
|
...request,
|
|
@@ -15087,7 +15935,7 @@
|
|
|
15087
15935
|
* @param nativeMessageHandler
|
|
15088
15936
|
* @returns
|
|
15089
15937
|
*/
|
|
15090
|
-
async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
15938
|
+
async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
15091
15939
|
// Remove throttle if it exists
|
|
15092
15940
|
ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
|
|
15093
15941
|
// Instrument clientdata telemetry fields from the authorize response
|
|
@@ -15102,9 +15950,9 @@
|
|
|
15102
15950
|
}
|
|
15103
15951
|
const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
|
|
15104
15952
|
if (decryptedData.accountId) {
|
|
15105
|
-
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
|
|
15953
|
+
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
|
|
15106
15954
|
}
|
|
15107
|
-
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null,
|
|
15955
|
+
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, tokenBindingKeyManager);
|
|
15108
15956
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
15109
15957
|
responseHandler.validateTokenResponse(decryptedData, request.correlationId);
|
|
15110
15958
|
// Temporary until response handler is refactored to be more flow agnostic.
|
|
@@ -15366,7 +16214,7 @@
|
|
|
15366
16214
|
*/
|
|
15367
16215
|
// Default timeout for popup windows and iframes in milliseconds
|
|
15368
16216
|
const DEFAULT_POPUP_TIMEOUT_MS = 60000;
|
|
15369
|
-
const DEFAULT_IFRAME_TIMEOUT_MS = 10000;
|
|
16217
|
+
const DEFAULT_IFRAME_TIMEOUT_MS$1 = 10000;
|
|
15370
16218
|
const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
|
|
15371
16219
|
const DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS = 2000;
|
|
15372
16220
|
/**
|
|
@@ -15407,6 +16255,8 @@
|
|
|
15407
16255
|
instanceAware: false,
|
|
15408
16256
|
isMcp: false,
|
|
15409
16257
|
verifySSO: false,
|
|
16258
|
+
// Legacy polling needs COOP omitted, so it implies asserting pocd=1.
|
|
16259
|
+
originCheck: !userInputSystem?.enableLegacyPolling,
|
|
15410
16260
|
};
|
|
15411
16261
|
// Default cache options for browser
|
|
15412
16262
|
const DEFAULT_CACHE_OPTIONS = {
|
|
@@ -15431,7 +16281,7 @@
|
|
|
15431
16281
|
: StubbedNetworkModule,
|
|
15432
16282
|
navigationClient: new NavigationClient(),
|
|
15433
16283
|
popupBridgeTimeout: userInputSystem?.popupBridgeTimeout || DEFAULT_POPUP_TIMEOUT_MS,
|
|
15434
|
-
iframeBridgeTimeout: userInputSystem?.iframeBridgeTimeout || DEFAULT_IFRAME_TIMEOUT_MS,
|
|
16284
|
+
iframeBridgeTimeout: userInputSystem?.iframeBridgeTimeout || DEFAULT_IFRAME_TIMEOUT_MS$1,
|
|
15435
16285
|
redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,
|
|
15436
16286
|
allowRedirectInIframe: false,
|
|
15437
16287
|
navigatePopups: true,
|
|
@@ -15440,6 +16290,7 @@
|
|
|
15440
16290
|
DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
|
|
15441
16291
|
protocolMode: ProtocolMode.AAD,
|
|
15442
16292
|
serverTelemetryEnabled: false,
|
|
16293
|
+
enableLegacyPolling: false,
|
|
15443
16294
|
};
|
|
15444
16295
|
const providedSystemOptions = {
|
|
15445
16296
|
...DEFAULT_BROWSER_SYSTEM_OPTIONS,
|
|
@@ -15457,11 +16308,17 @@
|
|
|
15457
16308
|
iframeTimeoutTelemetry: false,
|
|
15458
16309
|
allowPlatformBrokerWithDOM: false,
|
|
15459
16310
|
};
|
|
16311
|
+
let logger;
|
|
16312
|
+
const getLogger = () => {
|
|
16313
|
+
if (!logger) {
|
|
16314
|
+
logger = new Logger(providedSystemOptions.loggerOptions, name, version);
|
|
16315
|
+
}
|
|
16316
|
+
return logger;
|
|
16317
|
+
};
|
|
15460
16318
|
// Throw an error if user has set OIDCOptions without being in OIDC protocol mode
|
|
15461
16319
|
if (userInputSystem?.protocolMode !== ProtocolMode.OIDC &&
|
|
15462
16320
|
userInputAuth?.OIDCOptions) {
|
|
15463
|
-
|
|
15464
|
-
logger.warning(JSON.stringify(createClientConfigurationError(cannotSetOIDCOptions, "")), "");
|
|
16321
|
+
getLogger().warning(JSON.stringify(createClientConfigurationError(cannotSetOIDCOptions, "")), "");
|
|
15465
16322
|
}
|
|
15466
16323
|
// Throw an error if user has set allowPlatformBroker to true with OIDC protocol mode
|
|
15467
16324
|
if (userInputSystem?.protocolMode &&
|
|
@@ -15469,6 +16326,24 @@
|
|
|
15469
16326
|
providedSystemOptions?.allowPlatformBroker) {
|
|
15470
16327
|
throw createClientConfigurationError(cannotAllowPlatformBroker, "");
|
|
15471
16328
|
}
|
|
16329
|
+
/*
|
|
16330
|
+
* The origin check computes 0 in the embedded contexts legacy polling
|
|
16331
|
+
* serves, so re-enabling it there breaks the flow. Honor it, but warn.
|
|
16332
|
+
*/
|
|
16333
|
+
if (userInputSystem?.enableLegacyPolling &&
|
|
16334
|
+
userInputAuth?.originCheck === true) {
|
|
16335
|
+
getLogger().warning("buildConfiguration: system.enableLegacyPolling is true and auth.originCheck is explicitly true. Legacy polling requires pocd=1, which the origin check will not produce in an embedded context. Unset auth.originCheck to let legacy polling assert it.", "");
|
|
16336
|
+
}
|
|
16337
|
+
/*
|
|
16338
|
+
* Opting out is a deliberate risk transfer, not an error — but the app
|
|
16339
|
+
* cannot know at config time that the risky topology is actually present.
|
|
16340
|
+
*/
|
|
16341
|
+
if ((userInputAuth?.originCheck ?? DEFAULT_AUTH_OPTIONS.originCheck) ===
|
|
16342
|
+
false &&
|
|
16343
|
+
typeof window !== "undefined" &&
|
|
16344
|
+
!topOpenerIsSameOriginOrAbsent(window)) {
|
|
16345
|
+
getLogger().warning("buildConfiguration: auth.originCheck is disabled and the top-level window has a cross-origin opener. MSAL will assert pocd=1, so the STS omits Cross-Origin-Opener-Policy and that opener can reach the auth popup. The application is responsible for this risk.", "");
|
|
16346
|
+
}
|
|
15472
16347
|
const overlayedConfig = {
|
|
15473
16348
|
auth: {
|
|
15474
16349
|
...DEFAULT_AUTH_OPTIONS,
|
|
@@ -15524,6 +16399,7 @@
|
|
|
15524
16399
|
const extensionRequest = { ...request };
|
|
15525
16400
|
delete extensionRequest.resourceRequestMethod;
|
|
15526
16401
|
delete extensionRequest.resourceRequestUri;
|
|
16402
|
+
delete extensionRequest.bindingPreferenceSent;
|
|
15527
16403
|
const messageBody = {
|
|
15528
16404
|
method: NativeExtensionMethod.GetToken,
|
|
15529
16405
|
request: extensionRequest,
|
|
@@ -15535,8 +16411,9 @@
|
|
|
15535
16411
|
body: messageBody,
|
|
15536
16412
|
};
|
|
15537
16413
|
this.logger.trace(`1qadfi ${this.platformAuthType}`, correlationId);
|
|
15538
|
-
this.logger.tracePii(`1xm533 ${this.platformAuthType} ${JSON.stringify(req)}`, correlationId);
|
|
15539
16414
|
this.messageChannel.port1.postMessage(req);
|
|
16415
|
+
request.bindingPreferenceSent =
|
|
16416
|
+
extensionRequest.preferBinding !== undefined;
|
|
15540
16417
|
const response = await new Promise((resolve, reject) => {
|
|
15541
16418
|
this.resolvers.set(req.responseId, {
|
|
15542
16419
|
resolve,
|
|
@@ -15733,13 +16610,11 @@
|
|
|
15733
16610
|
try {
|
|
15734
16611
|
const response = request.body.response;
|
|
15735
16612
|
this.logger.trace(`19hpgm ${this.platformAuthType}`, correlationId);
|
|
15736
|
-
this.logger.tracePii(`179a24 ${this.platformAuthType} ${JSON.stringify(response)}`, correlationId);
|
|
15737
16613
|
if (response.status !== "Success") {
|
|
15738
16614
|
resolver.reject(createNativeAuthError(response.code, correlationId, response.description, response.ext));
|
|
15739
16615
|
}
|
|
15740
16616
|
else if (response.result) {
|
|
15741
|
-
if (response.result["code"]
|
|
15742
|
-
response.result["description"]) {
|
|
16617
|
+
if (response.result["code"]) {
|
|
15743
16618
|
resolver.reject(createNativeAuthError(response.result["code"], correlationId, response.result["description"], response.result["ext"]));
|
|
15744
16619
|
}
|
|
15745
16620
|
else {
|
|
@@ -15820,11 +16695,12 @@
|
|
|
15820
16695
|
Object.prototype.hasOwnProperty.call(response, "account") &&
|
|
15821
16696
|
Object.prototype.hasOwnProperty.call(response, "scope") &&
|
|
15822
16697
|
Object.prototype.hasOwnProperty.call(response, "expires_in")) {
|
|
16698
|
+
const validatedResponse = response;
|
|
15823
16699
|
validationMeasurement.end({
|
|
15824
16700
|
success: true,
|
|
15825
16701
|
platformAuthProviderType: this.platformAuthType,
|
|
15826
16702
|
});
|
|
15827
|
-
return
|
|
16703
|
+
return validatedResponse;
|
|
15828
16704
|
}
|
|
15829
16705
|
else {
|
|
15830
16706
|
const error = createAuthError(unexpectedError, responseCorrelationId, "Response missing expected properties.");
|
|
@@ -15866,6 +16742,7 @@
|
|
|
15866
16742
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15867
16743
|
* Licensed under the MIT License.
|
|
15868
16744
|
*/
|
|
16745
|
+
const PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED = "platform_auth_dom_dpop_not_supported";
|
|
15869
16746
|
class PlatformAuthDOMHandler {
|
|
15870
16747
|
constructor(logger, performanceClient, correlationId) {
|
|
15871
16748
|
this.logger = logger;
|
|
@@ -15945,6 +16822,10 @@
|
|
|
15945
16822
|
});
|
|
15946
16823
|
this.logger.trace(`02bcil ${this.platformAuthType}`, correlationId);
|
|
15947
16824
|
try {
|
|
16825
|
+
if (request.tokenType?.trim().toLowerCase() ===
|
|
16826
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF) {
|
|
16827
|
+
throw createBrowserAuthError(PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED, correlationId);
|
|
16828
|
+
}
|
|
15948
16829
|
const platformDOMRequest = invoke(this.initializePlatformDOMRequest.bind(this), PlatformAuthDOMInitializeRequest, this.logger, this.performanceClient, correlationId)(request);
|
|
15949
16830
|
const response =
|
|
15950
16831
|
// @ts-ignore
|
|
@@ -15971,6 +16852,7 @@
|
|
|
15971
16852
|
this.logger.trace(`15d6yv ${this.platformAuthType}`, requestCorrelationId);
|
|
15972
16853
|
delete remainingProperties.resourceRequestMethod;
|
|
15973
16854
|
delete remainingProperties.resourceRequestUri;
|
|
16855
|
+
delete remainingProperties.bindingPreferenceSent;
|
|
15974
16856
|
const validExtraParameters = this.getDOMExtraParams(remainingProperties, requestCorrelationId);
|
|
15975
16857
|
const platformDOMRequest = {
|
|
15976
16858
|
accountId: accountId,
|
|
@@ -16198,7 +17080,9 @@
|
|
|
16198
17080
|
logger.trace("0uko3r", correlationId);
|
|
16199
17081
|
const schemeSupported = !authenticationScheme ||
|
|
16200
17082
|
authenticationScheme === AuthenticationScheme$1.BEARER ||
|
|
16201
|
-
authenticationScheme === AuthenticationScheme$1.POP
|
|
17083
|
+
authenticationScheme === AuthenticationScheme$1.POP ||
|
|
17084
|
+
(authenticationScheme === AuthenticationScheme$1.DPOP &&
|
|
17085
|
+
!(platformAuthProvider instanceof PlatformAuthDOMHandler));
|
|
16202
17086
|
const fields = {
|
|
16203
17087
|
allowPlatformBroker: config.system.allowPlatformBroker,
|
|
16204
17088
|
...(config.system.allowPlatformBroker && {
|
|
@@ -16294,6 +17178,9 @@
|
|
|
16294
17178
|
popupWindowAttributes: logoutRequest?.popupWindowAttributes || {},
|
|
16295
17179
|
popupWindowParent: logoutRequest?.popupWindowParent ?? window,
|
|
16296
17180
|
};
|
|
17181
|
+
validLogoutRequest.popupOriginCheckDone =
|
|
17182
|
+
this.getPopupOriginCheckDone(popupParams.popupWindowParent) ??
|
|
17183
|
+
validLogoutRequest.popupOriginCheckDone;
|
|
16297
17184
|
const authority = logoutRequest && logoutRequest.authority;
|
|
16298
17185
|
const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;
|
|
16299
17186
|
// navigatePopups flag set to false. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
|
@@ -16358,6 +17245,7 @@
|
|
|
16358
17245
|
...request,
|
|
16359
17246
|
codeChallenge: pkce.challenge,
|
|
16360
17247
|
...tokenBindingParams,
|
|
17248
|
+
popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
|
|
16361
17249
|
};
|
|
16362
17250
|
try {
|
|
16363
17251
|
// Initialize the client
|
|
@@ -16391,12 +17279,13 @@
|
|
|
16391
17279
|
// Wait for the redirect bridge response
|
|
16392
17280
|
const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
|
|
16393
17281
|
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
16394
|
-
return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, pkce.verifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
|
|
17282
|
+
return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, pkce.verifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
16395
17283
|
}
|
|
16396
17284
|
}
|
|
16397
17285
|
catch (e) {
|
|
16398
17286
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
16399
17287
|
popupParams.popup?.close();
|
|
17288
|
+
await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16400
17289
|
if (e instanceof AuthError) {
|
|
16401
17290
|
e.correlationId = this.correlationId;
|
|
16402
17291
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -16421,24 +17310,31 @@
|
|
|
16421
17310
|
earJwk: earJwk,
|
|
16422
17311
|
codeChallenge: pkce.challenge,
|
|
16423
17312
|
...tokenBindingParams,
|
|
17313
|
+
popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
|
|
16424
17314
|
};
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
16435
|
-
|
|
16436
|
-
|
|
16437
|
-
|
|
16438
|
-
|
|
17315
|
+
try {
|
|
17316
|
+
const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
|
|
17317
|
+
// Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
17318
|
+
const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
|
|
17319
|
+
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
17320
|
+
if (!serverParams.ear_jwe && serverParams.code) {
|
|
17321
|
+
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
|
|
17322
|
+
serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
|
|
17323
|
+
requestAuthority: request.authority,
|
|
17324
|
+
requestAzureCloudOptions: request.azureCloudOptions,
|
|
17325
|
+
requestExtraQueryParameters: request.extraQueryParameters,
|
|
17326
|
+
account: request.account,
|
|
17327
|
+
authority: discoveredAuthority,
|
|
17328
|
+
});
|
|
17329
|
+
return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, pkce.verifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17330
|
+
}
|
|
17331
|
+
else {
|
|
17332
|
+
return await invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, ApiId.acquireTokenPopup, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17333
|
+
}
|
|
16439
17334
|
}
|
|
16440
|
-
|
|
16441
|
-
|
|
17335
|
+
catch (e) {
|
|
17336
|
+
await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
17337
|
+
throw e;
|
|
16442
17338
|
}
|
|
16443
17339
|
}
|
|
16444
17340
|
async executeCodeFlowWithPost(request, popupParams, authClient, pkceVerifier) {
|
|
@@ -16449,7 +17345,7 @@
|
|
|
16449
17345
|
// Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
16450
17346
|
const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
|
|
16451
17347
|
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
16452
|
-
return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(request, serverParams, pkceVerifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
|
|
17348
|
+
return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(request, serverParams, pkceVerifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
16453
17349
|
}
|
|
16454
17350
|
/**
|
|
16455
17351
|
*
|
|
@@ -16693,6 +17589,27 @@
|
|
|
16693
17589
|
getRelayStateId(state, correlationId) {
|
|
16694
17590
|
return parseRequestState(base64Decode, state, correlationId).libraryState.id;
|
|
16695
17591
|
}
|
|
17592
|
+
/**
|
|
17593
|
+
* Asserts `pocd=1` for the relay flow. Direct popups also require the
|
|
17594
|
+
* environment of a delegated opening window to pass the origin check.
|
|
17595
|
+
*
|
|
17596
|
+
* With a relay the IdP window is a grandchild popup, which an untrusted
|
|
17597
|
+
* ancestor cannot reach by name — so the topology satisfies the check by
|
|
17598
|
+
* construction. The current window is framed and would otherwise compute
|
|
17599
|
+
* `0`. Without a delegated parent, the standard app check remains unchanged.
|
|
17600
|
+
*
|
|
17601
|
+
* @param popupWindowParent Window that opens the popup.
|
|
17602
|
+
*/
|
|
17603
|
+
getPopupOriginCheckDone(popupWindowParent) {
|
|
17604
|
+
if (this.config.auth.popupRelayUri) {
|
|
17605
|
+
return true;
|
|
17606
|
+
}
|
|
17607
|
+
if (popupWindowParent !== window) {
|
|
17608
|
+
return (computePocd(this.config) === 1 &&
|
|
17609
|
+
computePocd(this.config, popupWindowParent) === 1);
|
|
17610
|
+
}
|
|
17611
|
+
return undefined;
|
|
17612
|
+
}
|
|
16696
17613
|
/**
|
|
16697
17614
|
* Opens the interactive popup for a POST-form /authorize request. Shared by
|
|
16698
17615
|
* the auth-code POST and EAR flows, which are identical apart from the form
|
|
@@ -16816,8 +17733,11 @@
|
|
|
16816
17733
|
codeChallenge: pkceCodes.challenge,
|
|
16817
17734
|
...tokenBindingParams,
|
|
16818
17735
|
};
|
|
16819
|
-
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
16820
17736
|
try {
|
|
17737
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
|
|
17738
|
+
throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
|
|
17739
|
+
}
|
|
17740
|
+
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
16821
17741
|
if (redirectRequest.httpMethod === HttpMethod.POST) {
|
|
16822
17742
|
return await this.executeCodeFlowWithPost(redirectRequest);
|
|
16823
17743
|
}
|
|
@@ -16837,6 +17757,7 @@
|
|
|
16837
17757
|
}
|
|
16838
17758
|
}
|
|
16839
17759
|
catch (e) {
|
|
17760
|
+
await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16840
17761
|
if (e instanceof AuthError) {
|
|
16841
17762
|
e.correlationId = this.correlationId;
|
|
16842
17763
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -16861,14 +17782,23 @@
|
|
|
16861
17782
|
codeChallenge: pkceCodes.challenge,
|
|
16862
17783
|
...tokenBindingParams,
|
|
16863
17784
|
};
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
16867
|
-
|
|
16868
|
-
|
|
16869
|
-
|
|
16870
|
-
|
|
16871
|
-
|
|
17785
|
+
try {
|
|
17786
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
|
|
17787
|
+
throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
|
|
17788
|
+
}
|
|
17789
|
+
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
17790
|
+
const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
|
|
17791
|
+
form.submit();
|
|
17792
|
+
return await new Promise((resolve, reject) => {
|
|
17793
|
+
setTimeout(() => {
|
|
17794
|
+
reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
|
|
17795
|
+
}, this.config.system.redirectNavigationTimeout);
|
|
17796
|
+
});
|
|
17797
|
+
}
|
|
17798
|
+
catch (e) {
|
|
17799
|
+
await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
17800
|
+
throw e;
|
|
17801
|
+
}
|
|
16872
17802
|
}
|
|
16873
17803
|
/**
|
|
16874
17804
|
* Executes classic Authorization Code flow with a POST request.
|
|
@@ -16907,6 +17837,7 @@
|
|
|
16907
17837
|
if (!serverParams) {
|
|
16908
17838
|
// Not a recognized server response hash or hash not associated with a redirect request
|
|
16909
17839
|
this.logger.info("1qmv0q", this.correlationId);
|
|
17840
|
+
await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16910
17841
|
this.browserStorage.resetRequestCache(this.correlationId);
|
|
16911
17842
|
// Do not instrument "no_server_response" if user clicked back button
|
|
16912
17843
|
if (getNavigationType() !== "back_forward") {
|
|
@@ -16976,6 +17907,7 @@
|
|
|
16976
17907
|
return null;
|
|
16977
17908
|
}
|
|
16978
17909
|
catch (e) {
|
|
17910
|
+
await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16979
17911
|
if (e instanceof AuthError) {
|
|
16980
17912
|
e.correlationId = this.correlationId;
|
|
16981
17913
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -17015,7 +17947,6 @@
|
|
|
17015
17947
|
}
|
|
17016
17948
|
return [null, ""];
|
|
17017
17949
|
}
|
|
17018
|
-
clearHash(window);
|
|
17019
17950
|
this.logger.verbose("00uvho", this.correlationId);
|
|
17020
17951
|
return [response, responseString];
|
|
17021
17952
|
}
|
|
@@ -17043,10 +17974,10 @@
|
|
|
17043
17974
|
const { authority, azureCloudOptions, extraQueryParameters, account } = request;
|
|
17044
17975
|
if (serverParams.ear_jwe) {
|
|
17045
17976
|
const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, request.correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
|
|
17046
|
-
return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, request.correlationId)(request, serverParams, ApiId.acquireTokenRedirect, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
|
|
17977
|
+
return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, request.correlationId)(request, serverParams, ApiId.acquireTokenRedirect, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17047
17978
|
}
|
|
17048
17979
|
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
|
|
17049
|
-
return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(request, serverParams, codeVerifier, ApiId.acquireTokenRedirect, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
|
|
17980
|
+
return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(request, serverParams, codeVerifier, ApiId.acquireTokenRedirect, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17050
17981
|
}
|
|
17051
17982
|
/**
|
|
17052
17983
|
* Redirects window to given URL.
|
|
@@ -17377,10 +18308,10 @@
|
|
|
17377
18308
|
account: request.account,
|
|
17378
18309
|
authority: discoveredAuthority,
|
|
17379
18310
|
});
|
|
17380
|
-
return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
|
|
18311
|
+
return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17381
18312
|
}
|
|
17382
18313
|
else {
|
|
17383
|
-
return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, this.apiId, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
|
|
18314
|
+
return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, this.apiId, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17384
18315
|
}
|
|
17385
18316
|
}
|
|
17386
18317
|
/**
|
|
@@ -17430,7 +18361,13 @@
|
|
|
17430
18361
|
*/
|
|
17431
18362
|
async silentTokenHelper(authClient, request) {
|
|
17432
18363
|
const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
|
|
17433
|
-
|
|
18364
|
+
try {
|
|
18365
|
+
return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
18366
|
+
}
|
|
18367
|
+
catch (e) {
|
|
18368
|
+
await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
18369
|
+
throw e;
|
|
18370
|
+
}
|
|
17434
18371
|
}
|
|
17435
18372
|
/**
|
|
17436
18373
|
* Shared helper that generates PKCE codes, builds the /authorize URL,
|
|
@@ -17447,38 +18384,44 @@
|
|
|
17447
18384
|
codeChallenge: pkceCodes.challenge,
|
|
17448
18385
|
...tokenBindingParams,
|
|
17449
18386
|
};
|
|
17450
|
-
// Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
|
|
17451
|
-
const iframe = createHiddenIframe();
|
|
17452
|
-
const responseType = this.config.auth.OIDCOptions.responseMode;
|
|
17453
|
-
// Wait for response from the redirect bridge.
|
|
17454
|
-
let responseString;
|
|
17455
18387
|
try {
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
17464
|
-
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
|
|
18388
|
+
// Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
|
|
18389
|
+
const iframe = createHiddenIframe();
|
|
18390
|
+
const responseType = this.config.auth.OIDCOptions.responseMode;
|
|
18391
|
+
// Wait for response from the redirect bridge.
|
|
18392
|
+
let responseString;
|
|
18393
|
+
try {
|
|
18394
|
+
const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
|
|
18395
|
+
responsePromise.catch(() => {
|
|
18396
|
+
/*
|
|
18397
|
+
* If URL creation or navigation below throws before
|
|
18398
|
+
* responsePromise is awaited, the listener still rejects on
|
|
18399
|
+
* timeout. Swallow it here so it does not surface as an
|
|
18400
|
+
* unhandled rejection; the navigation error is propagated
|
|
18401
|
+
* instead.
|
|
18402
|
+
*/
|
|
18403
|
+
});
|
|
18404
|
+
if (request.httpMethod === HttpMethod.POST) {
|
|
18405
|
+
await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
18406
|
+
}
|
|
18407
|
+
else {
|
|
18408
|
+
// Create authorize request url
|
|
18409
|
+
const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
18410
|
+
// Navigate the iframe to the authorize request url
|
|
18411
|
+
await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
|
|
18412
|
+
}
|
|
18413
|
+
responseString = await responsePromise;
|
|
17468
18414
|
}
|
|
17469
|
-
|
|
17470
|
-
|
|
17471
|
-
const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
17472
|
-
// Navigate the iframe to the authorize request url
|
|
17473
|
-
await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
|
|
18415
|
+
finally {
|
|
18416
|
+
invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
|
|
17474
18417
|
}
|
|
17475
|
-
|
|
18418
|
+
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
|
|
18419
|
+
return { serverParams, pkceCodes, silentRequest };
|
|
17476
18420
|
}
|
|
17477
|
-
|
|
17478
|
-
|
|
18421
|
+
catch (e) {
|
|
18422
|
+
await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
18423
|
+
throw e;
|
|
17479
18424
|
}
|
|
17480
|
-
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
|
|
17481
|
-
return { serverParams, pkceCodes, silentRequest };
|
|
17482
18425
|
}
|
|
17483
18426
|
async waitForIframeResponse(iframe, request) {
|
|
17484
18427
|
if (this.waitForIframeResponseHook) {
|
|
@@ -17751,7 +18694,6 @@
|
|
|
17751
18694
|
: undefined,
|
|
17752
18695
|
extraParameters: canonicalizeStringDict(request.extraParameters),
|
|
17753
18696
|
extraQueryParameters: canonicalizeStringDict(request.extraQueryParameters),
|
|
17754
|
-
extraParametersNoCache: canonicalizeStringDict(request.extraParametersNoCache),
|
|
17755
18697
|
forceRefresh: !!request.forceRefresh,
|
|
17756
18698
|
cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
|
|
17757
18699
|
});
|
|
@@ -17760,8 +18702,12 @@
|
|
|
17760
18702
|
* Copies caller-owned mutable inputs before asynchronous broker initialization.
|
|
17761
18703
|
*/
|
|
17762
18704
|
function snapshotPlatformSilentRequest(request) {
|
|
17763
|
-
|
|
18705
|
+
const snapshot = {
|
|
17764
18706
|
...request,
|
|
18707
|
+
};
|
|
18708
|
+
delete snapshot.extraParametersNoCache;
|
|
18709
|
+
return {
|
|
18710
|
+
...snapshot,
|
|
17765
18711
|
scopes: [...(request.scopes || [])],
|
|
17766
18712
|
account: { ...request.account },
|
|
17767
18713
|
azureCloudOptions: request.azureCloudOptions
|
|
@@ -17773,9 +18719,6 @@
|
|
|
17773
18719
|
extraQueryParameters: request.extraQueryParameters
|
|
17774
18720
|
? { ...request.extraQueryParameters }
|
|
17775
18721
|
: undefined,
|
|
17776
|
-
extraParametersNoCache: request.extraParametersNoCache
|
|
17777
|
-
? { ...request.extraParametersNoCache }
|
|
17778
|
-
: undefined,
|
|
17779
18722
|
attributeTokens: request.attributeTokens
|
|
17780
18723
|
? [...request.attributeTokens]
|
|
17781
18724
|
: undefined,
|
|
@@ -17986,7 +18929,32 @@
|
|
|
17986
18929
|
* @returns
|
|
17987
18930
|
*/
|
|
17988
18931
|
async handleRedirectPromiseInternal(options) {
|
|
17989
|
-
|
|
18932
|
+
// Preserve the response for RedirectClient before removing it from the URL.
|
|
18933
|
+
const responseString = options?.hash ||
|
|
18934
|
+
(this.config.auth.OIDCOptions.responseMode ===
|
|
18935
|
+
ResponseMode$1.QUERY
|
|
18936
|
+
? window.location.search
|
|
18937
|
+
: window.location.hash);
|
|
18938
|
+
const anyClientInteractionInProgress = this.browserStorage.isInteractionInProgress(false);
|
|
18939
|
+
const currentClientInteraction = this.browserStorage.isInteractionInProgress(true);
|
|
18940
|
+
const isBridgeCallback = isInPopup() ||
|
|
18941
|
+
(isInIframe() &&
|
|
18942
|
+
!this.config.system.allowRedirectInIframe);
|
|
18943
|
+
/*
|
|
18944
|
+
* Clear recognized response fragments for:
|
|
18945
|
+
* - Stale callbacks with no pending interaction.
|
|
18946
|
+
* - This client's login callback, even if request setup or response validation fails.
|
|
18947
|
+
* - This client's logout callback containing state, before the SIGNOUT early return.
|
|
18948
|
+
* Leave another client's callback untouched. clearHash preserves query strings
|
|
18949
|
+
* and application routes, and does nothing when no response fragment is present.
|
|
18950
|
+
* Skip popup and non-redirect iframe callbacks: legacy apps may call HRP
|
|
18951
|
+
* before their redirect bridge reads and broadcasts the response.
|
|
18952
|
+
*/
|
|
18953
|
+
if (!isBridgeCallback &&
|
|
18954
|
+
(!anyClientInteractionInProgress || currentClientInteraction)) {
|
|
18955
|
+
clearHash(window);
|
|
18956
|
+
}
|
|
18957
|
+
if (!currentClientInteraction) {
|
|
17990
18958
|
this.logger.info("0le6uv", "");
|
|
17991
18959
|
return null;
|
|
17992
18960
|
}
|
|
@@ -17994,7 +18962,7 @@
|
|
|
17994
18962
|
if (interactionType === INTERACTION_TYPE.SIGNOUT) {
|
|
17995
18963
|
this.logger.verbose("1ywcv2", "");
|
|
17996
18964
|
this.browserStorage.setInteractionInProgress(false);
|
|
17997
|
-
return
|
|
18965
|
+
return null;
|
|
17998
18966
|
}
|
|
17999
18967
|
const loggedInAccounts = this.getAllAccounts();
|
|
18000
18968
|
const platformBrokerRequest = this.browserStorage.getCachedNativeRequest();
|
|
@@ -18024,7 +18992,9 @@
|
|
|
18024
18992
|
rootMeasurement = this.performanceClient.startMeasurement(AcquireTokenRedirect, correlationId);
|
|
18025
18993
|
this.logger.trace("0znzs5", correlationId);
|
|
18026
18994
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
18027
|
-
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(standardRequest, codeVerifier, rootMeasurement, options
|
|
18995
|
+
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(standardRequest, codeVerifier, rootMeasurement, options?.hash
|
|
18996
|
+
? options
|
|
18997
|
+
: { ...options, hash: responseString });
|
|
18028
18998
|
}
|
|
18029
18999
|
}
|
|
18030
19000
|
catch (e) {
|
|
@@ -18113,8 +19083,9 @@
|
|
|
18113
19083
|
let result;
|
|
18114
19084
|
const platformAuthProvider = this.platformAuthProvider;
|
|
18115
19085
|
if (this.canUsePlatformBroker(request) && platformAuthProvider) {
|
|
19086
|
+
const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
|
|
18116
19087
|
const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, platformAuthProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
|
|
18117
|
-
result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(
|
|
19088
|
+
result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(nativeRequest, atrMeasurement).catch((e) => {
|
|
18118
19089
|
if (e instanceof NativeAuthError &&
|
|
18119
19090
|
isFatalNativeAuthError(e)) {
|
|
18120
19091
|
this.platformAuthProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt platform broker calls
|
|
@@ -18172,6 +19143,9 @@
|
|
|
18172
19143
|
this.logger.verbose("0ch87b", correlationId);
|
|
18173
19144
|
preflightCheck(this.initialized, atPopupMeasurement, this.config, request);
|
|
18174
19145
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNIN, request.overrideInteractionInProgress, correlationId);
|
|
19146
|
+
if (request.overrideInteractionInProgress) {
|
|
19147
|
+
cancelPendingPopupPollingResponse(this.logger);
|
|
19148
|
+
}
|
|
18175
19149
|
}
|
|
18176
19150
|
catch (e) {
|
|
18177
19151
|
// Since this function is syncronous we need to reject
|
|
@@ -18656,6 +19630,13 @@
|
|
|
18656
19630
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
18657
19631
|
redirectPreflightCheck(this.initialized, this.config);
|
|
18658
19632
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
|
|
19633
|
+
try {
|
|
19634
|
+
await this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
19635
|
+
}
|
|
19636
|
+
catch (error) {
|
|
19637
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
19638
|
+
throw error;
|
|
19639
|
+
}
|
|
18659
19640
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
18660
19641
|
return redirectClient.logout(logoutRequest);
|
|
18661
19642
|
}
|
|
@@ -18669,7 +19650,11 @@
|
|
|
18669
19650
|
preflightCheck$1(this.initialized);
|
|
18670
19651
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
|
|
18671
19652
|
const popupClient = this.createPopupClient(correlationId);
|
|
18672
|
-
|
|
19653
|
+
const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
19654
|
+
const popupLogout = popupClient.logout(logoutRequest);
|
|
19655
|
+
return Promise.all([nativeCacheClear, popupLogout])
|
|
19656
|
+
.then(() => undefined)
|
|
19657
|
+
.finally(() => {
|
|
18673
19658
|
this.browserStorage.setInteractionInProgress(false);
|
|
18674
19659
|
});
|
|
18675
19660
|
}
|
|
@@ -18688,7 +19673,30 @@
|
|
|
18688
19673
|
}
|
|
18689
19674
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
18690
19675
|
const cacheClient = this.createSilentCacheClient(correlationId);
|
|
18691
|
-
|
|
19676
|
+
const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
19677
|
+
const browserCacheClear = cacheClient.logout(logoutRequest);
|
|
19678
|
+
await Promise.all([nativeCacheClear, browserCacheClear]);
|
|
19679
|
+
}
|
|
19680
|
+
async clearNativeCache(account, correlationId) {
|
|
19681
|
+
const homeAccountId = account?.homeAccountId.toLowerCase();
|
|
19682
|
+
const environment = account?.environment.toLowerCase();
|
|
19683
|
+
const accessTokenKeys = this.nativeInternalStorage
|
|
19684
|
+
.getTokenKeys()
|
|
19685
|
+
.accessToken.filter((key) => {
|
|
19686
|
+
if (!account) {
|
|
19687
|
+
return true;
|
|
19688
|
+
}
|
|
19689
|
+
const accessToken = this.nativeInternalStorage.getAccessTokenCredential(key, correlationId);
|
|
19690
|
+
if (!accessToken) {
|
|
19691
|
+
return false;
|
|
19692
|
+
}
|
|
19693
|
+
return (accessToken.homeAccountId.toLowerCase() === homeAccountId &&
|
|
19694
|
+
accessToken.environment.toLowerCase() === environment);
|
|
19695
|
+
});
|
|
19696
|
+
await Promise.all(accessTokenKeys.map((key) => this.nativeInternalStorage.removeAccessTokenAndTokenBindingKey(key, correlationId)));
|
|
19697
|
+
if (!account) {
|
|
19698
|
+
this.nativeInternalStorage.clear(correlationId);
|
|
19699
|
+
}
|
|
18692
19700
|
}
|
|
18693
19701
|
// #endregion
|
|
18694
19702
|
// #region Account APIs
|
|
@@ -18770,6 +19778,19 @@
|
|
|
18770
19778
|
}
|
|
18771
19779
|
}
|
|
18772
19780
|
// #region Helpers
|
|
19781
|
+
/**
|
|
19782
|
+
* Removes internal DPoP key state from application-originated broker requests.
|
|
19783
|
+
*/
|
|
19784
|
+
sanitizeNativeBrokerRequest(request, correlationId) {
|
|
19785
|
+
if (!request.dpopJkt) {
|
|
19786
|
+
return request;
|
|
19787
|
+
}
|
|
19788
|
+
this.logger.warning("0rh2us", correlationId);
|
|
19789
|
+
return {
|
|
19790
|
+
...request,
|
|
19791
|
+
dpopJkt: undefined,
|
|
19792
|
+
};
|
|
19793
|
+
}
|
|
18773
19794
|
/**
|
|
18774
19795
|
* Acquire a token from native device (e.g. WAM)
|
|
18775
19796
|
* @param request
|
|
@@ -18789,7 +19810,8 @@
|
|
|
18789
19810
|
throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
|
|
18790
19811
|
}
|
|
18791
19812
|
const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.platformAuthProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
|
|
18792
|
-
|
|
19813
|
+
const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
|
|
19814
|
+
return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(nativeRequest, cacheLookupPolicy);
|
|
18793
19815
|
}
|
|
18794
19816
|
/**
|
|
18795
19817
|
* Returns boolean indicating if this request can use the platform broker
|
|
@@ -19069,14 +20091,23 @@
|
|
|
19069
20091
|
correlationId,
|
|
19070
20092
|
config: this.config,
|
|
19071
20093
|
}, this.platformAuthProvider, this.logger, this.performanceClient);
|
|
19072
|
-
const
|
|
20094
|
+
const shouldDeduplicate = preparedRequest.request.authenticationScheme !==
|
|
20095
|
+
AuthenticationScheme$1.DPOP;
|
|
20096
|
+
const inProgressRequest = shouldDeduplicate
|
|
20097
|
+
? this.activeSilentTokenRequests.get(preparedRequest.key)
|
|
20098
|
+
: undefined;
|
|
19073
20099
|
if (typeof inProgressRequest === "undefined") {
|
|
19074
|
-
this.logger.verbose(
|
|
20100
|
+
this.logger.verbose(shouldDeduplicate
|
|
20101
|
+
? "0fcjbk"
|
|
20102
|
+
: "acquireTokenSilent called for DPoP request, starting an independent operation", correlationId);
|
|
19075
20103
|
this.performanceClient.addFields({ deduped: false }, correlationId);
|
|
19076
20104
|
const activeRequest = invokeAsync(this.acquireTokenSilentAsync.bind(this), AcquireTokenSilentAsync, this.logger, this.performanceClient, correlationId)({
|
|
19077
20105
|
...preparedRequest.request,
|
|
19078
20106
|
correlationId,
|
|
19079
20107
|
}, preparedRequest.account);
|
|
20108
|
+
if (!shouldDeduplicate) {
|
|
20109
|
+
return activeRequest;
|
|
20110
|
+
}
|
|
19080
20111
|
this.activeSilentTokenRequests.set(preparedRequest.key, activeRequest);
|
|
19081
20112
|
return activeRequest.finally(() => {
|
|
19082
20113
|
this.activeSilentTokenRequests.delete(preparedRequest.key);
|
|
@@ -20547,6 +21578,79 @@
|
|
|
20547
21578
|
*/
|
|
20548
21579
|
NestedAppOperatingContext.ID = "NestedAppOperatingContext";
|
|
20549
21580
|
|
|
21581
|
+
/*
|
|
21582
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
21583
|
+
* Licensed under the MIT License.
|
|
21584
|
+
*/
|
|
21585
|
+
const IFRAME_POLL_INTERVAL_MS = 50;
|
|
21586
|
+
const DEFAULT_IFRAME_TIMEOUT_MS = 10000;
|
|
21587
|
+
/**
|
|
21588
|
+
* Monitors an iframe content window until it loads a URL with a known hash, or hits a specified timeout.
|
|
21589
|
+
*
|
|
21590
|
+
* @param iframe - The hidden iframe to monitor.
|
|
21591
|
+
* @param timeout - Maximum time (ms) to wait for navigation before rejecting with
|
|
21592
|
+
* `monitor_window_timeout`.
|
|
21593
|
+
* @param logger - Logger instance.
|
|
21594
|
+
* @param correlationId
|
|
21595
|
+
* @param responseMode - `"query"` or `"fragment"` — determines whether to read
|
|
21596
|
+
* `location.search` or `location.hash`. Any value other than `"query"` is
|
|
21597
|
+
* treated as fragment.
|
|
21598
|
+
*/
|
|
21599
|
+
async function monitorIframeForHash(iframe, timeout, logger, correlationId, responseMode) {
|
|
21600
|
+
return new Promise((resolve, reject) => {
|
|
21601
|
+
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
21602
|
+
logger.warning(`137tec ${timeout} ${DEFAULT_IFRAME_TIMEOUT_MS}`, correlationId);
|
|
21603
|
+
}
|
|
21604
|
+
/*
|
|
21605
|
+
* Polling for iframes can be purely timing based,
|
|
21606
|
+
* since we don't need to account for interaction.
|
|
21607
|
+
*/
|
|
21608
|
+
const timeoutId = window.setTimeout(() => {
|
|
21609
|
+
window.clearInterval(intervalId);
|
|
21610
|
+
reject(new AuthError(timedOut, correlationId, undefined, "monitor_window_timeout"));
|
|
21611
|
+
}, timeout);
|
|
21612
|
+
const intervalId = window.setInterval(() => {
|
|
21613
|
+
const contentWindow = iframe.contentWindow;
|
|
21614
|
+
if (!contentWindow) {
|
|
21615
|
+
return;
|
|
21616
|
+
}
|
|
21617
|
+
let href = "";
|
|
21618
|
+
try {
|
|
21619
|
+
/*
|
|
21620
|
+
* Will throw if cross origin,
|
|
21621
|
+
* which should be caught and ignored
|
|
21622
|
+
* since we need the interval to keep running while on STS UI.
|
|
21623
|
+
*/
|
|
21624
|
+
href = contentWindow.location.href;
|
|
21625
|
+
}
|
|
21626
|
+
catch (e) { }
|
|
21627
|
+
if (!href || href === "about:blank") {
|
|
21628
|
+
return;
|
|
21629
|
+
}
|
|
21630
|
+
const responseString = responseMode === ResponseMode$1.QUERY
|
|
21631
|
+
? contentWindow.location.search
|
|
21632
|
+
: contentWindow.location.hash;
|
|
21633
|
+
window.clearTimeout(timeoutId);
|
|
21634
|
+
window.clearInterval(intervalId);
|
|
21635
|
+
resolve(responseString);
|
|
21636
|
+
}, IFRAME_POLL_INTERVAL_MS);
|
|
21637
|
+
}).finally(() => {
|
|
21638
|
+
/*
|
|
21639
|
+
* Strip auth-response params from the iframe URL. The monitor owns the
|
|
21640
|
+
* iframe for the duration of the poll, mirroring cleanPopup in
|
|
21641
|
+
* PopupMonitor.
|
|
21642
|
+
*/
|
|
21643
|
+
try {
|
|
21644
|
+
if (iframe.contentWindow) {
|
|
21645
|
+
clearAuthResponseFromUrl(iframe.contentWindow);
|
|
21646
|
+
}
|
|
21647
|
+
}
|
|
21648
|
+
catch {
|
|
21649
|
+
// Iframe may already be navigated away or cross-origin; ignore.
|
|
21650
|
+
}
|
|
21651
|
+
});
|
|
21652
|
+
}
|
|
21653
|
+
|
|
20550
21654
|
/*
|
|
20551
21655
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
20552
21656
|
* Licensed under the MIT License.
|
|
@@ -20589,27 +21693,29 @@
|
|
|
20589
21693
|
/**
|
|
20590
21694
|
* Waits for the auth response from a popup window opened by MSAL.
|
|
20591
21695
|
*
|
|
20592
|
-
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge
|
|
20593
|
-
*
|
|
20594
|
-
*
|
|
21696
|
+
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge,
|
|
21697
|
+
* or to the v4-style same-origin location poller when
|
|
21698
|
+
* `system.enableLegacyPolling` is set. Subclasses must return the raw response
|
|
21699
|
+
* string (hash/query/fragment), or reject with an `AuthError` on failure.
|
|
20595
21700
|
*
|
|
20596
21701
|
* @internal
|
|
20597
21702
|
* @param request The in-flight authorization or end-session request.
|
|
20598
21703
|
* @param popupWindow The popup window opened by MSAL.
|
|
20599
21704
|
* @param popupWindowParent The parent window that opened the popup.
|
|
20600
21705
|
*/
|
|
20601
|
-
async waitForPopupResponse(request,
|
|
20602
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20603
|
-
popupWindow,
|
|
20604
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20605
|
-
popupWindowParent) {
|
|
21706
|
+
async waitForPopupResponse(request, popupWindow, popupWindowParent) {
|
|
20606
21707
|
const controller = this.controller;
|
|
20607
|
-
|
|
21708
|
+
const config = controller.getConfiguration();
|
|
21709
|
+
if (config.system.enableLegacyPolling) {
|
|
21710
|
+
return waitForPopupPollingResponse(config, controller.getLogger(), controller.getPerformanceClient(), request, popupWindow, popupWindowParent);
|
|
21711
|
+
}
|
|
21712
|
+
return waitForBridgeResponse(config.system.popupBridgeTimeout, controller.getLogger(), request, controller.getPerformanceClient());
|
|
20608
21713
|
}
|
|
20609
21714
|
/**
|
|
20610
21715
|
* Waits for the auth response from a hidden iframe used by MSAL silent flows.
|
|
20611
21716
|
*
|
|
20612
|
-
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge
|
|
21717
|
+
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge,
|
|
21718
|
+
* or to the v4-style location poller when `system.enableLegacyPolling` is set.
|
|
20613
21719
|
* Subclasses must return the raw response string (hash/query/fragment), or reject
|
|
20614
21720
|
* with an `AuthError` on failure.
|
|
20615
21721
|
*
|
|
@@ -20617,11 +21723,12 @@
|
|
|
20617
21723
|
* @param iframe The hidden iframe MSAL attached to the document.
|
|
20618
21724
|
* @param request The in-flight authorization request.
|
|
20619
21725
|
*/
|
|
20620
|
-
async waitForIframeResponse(
|
|
20621
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20622
|
-
iframe, request) {
|
|
21726
|
+
async waitForIframeResponse(iframe, request) {
|
|
20623
21727
|
const controller = this.controller;
|
|
20624
21728
|
const config = controller.getConfiguration();
|
|
21729
|
+
if (config.system.enableLegacyPolling) {
|
|
21730
|
+
return waitForIframePollingResponse(config, controller.getLogger(), controller.getPerformanceClient(), iframe, request);
|
|
21731
|
+
}
|
|
20625
21732
|
return waitForBridgeResponse(config.system.iframeBridgeTimeout, controller.getLogger(), request, controller.getPerformanceClient(), config.experimental);
|
|
20626
21733
|
}
|
|
20627
21734
|
/**
|
|
@@ -20890,6 +21997,40 @@
|
|
|
20890
21997
|
const pca = new PublicClientApplication(configuration);
|
|
20891
21998
|
await pca.initialize();
|
|
20892
21999
|
return pca;
|
|
22000
|
+
}
|
|
22001
|
+
/**
|
|
22002
|
+
* Collects a popup auth response using the v4-style same-origin location
|
|
22003
|
+
* poller instead of the `BroadcastChannel` redirect bridge.
|
|
22004
|
+
*/
|
|
22005
|
+
async function waitForPopupPollingResponse(config, logger, performanceClient, request, popupWindow, popupWindowParent) {
|
|
22006
|
+
const responseMode = config.auth.OIDCOptions?.responseMode === ResponseMode$1.QUERY
|
|
22007
|
+
? ResponseMode$1.QUERY
|
|
22008
|
+
: ResponseMode$1.FRAGMENT;
|
|
22009
|
+
performanceClient.addFields({ usesLegacyPolling: true }, request.correlationId);
|
|
22010
|
+
const unloadHandler = () => {
|
|
22011
|
+
try {
|
|
22012
|
+
if (popupWindow && !popupWindow.closed) {
|
|
22013
|
+
popupWindow.close();
|
|
22014
|
+
}
|
|
22015
|
+
}
|
|
22016
|
+
catch {
|
|
22017
|
+
/* ignore */
|
|
22018
|
+
}
|
|
22019
|
+
};
|
|
22020
|
+
popupWindowParent.addEventListener("beforeunload", unloadHandler);
|
|
22021
|
+
return monitorPopupForHash(popupWindow, popupWindowParent, responseMode, logger, unloadHandler, request.correlationId);
|
|
22022
|
+
}
|
|
22023
|
+
/**
|
|
22024
|
+
* Collects a silent-iframe auth response using the v4-style location poller
|
|
22025
|
+
* instead of the `BroadcastChannel` redirect bridge.
|
|
22026
|
+
*/
|
|
22027
|
+
async function waitForIframePollingResponse(config, logger, performanceClient, iframe, request) {
|
|
22028
|
+
const responseMode = config.auth.OIDCOptions?.responseMode === ResponseMode$1.QUERY
|
|
22029
|
+
? ResponseMode$1.QUERY
|
|
22030
|
+
: ResponseMode$1.FRAGMENT;
|
|
22031
|
+
const iframePollTimeout = config.system.iframeBridgeTimeout;
|
|
22032
|
+
performanceClient.addFields({ usesLegacyPolling: true, iframePollTimeout }, request.correlationId);
|
|
22033
|
+
return monitorIframeForHash(iframe, iframePollTimeout, logger, request.correlationId, responseMode);
|
|
20893
22034
|
}
|
|
20894
22035
|
|
|
20895
22036
|
/*
|
|
@@ -21523,7 +22664,7 @@
|
|
|
21523
22664
|
exports.ClientAuthErrorCodes = ClientAuthErrorCodes;
|
|
21524
22665
|
exports.ClientConfigurationError = ClientConfigurationError;
|
|
21525
22666
|
exports.ClientConfigurationErrorCodes = ClientConfigurationErrorCodes;
|
|
21526
|
-
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
|
|
22667
|
+
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS$1;
|
|
21527
22668
|
exports.EventHandler = EventHandler;
|
|
21528
22669
|
exports.EventMessageUtils = EventMessageUtils;
|
|
21529
22670
|
exports.EventType = EventType;
|