@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.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v5.
|
|
1
|
+
/*! @azure/msal-browser v5.28.0 2026-11-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v16.
|
|
5
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -54,9 +54,15 @@ const EAR_JWK = "ear_jwk";
|
|
|
54
54
|
const EAR_JWE_CRYPTO = "ear_jwe_crypto";
|
|
55
55
|
const RESOURCE = "resource";
|
|
56
56
|
const CLI_DATA = "clidata";
|
|
57
|
-
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
57
|
+
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
58
|
+
/**
|
|
59
|
+
* Popup-origin-check-done. Signals to the STS that the client verified the
|
|
60
|
+
* popup cannot be reached by an untrusted window, so the
|
|
61
|
+
* Cross-Origin-Opener-Policy response header may be omitted.
|
|
62
|
+
*/
|
|
63
|
+
const POPUP_ORIGIN_CHECK_DONE = "pocd";
|
|
58
64
|
|
|
59
|
-
/*! @azure/msal-common v16.
|
|
65
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
60
66
|
/*
|
|
61
67
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
62
68
|
* Licensed under the MIT License.
|
|
@@ -295,7 +301,7 @@ const JsonWebTokenTypes$1 = {
|
|
|
295
301
|
// Token renewal offset default in seconds
|
|
296
302
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
297
303
|
|
|
298
|
-
/*! @azure/msal-common v16.
|
|
304
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
299
305
|
/*
|
|
300
306
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
301
307
|
* Licensed under the MIT License.
|
|
@@ -324,7 +330,7 @@ function createAuthError(code, correlationId, additionalMessage) {
|
|
|
324
330
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
|
|
325
331
|
}
|
|
326
332
|
|
|
327
|
-
/*! @azure/msal-common v16.
|
|
333
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
328
334
|
|
|
329
335
|
/*
|
|
330
336
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -347,7 +353,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
|
|
|
347
353
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
348
354
|
}
|
|
349
355
|
|
|
350
|
-
/*! @azure/msal-common v16.
|
|
356
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
351
357
|
/*
|
|
352
358
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
353
359
|
* Licensed under the MIT License.
|
|
@@ -433,7 +439,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
433
439
|
userCanceled: userCanceled
|
|
434
440
|
});
|
|
435
441
|
|
|
436
|
-
/*! @azure/msal-common v16.
|
|
442
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
437
443
|
|
|
438
444
|
/*
|
|
439
445
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -471,7 +477,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
471
477
|
};
|
|
472
478
|
}
|
|
473
479
|
|
|
474
|
-
/*! @azure/msal-common v16.
|
|
480
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
475
481
|
|
|
476
482
|
/*
|
|
477
483
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -537,7 +543,7 @@ function getJWSPayload(authToken, correlationId) {
|
|
|
537
543
|
return matches[2];
|
|
538
544
|
}
|
|
539
545
|
|
|
540
|
-
/*! @azure/msal-common v16.
|
|
546
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
541
547
|
|
|
542
548
|
/*
|
|
543
549
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -625,7 +631,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
625
631
|
return updatedAccountInfo;
|
|
626
632
|
}
|
|
627
633
|
|
|
628
|
-
/*! @azure/msal-common v16.
|
|
634
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
629
635
|
/*
|
|
630
636
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
631
637
|
* Licensed under the MIT License.
|
|
@@ -639,7 +645,7 @@ const AuthorityType = {
|
|
|
639
645
|
Ciam: 3,
|
|
640
646
|
};
|
|
641
647
|
|
|
642
|
-
/*! @azure/msal-common v16.
|
|
648
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
643
649
|
/*
|
|
644
650
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
645
651
|
* Licensed under the MIT License.
|
|
@@ -661,7 +667,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
661
667
|
return null;
|
|
662
668
|
}
|
|
663
669
|
|
|
664
|
-
/*! @azure/msal-common v16.
|
|
670
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
665
671
|
/*
|
|
666
672
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
667
673
|
* Licensed under the MIT License.
|
|
@@ -685,7 +691,7 @@ const ProtocolMode = {
|
|
|
685
691
|
EAR: "EAR",
|
|
686
692
|
};
|
|
687
693
|
|
|
688
|
-
/*! @azure/msal-common v16.
|
|
694
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
689
695
|
/**
|
|
690
696
|
* Returns the AccountInfo interface for this account.
|
|
691
697
|
* @internal
|
|
@@ -874,7 +880,7 @@ function isAccountEntity(entity) {
|
|
|
874
880
|
entity.hasOwnProperty("authorityType"));
|
|
875
881
|
}
|
|
876
882
|
|
|
877
|
-
/*! @azure/msal-common v16.
|
|
883
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
878
884
|
/*
|
|
879
885
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
880
886
|
* Licensed under the MIT License.
|
|
@@ -891,7 +897,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
891
897
|
unexpectedError: unexpectedError
|
|
892
898
|
});
|
|
893
899
|
|
|
894
|
-
/*! @azure/msal-common v16.
|
|
900
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
895
901
|
|
|
896
902
|
/*
|
|
897
903
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -911,7 +917,47 @@ function createClientConfigurationError(errorCode, correlationId) {
|
|
|
911
917
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
912
918
|
}
|
|
913
919
|
|
|
914
|
-
/*! @azure/msal-common v16.
|
|
920
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
921
|
+
/*
|
|
922
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
923
|
+
* Licensed under the MIT License.
|
|
924
|
+
*/
|
|
925
|
+
// Track only our normalized copies, never caller-owned mutable inputs.
|
|
926
|
+
const normalizedHeaderRecords = new WeakSet();
|
|
927
|
+
/**
|
|
928
|
+
* Creates a lowercase-keyed snapshot without changing header values or the input.
|
|
929
|
+
* Reuses snapshots produced by this function to avoid repeated normalization.
|
|
930
|
+
* @internal
|
|
931
|
+
*/
|
|
932
|
+
function normalizeResponseHeaders(headers) {
|
|
933
|
+
if (normalizedHeaderRecords.has(headers)) {
|
|
934
|
+
return headers;
|
|
935
|
+
}
|
|
936
|
+
const normalized = Object.fromEntries(Object.entries(headers).map(([name, value]) => [
|
|
937
|
+
name.toLowerCase(),
|
|
938
|
+
value,
|
|
939
|
+
]));
|
|
940
|
+
normalizedHeaderRecords.add(normalized);
|
|
941
|
+
return normalized;
|
|
942
|
+
}
|
|
943
|
+
/**
|
|
944
|
+
* Reads a response header case-insensitively.
|
|
945
|
+
* Normalized snapshots are never scanned, even when a header is missing.
|
|
946
|
+
* @internal
|
|
947
|
+
*/
|
|
948
|
+
function getResponseHeader(headers, name) {
|
|
949
|
+
const key = name.toLowerCase();
|
|
950
|
+
if (Object.prototype.hasOwnProperty.call(headers, key)) {
|
|
951
|
+
return headers[key];
|
|
952
|
+
}
|
|
953
|
+
if (normalizedHeaderRecords.has(headers)) {
|
|
954
|
+
return undefined;
|
|
955
|
+
}
|
|
956
|
+
const headerName = Object.keys(headers).find((header) => header.toLowerCase() === key);
|
|
957
|
+
return headerName === undefined ? undefined : headers[headerName];
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
915
961
|
/*
|
|
916
962
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
917
963
|
* Licensed under the MIT License.
|
|
@@ -981,7 +1027,7 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
981
1027
|
urlParseError: urlParseError
|
|
982
1028
|
});
|
|
983
1029
|
|
|
984
|
-
/*! @azure/msal-common v16.
|
|
1030
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
985
1031
|
|
|
986
1032
|
/*
|
|
987
1033
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -992,8 +1038,9 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
992
1038
|
* header challenge values that can be used outside the basic authorization flows.
|
|
993
1039
|
*/
|
|
994
1040
|
class AuthenticationHeaderParser {
|
|
1041
|
+
/** Captures a case-insensitive snapshot of the response headers. */
|
|
995
1042
|
constructor(headers) {
|
|
996
|
-
this.headers = headers;
|
|
1043
|
+
this.headers = normalizeResponseHeaders(headers);
|
|
997
1044
|
}
|
|
998
1045
|
/**
|
|
999
1046
|
* This method parses the SHR nonce value out of either the Authentication-Info or WWW-Authenticate authentication headers.
|
|
@@ -1001,7 +1048,7 @@ class AuthenticationHeaderParser {
|
|
|
1001
1048
|
*/
|
|
1002
1049
|
getShrNonce() {
|
|
1003
1050
|
// Attempt to parse nonce from Authentiacation-Info
|
|
1004
|
-
const authenticationInfo = this.headers
|
|
1051
|
+
const authenticationInfo = getResponseHeader(this.headers, HeaderNames.AuthenticationInfo);
|
|
1005
1052
|
if (authenticationInfo) {
|
|
1006
1053
|
const authenticationInfoChallenges = this.parseChallenges(authenticationInfo);
|
|
1007
1054
|
if (authenticationInfoChallenges.nextnonce) {
|
|
@@ -1010,7 +1057,7 @@ class AuthenticationHeaderParser {
|
|
|
1010
1057
|
throw createClientConfigurationError(invalidAuthenticationHeader, "");
|
|
1011
1058
|
}
|
|
1012
1059
|
// Attempt to parse nonce from WWW-Authenticate
|
|
1013
|
-
const wwwAuthenticate = this.headers
|
|
1060
|
+
const wwwAuthenticate = getResponseHeader(this.headers, HeaderNames.WWWAuthenticate);
|
|
1014
1061
|
if (wwwAuthenticate) {
|
|
1015
1062
|
const wwwAuthenticateChallenges = this.parseChallenges(wwwAuthenticate);
|
|
1016
1063
|
if (wwwAuthenticateChallenges.nonce) {
|
|
@@ -1039,7 +1086,7 @@ class AuthenticationHeaderParser {
|
|
|
1039
1086
|
}
|
|
1040
1087
|
}
|
|
1041
1088
|
|
|
1042
|
-
/*! @azure/msal-common v16.
|
|
1089
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1043
1090
|
/*
|
|
1044
1091
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1045
1092
|
* Licensed under the MIT License.
|
|
@@ -1051,7 +1098,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
1051
1098
|
response.hasOwnProperty("jwks_uri"));
|
|
1052
1099
|
}
|
|
1053
1100
|
|
|
1054
|
-
/*! @azure/msal-common v16.
|
|
1101
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1055
1102
|
/*
|
|
1056
1103
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1057
1104
|
* Licensed under the MIT License.
|
|
@@ -1131,7 +1178,7 @@ class StringUtils {
|
|
|
1131
1178
|
}
|
|
1132
1179
|
}
|
|
1133
1180
|
|
|
1134
|
-
/*! @azure/msal-common v16.
|
|
1181
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1135
1182
|
|
|
1136
1183
|
/*
|
|
1137
1184
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1289,7 +1336,7 @@ class UrlString {
|
|
|
1289
1336
|
}
|
|
1290
1337
|
}
|
|
1291
1338
|
|
|
1292
|
-
/*! @azure/msal-common v16.
|
|
1339
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1293
1340
|
|
|
1294
1341
|
/*
|
|
1295
1342
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1443,7 +1490,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
1443
1490
|
return null;
|
|
1444
1491
|
}
|
|
1445
1492
|
|
|
1446
|
-
/*! @azure/msal-common v16.
|
|
1493
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1447
1494
|
/*
|
|
1448
1495
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1449
1496
|
* Licensed under the MIT License.
|
|
@@ -1461,7 +1508,7 @@ const AzureCloudInstance = {
|
|
|
1461
1508
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1462
1509
|
};
|
|
1463
1510
|
|
|
1464
|
-
/*! @azure/msal-common v16.
|
|
1511
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1465
1512
|
/*
|
|
1466
1513
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1467
1514
|
* Licensed under the MIT License.
|
|
@@ -1471,7 +1518,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
1471
1518
|
response.hasOwnProperty("metadata"));
|
|
1472
1519
|
}
|
|
1473
1520
|
|
|
1474
|
-
/*! @azure/msal-common v16.
|
|
1521
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1475
1522
|
/*
|
|
1476
1523
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1477
1524
|
* Licensed under the MIT License.
|
|
@@ -1481,7 +1528,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
1481
1528
|
response.hasOwnProperty("error_description"));
|
|
1482
1529
|
}
|
|
1483
1530
|
|
|
1484
|
-
/*! @azure/msal-common v16.
|
|
1531
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1485
1532
|
/*
|
|
1486
1533
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1487
1534
|
* Licensed under the MIT License.
|
|
@@ -1552,7 +1599,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
|
|
|
1552
1599
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1553
1600
|
const SetUserData = "setUserData";
|
|
1554
1601
|
|
|
1555
|
-
/*! @azure/msal-common v16.
|
|
1602
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1556
1603
|
/*
|
|
1557
1604
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1558
1605
|
* Licensed under the MIT License.
|
|
@@ -1645,7 +1692,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
1645
1692
|
};
|
|
1646
1693
|
};
|
|
1647
1694
|
|
|
1648
|
-
/*! @azure/msal-common v16.
|
|
1695
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1649
1696
|
|
|
1650
1697
|
/*
|
|
1651
1698
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1756,7 +1803,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
1756
1803
|
},
|
|
1757
1804
|
};
|
|
1758
1805
|
|
|
1759
|
-
/*! @azure/msal-common v16.
|
|
1806
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1760
1807
|
/*
|
|
1761
1808
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1762
1809
|
* Licensed under the MIT License.
|
|
@@ -1821,7 +1868,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1821
1868
|
return cachedAtSec > nowSeconds();
|
|
1822
1869
|
}
|
|
1823
1870
|
|
|
1824
|
-
/*! @azure/msal-common v16.
|
|
1871
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1825
1872
|
|
|
1826
1873
|
/*
|
|
1827
1874
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2108,7 +2155,7 @@ function serializeAttributeTokens(attributeTokens) {
|
|
|
2108
2155
|
return [...attributeTokens].sort().join(" ");
|
|
2109
2156
|
}
|
|
2110
2157
|
|
|
2111
|
-
/*! @azure/msal-common v16.
|
|
2158
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
2112
2159
|
|
|
2113
2160
|
/*
|
|
2114
2161
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3076,7 +3123,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
3076
3123
|
};
|
|
3077
3124
|
}
|
|
3078
3125
|
|
|
3079
|
-
/*! @azure/msal-common v16.
|
|
3126
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3080
3127
|
|
|
3081
3128
|
/*
|
|
3082
3129
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3110,7 +3157,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
3110
3157
|
}
|
|
3111
3158
|
}
|
|
3112
3159
|
|
|
3113
|
-
/*! @azure/msal-common v16.
|
|
3160
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3114
3161
|
|
|
3115
3162
|
/*
|
|
3116
3163
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3306,7 +3353,7 @@ class ScopeSet {
|
|
|
3306
3353
|
}
|
|
3307
3354
|
}
|
|
3308
3355
|
|
|
3309
|
-
/*! @azure/msal-common v16.
|
|
3356
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3310
3357
|
|
|
3311
3358
|
/*
|
|
3312
3359
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3587,6 +3634,20 @@ function addInstanceAware(parameters) {
|
|
|
3587
3634
|
parameters.set(INSTANCE_AWARE, "true");
|
|
3588
3635
|
}
|
|
3589
3636
|
}
|
|
3637
|
+
/**
|
|
3638
|
+
* Adds `pocd=1`, telling the STS that the client verified the popup driving
|
|
3639
|
+
* this request cannot be reached by an untrusted window, so the
|
|
3640
|
+
* Cross-Origin-Opener-Policy response header may be omitted.
|
|
3641
|
+
*
|
|
3642
|
+
* Only ever added when the check passed — a negative result is signalled by
|
|
3643
|
+
* omitting the parameter, which keeps the STS default (apply COOP) and stays
|
|
3644
|
+
* compatible with library versions that never send it.
|
|
3645
|
+
*/
|
|
3646
|
+
function addPopupOriginCheckDone(parameters) {
|
|
3647
|
+
if (!parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
|
|
3648
|
+
parameters.set(POPUP_ORIGIN_CHECK_DONE, "1");
|
|
3649
|
+
}
|
|
3650
|
+
}
|
|
3590
3651
|
/**
|
|
3591
3652
|
* Add extraParameters
|
|
3592
3653
|
* @param extraParams - String dictionary containing extra parameters to be added.
|
|
@@ -3792,7 +3853,7 @@ function addAttributeTokens(parameters, attributeTokens) {
|
|
|
3792
3853
|
}
|
|
3793
3854
|
}
|
|
3794
3855
|
|
|
3795
|
-
/*! @azure/msal-common v16.
|
|
3856
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3796
3857
|
|
|
3797
3858
|
/*
|
|
3798
3859
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3813,7 +3874,8 @@ function stripLeadingHashOrQuery(responseString) {
|
|
|
3813
3874
|
return responseString;
|
|
3814
3875
|
}
|
|
3815
3876
|
/**
|
|
3816
|
-
* Returns
|
|
3877
|
+
* Returns flat fragment or query parameters as an authorization response.
|
|
3878
|
+
* Application routes and unrecognized responses return null.
|
|
3817
3879
|
*/
|
|
3818
3880
|
function getDeserializedResponse(responseString) {
|
|
3819
3881
|
// Check if given hash is empty
|
|
@@ -3823,7 +3885,15 @@ function getDeserializedResponse(responseString) {
|
|
|
3823
3885
|
try {
|
|
3824
3886
|
// Strip the # or ? symbol if present
|
|
3825
3887
|
const normalizedResponse = stripLeadingHashOrQuery(responseString);
|
|
3826
|
-
|
|
3888
|
+
/*
|
|
3889
|
+
* Require a flat parameter name, not an application route.
|
|
3890
|
+
* Reject routes like #/dashboard?tab=orders&code=... and
|
|
3891
|
+
* #/dashboard/orders&state=..., where ?, /, or # appears before
|
|
3892
|
+
* the first = or &. These characters are allowed in parameter values.
|
|
3893
|
+
*/
|
|
3894
|
+
if (!/^[^=&?#/]+(?:=|&|$)/.test(normalizedResponse)) {
|
|
3895
|
+
return null;
|
|
3896
|
+
}
|
|
3827
3897
|
const deserializedHash = Object.fromEntries(new URLSearchParams(normalizedResponse));
|
|
3828
3898
|
// Check for known response properties
|
|
3829
3899
|
if (deserializedHash.code ||
|
|
@@ -3914,7 +3984,7 @@ function validateUrl(url, logger, correlationId) {
|
|
|
3914
3984
|
}
|
|
3915
3985
|
}
|
|
3916
3986
|
|
|
3917
|
-
/*! @azure/msal-common v16.
|
|
3987
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3918
3988
|
|
|
3919
3989
|
/*
|
|
3920
3990
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3962,7 +4032,7 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
3962
4032
|
},
|
|
3963
4033
|
};
|
|
3964
4034
|
|
|
3965
|
-
/*! @azure/msal-common v16.
|
|
4035
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3966
4036
|
|
|
3967
4037
|
/*
|
|
3968
4038
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3985,7 +4055,7 @@ const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
|
|
|
3985
4055
|
},
|
|
3986
4056
|
};
|
|
3987
4057
|
|
|
3988
|
-
/*! @azure/msal-common v16.
|
|
4058
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3989
4059
|
/*
|
|
3990
4060
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3991
4061
|
* Licensed under the MIT License.
|
|
@@ -4274,12 +4344,12 @@ class Logger {
|
|
|
4274
4344
|
}
|
|
4275
4345
|
}
|
|
4276
4346
|
|
|
4277
|
-
/*! @azure/msal-common v16.
|
|
4347
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4278
4348
|
/* eslint-disable header/header */
|
|
4279
4349
|
const name$1 = "@azure/msal-common";
|
|
4280
|
-
const version$1 = "16.
|
|
4350
|
+
const version$1 = "16.16.0";
|
|
4281
4351
|
|
|
4282
|
-
/*! @azure/msal-common v16.
|
|
4352
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4283
4353
|
/*
|
|
4284
4354
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4285
4355
|
* Licensed under the MIT License.
|
|
@@ -4287,7 +4357,7 @@ const version$1 = "16.14.3";
|
|
|
4287
4357
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4288
4358
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4289
4359
|
|
|
4290
|
-
/*! @azure/msal-common v16.
|
|
4360
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4291
4361
|
|
|
4292
4362
|
/*
|
|
4293
4363
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4325,7 +4395,7 @@ function createCacheError(e) {
|
|
|
4325
4395
|
}
|
|
4326
4396
|
}
|
|
4327
4397
|
|
|
4328
|
-
/*! @azure/msal-common v16.
|
|
4398
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4329
4399
|
|
|
4330
4400
|
/*
|
|
4331
4401
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4574,6 +4644,7 @@ class CacheManager {
|
|
|
4574
4644
|
};
|
|
4575
4645
|
const tokenKeys = this.getTokenKeys();
|
|
4576
4646
|
const currentScopes = ScopeSet.fromString(credential.target, correlationId);
|
|
4647
|
+
const accessTokenKeysToRemove = [];
|
|
4577
4648
|
tokenKeys.accessToken.forEach((key) => {
|
|
4578
4649
|
if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
|
|
4579
4650
|
return;
|
|
@@ -4583,10 +4654,13 @@ class CacheManager {
|
|
|
4583
4654
|
this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
|
|
4584
4655
|
const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
|
|
4585
4656
|
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
|
|
4586
|
-
|
|
4657
|
+
accessTokenKeysToRemove.push(key);
|
|
4587
4658
|
}
|
|
4588
4659
|
}
|
|
4589
4660
|
});
|
|
4661
|
+
for (const key of accessTokenKeysToRemove) {
|
|
4662
|
+
await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
|
|
4663
|
+
}
|
|
4590
4664
|
await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
|
|
4591
4665
|
}
|
|
4592
4666
|
/**
|
|
@@ -4822,12 +4896,32 @@ class CacheManager {
|
|
|
4822
4896
|
* @param correlationId
|
|
4823
4897
|
*/
|
|
4824
4898
|
removeAccessToken(key, correlationId) {
|
|
4899
|
+
const credential = this.removeAccessTokenCredential(key, correlationId);
|
|
4900
|
+
if (credential) {
|
|
4901
|
+
void this.removeTokenBindingKeyForCredential(credential, correlationId);
|
|
4902
|
+
}
|
|
4903
|
+
}
|
|
4904
|
+
/**
|
|
4905
|
+
* Removes an access token and waits for any unreferenced token-binding key
|
|
4906
|
+
* cleanup. Internal callers that require deterministic cleanup should use
|
|
4907
|
+
* this method instead of the synchronous public cache contract.
|
|
4908
|
+
*/
|
|
4909
|
+
async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId) {
|
|
4910
|
+
const credential = this.removeAccessTokenCredential(key, correlationId);
|
|
4911
|
+
if (credential) {
|
|
4912
|
+
await this.removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId);
|
|
4913
|
+
}
|
|
4914
|
+
}
|
|
4915
|
+
removeAccessTokenCredential(key, correlationId) {
|
|
4825
4916
|
const credential = this.getAccessTokenCredential(key, correlationId);
|
|
4826
4917
|
if (!credential) {
|
|
4827
|
-
return;
|
|
4918
|
+
return null;
|
|
4828
4919
|
}
|
|
4829
4920
|
this.removeItem(key, correlationId);
|
|
4830
4921
|
this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
|
|
4922
|
+
return credential;
|
|
4923
|
+
}
|
|
4924
|
+
async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
|
|
4831
4925
|
// Remove Token Binding Key from key store for token-bound access token credentials
|
|
4832
4926
|
if (credential.credentialType.toLowerCase() ===
|
|
4833
4927
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
|
|
@@ -4837,19 +4931,28 @@ class CacheManager {
|
|
|
4837
4931
|
case AuthenticationScheme$1.DPOP.toLowerCase(): {
|
|
4838
4932
|
const accessTokenWithAuthSchemeEntity = credential;
|
|
4839
4933
|
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
4840
|
-
if (kid
|
|
4841
|
-
|
|
4842
|
-
|
|
4843
|
-
|
|
4934
|
+
if (kid &&
|
|
4935
|
+
kid !== preservedKeyId &&
|
|
4936
|
+
!this.isTokenBindingKeyReferenced(kid, correlationId)) {
|
|
4937
|
+
try {
|
|
4938
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
|
|
4939
|
+
}
|
|
4940
|
+
catch {
|
|
4844
4941
|
this.commonLogger.error("0id34f", correlationId);
|
|
4845
4942
|
this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
|
|
4846
|
-
}
|
|
4943
|
+
}
|
|
4847
4944
|
}
|
|
4848
4945
|
break;
|
|
4849
4946
|
}
|
|
4850
4947
|
}
|
|
4851
4948
|
}
|
|
4852
4949
|
}
|
|
4950
|
+
isTokenBindingKeyReferenced(keyId, correlationId) {
|
|
4951
|
+
return this.getTokenKeys().accessToken.some((accessTokenKey) => {
|
|
4952
|
+
const accessToken = this.getAccessTokenCredential(accessTokenKey, correlationId);
|
|
4953
|
+
return accessToken?.keyId === keyId;
|
|
4954
|
+
});
|
|
4955
|
+
}
|
|
4853
4956
|
/**
|
|
4854
4957
|
* Removes all app metadata objects from cache.
|
|
4855
4958
|
*/
|
|
@@ -4988,6 +5091,7 @@ class CacheManager {
|
|
|
4988
5091
|
const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
|
|
4989
5092
|
const authScheme = request.authenticationScheme ||
|
|
4990
5093
|
AuthenticationScheme$1.BEARER;
|
|
5094
|
+
const normalizedAuthScheme = authScheme.toLowerCase();
|
|
4991
5095
|
/*
|
|
4992
5096
|
* Distinguish between Bearer and PoP/SSH token cache types
|
|
4993
5097
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
@@ -5013,7 +5117,10 @@ class CacheManager {
|
|
|
5013
5117
|
tokenType: authScheme,
|
|
5014
5118
|
keyId: authScheme === AuthenticationScheme$1.SSH
|
|
5015
5119
|
? request.sshKid
|
|
5016
|
-
:
|
|
5120
|
+
: normalizedAuthScheme ===
|
|
5121
|
+
AuthenticationScheme$1.DPOP.toLowerCase()
|
|
5122
|
+
? request.popKid || request.dpopJkt
|
|
5123
|
+
: undefined,
|
|
5017
5124
|
additionalCacheKeyComponents: additionalCacheKeyComponents,
|
|
5018
5125
|
};
|
|
5019
5126
|
const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
|
|
@@ -5513,7 +5620,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5513
5620
|
}
|
|
5514
5621
|
}
|
|
5515
5622
|
|
|
5516
|
-
/*! @azure/msal-common v16.
|
|
5623
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5517
5624
|
/*
|
|
5518
5625
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5519
5626
|
* Licensed under the MIT License.
|
|
@@ -5578,7 +5685,7 @@ const IntFields = new Set([
|
|
|
5578
5685
|
"fetchRetryCount",
|
|
5579
5686
|
]);
|
|
5580
5687
|
|
|
5581
|
-
/*! @azure/msal-common v16.
|
|
5688
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5582
5689
|
|
|
5583
5690
|
/*
|
|
5584
5691
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5636,7 +5743,7 @@ class StubPerformanceClient {
|
|
|
5636
5743
|
}
|
|
5637
5744
|
}
|
|
5638
5745
|
|
|
5639
|
-
/*! @azure/msal-common v16.
|
|
5746
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5640
5747
|
|
|
5641
5748
|
/*
|
|
5642
5749
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5734,7 +5841,7 @@ function isOidcProtocolMode(config) {
|
|
|
5734
5841
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5735
5842
|
}
|
|
5736
5843
|
|
|
5737
|
-
/*! @azure/msal-common v16.
|
|
5844
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5738
5845
|
/*
|
|
5739
5846
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5740
5847
|
* Licensed under the MIT License.
|
|
@@ -5761,7 +5868,7 @@ function isOidcProtocolMode(config) {
|
|
|
5761
5868
|
}
|
|
5762
5869
|
}
|
|
5763
5870
|
|
|
5764
|
-
/*! @azure/msal-common v16.
|
|
5871
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5765
5872
|
|
|
5766
5873
|
/*
|
|
5767
5874
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5782,7 +5889,7 @@ function createJoseHeaderError(code, correlationId) {
|
|
|
5782
5889
|
return new JoseHeaderError(code, correlationId);
|
|
5783
5890
|
}
|
|
5784
5891
|
|
|
5785
|
-
/*! @azure/msal-common v16.
|
|
5892
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5786
5893
|
/*
|
|
5787
5894
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5788
5895
|
* Licensed under the MIT License.
|
|
@@ -5807,7 +5914,7 @@ function isPlainObject(value) {
|
|
|
5807
5914
|
return Object.getPrototypeOf(value) === proto;
|
|
5808
5915
|
}
|
|
5809
5916
|
|
|
5810
|
-
/*! @azure/msal-common v16.
|
|
5917
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5811
5918
|
/*
|
|
5812
5919
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5813
5920
|
* Licensed under the MIT License.
|
|
@@ -5817,7 +5924,7 @@ const missingAlgError = "missing_alg_error";
|
|
|
5817
5924
|
const missingJwkError = "missing_jwk_error";
|
|
5818
5925
|
const invalidJwkError = "invalid_jwk_error";
|
|
5819
5926
|
|
|
5820
|
-
/*! @azure/msal-common v16.
|
|
5927
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5821
5928
|
|
|
5822
5929
|
/*
|
|
5823
5930
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5883,7 +5990,7 @@ class JoseHeader {
|
|
|
5883
5990
|
}
|
|
5884
5991
|
}
|
|
5885
5992
|
|
|
5886
|
-
/*! @azure/msal-common v16.
|
|
5993
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5887
5994
|
|
|
5888
5995
|
/*
|
|
5889
5996
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5984,7 +6091,7 @@ class PopTokenGenerator {
|
|
|
5984
6091
|
}
|
|
5985
6092
|
}
|
|
5986
6093
|
|
|
5987
|
-
/*! @azure/msal-common v16.
|
|
6094
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5988
6095
|
|
|
5989
6096
|
/*
|
|
5990
6097
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6034,13 +6141,22 @@ function validateDpopNonce(nonce, correlationId) {
|
|
|
6034
6141
|
throw createClientConfigurationError(invalidDpopNonce, correlationId);
|
|
6035
6142
|
}
|
|
6036
6143
|
}
|
|
6144
|
+
/**
|
|
6145
|
+
* Validates and normalizes the HTTP resource context for a DPoP-bound request.
|
|
6146
|
+
* @internal
|
|
6147
|
+
*/
|
|
6148
|
+
function normalizeDpopResourceRequestContext(context, correlationId = "") {
|
|
6149
|
+
return {
|
|
6150
|
+
htm: normalizeHtm(context.htm, correlationId),
|
|
6151
|
+
htu: normalizeHtu(context.htu, correlationId),
|
|
6152
|
+
};
|
|
6153
|
+
}
|
|
6037
6154
|
/**
|
|
6038
6155
|
* Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
|
|
6039
6156
|
* resource-endpoint proof bindings.
|
|
6040
6157
|
*
|
|
6041
|
-
*
|
|
6042
|
-
* This helper
|
|
6043
|
-
* in a subsequent work item.
|
|
6158
|
+
* Exported from package entry points for use by MSAL Browser.
|
|
6159
|
+
* This helper remains an unsupported internal API for direct consumers.
|
|
6044
6160
|
*
|
|
6045
6161
|
* DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
|
|
6046
6162
|
* @internal
|
|
@@ -6095,10 +6211,11 @@ class DpopProofGenerator {
|
|
|
6095
6211
|
*/
|
|
6096
6212
|
buildResourceProofClaims(params, correlationId = "") {
|
|
6097
6213
|
validateDpopNonce(params.nonce, correlationId);
|
|
6214
|
+
const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
|
|
6098
6215
|
const claims = {
|
|
6099
6216
|
jti: this.cryptoUtils.createNewGuid(),
|
|
6100
|
-
htm:
|
|
6101
|
-
htu:
|
|
6217
|
+
htm: resourceContext.htm,
|
|
6218
|
+
htu: resourceContext.htu,
|
|
6102
6219
|
ath: params.ath,
|
|
6103
6220
|
iat: nowSeconds(),
|
|
6104
6221
|
};
|
|
@@ -6129,7 +6246,7 @@ class DpopProofGenerator {
|
|
|
6129
6246
|
}
|
|
6130
6247
|
}
|
|
6131
6248
|
|
|
6132
|
-
/*! @azure/msal-common v16.
|
|
6249
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6133
6250
|
/*
|
|
6134
6251
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6135
6252
|
* Licensed under the MIT License.
|
|
@@ -6193,7 +6310,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
6193
6310
|
uiNotAllowed: uiNotAllowed
|
|
6194
6311
|
});
|
|
6195
6312
|
|
|
6196
|
-
/*! @azure/msal-common v16.
|
|
6313
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6197
6314
|
|
|
6198
6315
|
/*
|
|
6199
6316
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6260,7 +6377,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
|
|
|
6260
6377
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
6261
6378
|
}
|
|
6262
6379
|
|
|
6263
|
-
/*! @azure/msal-common v16.
|
|
6380
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6264
6381
|
|
|
6265
6382
|
/*
|
|
6266
6383
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6279,7 +6396,7 @@ class ServerError extends AuthError {
|
|
|
6279
6396
|
}
|
|
6280
6397
|
}
|
|
6281
6398
|
|
|
6282
|
-
/*! @azure/msal-common v16.
|
|
6399
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6283
6400
|
|
|
6284
6401
|
/*
|
|
6285
6402
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6350,7 +6467,7 @@ function parseRequestState(base64Decode, state, correlationId) {
|
|
|
6350
6467
|
}
|
|
6351
6468
|
}
|
|
6352
6469
|
|
|
6353
|
-
/*! @azure/msal-common v16.
|
|
6470
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6354
6471
|
|
|
6355
6472
|
/*
|
|
6356
6473
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6778,7 +6895,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
6778
6895
|
return baseAccount;
|
|
6779
6896
|
}
|
|
6780
6897
|
|
|
6781
|
-
/*! @azure/msal-common v16.
|
|
6898
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6782
6899
|
/*
|
|
6783
6900
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6784
6901
|
* Licensed under the MIT License.
|
|
@@ -6788,7 +6905,7 @@ const CcsCredentialType = {
|
|
|
6788
6905
|
UPN: "UPN",
|
|
6789
6906
|
};
|
|
6790
6907
|
|
|
6791
|
-
/*! @azure/msal-common v16.
|
|
6908
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6792
6909
|
/*
|
|
6793
6910
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6794
6911
|
* Licensed under the MIT License.
|
|
@@ -6807,7 +6924,7 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
|
|
|
6807
6924
|
}
|
|
6808
6925
|
}
|
|
6809
6926
|
|
|
6810
|
-
/*! @azure/msal-common v16.
|
|
6927
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6811
6928
|
|
|
6812
6929
|
/*
|
|
6813
6930
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6831,7 +6948,7 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
|
|
|
6831
6948
|
};
|
|
6832
6949
|
}
|
|
6833
6950
|
|
|
6834
|
-
/*! @azure/msal-common v16.
|
|
6951
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6835
6952
|
|
|
6836
6953
|
/*
|
|
6837
6954
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6866,13 +6983,14 @@ class ThrottlingUtils {
|
|
|
6866
6983
|
* Performs necessary throttling checks after a network request.
|
|
6867
6984
|
* @param cacheManager
|
|
6868
6985
|
* @param thumbprint
|
|
6869
|
-
* @param response
|
|
6986
|
+
* @param response - Token response with case-insensitive header names.
|
|
6870
6987
|
*/
|
|
6871
6988
|
static postProcess(cacheManager, thumbprint, response, correlationId) {
|
|
6989
|
+
const retryAfter = getRetryAfterHeader(response);
|
|
6872
6990
|
if (ThrottlingUtils.checkResponseStatus(response) ||
|
|
6873
|
-
|
|
6991
|
+
retryAfter !== undefined) {
|
|
6874
6992
|
const thumbprintValue = {
|
|
6875
|
-
throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(
|
|
6993
|
+
throttleTime: ThrottlingUtils.calculateThrottleTime(parseInt(retryAfter || "")),
|
|
6876
6994
|
error: response.body.error,
|
|
6877
6995
|
errorCodes: response.body.error_codes,
|
|
6878
6996
|
errorMessage: response.body.error_description,
|
|
@@ -6891,14 +7009,10 @@ class ThrottlingUtils {
|
|
|
6891
7009
|
}
|
|
6892
7010
|
/**
|
|
6893
7011
|
* Checks a NetworkResponse object's RetryAfter header
|
|
6894
|
-
* @param response
|
|
7012
|
+
* @param response - Token response with case-insensitive header names.
|
|
6895
7013
|
*/
|
|
6896
7014
|
static checkResponseForRetryAfter(response) {
|
|
6897
|
-
|
|
6898
|
-
return (response.headers.hasOwnProperty(HeaderNames.RETRY_AFTER) &&
|
|
6899
|
-
(response.status < 200 || response.status >= 300));
|
|
6900
|
-
}
|
|
6901
|
-
return false;
|
|
7015
|
+
return getRetryAfterHeader(response) !== undefined;
|
|
6902
7016
|
}
|
|
6903
7017
|
/**
|
|
6904
7018
|
* Calculates the Unix-time value for a throttle to expire given throttleTime in seconds.
|
|
@@ -6915,9 +7029,16 @@ class ThrottlingUtils {
|
|
|
6915
7029
|
const key = this.generateThrottlingStorageKey(thumbprint);
|
|
6916
7030
|
cacheManager.removeItem(key, request.correlationId);
|
|
6917
7031
|
}
|
|
7032
|
+
}
|
|
7033
|
+
/** Reads Retry-After only for non-success responses. */
|
|
7034
|
+
function getRetryAfterHeader(response) {
|
|
7035
|
+
if ((response.status < 200 || response.status >= 300) && response.headers) {
|
|
7036
|
+
return getResponseHeader(response.headers, HeaderNames.RETRY_AFTER);
|
|
7037
|
+
}
|
|
7038
|
+
return undefined;
|
|
6918
7039
|
}
|
|
6919
7040
|
|
|
6920
|
-
/*! @azure/msal-common v16.
|
|
7041
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6921
7042
|
|
|
6922
7043
|
/*
|
|
6923
7044
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6948,7 +7069,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
|
|
|
6948
7069
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6949
7070
|
}
|
|
6950
7071
|
|
|
6951
|
-
/*! @azure/msal-common v16.
|
|
7072
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6952
7073
|
|
|
6953
7074
|
/*
|
|
6954
7075
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7046,7 +7167,8 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
|
|
|
7046
7167
|
let response;
|
|
7047
7168
|
try {
|
|
7048
7169
|
response = await invokeAsync((networkClient.sendPostRequestAsync.bind(networkClient)), NetworkClientSendPostRequestAsync, logger, performanceClient, correlationId)(tokenEndpoint, { ...options, correlationId, performanceClient });
|
|
7049
|
-
const responseHeaders = response.headers || {};
|
|
7170
|
+
const responseHeaders = normalizeResponseHeaders(response.headers || {});
|
|
7171
|
+
response = { ...response, headers: responseHeaders };
|
|
7050
7172
|
performanceClient?.addFields({
|
|
7051
7173
|
refreshTokenSize: response.body.refresh_token?.length || 0,
|
|
7052
7174
|
httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] || "",
|
|
@@ -7055,16 +7177,16 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
|
|
|
7055
7177
|
}
|
|
7056
7178
|
catch (e) {
|
|
7057
7179
|
if (e instanceof NetworkError) {
|
|
7058
|
-
const responseHeaders = e.responseHeaders
|
|
7180
|
+
const responseHeaders = e.responseHeaders
|
|
7181
|
+
? normalizeResponseHeaders(e.responseHeaders)
|
|
7182
|
+
: undefined;
|
|
7059
7183
|
if (responseHeaders) {
|
|
7060
7184
|
performanceClient?.addFields({
|
|
7061
7185
|
httpVerToken: responseHeaders[HeaderNames.X_MS_HTTP_VERSION] ||
|
|
7062
7186
|
"",
|
|
7063
7187
|
requestId: responseHeaders[HeaderNames.X_MS_REQUEST_ID] || "",
|
|
7064
|
-
contentTypeHeader: responseHeaders
|
|
7065
|
-
|
|
7066
|
-
contentLengthHeader: responseHeaders[HeaderNames.CONTENT_LENGTH] ||
|
|
7067
|
-
undefined,
|
|
7188
|
+
contentTypeHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_TYPE) || undefined,
|
|
7189
|
+
contentLengthHeader: getResponseHeader(responseHeaders, HeaderNames.CONTENT_LENGTH) || undefined,
|
|
7068
7190
|
httpStatus: e.httpStatus,
|
|
7069
7191
|
}, correlationId);
|
|
7070
7192
|
}
|
|
@@ -7081,7 +7203,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
|
|
|
7081
7203
|
return response;
|
|
7082
7204
|
}
|
|
7083
7205
|
|
|
7084
|
-
/*! @azure/msal-common v16.
|
|
7206
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7085
7207
|
|
|
7086
7208
|
/*
|
|
7087
7209
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7325,6 +7447,9 @@ class AuthorizationCodeClient {
|
|
|
7325
7447
|
if (request.logoutHint) {
|
|
7326
7448
|
addLogoutHint(parameters, request.logoutHint);
|
|
7327
7449
|
}
|
|
7450
|
+
if (request.popupOriginCheckDone) {
|
|
7451
|
+
addPopupOriginCheckDone(parameters);
|
|
7452
|
+
}
|
|
7328
7453
|
if (request.extraQueryParameters) {
|
|
7329
7454
|
addExtraParameters(parameters, request.extraQueryParameters);
|
|
7330
7455
|
}
|
|
@@ -7345,7 +7470,7 @@ class AuthorizationCodeClient {
|
|
|
7345
7470
|
}
|
|
7346
7471
|
}
|
|
7347
7472
|
|
|
7348
|
-
/*! @azure/msal-common v16.
|
|
7473
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7349
7474
|
|
|
7350
7475
|
/*
|
|
7351
7476
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7480,6 +7605,9 @@ function getStandardAuthorizeRequestParameters(authOptions, request, logger, per
|
|
|
7480
7605
|
!Object.keys(request.extraQueryParameters).includes(INSTANCE_AWARE))) {
|
|
7481
7606
|
addInstanceAware(parameters);
|
|
7482
7607
|
}
|
|
7608
|
+
if (request.popupOriginCheckDone) {
|
|
7609
|
+
addPopupOriginCheckDone(parameters);
|
|
7610
|
+
}
|
|
7483
7611
|
return parameters;
|
|
7484
7612
|
}
|
|
7485
7613
|
/**
|
|
@@ -7572,7 +7700,7 @@ function extractLoginHint(account) {
|
|
|
7572
7700
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
7573
7701
|
}
|
|
7574
7702
|
|
|
7575
|
-
/*! @azure/msal-common v16.
|
|
7703
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7576
7704
|
|
|
7577
7705
|
/*
|
|
7578
7706
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8121,7 +8249,7 @@ class PerformanceClient {
|
|
|
8121
8249
|
}
|
|
8122
8250
|
}
|
|
8123
8251
|
|
|
8124
|
-
/*! @azure/msal-common v16.
|
|
8252
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8125
8253
|
|
|
8126
8254
|
/*
|
|
8127
8255
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8356,7 +8484,7 @@ class RefreshTokenClient {
|
|
|
8356
8484
|
}
|
|
8357
8485
|
}
|
|
8358
8486
|
|
|
8359
|
-
/*! @azure/msal-common v16.
|
|
8487
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8360
8488
|
|
|
8361
8489
|
/*
|
|
8362
8490
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8649,7 +8777,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
|
|
|
8649
8777
|
clearNativeBrokerErrorCode() { }
|
|
8650
8778
|
}
|
|
8651
8779
|
|
|
8652
|
-
/*! @azure/msal-common v16.
|
|
8780
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8653
8781
|
|
|
8654
8782
|
/*
|
|
8655
8783
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8776,7 +8904,7 @@ class SilentFlowClient {
|
|
|
8776
8904
|
}
|
|
8777
8905
|
}
|
|
8778
8906
|
|
|
8779
|
-
/*! @azure/msal-common v16.
|
|
8907
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8780
8908
|
|
|
8781
8909
|
/*
|
|
8782
8910
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8792,7 +8920,7 @@ const StubbedNetworkModule = {
|
|
|
8792
8920
|
},
|
|
8793
8921
|
};
|
|
8794
8922
|
|
|
8795
|
-
/*! @azure/msal-common v16.
|
|
8923
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8796
8924
|
|
|
8797
8925
|
/*
|
|
8798
8926
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8941,6 +9069,7 @@ const PlatformAuthInteractionClientInitializeRequest = "platformAuthInteractionC
|
|
|
8941
9069
|
const PlatformAuthHandleNativeResponse = "platformAuthHandleNativeResponse";
|
|
8942
9070
|
const PlatformAuthCacheAccount = "platformAuthCacheAccount";
|
|
8943
9071
|
const PlatformAuthCacheNativeTokens = "platformAuthCacheNativeTokens";
|
|
9072
|
+
const PlatformAuthDpopKeyCleanup = "platformAuthDpopKeyCleanup";
|
|
8944
9073
|
const RemoveHiddenIframe = "removeHiddenIframe";
|
|
8945
9074
|
const ImportExistingCache = "importExistingCache";
|
|
8946
9075
|
/**
|
|
@@ -9870,9 +9999,14 @@ function parseAuthResponseFromUrl() {
|
|
|
9870
9999
|
};
|
|
9871
10000
|
}
|
|
9872
10001
|
/**
|
|
9873
|
-
* Clears
|
|
10002
|
+
* Clears a recognized authentication response fragment, preserving the query string.
|
|
10003
|
+
* Assigns an empty hash, then removes the trailing # when history updates are available.
|
|
9874
10004
|
*/
|
|
9875
10005
|
function clearHash(contentWindow) {
|
|
10006
|
+
const serverParams = getDeserializedResponse(contentWindow.location.hash);
|
|
10007
|
+
if (!serverParams) {
|
|
10008
|
+
return;
|
|
10009
|
+
}
|
|
9876
10010
|
// Office.js sets history.replaceState to null
|
|
9877
10011
|
contentWindow.location.hash = "";
|
|
9878
10012
|
if (typeof contentWindow.history.replaceState === "function") {
|
|
@@ -10496,6 +10630,19 @@ class AsyncMemoryStorage {
|
|
|
10496
10630
|
return cacheKeys;
|
|
10497
10631
|
}
|
|
10498
10632
|
}
|
|
10633
|
+
/**
|
|
10634
|
+
* Returns whether a key is available in persistent storage. Unlike
|
|
10635
|
+
* containsKey, this does not consult the in-memory fallback.
|
|
10636
|
+
*/
|
|
10637
|
+
async containsKeyInPersistentStorage(key, correlationId) {
|
|
10638
|
+
try {
|
|
10639
|
+
return await this.indexedDBCache.containsKey(key);
|
|
10640
|
+
}
|
|
10641
|
+
catch (e) {
|
|
10642
|
+
this.handleDatabaseAccessError(e, correlationId);
|
|
10643
|
+
return false;
|
|
10644
|
+
}
|
|
10645
|
+
}
|
|
10499
10646
|
/**
|
|
10500
10647
|
* Returns true or false if the given key is present in the cache.
|
|
10501
10648
|
* @param key
|
|
@@ -10601,6 +10748,12 @@ class TokenBindingKeyManager {
|
|
|
10601
10748
|
throw createClientAuthError(bindingKeyNotRemoved, correlationId);
|
|
10602
10749
|
}
|
|
10603
10750
|
}
|
|
10751
|
+
/**
|
|
10752
|
+
* Returns whether a browser token-binding key is available.
|
|
10753
|
+
*/
|
|
10754
|
+
async hasTokenBindingKey(keyId, correlationId) {
|
|
10755
|
+
return this.cache.containsKey(keyId, correlationId);
|
|
10756
|
+
}
|
|
10604
10757
|
/**
|
|
10605
10758
|
* Clears browser token-binding keys from memory and persistent storage.
|
|
10606
10759
|
* @param correlationId - Request correlation identifier.
|
|
@@ -10662,6 +10815,13 @@ class TokenBindingKeyManager {
|
|
|
10662
10815
|
}
|
|
10663
10816
|
return cachedKeyPair;
|
|
10664
10817
|
}
|
|
10818
|
+
/**
|
|
10819
|
+
* Returns whether a browser token-binding key survived in persistent
|
|
10820
|
+
* storage and can be restored after a redirect navigation.
|
|
10821
|
+
*/
|
|
10822
|
+
async isTokenBindingKeyPersisted(keyId, correlationId) {
|
|
10823
|
+
return this.cache.containsKeyInPersistentStorage(keyId, correlationId);
|
|
10824
|
+
}
|
|
10665
10825
|
/** @internal */
|
|
10666
10826
|
getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
|
|
10667
10827
|
return {
|
|
@@ -11495,7 +11655,7 @@ const EventType = {
|
|
|
11495
11655
|
|
|
11496
11656
|
/* eslint-disable header/header */
|
|
11497
11657
|
const name = "@azure/msal-browser";
|
|
11498
|
-
const version = "5.
|
|
11658
|
+
const version = "5.28.0";
|
|
11499
11659
|
|
|
11500
11660
|
/*
|
|
11501
11661
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -12127,7 +12287,7 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12127
12287
|
throw cacheError;
|
|
12128
12288
|
}
|
|
12129
12289
|
// When cache quota is exceeded, start removing access tokens until we can successfully set the item
|
|
12130
|
-
this.
|
|
12290
|
+
await this.removeAccessTokenAndTokenBindingKey(accessTokenKeys[i], correlationId, undefined, false // Don't save token keys yet, do it at the end
|
|
12131
12291
|
);
|
|
12132
12292
|
}
|
|
12133
12293
|
else {
|
|
@@ -12269,6 +12429,13 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12269
12429
|
super.removeAccessToken(key, correlationId);
|
|
12270
12430
|
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
|
|
12271
12431
|
}
|
|
12432
|
+
/**
|
|
12433
|
+
* Removes an access token and awaits token-binding key cleanup.
|
|
12434
|
+
*/
|
|
12435
|
+
async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId, updateTokenKeys = true) {
|
|
12436
|
+
await super.removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId);
|
|
12437
|
+
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
|
|
12438
|
+
}
|
|
12272
12439
|
/**
|
|
12273
12440
|
* Remove access token key from the key map
|
|
12274
12441
|
* @param key
|
|
@@ -13003,6 +13170,116 @@ function getActiveAccount(browserStorage, correlationId) {
|
|
|
13003
13170
|
return browserStorage.getActiveAccount(correlationId);
|
|
13004
13171
|
}
|
|
13005
13172
|
|
|
13173
|
+
/*
|
|
13174
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13175
|
+
* Licensed under the MIT License.
|
|
13176
|
+
*/
|
|
13177
|
+
const POPUP_POLL_INTERVAL_MS = 30;
|
|
13178
|
+
let activePopupPoller;
|
|
13179
|
+
/**
|
|
13180
|
+
* Cancels legacy popup polling when an interaction is superseded.
|
|
13181
|
+
*
|
|
13182
|
+
* @internal
|
|
13183
|
+
* @param logger Logger for the interaction.
|
|
13184
|
+
*/
|
|
13185
|
+
function cancelPendingPopupPollingResponse(logger) {
|
|
13186
|
+
if (activePopupPoller) {
|
|
13187
|
+
logger.verbose("0g9n3p", activePopupPoller.correlationId);
|
|
13188
|
+
activePopupPoller.cancel();
|
|
13189
|
+
}
|
|
13190
|
+
}
|
|
13191
|
+
/**
|
|
13192
|
+
* Monitors a popup window for a URL change to the same origin as the parent application.
|
|
13193
|
+
* Polls the popup at a specified interval until it is redirected back to the application,
|
|
13194
|
+
* closed by the user, or a navigation to a same-origin URL is detected. Once a same-origin
|
|
13195
|
+
* URL is detected, extracts the response string (query or hash) and resolves the promise.
|
|
13196
|
+
*
|
|
13197
|
+
* @param popupWindow - The popup window to monitor for navigation.
|
|
13198
|
+
* @param popupWindowParent - The parent window that opened the popup.
|
|
13199
|
+
* @param responseMode - Response mode (`"query"` | `"fragment"`) determines whether
|
|
13200
|
+
* to read `location.search` or `location.hash` from the popup once on the same
|
|
13201
|
+
* origin. Any value other than `"query"` is treated as fragment.
|
|
13202
|
+
* @param logger - Logger instance.
|
|
13203
|
+
* @param unloadWindow - Event handler to remove from the parent window on cleanup.
|
|
13204
|
+
* @param correlationId
|
|
13205
|
+
*/
|
|
13206
|
+
async function monitorPopupForHash(popupWindow, popupWindowParent, responseMode, logger, unloadWindow, correlationId) {
|
|
13207
|
+
let poller;
|
|
13208
|
+
return new Promise((resolve, reject) => {
|
|
13209
|
+
logger.verbose("0cp91u", correlationId);
|
|
13210
|
+
const intervalId = window.setInterval(() => {
|
|
13211
|
+
if (popupWindow.closed) {
|
|
13212
|
+
logger.error("0n69wb", correlationId);
|
|
13213
|
+
window.clearInterval(intervalId);
|
|
13214
|
+
reject(new BrowserAuthError(userCancelled, correlationId));
|
|
13215
|
+
return;
|
|
13216
|
+
}
|
|
13217
|
+
let href = "";
|
|
13218
|
+
try {
|
|
13219
|
+
/*
|
|
13220
|
+
* Will throw if cross origin,
|
|
13221
|
+
* which should be caught and ignored
|
|
13222
|
+
* since we need the interval to keep running while on STS UI.
|
|
13223
|
+
*/
|
|
13224
|
+
href = popupWindow.location.href;
|
|
13225
|
+
}
|
|
13226
|
+
catch (e) { }
|
|
13227
|
+
// Don't process blank pages or cross domain
|
|
13228
|
+
if (!href || href === "about:blank") {
|
|
13229
|
+
return;
|
|
13230
|
+
}
|
|
13231
|
+
window.clearInterval(intervalId);
|
|
13232
|
+
let responseString;
|
|
13233
|
+
if (responseMode === ResponseMode$1.QUERY) {
|
|
13234
|
+
responseString = popupWindow.location.search;
|
|
13235
|
+
}
|
|
13236
|
+
else {
|
|
13237
|
+
responseString = popupWindow.location.hash;
|
|
13238
|
+
}
|
|
13239
|
+
logger.verbose("0po9er", correlationId);
|
|
13240
|
+
resolve(responseString);
|
|
13241
|
+
}, POPUP_POLL_INTERVAL_MS);
|
|
13242
|
+
poller = {
|
|
13243
|
+
correlationId,
|
|
13244
|
+
cancel: () => {
|
|
13245
|
+
window.clearInterval(intervalId);
|
|
13246
|
+
if (activePopupPoller === poller) {
|
|
13247
|
+
activePopupPoller = undefined;
|
|
13248
|
+
}
|
|
13249
|
+
reject(new BrowserAuthError(interactionInProgressCancelled, correlationId));
|
|
13250
|
+
},
|
|
13251
|
+
};
|
|
13252
|
+
activePopupPoller = poller;
|
|
13253
|
+
}).finally(() => {
|
|
13254
|
+
if (poller && activePopupPoller === poller) {
|
|
13255
|
+
activePopupPoller = undefined;
|
|
13256
|
+
}
|
|
13257
|
+
cleanPopup(popupWindow, popupWindowParent, unloadWindow);
|
|
13258
|
+
});
|
|
13259
|
+
}
|
|
13260
|
+
/**
|
|
13261
|
+
* Performs cleanup operations after popup authentication.
|
|
13262
|
+
* Strips auth-response params (code/state) from the popup URL while it is still
|
|
13263
|
+
* open, closes the popup window, and removes the 'beforeunload' event listener
|
|
13264
|
+
* from the parent window.
|
|
13265
|
+
*
|
|
13266
|
+
* @param popupWindow - The popup window to be closed.
|
|
13267
|
+
* @param popupWindowParent - The parent window from which the event listener will be removed.
|
|
13268
|
+
* @param unloadWindow - The event handler function to remove.
|
|
13269
|
+
*/
|
|
13270
|
+
function cleanPopup(popupWindow, popupWindowParent, unloadWindow) {
|
|
13271
|
+
if (!popupWindow.closed) {
|
|
13272
|
+
try {
|
|
13273
|
+
clearAuthResponseFromUrl(popupWindow);
|
|
13274
|
+
}
|
|
13275
|
+
catch {
|
|
13276
|
+
// Popup may have become cross-origin or otherwise inaccessible; ignore.
|
|
13277
|
+
}
|
|
13278
|
+
}
|
|
13279
|
+
popupWindow.close();
|
|
13280
|
+
popupWindowParent.removeEventListener("beforeunload", unloadWindow);
|
|
13281
|
+
}
|
|
13282
|
+
|
|
13006
13283
|
/*
|
|
13007
13284
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13008
13285
|
* Licensed under the MIT License.
|
|
@@ -13272,19 +13549,13 @@ function validateDpopRequest(request, correlationId) {
|
|
|
13272
13549
|
}
|
|
13273
13550
|
/**
|
|
13274
13551
|
* Resolves the token-binding parameters needed before building authorize or token requests.
|
|
13275
|
-
*
|
|
13276
|
-
*
|
|
13277
|
-
*
|
|
13552
|
+
* DPoP requests provision a browser key for token endpoint redemption. Platform broker
|
|
13553
|
+
* authorization requests retain the key for auth-code fallback but suppress dpop_jkt on
|
|
13554
|
+
* /authorize. Platform broker PoP requests use a reqCnf confirmation claim.
|
|
13278
13555
|
*/
|
|
13279
13556
|
async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
|
|
13280
13557
|
switch (request.authenticationScheme) {
|
|
13281
13558
|
case AuthenticationScheme$1.DPOP:
|
|
13282
|
-
if (request.platformBroker) {
|
|
13283
|
-
return {};
|
|
13284
|
-
}
|
|
13285
|
-
if (request.dpopJkt) {
|
|
13286
|
-
return { dpopJkt: request.dpopJkt };
|
|
13287
|
-
}
|
|
13288
13559
|
return {
|
|
13289
13560
|
dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
|
|
13290
13561
|
tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
|
|
@@ -13307,6 +13578,36 @@ async function getTokenBindingRequestParams(request, tokenBindingKeyManager, log
|
|
|
13307
13578
|
return {};
|
|
13308
13579
|
}
|
|
13309
13580
|
}
|
|
13581
|
+
/**
|
|
13582
|
+
* Removes a DPoP key that was provisioned for an authorization attempt which
|
|
13583
|
+
* did not complete. Cleanup failures are recorded without replacing the
|
|
13584
|
+
* original authorization error.
|
|
13585
|
+
*/
|
|
13586
|
+
async function removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient) {
|
|
13587
|
+
if (request.authenticationScheme !== AuthenticationScheme$1.DPOP ||
|
|
13588
|
+
!request.dpopJkt) {
|
|
13589
|
+
return;
|
|
13590
|
+
}
|
|
13591
|
+
try {
|
|
13592
|
+
await tokenBindingKeyManager.removeTokenBindingKey(request.dpopJkt, request.correlationId);
|
|
13593
|
+
}
|
|
13594
|
+
catch {
|
|
13595
|
+
logger.error("1su7ne", request.correlationId);
|
|
13596
|
+
performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, request.correlationId);
|
|
13597
|
+
}
|
|
13598
|
+
}
|
|
13599
|
+
/**
|
|
13600
|
+
* Returns whether an MSAL-owned DPoP key is available in persistent storage
|
|
13601
|
+
* before a redirect navigation. Custom managers without a persistence probe
|
|
13602
|
+
* retain their existing behavior.
|
|
13603
|
+
*/
|
|
13604
|
+
async function isTokenBindingKeyPersistedForRedirect(request, tokenBindingKeyManager) {
|
|
13605
|
+
const keyId = request.dpopJkt ?? request.keyId;
|
|
13606
|
+
if (!keyId || !tokenBindingKeyManager.isTokenBindingKeyPersisted) {
|
|
13607
|
+
return true;
|
|
13608
|
+
}
|
|
13609
|
+
return tokenBindingKeyManager.isTokenBindingKeyPersisted(keyId, request.correlationId);
|
|
13610
|
+
}
|
|
13310
13611
|
/**
|
|
13311
13612
|
* Initializer function for all request APIs
|
|
13312
13613
|
* @param request
|
|
@@ -13382,6 +13683,90 @@ function validateRequestMethod(interactionRequest, protocolMode) {
|
|
|
13382
13683
|
return httpMethod;
|
|
13383
13684
|
}
|
|
13384
13685
|
|
|
13686
|
+
/*
|
|
13687
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13688
|
+
* Licensed under the MIT License.
|
|
13689
|
+
*/
|
|
13690
|
+
/**
|
|
13691
|
+
* `window.origin` of a document with an opaque origin, e.g. one sandboxed
|
|
13692
|
+
* without `allow-same-origin`. Read from `window.origin`, not
|
|
13693
|
+
* `location.origin`, which reports the real host even when sandboxed.
|
|
13694
|
+
*/
|
|
13695
|
+
const OPAQUE_ORIGIN = "null";
|
|
13696
|
+
/**
|
|
13697
|
+
* Returns `true` when every ancestor browsing context is same-origin with
|
|
13698
|
+
* `win`. A top-level document has no ancestors, so it always passes.
|
|
13699
|
+
*/
|
|
13700
|
+
function allAncestorsSameOrigin(win) {
|
|
13701
|
+
try {
|
|
13702
|
+
// Sandboxed: no origin to compare ancestors against.
|
|
13703
|
+
if (win.origin === OPAQUE_ORIGIN) {
|
|
13704
|
+
return false;
|
|
13705
|
+
}
|
|
13706
|
+
let current = win;
|
|
13707
|
+
// `window.parent` is self-referential at the top level, never falsy.
|
|
13708
|
+
while (current !== current.parent) {
|
|
13709
|
+
current = current.parent;
|
|
13710
|
+
// Throws SecurityError if this ancestor is cross-origin.
|
|
13711
|
+
void current.location.href;
|
|
13712
|
+
}
|
|
13713
|
+
return true;
|
|
13714
|
+
}
|
|
13715
|
+
catch {
|
|
13716
|
+
return false;
|
|
13717
|
+
}
|
|
13718
|
+
}
|
|
13719
|
+
/**
|
|
13720
|
+
* Returns `true` when the top-level window has no opener, or one that is
|
|
13721
|
+
* same-origin with it.
|
|
13722
|
+
*
|
|
13723
|
+
* Reads the opener from `win.top`, not `win`: a framed document always reports
|
|
13724
|
+
* `window.opener === null` and would pass while the top window's untrusted
|
|
13725
|
+
* opener still holds a handle on it.
|
|
13726
|
+
*/
|
|
13727
|
+
function topOpenerIsSameOriginOrAbsent(win) {
|
|
13728
|
+
try {
|
|
13729
|
+
const top = win.top;
|
|
13730
|
+
if (!top) {
|
|
13731
|
+
// Detached from its browsing context; treat as unsafe.
|
|
13732
|
+
return false;
|
|
13733
|
+
}
|
|
13734
|
+
const opener = top.opener;
|
|
13735
|
+
if (!opener || opener === top) {
|
|
13736
|
+
return true;
|
|
13737
|
+
}
|
|
13738
|
+
// Throws SecurityError if the opener is cross-origin.
|
|
13739
|
+
void opener.location.href;
|
|
13740
|
+
return true;
|
|
13741
|
+
}
|
|
13742
|
+
catch {
|
|
13743
|
+
return false;
|
|
13744
|
+
}
|
|
13745
|
+
}
|
|
13746
|
+
/**
|
|
13747
|
+
* Computes the `pocd` ("popup origin check done") authorize parameter value.
|
|
13748
|
+
*
|
|
13749
|
+
* `1` means no untrusted window can reach the popup, which is what lets Entra
|
|
13750
|
+
* omit the `Cross-Origin-Opener-Policy` response header for the request.
|
|
13751
|
+
*
|
|
13752
|
+
* @param config Resolved browser configuration.
|
|
13753
|
+
* @param win Window whose hosting environment is being checked. Defaults to the app window.
|
|
13754
|
+
* @returns `1` when the check passes, otherwise `0`.
|
|
13755
|
+
*/
|
|
13756
|
+
function computePocd(config, win = typeof window !== "undefined" ? window : undefined) {
|
|
13757
|
+
/*
|
|
13758
|
+
* Only an explicit false opts out; anything else computes the check, so an
|
|
13759
|
+
* unresolved config fails closed rather than asserting pocd=1.
|
|
13760
|
+
*/
|
|
13761
|
+
if (config.auth.originCheck === false) {
|
|
13762
|
+
return 1;
|
|
13763
|
+
}
|
|
13764
|
+
if (!win || !allAncestorsSameOrigin(win)) {
|
|
13765
|
+
return 0;
|
|
13766
|
+
}
|
|
13767
|
+
return topOpenerIsSameOriginOrAbsent(win) ? 1 : 0;
|
|
13768
|
+
}
|
|
13769
|
+
|
|
13385
13770
|
/*
|
|
13386
13771
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13387
13772
|
* Licensed under the MIT License.
|
|
@@ -13399,6 +13784,11 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
13399
13784
|
const validLogoutRequest = {
|
|
13400
13785
|
correlationId: this.correlationId,
|
|
13401
13786
|
...logoutRequest,
|
|
13787
|
+
/*
|
|
13788
|
+
* Computed here rather than per flow so every end-session request
|
|
13789
|
+
* carries it, matching the authorize path.
|
|
13790
|
+
*/
|
|
13791
|
+
popupOriginCheckDone: computePocd(this.config) === 1,
|
|
13402
13792
|
};
|
|
13403
13793
|
/**
|
|
13404
13794
|
* Set logout_hint to be login_hint from ID Token Claims if present
|
|
@@ -13905,12 +14295,26 @@ class InteractionHandler {
|
|
|
13905
14295
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
13906
14296
|
* Licensed under the MIT License.
|
|
13907
14297
|
*/
|
|
14298
|
+
/**
|
|
14299
|
+
* Key storage enclaves supported by the platform broker.
|
|
14300
|
+
*/
|
|
14301
|
+
const PlatformAuthEnclave = {
|
|
14302
|
+
/**
|
|
14303
|
+
* Persisted software key using MS_KEY_STORAGE_PROVIDER.
|
|
14304
|
+
*/
|
|
14305
|
+
SOFTWARE: "sw"};
|
|
13908
14306
|
/**
|
|
13909
14307
|
* Token types supported by the platform broker request contract.
|
|
13910
14308
|
*/
|
|
13911
14309
|
const PlatformAuthTokenType = {
|
|
13912
14310
|
DPOP_WITH_PROOF: "dpop+proof",
|
|
13913
14311
|
};
|
|
14312
|
+
/**
|
|
14313
|
+
* Token binding preferences supported by the platform broker.
|
|
14314
|
+
*/
|
|
14315
|
+
const PlatformAuthBindingPreference = {
|
|
14316
|
+
ATTESTED: "attested",
|
|
14317
|
+
};
|
|
13914
14318
|
const PROOF_OF_POSSESSION_TOKEN_TYPES = [
|
|
13915
14319
|
AuthenticationScheme$1.POP,
|
|
13916
14320
|
AuthenticationScheme$1.DPOP,
|
|
@@ -13926,19 +14330,19 @@ function isProofOfPossessionTokenType(tokenType) {
|
|
|
13926
14330
|
/**
|
|
13927
14331
|
* Adds canonical proof request fields to the broker no-cache property bag.
|
|
13928
14332
|
*/
|
|
13929
|
-
function createPlatformAuthExtraParametersNoCache(
|
|
13930
|
-
if (!
|
|
13931
|
-
return
|
|
14333
|
+
function createPlatformAuthExtraParametersNoCache(tokenType, resourceRequestMethod, resourceRequestUri, dpopNonce) {
|
|
14334
|
+
if (!isProofOfPossessionTokenType(tokenType)) {
|
|
14335
|
+
return undefined;
|
|
13932
14336
|
}
|
|
13933
14337
|
return {
|
|
13934
|
-
...extraParametersNoCache,
|
|
13935
14338
|
...(resourceRequestMethod && {
|
|
13936
14339
|
pop_method: resourceRequestMethod,
|
|
13937
14340
|
}),
|
|
13938
14341
|
...(resourceRequestUri && {
|
|
13939
14342
|
pop_url: resourceRequestUri,
|
|
13940
14343
|
}),
|
|
13941
|
-
...(
|
|
14344
|
+
...(tokenType === PlatformAuthTokenType.DPOP_WITH_PROOF &&
|
|
14345
|
+
dpopNonce && {
|
|
13942
14346
|
pop_nonce: dpopNonce,
|
|
13943
14347
|
}),
|
|
13944
14348
|
};
|
|
@@ -14086,6 +14490,7 @@ class SilentCacheClient extends StandardInteractionClient {
|
|
|
14086
14490
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14087
14491
|
* Licensed under the MIT License.
|
|
14088
14492
|
*/
|
|
14493
|
+
const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
|
|
14089
14494
|
class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
14090
14495
|
constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
|
|
14091
14496
|
super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
|
|
@@ -14144,17 +14549,9 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14144
14549
|
throw e;
|
|
14145
14550
|
}
|
|
14146
14551
|
// check if the tokens can be retrieved from internal cache
|
|
14552
|
+
let cachedResult;
|
|
14147
14553
|
try {
|
|
14148
|
-
|
|
14149
|
-
// Served from the native internal cache; token did not come directly from the broker
|
|
14150
|
-
nativeATMeasurement.add({
|
|
14151
|
-
isNativeBroker: false,
|
|
14152
|
-
});
|
|
14153
|
-
nativeATMeasurement.end({
|
|
14154
|
-
success: true,
|
|
14155
|
-
fromCache: true,
|
|
14156
|
-
});
|
|
14157
|
-
return result;
|
|
14554
|
+
cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
|
|
14158
14555
|
}
|
|
14159
14556
|
catch (e) {
|
|
14160
14557
|
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
@@ -14165,13 +14562,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14165
14562
|
nativeATMeasurement.end({
|
|
14166
14563
|
success: false,
|
|
14167
14564
|
});
|
|
14565
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14168
14566
|
throw e;
|
|
14169
14567
|
}
|
|
14170
14568
|
// continue with a native call for any and all errors
|
|
14171
14569
|
this.logger.info("0957j1", this.correlationId);
|
|
14172
14570
|
}
|
|
14571
|
+
if (cachedResult) {
|
|
14572
|
+
// Served from the native internal cache; token did not come directly from the broker
|
|
14573
|
+
nativeATMeasurement.add({
|
|
14574
|
+
isNativeBroker: false,
|
|
14575
|
+
});
|
|
14576
|
+
nativeATMeasurement.end({
|
|
14577
|
+
success: true,
|
|
14578
|
+
fromCache: true,
|
|
14579
|
+
});
|
|
14580
|
+
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
14581
|
+
return cachedResult;
|
|
14582
|
+
}
|
|
14173
14583
|
// dispatch the request to the broker
|
|
14174
14584
|
try {
|
|
14585
|
+
await this.prepareDpopBrokerRequest(nativeRequest);
|
|
14586
|
+
this.addDpopBrokerAttemptTelemetry(nativeRequest);
|
|
14175
14587
|
const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
|
|
14176
14588
|
const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
|
|
14177
14589
|
nativeATMeasurement.end({
|
|
@@ -14189,6 +14601,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14189
14601
|
success: false,
|
|
14190
14602
|
}, e);
|
|
14191
14603
|
this.setBrokerErrorTelemetry(e);
|
|
14604
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14192
14605
|
throw e;
|
|
14193
14606
|
}
|
|
14194
14607
|
}
|
|
@@ -14223,6 +14636,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14223
14636
|
scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
|
|
14224
14637
|
account: cachedAccount,
|
|
14225
14638
|
forceRefresh: false,
|
|
14639
|
+
...this.createSilentCacheTokenBindingParameters(request),
|
|
14226
14640
|
resource: request.extraParameters?.resource,
|
|
14227
14641
|
};
|
|
14228
14642
|
// Preserve FMI partition semantics for silent cache filtering.
|
|
@@ -14231,6 +14645,29 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14231
14645
|
}
|
|
14232
14646
|
return silentRequest;
|
|
14233
14647
|
}
|
|
14648
|
+
/**
|
|
14649
|
+
* Maps platform-broker token-binding state to silent-cache request fields.
|
|
14650
|
+
* @param request
|
|
14651
|
+
*/
|
|
14652
|
+
createSilentCacheTokenBindingParameters(request) {
|
|
14653
|
+
const authenticationScheme = this.isDpopBrokerRequest(request)
|
|
14654
|
+
? AuthenticationScheme$1.DPOP
|
|
14655
|
+
: request.tokenType;
|
|
14656
|
+
if (authenticationScheme !== AuthenticationScheme$1.DPOP &&
|
|
14657
|
+
authenticationScheme !== AuthenticationScheme$1.POP) {
|
|
14658
|
+
return { authenticationScheme };
|
|
14659
|
+
}
|
|
14660
|
+
return {
|
|
14661
|
+
authenticationScheme,
|
|
14662
|
+
...(authenticationScheme === AuthenticationScheme$1.DPOP &&
|
|
14663
|
+
request.keyId && { dpopJkt: request.keyId }),
|
|
14664
|
+
...(authenticationScheme === AuthenticationScheme$1.POP &&
|
|
14665
|
+
request.signPopToken === false &&
|
|
14666
|
+
request.keyId && { popKid: request.keyId }),
|
|
14667
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
14668
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
14669
|
+
};
|
|
14670
|
+
}
|
|
14234
14671
|
/**
|
|
14235
14672
|
* Fetches the tokens from the cache if un-expired
|
|
14236
14673
|
* @param nativeAccountId
|
|
@@ -14279,10 +14716,22 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14279
14716
|
const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
|
|
14280
14717
|
const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
|
|
14281
14718
|
try {
|
|
14282
|
-
await this.
|
|
14719
|
+
await this.prepareDpopBrokerRequest(nativeRequest);
|
|
14720
|
+
this.addDpopBrokerAttemptTelemetry(nativeRequest);
|
|
14721
|
+
const response = await this.platformAuthProvider.sendMessage(nativeRequest);
|
|
14722
|
+
const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
|
|
14723
|
+
if (dpopBrokerOutcome === "L3") {
|
|
14724
|
+
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
14725
|
+
}
|
|
14283
14726
|
}
|
|
14284
14727
|
catch (e) {
|
|
14285
|
-
|
|
14728
|
+
/*
|
|
14729
|
+
* Raw persistent/transient broker errors are retrieved again in
|
|
14730
|
+
* phase two. Availability errors are thrown for controller-managed
|
|
14731
|
+
* web fallback, while translated cancellation, network, and
|
|
14732
|
+
* interaction-required errors are surfaced without being swallowed.
|
|
14733
|
+
*/
|
|
14734
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14286
14735
|
if (e instanceof NativeAuthError) {
|
|
14287
14736
|
const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
|
|
14288
14737
|
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
@@ -14297,6 +14746,16 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14297
14746
|
throw e;
|
|
14298
14747
|
}
|
|
14299
14748
|
}
|
|
14749
|
+
else if (this.isDpopBrokerRequest(nativeRequest)) {
|
|
14750
|
+
throw e;
|
|
14751
|
+
}
|
|
14752
|
+
}
|
|
14753
|
+
try {
|
|
14754
|
+
await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
|
|
14755
|
+
}
|
|
14756
|
+
catch (e) {
|
|
14757
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14758
|
+
throw e;
|
|
14300
14759
|
}
|
|
14301
14760
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
|
|
14302
14761
|
...nativeRequest,
|
|
@@ -14311,7 +14770,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14311
14770
|
? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
|
|
14312
14771
|
: getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
|
|
14313
14772
|
rootMeasurement.end({ success: true });
|
|
14314
|
-
|
|
14773
|
+
try {
|
|
14774
|
+
await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
|
|
14775
|
+
}
|
|
14776
|
+
catch (e) {
|
|
14777
|
+
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
14778
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
14779
|
+
throw e;
|
|
14780
|
+
}
|
|
14315
14781
|
}
|
|
14316
14782
|
/**
|
|
14317
14783
|
* If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
|
|
@@ -14344,6 +14810,8 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14344
14810
|
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
14345
14811
|
const reqTimestamp = nowSeconds();
|
|
14346
14812
|
try {
|
|
14813
|
+
await this.prepareDpopBrokerRequest(request, true);
|
|
14814
|
+
this.addDpopBrokerAttemptTelemetry(request);
|
|
14347
14815
|
this.logger.verbose("003x5a", this.correlationId);
|
|
14348
14816
|
const response = await this.platformAuthProvider.sendMessage(request);
|
|
14349
14817
|
const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
|
|
@@ -14352,7 +14820,12 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14352
14820
|
return authResult;
|
|
14353
14821
|
}
|
|
14354
14822
|
catch (e) {
|
|
14823
|
+
if (e instanceof NativeAuthError) {
|
|
14824
|
+
const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
|
|
14825
|
+
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
14826
|
+
}
|
|
14355
14827
|
this.setBrokerErrorTelemetry(e);
|
|
14828
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(request);
|
|
14356
14829
|
throw e;
|
|
14357
14830
|
}
|
|
14358
14831
|
}
|
|
@@ -14372,6 +14845,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14372
14845
|
*/
|
|
14373
14846
|
async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
|
|
14374
14847
|
this.logger.trace("1bojln", this.correlationId);
|
|
14848
|
+
const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
|
|
14375
14849
|
// generate identifiers
|
|
14376
14850
|
const idTokenClaims = extractTokenClaims(response.id_token, base64Decode, this.correlationId);
|
|
14377
14851
|
const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
|
|
@@ -14397,10 +14871,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14397
14871
|
response.expires_in = Number(response.expires_in);
|
|
14398
14872
|
// generate authenticationResult
|
|
14399
14873
|
const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
|
|
14874
|
+
const isL3DpopResponse = dpopBrokerOutcome === "L3";
|
|
14400
14875
|
// cache accounts and tokens in the appropriate storage
|
|
14401
|
-
|
|
14876
|
+
const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
|
|
14877
|
+
(this.isDpopBrokerRequest(request) &&
|
|
14878
|
+
storeInCache?.accessToken === false);
|
|
14879
|
+
if (shouldRemoveGeneratedDpopKey) {
|
|
14880
|
+
await this.resetGeneratedDpopRequestKey(request);
|
|
14881
|
+
}
|
|
14882
|
+
await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims), !isL3DpopResponse);
|
|
14402
14883
|
await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
|
|
14403
|
-
storeInCache);
|
|
14884
|
+
storeInCache, dpopBrokerOutcome);
|
|
14404
14885
|
return result;
|
|
14405
14886
|
}
|
|
14406
14887
|
/**
|
|
@@ -14476,7 +14957,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14476
14957
|
*/
|
|
14477
14958
|
async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
|
|
14478
14959
|
// Add Native Broker fields to Telemetry
|
|
14479
|
-
const mats = this.addTelemetryFromNativeResponse(response.properties
|
|
14960
|
+
const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
|
|
14480
14961
|
// If scopes not returned in server response, use request scopes
|
|
14481
14962
|
const responseScopes = this.generateScopes(request.scope, response.scope);
|
|
14482
14963
|
const accountProperties = response.account.properties || {};
|
|
@@ -14502,9 +14983,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14502
14983
|
}
|
|
14503
14984
|
// generate PoP token as needed
|
|
14504
14985
|
const responseAccessToken = await this.generatePopAccessToken(response, request);
|
|
14505
|
-
const
|
|
14506
|
-
|
|
14507
|
-
|
|
14986
|
+
const isDpopRequest = this.isDpopBrokerRequest(request);
|
|
14987
|
+
let tokenType = AuthenticationScheme$1.BEARER;
|
|
14988
|
+
if (isDpopRequest) {
|
|
14989
|
+
tokenType = AuthenticationScheme$1.DPOP;
|
|
14990
|
+
}
|
|
14991
|
+
else if (request.tokenType === AuthenticationScheme$1.POP) {
|
|
14992
|
+
tokenType = AuthenticationScheme$1.POP;
|
|
14993
|
+
}
|
|
14994
|
+
const dpopProof = isDpopRequest
|
|
14995
|
+
? await this.generateDpopProof(response, request)
|
|
14996
|
+
: undefined;
|
|
14508
14997
|
const result = {
|
|
14509
14998
|
authority: authority,
|
|
14510
14999
|
uniqueId: uid,
|
|
@@ -14518,6 +15007,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14518
15007
|
// Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
|
|
14519
15008
|
expiresOn: toDateFromSeconds(reqTimestamp + response.expires_in),
|
|
14520
15009
|
tokenType: tokenType,
|
|
15010
|
+
dpopProof,
|
|
14521
15011
|
correlationId: this.correlationId,
|
|
14522
15012
|
state: response.state,
|
|
14523
15013
|
fromPlatformBroker: true,
|
|
@@ -14531,11 +15021,13 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14531
15021
|
* cache the account entity in browser storage
|
|
14532
15022
|
* @param accountEntity
|
|
14533
15023
|
*/
|
|
14534
|
-
async cacheAccount(accountEntity, kmsi) {
|
|
15024
|
+
async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
|
|
14535
15025
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
14536
15026
|
await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
|
|
14537
15027
|
// Remove any existing cached tokens for this account in browser storage
|
|
14538
|
-
|
|
15028
|
+
if (clearExistingTokens) {
|
|
15029
|
+
this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
|
|
15030
|
+
}
|
|
14539
15031
|
}
|
|
14540
15032
|
/**
|
|
14541
15033
|
* Stores the access_token and id_token in inmemory storage
|
|
@@ -14547,29 +15039,35 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14547
15039
|
* @param tenantId
|
|
14548
15040
|
* @param reqTimestamp
|
|
14549
15041
|
*/
|
|
14550
|
-
async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
|
|
15042
|
+
async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
|
|
14551
15043
|
const cachedIdToken = createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
|
|
14552
|
-
//
|
|
14553
|
-
|
|
14554
|
-
|
|
14555
|
-
|
|
14556
|
-
|
|
14557
|
-
|
|
15044
|
+
// save idtoken credential in configured browser storage
|
|
15045
|
+
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
15046
|
+
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
15047
|
+
}
|
|
15048
|
+
if (dpopBrokerOutcome === "L3") {
|
|
15049
|
+
return;
|
|
15050
|
+
}
|
|
15051
|
+
if (storeInCache?.accessToken === false) {
|
|
15052
|
+
return;
|
|
15053
|
+
}
|
|
15054
|
+
// cache accessToken in inmemory storage
|
|
15055
|
+
const expiresIn = request.tokenType === AuthenticationScheme$1.POP
|
|
15056
|
+
? SHR_NONCE_VALIDITY
|
|
15057
|
+
: (typeof response.expires_in === "string"
|
|
15058
|
+
? parseInt(response.expires_in, 10)
|
|
15059
|
+
: response.expires_in) || 0;
|
|
14558
15060
|
const tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
14559
15061
|
const responseScopes = this.generateScopes(response.scope, request.scope);
|
|
14560
15062
|
const additionalCacheKeyComponents = request.attributeTokens
|
|
14561
|
-
? {
|
|
14562
|
-
attribute_tokens: request.attributeTokens,
|
|
14563
|
-
}
|
|
15063
|
+
? { attribute_tokens: request.attributeTokens }
|
|
14564
15064
|
: undefined;
|
|
14565
|
-
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined,
|
|
15065
|
+
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
|
|
15066
|
+
? AuthenticationScheme$1.DPOP
|
|
15067
|
+
: request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
|
|
14566
15068
|
if (request.extraParameters?.resource) {
|
|
14567
15069
|
cachedAccessToken.resource = request.extraParameters.resource;
|
|
14568
15070
|
}
|
|
14569
|
-
// save idtoken credential in configured browser storage
|
|
14570
|
-
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
14571
|
-
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
14572
|
-
}
|
|
14573
15071
|
// save access token credential in memory storage
|
|
14574
15072
|
const nativeCacheRecord = {
|
|
14575
15073
|
accessToken: cachedAccessToken,
|
|
@@ -14646,11 +15144,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14646
15144
|
const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
|
|
14647
15145
|
? undefined
|
|
14648
15146
|
: this.config.auth.clientCapabilities;
|
|
14649
|
-
|
|
14650
|
-
* 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.
|
|
14651
|
-
* attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
|
|
14652
|
-
*/
|
|
14653
|
-
const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
|
|
15147
|
+
const { scopes, claims, dpopNonce } = request;
|
|
14654
15148
|
const scopeSet = new ScopeSet([...(scopes || []), ...OIDC_DEFAULT_SCOPES$1], this.correlationId);
|
|
14655
15149
|
const mergedClaims = buildMergedClaims$1(claims, configClaims?.length ? configClaims : undefined);
|
|
14656
15150
|
const hasAttributeTokens = !!request.attributeTokens?.length;
|
|
@@ -14674,57 +15168,391 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14674
15168
|
loginHint: request.loginHint,
|
|
14675
15169
|
extraParameters: {
|
|
14676
15170
|
...request.extraParameters,
|
|
14677
|
-
|
|
15171
|
+
// Native broker resource is set for MCP scenarios.
|
|
15172
|
+
...(request.resource && { resource: request.resource }),
|
|
14678
15173
|
},
|
|
14679
15174
|
extendedExpiryToken: false,
|
|
14680
15175
|
keyId: request.popKid,
|
|
14681
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
14682
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
14683
|
-
shrClaims: request.shrClaims,
|
|
14684
|
-
shrNonce: request.shrNonce,
|
|
14685
|
-
extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
|
|
14686
15176
|
};
|
|
14687
15177
|
if (hasAttributeTokens) {
|
|
14688
15178
|
validatedRequest.attributeTokens =
|
|
14689
15179
|
serializeAttributeTokens(request.attributeTokens);
|
|
14690
15180
|
}
|
|
14691
|
-
// Check for PoP token requests: signPopToken should only be set to true if popKid is not set
|
|
14692
|
-
if (validatedRequest.signPopToken && !!request.popKid) {
|
|
14693
|
-
throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
|
|
14694
|
-
}
|
|
14695
15181
|
this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
|
|
14696
15182
|
validatedRequest.extraParameters =
|
|
14697
15183
|
validatedRequest.extraParameters || {};
|
|
14698
15184
|
validatedRequest.extraParameters.telemetry =
|
|
14699
15185
|
PlatformAuthConstants.MATS_TELEMETRY;
|
|
14700
15186
|
if (request.authenticationScheme === AuthenticationScheme$1.POP) {
|
|
14701
|
-
// add POP request type
|
|
14702
15187
|
const shrParameters = {
|
|
14703
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
14704
15188
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
15189
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
14705
15190
|
shrClaims: request.shrClaims,
|
|
14706
15191
|
shrNonce: request.shrNonce,
|
|
14707
15192
|
correlationId: this.correlationId,
|
|
14708
15193
|
};
|
|
14709
15194
|
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
|
|
14710
|
-
// generate reqCnf if not provided in the request
|
|
14711
|
-
let reqCnfData;
|
|
14712
15195
|
if (!validatedRequest.keyId) {
|
|
14713
15196
|
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
|
|
14714
|
-
|
|
15197
|
+
validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
|
|
14715
15198
|
validatedRequest.keyId = generatedReqCnfData.kid;
|
|
14716
15199
|
validatedRequest.signPopToken = true;
|
|
14717
15200
|
}
|
|
14718
15201
|
else {
|
|
14719
|
-
|
|
15202
|
+
validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
|
|
14720
15203
|
validatedRequest.signPopToken = false;
|
|
14721
15204
|
}
|
|
14722
|
-
|
|
14723
|
-
|
|
15205
|
+
validatedRequest.resourceRequestMethod =
|
|
15206
|
+
request.resourceRequestMethod;
|
|
15207
|
+
validatedRequest.resourceRequestUri = request.resourceRequestUri;
|
|
15208
|
+
validatedRequest.shrClaims = request.shrClaims;
|
|
15209
|
+
validatedRequest.shrNonce = request.shrNonce;
|
|
14724
15210
|
}
|
|
15211
|
+
else if (request.authenticationScheme === AuthenticationScheme$1.DPOP) {
|
|
15212
|
+
Object.assign(validatedRequest, this.createDpopRequestParameters(request));
|
|
15213
|
+
}
|
|
15214
|
+
validatedRequest.extraParametersNoCache =
|
|
15215
|
+
createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
|
|
14725
15216
|
this.addRequestSKUs(validatedRequest);
|
|
14726
15217
|
return validatedRequest;
|
|
14727
15218
|
}
|
|
15219
|
+
/**
|
|
15220
|
+
* Creates and validates the broker-specific parameters for a DPoP request.
|
|
15221
|
+
* @param request - Developer-provided token request.
|
|
15222
|
+
* @returns Broker parameters for a DPoP token and resource proof.
|
|
15223
|
+
*/
|
|
15224
|
+
createDpopRequestParameters(request) {
|
|
15225
|
+
if (request.popKid) {
|
|
15226
|
+
throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
|
|
15227
|
+
}
|
|
15228
|
+
if (!request.resourceRequestMethod?.trim() ||
|
|
15229
|
+
!request.resourceRequestUri?.trim()) {
|
|
15230
|
+
throw createClientConfigurationError(dpopMissingResourceContext, this.correlationId);
|
|
15231
|
+
}
|
|
15232
|
+
const resourceContext = normalizeDpopResourceRequestContext({
|
|
15233
|
+
htm: request.resourceRequestMethod,
|
|
15234
|
+
htu: request.resourceRequestUri,
|
|
15235
|
+
}, this.correlationId);
|
|
15236
|
+
return {
|
|
15237
|
+
tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
|
|
15238
|
+
preferBinding: PlatformAuthBindingPreference.ATTESTED,
|
|
15239
|
+
keyId: request.dpopJkt,
|
|
15240
|
+
resourceRequestMethod: resourceContext.htm,
|
|
15241
|
+
resourceRequestUri: resourceContext.htu,
|
|
15242
|
+
};
|
|
15243
|
+
}
|
|
15244
|
+
/**
|
|
15245
|
+
* Provisions the local key and confirmation data for a DPoP broker request.
|
|
15246
|
+
* @param request - Broker request to prepare.
|
|
15247
|
+
* @param reuseExistingKey - Whether a complete existing key binding may be reused.
|
|
15248
|
+
*/
|
|
15249
|
+
async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
|
|
15250
|
+
if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
|
|
15251
|
+
return;
|
|
15252
|
+
}
|
|
15253
|
+
/*
|
|
15254
|
+
* Phase one clears both fields after an L3 response or non-fatal broker
|
|
15255
|
+
* error. In that case phase two must provision a replacement. If either
|
|
15256
|
+
* field remains, treat it as a retained binding and validate it fully.
|
|
15257
|
+
*/
|
|
15258
|
+
if (reuseExistingKey && (request.keyId || request.reqCnf)) {
|
|
15259
|
+
if (!request.keyId || !request.reqCnf) {
|
|
15260
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
|
|
15261
|
+
}
|
|
15262
|
+
const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
|
|
15263
|
+
if (request.reqCnf !== expectedReqCnf) {
|
|
15264
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
|
|
15265
|
+
}
|
|
15266
|
+
const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
|
|
15267
|
+
? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
|
|
15268
|
+
: await this.tokenBindingKeyManager
|
|
15269
|
+
.getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
|
|
15270
|
+
.then(() => true, () => false);
|
|
15271
|
+
if (!hasKey) {
|
|
15272
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
|
|
15273
|
+
}
|
|
15274
|
+
return;
|
|
15275
|
+
}
|
|
15276
|
+
if (request.reqCnf) {
|
|
15277
|
+
throw createAuthError(unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
|
|
15278
|
+
}
|
|
15279
|
+
if (!request.keyId) {
|
|
15280
|
+
request.keyId =
|
|
15281
|
+
await this.tokenBindingKeyManager.provisionTokenBindingKey({
|
|
15282
|
+
tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
|
|
15283
|
+
tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
|
|
15284
|
+
correlationId: this.correlationId,
|
|
15285
|
+
});
|
|
15286
|
+
}
|
|
15287
|
+
request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
|
|
15288
|
+
}
|
|
15289
|
+
/**
|
|
15290
|
+
* Creates the confirmation claim for an MSAL-owned broker DPoP key.
|
|
15291
|
+
* @param keyId - Browser-managed DPoP key identifier.
|
|
15292
|
+
* @returns Encoded broker confirmation claim.
|
|
15293
|
+
*/
|
|
15294
|
+
createDpopBrokerReqCnf(keyId) {
|
|
15295
|
+
return this.browserCrypto.base64UrlEncode(JSON.stringify({
|
|
15296
|
+
kid: keyId,
|
|
15297
|
+
xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
|
|
15298
|
+
}));
|
|
15299
|
+
}
|
|
15300
|
+
/**
|
|
15301
|
+
* Ensures an owned DPoP key can survive redirect navigation before the
|
|
15302
|
+
* request metadata is persisted for phase two.
|
|
15303
|
+
*/
|
|
15304
|
+
async ensureRedirectDpopKeyIsPersisted(request) {
|
|
15305
|
+
if (!this.isDpopBrokerRequest(request) || !request.keyId) {
|
|
15306
|
+
return;
|
|
15307
|
+
}
|
|
15308
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
|
|
15309
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
|
|
15310
|
+
}
|
|
15311
|
+
}
|
|
15312
|
+
/**
|
|
15313
|
+
* Validates and normalizes the DPoP binding outcome returned by the broker.
|
|
15314
|
+
* @param response - Broker response to validate.
|
|
15315
|
+
* @param request - Broker request associated with the response.
|
|
15316
|
+
* @returns The validated DPoP binding level, or `none` for non-DPoP requests.
|
|
15317
|
+
*/
|
|
15318
|
+
validateDpopBrokerOutcome(response, request) {
|
|
15319
|
+
const isDpopRequest = this.isDpopBrokerRequest(request);
|
|
15320
|
+
const normalizedResponse = this.normalizeDpopBrokerResponse(response);
|
|
15321
|
+
const normalizedRequestTokenType = request.tokenType
|
|
15322
|
+
?.trim()
|
|
15323
|
+
.toLowerCase();
|
|
15324
|
+
const bindingPreferenceSent = request.bindingPreferenceSent ??
|
|
15325
|
+
request.preferBinding !== undefined;
|
|
15326
|
+
const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
|
|
15327
|
+
normalizedResponse.proof !== undefined ||
|
|
15328
|
+
normalizedResponse.hasBindingAttested;
|
|
15329
|
+
if (!isDpopRequest) {
|
|
15330
|
+
if (hasDpopResponse) {
|
|
15331
|
+
this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
|
|
15332
|
+
}
|
|
15333
|
+
return "none";
|
|
15334
|
+
}
|
|
15335
|
+
if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
|
|
15336
|
+
this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
|
|
15337
|
+
}
|
|
15338
|
+
this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
|
|
15339
|
+
if (normalizedResponse.tokenType ===
|
|
15340
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
|
|
15341
|
+
return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
|
|
15342
|
+
}
|
|
15343
|
+
return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
|
|
15344
|
+
}
|
|
15345
|
+
/**
|
|
15346
|
+
* Normalizes the canonical DPoP fields returned under response properties.
|
|
15347
|
+
*/
|
|
15348
|
+
normalizeDpopBrokerResponse(response) {
|
|
15349
|
+
const responseProperties = response.properties;
|
|
15350
|
+
const rawTokenType = responseProperties?.token_type;
|
|
15351
|
+
const tokenType = typeof rawTokenType === "string"
|
|
15352
|
+
? rawTokenType.trim().toLowerCase()
|
|
15353
|
+
: undefined;
|
|
15354
|
+
const rawBindingAttested = responseProperties?.binding_attested;
|
|
15355
|
+
let bindingAttested;
|
|
15356
|
+
if (typeof rawBindingAttested === "string") {
|
|
15357
|
+
const normalizedBindingAttested = rawBindingAttested
|
|
15358
|
+
.trim()
|
|
15359
|
+
.toLowerCase();
|
|
15360
|
+
if (normalizedBindingAttested === "true") {
|
|
15361
|
+
bindingAttested = true;
|
|
15362
|
+
}
|
|
15363
|
+
else if (normalizedBindingAttested === "false") {
|
|
15364
|
+
bindingAttested = false;
|
|
15365
|
+
}
|
|
15366
|
+
}
|
|
15367
|
+
return {
|
|
15368
|
+
tokenType,
|
|
15369
|
+
proof: responseProperties?.DPoP,
|
|
15370
|
+
bindingAttested,
|
|
15371
|
+
hasBindingAttested: rawBindingAttested !== undefined,
|
|
15372
|
+
hasMalformedBindingAttested: rawBindingAttested !== undefined &&
|
|
15373
|
+
bindingAttested === undefined,
|
|
15374
|
+
};
|
|
15375
|
+
}
|
|
15376
|
+
/**
|
|
15377
|
+
* Validates normalized fields shared by L1 and L3 broker DPoP responses.
|
|
15378
|
+
*/
|
|
15379
|
+
validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
|
|
15380
|
+
if (normalizedResponse.hasMalformedBindingAttested) {
|
|
15381
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
|
|
15382
|
+
}
|
|
15383
|
+
if (bindingPreferenceSent &&
|
|
15384
|
+
normalizedResponse.bindingAttested === undefined) {
|
|
15385
|
+
this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
|
|
15386
|
+
}
|
|
15387
|
+
}
|
|
15388
|
+
/**
|
|
15389
|
+
* Validates a broker-returned L3 DPoP proof outcome.
|
|
15390
|
+
*/
|
|
15391
|
+
validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
|
|
15392
|
+
const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
|
|
15393
|
+
if (typeof normalizedResponse.proof !== "string" ||
|
|
15394
|
+
normalizedResponse.proof.trim().length === 0) {
|
|
15395
|
+
this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
|
|
15396
|
+
}
|
|
15397
|
+
if (normalizedResponse.bindingAttested !== true) {
|
|
15398
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
|
|
15399
|
+
}
|
|
15400
|
+
if (normalizedRequestTokenType !== dpopWithProofTokenType ||
|
|
15401
|
+
normalizedResponse.tokenType !== dpopWithProofTokenType) {
|
|
15402
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
|
|
15403
|
+
}
|
|
15404
|
+
this.performanceClient.addFields({
|
|
15405
|
+
"ext.brokerDpopOutcome": "l3",
|
|
15406
|
+
"ext.brokerDpopBindingLevel": "L3",
|
|
15407
|
+
}, this.correlationId);
|
|
15408
|
+
return "L3";
|
|
15409
|
+
}
|
|
15410
|
+
/**
|
|
15411
|
+
* Validates an L1 DPoP outcome that MSAL will sign with its local key.
|
|
15412
|
+
*/
|
|
15413
|
+
validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
|
|
15414
|
+
if (normalizedResponse.proof !== undefined) {
|
|
15415
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
|
|
15416
|
+
}
|
|
15417
|
+
if (normalizedRequestTokenType !==
|
|
15418
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
|
|
15419
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
|
|
15420
|
+
}
|
|
15421
|
+
if (normalizedResponse.bindingAttested !== false &&
|
|
15422
|
+
!(!bindingPreferenceSent &&
|
|
15423
|
+
normalizedResponse.bindingAttested === undefined)) {
|
|
15424
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
|
|
15425
|
+
}
|
|
15426
|
+
if (!request.reqCnf || !request.keyId) {
|
|
15427
|
+
this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
|
|
15428
|
+
}
|
|
15429
|
+
this.performanceClient.addFields({
|
|
15430
|
+
"ext.brokerDpopOutcome": "l1",
|
|
15431
|
+
"ext.brokerDpopBindingLevel": "L1",
|
|
15432
|
+
}, this.correlationId);
|
|
15433
|
+
return "L1";
|
|
15434
|
+
}
|
|
15435
|
+
/**
|
|
15436
|
+
* Emits bounded failure telemetry and rejects an invalid DPoP response.
|
|
15437
|
+
*/
|
|
15438
|
+
throwInvalidDpopResponse(failureReason, message) {
|
|
15439
|
+
this.performanceClient.addFields({
|
|
15440
|
+
"ext.brokerDpopOutcome": "invalid_response",
|
|
15441
|
+
"ext.brokerDpopFailureReason": failureReason,
|
|
15442
|
+
}, this.correlationId);
|
|
15443
|
+
throw createAuthError(unexpectedError, this.correlationId, message);
|
|
15444
|
+
}
|
|
15445
|
+
/**
|
|
15446
|
+
* Returns the broker proof or signs an L1 resource proof with the local key.
|
|
15447
|
+
* @param response - Broker response containing the access token and optional proof.
|
|
15448
|
+
* @param request - Broker request containing the proof context and local key.
|
|
15449
|
+
* @returns The resource proof for the broker access token.
|
|
15450
|
+
*/
|
|
15451
|
+
async generateDpopProof(response, request) {
|
|
15452
|
+
const brokerProof = response.properties?.DPoP;
|
|
15453
|
+
if (brokerProof !== undefined) {
|
|
15454
|
+
return brokerProof;
|
|
15455
|
+
}
|
|
15456
|
+
const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
|
|
15457
|
+
return dpopProofGenerator.generateResourceProof({
|
|
15458
|
+
htu: request.resourceRequestUri,
|
|
15459
|
+
htm: request.resourceRequestMethod,
|
|
15460
|
+
accessToken: response.access_token,
|
|
15461
|
+
nonce: request.extraParametersNoCache?.pop_nonce,
|
|
15462
|
+
}, request.keyId, this.correlationId);
|
|
15463
|
+
}
|
|
15464
|
+
/**
|
|
15465
|
+
* Removes a generated DPoP request key and clears its request metadata.
|
|
15466
|
+
* @param request - Broker request whose generated key should be removed.
|
|
15467
|
+
*/
|
|
15468
|
+
async resetGeneratedDpopRequestKey(request) {
|
|
15469
|
+
if (!this.isDpopBrokerRequest(request) || !request.keyId) {
|
|
15470
|
+
return;
|
|
15471
|
+
}
|
|
15472
|
+
const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
|
|
15473
|
+
this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
|
|
15474
|
+
try {
|
|
15475
|
+
if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
|
|
15476
|
+
throw createAuthError(unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
|
|
15477
|
+
}
|
|
15478
|
+
this.performanceClient.addFields({
|
|
15479
|
+
"ext.brokerDpopKeyCleanupOutcome": "succeeded",
|
|
15480
|
+
}, this.correlationId);
|
|
15481
|
+
cleanupMeasurement.end({ success: true });
|
|
15482
|
+
request.keyId = undefined;
|
|
15483
|
+
request.reqCnf = undefined;
|
|
15484
|
+
}
|
|
15485
|
+
catch (error) {
|
|
15486
|
+
this.performanceClient.addFields({
|
|
15487
|
+
"ext.brokerDpopKeyCleanupOutcome": "failed",
|
|
15488
|
+
}, this.correlationId);
|
|
15489
|
+
this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
|
|
15490
|
+
cleanupMeasurement.end({ success: false }, error);
|
|
15491
|
+
throw error;
|
|
15492
|
+
}
|
|
15493
|
+
}
|
|
15494
|
+
/**
|
|
15495
|
+
* Attempts to remove a generated DPoP request key without replacing an
|
|
15496
|
+
* existing operation error with a cleanup failure.
|
|
15497
|
+
* @param request - Broker request whose generated key should be removed.
|
|
15498
|
+
*/
|
|
15499
|
+
async resetGeneratedDpopRequestKeyBestEffort(request) {
|
|
15500
|
+
try {
|
|
15501
|
+
await this.resetGeneratedDpopRequestKey(request);
|
|
15502
|
+
}
|
|
15503
|
+
catch {
|
|
15504
|
+
this.logger.error("1kxxak", this.correlationId);
|
|
15505
|
+
this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
|
|
15506
|
+
request.keyId = undefined;
|
|
15507
|
+
request.reqCnf = undefined;
|
|
15508
|
+
}
|
|
15509
|
+
}
|
|
15510
|
+
/**
|
|
15511
|
+
* Records that a DPoP request is about to be dispatched to the platform broker.
|
|
15512
|
+
* @param request - Broker request about to cross the provider boundary.
|
|
15513
|
+
*/
|
|
15514
|
+
addDpopBrokerAttemptTelemetry(request) {
|
|
15515
|
+
if (!this.isDpopBrokerRequest(request)) {
|
|
15516
|
+
return;
|
|
15517
|
+
}
|
|
15518
|
+
this.performanceClient.addFields({
|
|
15519
|
+
"ext.brokerDpopAttempted": 1,
|
|
15520
|
+
}, this.correlationId);
|
|
15521
|
+
}
|
|
15522
|
+
/**
|
|
15523
|
+
* Determines whether a request uses the DPoP broker protocol.
|
|
15524
|
+
* @param request - Broker request to inspect.
|
|
15525
|
+
* @returns Whether the request uses a DPoP token type.
|
|
15526
|
+
*/
|
|
15527
|
+
isDpopBrokerRequest(request) {
|
|
15528
|
+
return this.isDpopBrokerTokenType(request.tokenType);
|
|
15529
|
+
}
|
|
15530
|
+
/**
|
|
15531
|
+
* Determines whether a token type represents a DPoP broker request.
|
|
15532
|
+
* @param tokenType - Token type to inspect.
|
|
15533
|
+
* @returns Whether the token type is a supported DPoP broker token type.
|
|
15534
|
+
*/
|
|
15535
|
+
isDpopBrokerTokenType(tokenType) {
|
|
15536
|
+
const normalizedTokenType = tokenType?.trim().toLowerCase();
|
|
15537
|
+
return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
|
|
15538
|
+
normalizedTokenType ===
|
|
15539
|
+
AuthenticationScheme$1.DPOP.toLowerCase());
|
|
15540
|
+
}
|
|
15541
|
+
/**
|
|
15542
|
+
* Removes a DPoP key while reporting cleanup failures.
|
|
15543
|
+
* @param keyId - Identifier of the DPoP key to remove.
|
|
15544
|
+
* @returns Whether the key was removed successfully.
|
|
15545
|
+
*/
|
|
15546
|
+
async removeDpopKey(keyId) {
|
|
15547
|
+
try {
|
|
15548
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
|
|
15549
|
+
return true;
|
|
15550
|
+
}
|
|
15551
|
+
catch {
|
|
15552
|
+
this.logger.error("1w60e4", this.correlationId);
|
|
15553
|
+
return false;
|
|
15554
|
+
}
|
|
15555
|
+
}
|
|
14728
15556
|
async getCanonicalAuthority(request) {
|
|
14729
15557
|
const requestAuthority = request.authority || this.config.auth.authority;
|
|
14730
15558
|
const { azureCloudOptions, account } = request;
|
|
@@ -14763,29 +15591,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14763
15591
|
}
|
|
14764
15592
|
}
|
|
14765
15593
|
/**
|
|
14766
|
-
* Handles extra broker request parameters
|
|
14767
|
-
* @param request
|
|
14768
|
-
* @
|
|
15594
|
+
* Handles extra broker request parameters.
|
|
15595
|
+
* @param request - Platform broker request.
|
|
15596
|
+
* @param embeddedClientId - Embedded application client identifier.
|
|
14769
15597
|
*/
|
|
14770
15598
|
handleExtraBrokerParams(request, embeddedClientId) {
|
|
14771
|
-
const
|
|
14772
|
-
|
|
14773
|
-
|
|
14774
|
-
|
|
15599
|
+
const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
|
|
15600
|
+
const hasExtraBrokerParams = hasOwnParameter(BROKER_CLIENT_ID) &&
|
|
15601
|
+
hasOwnParameter(BROKER_REDIRECT_URI) &&
|
|
15602
|
+
hasOwnParameter(CLIENT_ID);
|
|
14775
15603
|
if (!embeddedClientId && !hasExtraBrokerParams) {
|
|
14776
15604
|
return;
|
|
14777
15605
|
}
|
|
14778
|
-
|
|
14779
|
-
const
|
|
15606
|
+
const childRedirectUri = request.redirectUri;
|
|
15607
|
+
const childClientId = embeddedClientId ||
|
|
15608
|
+
request.extraParameters?.[CLIENT_ID] ||
|
|
15609
|
+
"";
|
|
14780
15610
|
if (embeddedClientId) {
|
|
14781
15611
|
request.redirectUri = this.config.auth.redirectUri;
|
|
14782
|
-
child_client_id = embeddedClientId;
|
|
14783
15612
|
}
|
|
14784
15613
|
else if (request.extraParameters) {
|
|
14785
15614
|
request.redirectUri =
|
|
14786
15615
|
request.extraParameters[BROKER_REDIRECT_URI];
|
|
14787
|
-
child_client_id =
|
|
14788
|
-
request.extraParameters[CLIENT_ID];
|
|
14789
15616
|
}
|
|
14790
15617
|
const {
|
|
14791
15618
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -14796,15 +15623,20 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
14796
15623
|
[CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
|
|
14797
15624
|
request.extraParameters = {
|
|
14798
15625
|
...remainingExtraParameters,
|
|
14799
|
-
child_client_id,
|
|
14800
|
-
child_redirect_uri,
|
|
15626
|
+
child_client_id: childClientId,
|
|
15627
|
+
child_redirect_uri: childRedirectUri,
|
|
14801
15628
|
};
|
|
14802
15629
|
this.performanceClient?.addFields({
|
|
14803
|
-
embeddedClientId:
|
|
14804
|
-
embeddedRedirectUri:
|
|
15630
|
+
embeddedClientId: childClientId,
|
|
15631
|
+
embeddedRedirectUri: childRedirectUri,
|
|
14805
15632
|
}, this.correlationId);
|
|
14806
15633
|
}
|
|
14807
|
-
}
|
|
15634
|
+
}
|
|
15635
|
+
/**
|
|
15636
|
+
* Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
|
|
15637
|
+
* This does not constrain the binding selected by the platform broker.
|
|
15638
|
+
*/
|
|
15639
|
+
PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
|
|
14808
15640
|
|
|
14809
15641
|
/*
|
|
14810
15642
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -14876,7 +15708,16 @@ function instrumentClientData(response, correlationId, performanceClient) {
|
|
|
14876
15708
|
* @returns
|
|
14877
15709
|
*/
|
|
14878
15710
|
async function getStandardParameters(config, authority, request, logger, performanceClient) {
|
|
14879
|
-
const parameters = getStandardAuthorizeRequestParameters({ ...config.auth, authority: authority },
|
|
15711
|
+
const parameters = getStandardAuthorizeRequestParameters({ ...config.auth, authority: authority }, {
|
|
15712
|
+
...request,
|
|
15713
|
+
/*
|
|
15714
|
+
* Computed here rather than per flow so every authorize request
|
|
15715
|
+
* carries it — GET, POST and EAR, interactive and silent alike.
|
|
15716
|
+
* A request may assert it instead when the topology, rather than
|
|
15717
|
+
* the current window, is what makes the popup unreachable.
|
|
15718
|
+
*/
|
|
15719
|
+
popupOriginCheckDone: request.popupOriginCheckDone ?? computePocd(config) === 1,
|
|
15720
|
+
}, logger, performanceClient);
|
|
14880
15721
|
addLibraryInfo(parameters, {
|
|
14881
15722
|
sku: BrowserConstants.MSAL_SKU,
|
|
14882
15723
|
version: version,
|
|
@@ -14901,6 +15742,7 @@ async function getStandardParameters(config, authority, request, logger, perform
|
|
|
14901
15742
|
}
|
|
14902
15743
|
}
|
|
14903
15744
|
if (request.authenticationScheme === AuthenticationScheme$1.DPOP &&
|
|
15745
|
+
!request.platformBroker &&
|
|
14904
15746
|
request.dpopJkt) {
|
|
14905
15747
|
parameters.set(DPOP_JKT, request.dpopJkt);
|
|
14906
15748
|
}
|
|
@@ -14930,6 +15772,15 @@ async function getAuthCodeRequestUrl(config, authority, request, logger, perform
|
|
|
14930
15772
|
});
|
|
14931
15773
|
return getAuthorizeUrl(authority, parameters);
|
|
14932
15774
|
}
|
|
15775
|
+
function getAuthorizeFormAction(authority, request, parameters) {
|
|
15776
|
+
const queryParams = new Map();
|
|
15777
|
+
addExtraParameters(queryParams, request.extraQueryParameters || {});
|
|
15778
|
+
if (parameters.has(POPUP_ORIGIN_CHECK_DONE)) {
|
|
15779
|
+
queryParams.delete(POPUP_ORIGIN_CHECK_DONE);
|
|
15780
|
+
}
|
|
15781
|
+
addCorrelationId(queryParams, request.correlationId);
|
|
15782
|
+
return getAuthorizeUrl(authority, queryParams);
|
|
15783
|
+
}
|
|
14933
15784
|
/**
|
|
14934
15785
|
* Builds the action URL + POST-body fields for the EAR /authorize form.
|
|
14935
15786
|
*/
|
|
@@ -14945,11 +15796,7 @@ async function getEARFormData(config, authority, request, logger, performanceCli
|
|
|
14945
15796
|
addExtraParameters(parameters, {
|
|
14946
15797
|
...request.extraParameters,
|
|
14947
15798
|
});
|
|
14948
|
-
const
|
|
14949
|
-
addExtraParameters(queryParams, request.extraQueryParameters || {});
|
|
14950
|
-
// Add correlationId to query params so gateway can propagate it to IDPs
|
|
14951
|
-
addCorrelationId(queryParams, request.correlationId);
|
|
14952
|
-
const action = getAuthorizeUrl(authority, queryParams);
|
|
15799
|
+
const action = getAuthorizeFormAction(authority, request, parameters);
|
|
14953
15800
|
return { action, fields: Object.fromEntries(parameters) };
|
|
14954
15801
|
}
|
|
14955
15802
|
/**
|
|
@@ -14970,12 +15817,7 @@ async function getCodeFormData(config, authority, request, logger, performanceCl
|
|
|
14970
15817
|
addExtraParameters(parameters, {
|
|
14971
15818
|
...request.extraParameters,
|
|
14972
15819
|
});
|
|
14973
|
-
|
|
14974
|
-
const queryParams = new Map();
|
|
14975
|
-
addExtraParameters(queryParams, request.extraQueryParameters || {});
|
|
14976
|
-
// Add correlationId to query params so gateway can propagate it to IDPs
|
|
14977
|
-
addCorrelationId(queryParams, request.correlationId);
|
|
14978
|
-
const action = getAuthorizeUrl(authority, queryParams);
|
|
15820
|
+
const action = getAuthorizeFormAction(authority, request, parameters);
|
|
14979
15821
|
return { action, fields: Object.fromEntries(parameters) };
|
|
14980
15822
|
}
|
|
14981
15823
|
/**
|
|
@@ -15024,19 +15866,25 @@ function createForm(frame, action, fields) {
|
|
|
15024
15866
|
* @param nativeMessageHandler
|
|
15025
15867
|
* @returns
|
|
15026
15868
|
*/
|
|
15027
|
-
async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
15869
|
+
async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
15028
15870
|
logger.verbose("11qcow", request.correlationId);
|
|
15029
15871
|
if (!platformAuthProvider) {
|
|
15030
15872
|
throw createBrowserAuthError(nativeConnectionNotEstablished, request.correlationId);
|
|
15031
15873
|
}
|
|
15032
15874
|
const browserCrypto = new CryptoOps(logger, performanceClient);
|
|
15033
|
-
const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId);
|
|
15875
|
+
const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
|
|
15034
15876
|
const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
|
|
15035
|
-
|
|
15036
|
-
|
|
15037
|
-
|
|
15038
|
-
|
|
15039
|
-
|
|
15877
|
+
try {
|
|
15878
|
+
return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
|
|
15879
|
+
...request,
|
|
15880
|
+
state: userRequestState,
|
|
15881
|
+
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
15882
|
+
});
|
|
15883
|
+
}
|
|
15884
|
+
catch (e) {
|
|
15885
|
+
await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
|
|
15886
|
+
throw e;
|
|
15887
|
+
}
|
|
15040
15888
|
}
|
|
15041
15889
|
/**
|
|
15042
15890
|
* Response handler when server returns code on the /authorize request
|
|
@@ -15049,13 +15897,13 @@ async function handleResponsePlatformBroker(request, accountId, apiId, config, b
|
|
|
15049
15897
|
* @param performanceClient
|
|
15050
15898
|
* @returns
|
|
15051
15899
|
*/
|
|
15052
|
-
async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
15900
|
+
async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
15053
15901
|
// Remove throttle if it exists
|
|
15054
15902
|
ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
|
|
15055
15903
|
// Instrument clientdata telemetry fields from the authorize response
|
|
15056
15904
|
instrumentClientData(response, request.correlationId, performanceClient);
|
|
15057
15905
|
if (response.accountId) {
|
|
15058
|
-
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
|
|
15906
|
+
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
|
|
15059
15907
|
}
|
|
15060
15908
|
const authCodeRequest = {
|
|
15061
15909
|
...request,
|
|
@@ -15083,7 +15931,7 @@ async function handleResponseCode(request, response, codeVerifier, apiId, config
|
|
|
15083
15931
|
* @param nativeMessageHandler
|
|
15084
15932
|
* @returns
|
|
15085
15933
|
*/
|
|
15086
|
-
async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
15934
|
+
async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
15087
15935
|
// Remove throttle if it exists
|
|
15088
15936
|
ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
|
|
15089
15937
|
// Instrument clientdata telemetry fields from the authorize response
|
|
@@ -15098,9 +15946,9 @@ async function handleResponseEAR(request, response, apiId, config, authority, br
|
|
|
15098
15946
|
}
|
|
15099
15947
|
const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
|
|
15100
15948
|
if (decryptedData.accountId) {
|
|
15101
|
-
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
|
|
15949
|
+
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
|
|
15102
15950
|
}
|
|
15103
|
-
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null,
|
|
15951
|
+
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, tokenBindingKeyManager);
|
|
15104
15952
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
15105
15953
|
responseHandler.validateTokenResponse(decryptedData, request.correlationId);
|
|
15106
15954
|
// Temporary until response handler is refactored to be more flow agnostic.
|
|
@@ -15362,7 +16210,7 @@ function getHeaderDict(headers) {
|
|
|
15362
16210
|
*/
|
|
15363
16211
|
// Default timeout for popup windows and iframes in milliseconds
|
|
15364
16212
|
const DEFAULT_POPUP_TIMEOUT_MS = 60000;
|
|
15365
|
-
const DEFAULT_IFRAME_TIMEOUT_MS = 10000;
|
|
16213
|
+
const DEFAULT_IFRAME_TIMEOUT_MS$1 = 10000;
|
|
15366
16214
|
const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
|
|
15367
16215
|
const DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS = 2000;
|
|
15368
16216
|
/**
|
|
@@ -15403,6 +16251,8 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
15403
16251
|
instanceAware: false,
|
|
15404
16252
|
isMcp: false,
|
|
15405
16253
|
verifySSO: false,
|
|
16254
|
+
// Legacy polling needs COOP omitted, so it implies asserting pocd=1.
|
|
16255
|
+
originCheck: !userInputSystem?.enableLegacyPolling,
|
|
15406
16256
|
};
|
|
15407
16257
|
// Default cache options for browser
|
|
15408
16258
|
const DEFAULT_CACHE_OPTIONS = {
|
|
@@ -15427,7 +16277,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
15427
16277
|
: StubbedNetworkModule,
|
|
15428
16278
|
navigationClient: new NavigationClient(),
|
|
15429
16279
|
popupBridgeTimeout: userInputSystem?.popupBridgeTimeout || DEFAULT_POPUP_TIMEOUT_MS,
|
|
15430
|
-
iframeBridgeTimeout: userInputSystem?.iframeBridgeTimeout || DEFAULT_IFRAME_TIMEOUT_MS,
|
|
16280
|
+
iframeBridgeTimeout: userInputSystem?.iframeBridgeTimeout || DEFAULT_IFRAME_TIMEOUT_MS$1,
|
|
15431
16281
|
redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,
|
|
15432
16282
|
allowRedirectInIframe: false,
|
|
15433
16283
|
navigatePopups: true,
|
|
@@ -15436,6 +16286,7 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
15436
16286
|
DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
|
|
15437
16287
|
protocolMode: ProtocolMode.AAD,
|
|
15438
16288
|
serverTelemetryEnabled: false,
|
|
16289
|
+
enableLegacyPolling: false,
|
|
15439
16290
|
};
|
|
15440
16291
|
const providedSystemOptions = {
|
|
15441
16292
|
...DEFAULT_BROWSER_SYSTEM_OPTIONS,
|
|
@@ -15453,11 +16304,17 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
15453
16304
|
iframeTimeoutTelemetry: false,
|
|
15454
16305
|
allowPlatformBrokerWithDOM: false,
|
|
15455
16306
|
};
|
|
16307
|
+
let logger;
|
|
16308
|
+
const getLogger = () => {
|
|
16309
|
+
if (!logger) {
|
|
16310
|
+
logger = new Logger(providedSystemOptions.loggerOptions, name, version);
|
|
16311
|
+
}
|
|
16312
|
+
return logger;
|
|
16313
|
+
};
|
|
15456
16314
|
// Throw an error if user has set OIDCOptions without being in OIDC protocol mode
|
|
15457
16315
|
if (userInputSystem?.protocolMode !== ProtocolMode.OIDC &&
|
|
15458
16316
|
userInputAuth?.OIDCOptions) {
|
|
15459
|
-
|
|
15460
|
-
logger.warning(JSON.stringify(createClientConfigurationError(cannotSetOIDCOptions, "")), "");
|
|
16317
|
+
getLogger().warning(JSON.stringify(createClientConfigurationError(cannotSetOIDCOptions, "")), "");
|
|
15461
16318
|
}
|
|
15462
16319
|
// Throw an error if user has set allowPlatformBroker to true with OIDC protocol mode
|
|
15463
16320
|
if (userInputSystem?.protocolMode &&
|
|
@@ -15465,6 +16322,24 @@ function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system
|
|
|
15465
16322
|
providedSystemOptions?.allowPlatformBroker) {
|
|
15466
16323
|
throw createClientConfigurationError(cannotAllowPlatformBroker, "");
|
|
15467
16324
|
}
|
|
16325
|
+
/*
|
|
16326
|
+
* The origin check computes 0 in the embedded contexts legacy polling
|
|
16327
|
+
* serves, so re-enabling it there breaks the flow. Honor it, but warn.
|
|
16328
|
+
*/
|
|
16329
|
+
if (userInputSystem?.enableLegacyPolling &&
|
|
16330
|
+
userInputAuth?.originCheck === true) {
|
|
16331
|
+
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.", "");
|
|
16332
|
+
}
|
|
16333
|
+
/*
|
|
16334
|
+
* Opting out is a deliberate risk transfer, not an error — but the app
|
|
16335
|
+
* cannot know at config time that the risky topology is actually present.
|
|
16336
|
+
*/
|
|
16337
|
+
if ((userInputAuth?.originCheck ?? DEFAULT_AUTH_OPTIONS.originCheck) ===
|
|
16338
|
+
false &&
|
|
16339
|
+
typeof window !== "undefined" &&
|
|
16340
|
+
!topOpenerIsSameOriginOrAbsent(window)) {
|
|
16341
|
+
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.", "");
|
|
16342
|
+
}
|
|
15468
16343
|
const overlayedConfig = {
|
|
15469
16344
|
auth: {
|
|
15470
16345
|
...DEFAULT_AUTH_OPTIONS,
|
|
@@ -15520,6 +16395,7 @@ class PlatformAuthExtensionHandler {
|
|
|
15520
16395
|
const extensionRequest = { ...request };
|
|
15521
16396
|
delete extensionRequest.resourceRequestMethod;
|
|
15522
16397
|
delete extensionRequest.resourceRequestUri;
|
|
16398
|
+
delete extensionRequest.bindingPreferenceSent;
|
|
15523
16399
|
const messageBody = {
|
|
15524
16400
|
method: NativeExtensionMethod.GetToken,
|
|
15525
16401
|
request: extensionRequest,
|
|
@@ -15531,8 +16407,9 @@ class PlatformAuthExtensionHandler {
|
|
|
15531
16407
|
body: messageBody,
|
|
15532
16408
|
};
|
|
15533
16409
|
this.logger.trace(`1qadfi ${this.platformAuthType}`, correlationId);
|
|
15534
|
-
this.logger.tracePii(`1xm533 ${this.platformAuthType} ${JSON.stringify(req)}`, correlationId);
|
|
15535
16410
|
this.messageChannel.port1.postMessage(req);
|
|
16411
|
+
request.bindingPreferenceSent =
|
|
16412
|
+
extensionRequest.preferBinding !== undefined;
|
|
15536
16413
|
const response = await new Promise((resolve, reject) => {
|
|
15537
16414
|
this.resolvers.set(req.responseId, {
|
|
15538
16415
|
resolve,
|
|
@@ -15729,13 +16606,11 @@ class PlatformAuthExtensionHandler {
|
|
|
15729
16606
|
try {
|
|
15730
16607
|
const response = request.body.response;
|
|
15731
16608
|
this.logger.trace(`19hpgm ${this.platformAuthType}`, correlationId);
|
|
15732
|
-
this.logger.tracePii(`179a24 ${this.platformAuthType} ${JSON.stringify(response)}`, correlationId);
|
|
15733
16609
|
if (response.status !== "Success") {
|
|
15734
16610
|
resolver.reject(createNativeAuthError(response.code, correlationId, response.description, response.ext));
|
|
15735
16611
|
}
|
|
15736
16612
|
else if (response.result) {
|
|
15737
|
-
if (response.result["code"]
|
|
15738
|
-
response.result["description"]) {
|
|
16613
|
+
if (response.result["code"]) {
|
|
15739
16614
|
resolver.reject(createNativeAuthError(response.result["code"], correlationId, response.result["description"], response.result["ext"]));
|
|
15740
16615
|
}
|
|
15741
16616
|
else {
|
|
@@ -15816,11 +16691,12 @@ class PlatformAuthExtensionHandler {
|
|
|
15816
16691
|
Object.prototype.hasOwnProperty.call(response, "account") &&
|
|
15817
16692
|
Object.prototype.hasOwnProperty.call(response, "scope") &&
|
|
15818
16693
|
Object.prototype.hasOwnProperty.call(response, "expires_in")) {
|
|
16694
|
+
const validatedResponse = response;
|
|
15819
16695
|
validationMeasurement.end({
|
|
15820
16696
|
success: true,
|
|
15821
16697
|
platformAuthProviderType: this.platformAuthType,
|
|
15822
16698
|
});
|
|
15823
|
-
return
|
|
16699
|
+
return validatedResponse;
|
|
15824
16700
|
}
|
|
15825
16701
|
else {
|
|
15826
16702
|
const error = createAuthError(unexpectedError, responseCorrelationId, "Response missing expected properties.");
|
|
@@ -15862,6 +16738,7 @@ class PlatformAuthExtensionHandler {
|
|
|
15862
16738
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
15863
16739
|
* Licensed under the MIT License.
|
|
15864
16740
|
*/
|
|
16741
|
+
const PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED = "platform_auth_dom_dpop_not_supported";
|
|
15865
16742
|
class PlatformAuthDOMHandler {
|
|
15866
16743
|
constructor(logger, performanceClient, correlationId) {
|
|
15867
16744
|
this.logger = logger;
|
|
@@ -15941,6 +16818,10 @@ class PlatformAuthDOMHandler {
|
|
|
15941
16818
|
});
|
|
15942
16819
|
this.logger.trace(`02bcil ${this.platformAuthType}`, correlationId);
|
|
15943
16820
|
try {
|
|
16821
|
+
if (request.tokenType?.trim().toLowerCase() ===
|
|
16822
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF) {
|
|
16823
|
+
throw createBrowserAuthError(PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED, correlationId);
|
|
16824
|
+
}
|
|
15944
16825
|
const platformDOMRequest = invoke(this.initializePlatformDOMRequest.bind(this), PlatformAuthDOMInitializeRequest, this.logger, this.performanceClient, correlationId)(request);
|
|
15945
16826
|
const response =
|
|
15946
16827
|
// @ts-ignore
|
|
@@ -15967,6 +16848,7 @@ class PlatformAuthDOMHandler {
|
|
|
15967
16848
|
this.logger.trace(`15d6yv ${this.platformAuthType}`, requestCorrelationId);
|
|
15968
16849
|
delete remainingProperties.resourceRequestMethod;
|
|
15969
16850
|
delete remainingProperties.resourceRequestUri;
|
|
16851
|
+
delete remainingProperties.bindingPreferenceSent;
|
|
15970
16852
|
const validExtraParameters = this.getDOMExtraParams(remainingProperties, requestCorrelationId);
|
|
15971
16853
|
const platformDOMRequest = {
|
|
15972
16854
|
accountId: accountId,
|
|
@@ -16194,7 +17076,9 @@ function isPlatformAuthAllowed(config, logger, correlationId, platformAuthProvid
|
|
|
16194
17076
|
logger.trace("0uko3r", correlationId);
|
|
16195
17077
|
const schemeSupported = !authenticationScheme ||
|
|
16196
17078
|
authenticationScheme === AuthenticationScheme$1.BEARER ||
|
|
16197
|
-
authenticationScheme === AuthenticationScheme$1.POP
|
|
17079
|
+
authenticationScheme === AuthenticationScheme$1.POP ||
|
|
17080
|
+
(authenticationScheme === AuthenticationScheme$1.DPOP &&
|
|
17081
|
+
!(platformAuthProvider instanceof PlatformAuthDOMHandler));
|
|
16198
17082
|
const fields = {
|
|
16199
17083
|
allowPlatformBroker: config.system.allowPlatformBroker,
|
|
16200
17084
|
...(config.system.allowPlatformBroker && {
|
|
@@ -16290,6 +17174,9 @@ class PopupClient extends StandardInteractionClient {
|
|
|
16290
17174
|
popupWindowAttributes: logoutRequest?.popupWindowAttributes || {},
|
|
16291
17175
|
popupWindowParent: logoutRequest?.popupWindowParent ?? window,
|
|
16292
17176
|
};
|
|
17177
|
+
validLogoutRequest.popupOriginCheckDone =
|
|
17178
|
+
this.getPopupOriginCheckDone(popupParams.popupWindowParent) ??
|
|
17179
|
+
validLogoutRequest.popupOriginCheckDone;
|
|
16293
17180
|
const authority = logoutRequest && logoutRequest.authority;
|
|
16294
17181
|
const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;
|
|
16295
17182
|
// navigatePopups flag set to false. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
|
@@ -16354,6 +17241,7 @@ class PopupClient extends StandardInteractionClient {
|
|
|
16354
17241
|
...request,
|
|
16355
17242
|
codeChallenge: pkce.challenge,
|
|
16356
17243
|
...tokenBindingParams,
|
|
17244
|
+
popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
|
|
16357
17245
|
};
|
|
16358
17246
|
try {
|
|
16359
17247
|
// Initialize the client
|
|
@@ -16387,12 +17275,13 @@ class PopupClient extends StandardInteractionClient {
|
|
|
16387
17275
|
// Wait for the redirect bridge response
|
|
16388
17276
|
const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
|
|
16389
17277
|
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
16390
|
-
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);
|
|
17278
|
+
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);
|
|
16391
17279
|
}
|
|
16392
17280
|
}
|
|
16393
17281
|
catch (e) {
|
|
16394
17282
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
16395
17283
|
popupParams.popup?.close();
|
|
17284
|
+
await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16396
17285
|
if (e instanceof AuthError) {
|
|
16397
17286
|
e.correlationId = this.correlationId;
|
|
16398
17287
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -16417,24 +17306,31 @@ class PopupClient extends StandardInteractionClient {
|
|
|
16417
17306
|
earJwk: earJwk,
|
|
16418
17307
|
codeChallenge: pkce.challenge,
|
|
16419
17308
|
...tokenBindingParams,
|
|
17309
|
+
popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
|
|
16420
17310
|
};
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16426
|
-
|
|
16427
|
-
|
|
16428
|
-
|
|
16429
|
-
|
|
16430
|
-
|
|
16431
|
-
|
|
16432
|
-
|
|
16433
|
-
|
|
16434
|
-
|
|
17311
|
+
try {
|
|
17312
|
+
const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
|
|
17313
|
+
// Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
17314
|
+
const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
|
|
17315
|
+
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
17316
|
+
if (!serverParams.ear_jwe && serverParams.code) {
|
|
17317
|
+
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
|
|
17318
|
+
serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
|
|
17319
|
+
requestAuthority: request.authority,
|
|
17320
|
+
requestAzureCloudOptions: request.azureCloudOptions,
|
|
17321
|
+
requestExtraQueryParameters: request.extraQueryParameters,
|
|
17322
|
+
account: request.account,
|
|
17323
|
+
authority: discoveredAuthority,
|
|
17324
|
+
});
|
|
17325
|
+
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);
|
|
17326
|
+
}
|
|
17327
|
+
else {
|
|
17328
|
+
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);
|
|
17329
|
+
}
|
|
16435
17330
|
}
|
|
16436
|
-
|
|
16437
|
-
|
|
17331
|
+
catch (e) {
|
|
17332
|
+
await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
17333
|
+
throw e;
|
|
16438
17334
|
}
|
|
16439
17335
|
}
|
|
16440
17336
|
async executeCodeFlowWithPost(request, popupParams, authClient, pkceVerifier) {
|
|
@@ -16445,7 +17341,7 @@ class PopupClient extends StandardInteractionClient {
|
|
|
16445
17341
|
// Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
16446
17342
|
const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
|
|
16447
17343
|
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
16448
|
-
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);
|
|
17344
|
+
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);
|
|
16449
17345
|
}
|
|
16450
17346
|
/**
|
|
16451
17347
|
*
|
|
@@ -16689,6 +17585,27 @@ class PopupClient extends StandardInteractionClient {
|
|
|
16689
17585
|
getRelayStateId(state, correlationId) {
|
|
16690
17586
|
return parseRequestState(base64Decode, state, correlationId).libraryState.id;
|
|
16691
17587
|
}
|
|
17588
|
+
/**
|
|
17589
|
+
* Asserts `pocd=1` for the relay flow. Direct popups also require the
|
|
17590
|
+
* environment of a delegated opening window to pass the origin check.
|
|
17591
|
+
*
|
|
17592
|
+
* With a relay the IdP window is a grandchild popup, which an untrusted
|
|
17593
|
+
* ancestor cannot reach by name — so the topology satisfies the check by
|
|
17594
|
+
* construction. The current window is framed and would otherwise compute
|
|
17595
|
+
* `0`. Without a delegated parent, the standard app check remains unchanged.
|
|
17596
|
+
*
|
|
17597
|
+
* @param popupWindowParent Window that opens the popup.
|
|
17598
|
+
*/
|
|
17599
|
+
getPopupOriginCheckDone(popupWindowParent) {
|
|
17600
|
+
if (this.config.auth.popupRelayUri) {
|
|
17601
|
+
return true;
|
|
17602
|
+
}
|
|
17603
|
+
if (popupWindowParent !== window) {
|
|
17604
|
+
return (computePocd(this.config) === 1 &&
|
|
17605
|
+
computePocd(this.config, popupWindowParent) === 1);
|
|
17606
|
+
}
|
|
17607
|
+
return undefined;
|
|
17608
|
+
}
|
|
16692
17609
|
/**
|
|
16693
17610
|
* Opens the interactive popup for a POST-form /authorize request. Shared by
|
|
16694
17611
|
* the auth-code POST and EAR flows, which are identical apart from the form
|
|
@@ -16812,8 +17729,11 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
16812
17729
|
codeChallenge: pkceCodes.challenge,
|
|
16813
17730
|
...tokenBindingParams,
|
|
16814
17731
|
};
|
|
16815
|
-
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
16816
17732
|
try {
|
|
17733
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
|
|
17734
|
+
throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
|
|
17735
|
+
}
|
|
17736
|
+
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
16817
17737
|
if (redirectRequest.httpMethod === HttpMethod.POST) {
|
|
16818
17738
|
return await this.executeCodeFlowWithPost(redirectRequest);
|
|
16819
17739
|
}
|
|
@@ -16833,6 +17753,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
16833
17753
|
}
|
|
16834
17754
|
}
|
|
16835
17755
|
catch (e) {
|
|
17756
|
+
await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16836
17757
|
if (e instanceof AuthError) {
|
|
16837
17758
|
e.correlationId = this.correlationId;
|
|
16838
17759
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -16857,14 +17778,23 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
16857
17778
|
codeChallenge: pkceCodes.challenge,
|
|
16858
17779
|
...tokenBindingParams,
|
|
16859
17780
|
};
|
|
16860
|
-
|
|
16861
|
-
|
|
16862
|
-
|
|
16863
|
-
|
|
16864
|
-
|
|
16865
|
-
|
|
16866
|
-
|
|
16867
|
-
|
|
17781
|
+
try {
|
|
17782
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
|
|
17783
|
+
throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
|
|
17784
|
+
}
|
|
17785
|
+
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
17786
|
+
const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
|
|
17787
|
+
form.submit();
|
|
17788
|
+
return await new Promise((resolve, reject) => {
|
|
17789
|
+
setTimeout(() => {
|
|
17790
|
+
reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
|
|
17791
|
+
}, this.config.system.redirectNavigationTimeout);
|
|
17792
|
+
});
|
|
17793
|
+
}
|
|
17794
|
+
catch (e) {
|
|
17795
|
+
await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
17796
|
+
throw e;
|
|
17797
|
+
}
|
|
16868
17798
|
}
|
|
16869
17799
|
/**
|
|
16870
17800
|
* Executes classic Authorization Code flow with a POST request.
|
|
@@ -16903,6 +17833,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
16903
17833
|
if (!serverParams) {
|
|
16904
17834
|
// Not a recognized server response hash or hash not associated with a redirect request
|
|
16905
17835
|
this.logger.info("1qmv0q", this.correlationId);
|
|
17836
|
+
await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16906
17837
|
this.browserStorage.resetRequestCache(this.correlationId);
|
|
16907
17838
|
// Do not instrument "no_server_response" if user clicked back button
|
|
16908
17839
|
if (getNavigationType() !== "back_forward") {
|
|
@@ -16972,6 +17903,7 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
16972
17903
|
return null;
|
|
16973
17904
|
}
|
|
16974
17905
|
catch (e) {
|
|
17906
|
+
await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
16975
17907
|
if (e instanceof AuthError) {
|
|
16976
17908
|
e.correlationId = this.correlationId;
|
|
16977
17909
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -17011,7 +17943,6 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
17011
17943
|
}
|
|
17012
17944
|
return [null, ""];
|
|
17013
17945
|
}
|
|
17014
|
-
clearHash(window);
|
|
17015
17946
|
this.logger.verbose("00uvho", this.correlationId);
|
|
17016
17947
|
return [response, responseString];
|
|
17017
17948
|
}
|
|
@@ -17039,10 +17970,10 @@ class RedirectClient extends StandardInteractionClient {
|
|
|
17039
17970
|
const { authority, azureCloudOptions, extraQueryParameters, account } = request;
|
|
17040
17971
|
if (serverParams.ear_jwe) {
|
|
17041
17972
|
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);
|
|
17042
|
-
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);
|
|
17973
|
+
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);
|
|
17043
17974
|
}
|
|
17044
17975
|
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
|
|
17045
|
-
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);
|
|
17976
|
+
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);
|
|
17046
17977
|
}
|
|
17047
17978
|
/**
|
|
17048
17979
|
* Redirects window to given URL.
|
|
@@ -17373,10 +18304,10 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
17373
18304
|
account: request.account,
|
|
17374
18305
|
authority: discoveredAuthority,
|
|
17375
18306
|
});
|
|
17376
|
-
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);
|
|
18307
|
+
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);
|
|
17377
18308
|
}
|
|
17378
18309
|
else {
|
|
17379
|
-
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);
|
|
18310
|
+
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);
|
|
17380
18311
|
}
|
|
17381
18312
|
}
|
|
17382
18313
|
/**
|
|
@@ -17426,7 +18357,13 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
17426
18357
|
*/
|
|
17427
18358
|
async silentTokenHelper(authClient, request) {
|
|
17428
18359
|
const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
|
|
17429
|
-
|
|
18360
|
+
try {
|
|
18361
|
+
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);
|
|
18362
|
+
}
|
|
18363
|
+
catch (e) {
|
|
18364
|
+
await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
18365
|
+
throw e;
|
|
18366
|
+
}
|
|
17430
18367
|
}
|
|
17431
18368
|
/**
|
|
17432
18369
|
* Shared helper that generates PKCE codes, builds the /authorize URL,
|
|
@@ -17443,38 +18380,44 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
17443
18380
|
codeChallenge: pkceCodes.challenge,
|
|
17444
18381
|
...tokenBindingParams,
|
|
17445
18382
|
};
|
|
17446
|
-
// Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
|
|
17447
|
-
const iframe = createHiddenIframe();
|
|
17448
|
-
const responseType = this.config.auth.OIDCOptions.responseMode;
|
|
17449
|
-
// Wait for response from the redirect bridge.
|
|
17450
|
-
let responseString;
|
|
17451
18383
|
try {
|
|
17452
|
-
|
|
17453
|
-
|
|
17454
|
-
|
|
17455
|
-
|
|
17456
|
-
|
|
17457
|
-
|
|
17458
|
-
|
|
17459
|
-
|
|
17460
|
-
|
|
17461
|
-
|
|
17462
|
-
|
|
17463
|
-
|
|
18384
|
+
// Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
|
|
18385
|
+
const iframe = createHiddenIframe();
|
|
18386
|
+
const responseType = this.config.auth.OIDCOptions.responseMode;
|
|
18387
|
+
// Wait for response from the redirect bridge.
|
|
18388
|
+
let responseString;
|
|
18389
|
+
try {
|
|
18390
|
+
const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
|
|
18391
|
+
responsePromise.catch(() => {
|
|
18392
|
+
/*
|
|
18393
|
+
* If URL creation or navigation below throws before
|
|
18394
|
+
* responsePromise is awaited, the listener still rejects on
|
|
18395
|
+
* timeout. Swallow it here so it does not surface as an
|
|
18396
|
+
* unhandled rejection; the navigation error is propagated
|
|
18397
|
+
* instead.
|
|
18398
|
+
*/
|
|
18399
|
+
});
|
|
18400
|
+
if (request.httpMethod === HttpMethod.POST) {
|
|
18401
|
+
await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
18402
|
+
}
|
|
18403
|
+
else {
|
|
18404
|
+
// Create authorize request url
|
|
18405
|
+
const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
18406
|
+
// Navigate the iframe to the authorize request url
|
|
18407
|
+
await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
|
|
18408
|
+
}
|
|
18409
|
+
responseString = await responsePromise;
|
|
17464
18410
|
}
|
|
17465
|
-
|
|
17466
|
-
|
|
17467
|
-
const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
17468
|
-
// Navigate the iframe to the authorize request url
|
|
17469
|
-
await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
|
|
18411
|
+
finally {
|
|
18412
|
+
invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
|
|
17470
18413
|
}
|
|
17471
|
-
|
|
18414
|
+
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
|
|
18415
|
+
return { serverParams, pkceCodes, silentRequest };
|
|
17472
18416
|
}
|
|
17473
|
-
|
|
17474
|
-
|
|
18417
|
+
catch (e) {
|
|
18418
|
+
await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
18419
|
+
throw e;
|
|
17475
18420
|
}
|
|
17476
|
-
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
|
|
17477
|
-
return { serverParams, pkceCodes, silentRequest };
|
|
17478
18421
|
}
|
|
17479
18422
|
async waitForIframeResponse(iframe, request) {
|
|
17480
18423
|
if (this.waitForIframeResponseHook) {
|
|
@@ -17747,7 +18690,6 @@ function getPlatformSilentRequestKey(request, config) {
|
|
|
17747
18690
|
: undefined,
|
|
17748
18691
|
extraParameters: canonicalizeStringDict(request.extraParameters),
|
|
17749
18692
|
extraQueryParameters: canonicalizeStringDict(request.extraQueryParameters),
|
|
17750
|
-
extraParametersNoCache: canonicalizeStringDict(request.extraParametersNoCache),
|
|
17751
18693
|
forceRefresh: !!request.forceRefresh,
|
|
17752
18694
|
cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
|
|
17753
18695
|
});
|
|
@@ -17756,8 +18698,12 @@ function getPlatformSilentRequestKey(request, config) {
|
|
|
17756
18698
|
* Copies caller-owned mutable inputs before asynchronous broker initialization.
|
|
17757
18699
|
*/
|
|
17758
18700
|
function snapshotPlatformSilentRequest(request) {
|
|
17759
|
-
|
|
18701
|
+
const snapshot = {
|
|
17760
18702
|
...request,
|
|
18703
|
+
};
|
|
18704
|
+
delete snapshot.extraParametersNoCache;
|
|
18705
|
+
return {
|
|
18706
|
+
...snapshot,
|
|
17761
18707
|
scopes: [...(request.scopes || [])],
|
|
17762
18708
|
account: { ...request.account },
|
|
17763
18709
|
azureCloudOptions: request.azureCloudOptions
|
|
@@ -17769,9 +18715,6 @@ function snapshotPlatformSilentRequest(request) {
|
|
|
17769
18715
|
extraQueryParameters: request.extraQueryParameters
|
|
17770
18716
|
? { ...request.extraQueryParameters }
|
|
17771
18717
|
: undefined,
|
|
17772
|
-
extraParametersNoCache: request.extraParametersNoCache
|
|
17773
|
-
? { ...request.extraParametersNoCache }
|
|
17774
|
-
: undefined,
|
|
17775
18718
|
attributeTokens: request.attributeTokens
|
|
17776
18719
|
? [...request.attributeTokens]
|
|
17777
18720
|
: undefined,
|
|
@@ -17982,7 +18925,32 @@ class StandardController {
|
|
|
17982
18925
|
* @returns
|
|
17983
18926
|
*/
|
|
17984
18927
|
async handleRedirectPromiseInternal(options) {
|
|
17985
|
-
|
|
18928
|
+
// Preserve the response for RedirectClient before removing it from the URL.
|
|
18929
|
+
const responseString = options?.hash ||
|
|
18930
|
+
(this.config.auth.OIDCOptions.responseMode ===
|
|
18931
|
+
ResponseMode$1.QUERY
|
|
18932
|
+
? window.location.search
|
|
18933
|
+
: window.location.hash);
|
|
18934
|
+
const anyClientInteractionInProgress = this.browserStorage.isInteractionInProgress(false);
|
|
18935
|
+
const currentClientInteraction = this.browserStorage.isInteractionInProgress(true);
|
|
18936
|
+
const isBridgeCallback = isInPopup() ||
|
|
18937
|
+
(isInIframe() &&
|
|
18938
|
+
!this.config.system.allowRedirectInIframe);
|
|
18939
|
+
/*
|
|
18940
|
+
* Clear recognized response fragments for:
|
|
18941
|
+
* - Stale callbacks with no pending interaction.
|
|
18942
|
+
* - This client's login callback, even if request setup or response validation fails.
|
|
18943
|
+
* - This client's logout callback containing state, before the SIGNOUT early return.
|
|
18944
|
+
* Leave another client's callback untouched. clearHash preserves query strings
|
|
18945
|
+
* and application routes, and does nothing when no response fragment is present.
|
|
18946
|
+
* Skip popup and non-redirect iframe callbacks: legacy apps may call HRP
|
|
18947
|
+
* before their redirect bridge reads and broadcasts the response.
|
|
18948
|
+
*/
|
|
18949
|
+
if (!isBridgeCallback &&
|
|
18950
|
+
(!anyClientInteractionInProgress || currentClientInteraction)) {
|
|
18951
|
+
clearHash(window);
|
|
18952
|
+
}
|
|
18953
|
+
if (!currentClientInteraction) {
|
|
17986
18954
|
this.logger.info("0le6uv", "");
|
|
17987
18955
|
return null;
|
|
17988
18956
|
}
|
|
@@ -17990,7 +18958,7 @@ class StandardController {
|
|
|
17990
18958
|
if (interactionType === INTERACTION_TYPE.SIGNOUT) {
|
|
17991
18959
|
this.logger.verbose("1ywcv2", "");
|
|
17992
18960
|
this.browserStorage.setInteractionInProgress(false);
|
|
17993
|
-
return
|
|
18961
|
+
return null;
|
|
17994
18962
|
}
|
|
17995
18963
|
const loggedInAccounts = this.getAllAccounts();
|
|
17996
18964
|
const platformBrokerRequest = this.browserStorage.getCachedNativeRequest();
|
|
@@ -18020,7 +18988,9 @@ class StandardController {
|
|
|
18020
18988
|
rootMeasurement = this.performanceClient.startMeasurement(AcquireTokenRedirect, correlationId);
|
|
18021
18989
|
this.logger.trace("0znzs5", correlationId);
|
|
18022
18990
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
18023
|
-
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(standardRequest, codeVerifier, rootMeasurement, options
|
|
18991
|
+
redirectResponse = invokeAsync(redirectClient.handleRedirectPromise.bind(redirectClient), HandleRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)(standardRequest, codeVerifier, rootMeasurement, options?.hash
|
|
18992
|
+
? options
|
|
18993
|
+
: { ...options, hash: responseString });
|
|
18024
18994
|
}
|
|
18025
18995
|
}
|
|
18026
18996
|
catch (e) {
|
|
@@ -18109,8 +19079,9 @@ class StandardController {
|
|
|
18109
19079
|
let result;
|
|
18110
19080
|
const platformAuthProvider = this.platformAuthProvider;
|
|
18111
19081
|
if (this.canUsePlatformBroker(request) && platformAuthProvider) {
|
|
19082
|
+
const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
|
|
18112
19083
|
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);
|
|
18113
|
-
result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(
|
|
19084
|
+
result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(nativeRequest, atrMeasurement).catch((e) => {
|
|
18114
19085
|
if (e instanceof NativeAuthError &&
|
|
18115
19086
|
isFatalNativeAuthError(e)) {
|
|
18116
19087
|
this.platformAuthProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt platform broker calls
|
|
@@ -18168,6 +19139,9 @@ class StandardController {
|
|
|
18168
19139
|
this.logger.verbose("0ch87b", correlationId);
|
|
18169
19140
|
preflightCheck(this.initialized, atPopupMeasurement, this.config, request);
|
|
18170
19141
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNIN, request.overrideInteractionInProgress, correlationId);
|
|
19142
|
+
if (request.overrideInteractionInProgress) {
|
|
19143
|
+
cancelPendingPopupPollingResponse(this.logger);
|
|
19144
|
+
}
|
|
18171
19145
|
}
|
|
18172
19146
|
catch (e) {
|
|
18173
19147
|
// Since this function is syncronous we need to reject
|
|
@@ -18652,6 +19626,13 @@ class StandardController {
|
|
|
18652
19626
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
18653
19627
|
redirectPreflightCheck(this.initialized, this.config);
|
|
18654
19628
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
|
|
19629
|
+
try {
|
|
19630
|
+
await this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
19631
|
+
}
|
|
19632
|
+
catch (error) {
|
|
19633
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
19634
|
+
throw error;
|
|
19635
|
+
}
|
|
18655
19636
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
18656
19637
|
return redirectClient.logout(logoutRequest);
|
|
18657
19638
|
}
|
|
@@ -18665,7 +19646,11 @@ class StandardController {
|
|
|
18665
19646
|
preflightCheck$1(this.initialized);
|
|
18666
19647
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
|
|
18667
19648
|
const popupClient = this.createPopupClient(correlationId);
|
|
18668
|
-
|
|
19649
|
+
const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
19650
|
+
const popupLogout = popupClient.logout(logoutRequest);
|
|
19651
|
+
return Promise.all([nativeCacheClear, popupLogout])
|
|
19652
|
+
.then(() => undefined)
|
|
19653
|
+
.finally(() => {
|
|
18669
19654
|
this.browserStorage.setInteractionInProgress(false);
|
|
18670
19655
|
});
|
|
18671
19656
|
}
|
|
@@ -18684,7 +19669,30 @@ class StandardController {
|
|
|
18684
19669
|
}
|
|
18685
19670
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
18686
19671
|
const cacheClient = this.createSilentCacheClient(correlationId);
|
|
18687
|
-
|
|
19672
|
+
const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
19673
|
+
const browserCacheClear = cacheClient.logout(logoutRequest);
|
|
19674
|
+
await Promise.all([nativeCacheClear, browserCacheClear]);
|
|
19675
|
+
}
|
|
19676
|
+
async clearNativeCache(account, correlationId) {
|
|
19677
|
+
const homeAccountId = account?.homeAccountId.toLowerCase();
|
|
19678
|
+
const environment = account?.environment.toLowerCase();
|
|
19679
|
+
const accessTokenKeys = this.nativeInternalStorage
|
|
19680
|
+
.getTokenKeys()
|
|
19681
|
+
.accessToken.filter((key) => {
|
|
19682
|
+
if (!account) {
|
|
19683
|
+
return true;
|
|
19684
|
+
}
|
|
19685
|
+
const accessToken = this.nativeInternalStorage.getAccessTokenCredential(key, correlationId);
|
|
19686
|
+
if (!accessToken) {
|
|
19687
|
+
return false;
|
|
19688
|
+
}
|
|
19689
|
+
return (accessToken.homeAccountId.toLowerCase() === homeAccountId &&
|
|
19690
|
+
accessToken.environment.toLowerCase() === environment);
|
|
19691
|
+
});
|
|
19692
|
+
await Promise.all(accessTokenKeys.map((key) => this.nativeInternalStorage.removeAccessTokenAndTokenBindingKey(key, correlationId)));
|
|
19693
|
+
if (!account) {
|
|
19694
|
+
this.nativeInternalStorage.clear(correlationId);
|
|
19695
|
+
}
|
|
18688
19696
|
}
|
|
18689
19697
|
// #endregion
|
|
18690
19698
|
// #region Account APIs
|
|
@@ -18766,6 +19774,19 @@ class StandardController {
|
|
|
18766
19774
|
}
|
|
18767
19775
|
}
|
|
18768
19776
|
// #region Helpers
|
|
19777
|
+
/**
|
|
19778
|
+
* Removes internal DPoP key state from application-originated broker requests.
|
|
19779
|
+
*/
|
|
19780
|
+
sanitizeNativeBrokerRequest(request, correlationId) {
|
|
19781
|
+
if (!request.dpopJkt) {
|
|
19782
|
+
return request;
|
|
19783
|
+
}
|
|
19784
|
+
this.logger.warning("0rh2us", correlationId);
|
|
19785
|
+
return {
|
|
19786
|
+
...request,
|
|
19787
|
+
dpopJkt: undefined,
|
|
19788
|
+
};
|
|
19789
|
+
}
|
|
18769
19790
|
/**
|
|
18770
19791
|
* Acquire a token from native device (e.g. WAM)
|
|
18771
19792
|
* @param request
|
|
@@ -18785,7 +19806,8 @@ class StandardController {
|
|
|
18785
19806
|
throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
|
|
18786
19807
|
}
|
|
18787
19808
|
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);
|
|
18788
|
-
|
|
19809
|
+
const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
|
|
19810
|
+
return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(nativeRequest, cacheLookupPolicy);
|
|
18789
19811
|
}
|
|
18790
19812
|
/**
|
|
18791
19813
|
* Returns boolean indicating if this request can use the platform broker
|
|
@@ -19065,14 +20087,23 @@ class StandardController {
|
|
|
19065
20087
|
correlationId,
|
|
19066
20088
|
config: this.config,
|
|
19067
20089
|
}, this.platformAuthProvider, this.logger, this.performanceClient);
|
|
19068
|
-
const
|
|
20090
|
+
const shouldDeduplicate = preparedRequest.request.authenticationScheme !==
|
|
20091
|
+
AuthenticationScheme$1.DPOP;
|
|
20092
|
+
const inProgressRequest = shouldDeduplicate
|
|
20093
|
+
? this.activeSilentTokenRequests.get(preparedRequest.key)
|
|
20094
|
+
: undefined;
|
|
19069
20095
|
if (typeof inProgressRequest === "undefined") {
|
|
19070
|
-
this.logger.verbose(
|
|
20096
|
+
this.logger.verbose(shouldDeduplicate
|
|
20097
|
+
? "0fcjbk"
|
|
20098
|
+
: "acquireTokenSilent called for DPoP request, starting an independent operation", correlationId);
|
|
19071
20099
|
this.performanceClient.addFields({ deduped: false }, correlationId);
|
|
19072
20100
|
const activeRequest = invokeAsync(this.acquireTokenSilentAsync.bind(this), AcquireTokenSilentAsync, this.logger, this.performanceClient, correlationId)({
|
|
19073
20101
|
...preparedRequest.request,
|
|
19074
20102
|
correlationId,
|
|
19075
20103
|
}, preparedRequest.account);
|
|
20104
|
+
if (!shouldDeduplicate) {
|
|
20105
|
+
return activeRequest;
|
|
20106
|
+
}
|
|
19076
20107
|
this.activeSilentTokenRequests.set(preparedRequest.key, activeRequest);
|
|
19077
20108
|
return activeRequest.finally(() => {
|
|
19078
20109
|
this.activeSilentTokenRequests.delete(preparedRequest.key);
|
|
@@ -20543,6 +21574,79 @@ NestedAppOperatingContext.MODULE_NAME = "";
|
|
|
20543
21574
|
*/
|
|
20544
21575
|
NestedAppOperatingContext.ID = "NestedAppOperatingContext";
|
|
20545
21576
|
|
|
21577
|
+
/*
|
|
21578
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
21579
|
+
* Licensed under the MIT License.
|
|
21580
|
+
*/
|
|
21581
|
+
const IFRAME_POLL_INTERVAL_MS = 50;
|
|
21582
|
+
const DEFAULT_IFRAME_TIMEOUT_MS = 10000;
|
|
21583
|
+
/**
|
|
21584
|
+
* Monitors an iframe content window until it loads a URL with a known hash, or hits a specified timeout.
|
|
21585
|
+
*
|
|
21586
|
+
* @param iframe - The hidden iframe to monitor.
|
|
21587
|
+
* @param timeout - Maximum time (ms) to wait for navigation before rejecting with
|
|
21588
|
+
* `monitor_window_timeout`.
|
|
21589
|
+
* @param logger - Logger instance.
|
|
21590
|
+
* @param correlationId
|
|
21591
|
+
* @param responseMode - `"query"` or `"fragment"` — determines whether to read
|
|
21592
|
+
* `location.search` or `location.hash`. Any value other than `"query"` is
|
|
21593
|
+
* treated as fragment.
|
|
21594
|
+
*/
|
|
21595
|
+
async function monitorIframeForHash(iframe, timeout, logger, correlationId, responseMode) {
|
|
21596
|
+
return new Promise((resolve, reject) => {
|
|
21597
|
+
if (timeout < DEFAULT_IFRAME_TIMEOUT_MS) {
|
|
21598
|
+
logger.warning(`137tec ${timeout} ${DEFAULT_IFRAME_TIMEOUT_MS}`, correlationId);
|
|
21599
|
+
}
|
|
21600
|
+
/*
|
|
21601
|
+
* Polling for iframes can be purely timing based,
|
|
21602
|
+
* since we don't need to account for interaction.
|
|
21603
|
+
*/
|
|
21604
|
+
const timeoutId = window.setTimeout(() => {
|
|
21605
|
+
window.clearInterval(intervalId);
|
|
21606
|
+
reject(new AuthError(timedOut, correlationId, undefined, "monitor_window_timeout"));
|
|
21607
|
+
}, timeout);
|
|
21608
|
+
const intervalId = window.setInterval(() => {
|
|
21609
|
+
const contentWindow = iframe.contentWindow;
|
|
21610
|
+
if (!contentWindow) {
|
|
21611
|
+
return;
|
|
21612
|
+
}
|
|
21613
|
+
let href = "";
|
|
21614
|
+
try {
|
|
21615
|
+
/*
|
|
21616
|
+
* Will throw if cross origin,
|
|
21617
|
+
* which should be caught and ignored
|
|
21618
|
+
* since we need the interval to keep running while on STS UI.
|
|
21619
|
+
*/
|
|
21620
|
+
href = contentWindow.location.href;
|
|
21621
|
+
}
|
|
21622
|
+
catch (e) { }
|
|
21623
|
+
if (!href || href === "about:blank") {
|
|
21624
|
+
return;
|
|
21625
|
+
}
|
|
21626
|
+
const responseString = responseMode === ResponseMode$1.QUERY
|
|
21627
|
+
? contentWindow.location.search
|
|
21628
|
+
: contentWindow.location.hash;
|
|
21629
|
+
window.clearTimeout(timeoutId);
|
|
21630
|
+
window.clearInterval(intervalId);
|
|
21631
|
+
resolve(responseString);
|
|
21632
|
+
}, IFRAME_POLL_INTERVAL_MS);
|
|
21633
|
+
}).finally(() => {
|
|
21634
|
+
/*
|
|
21635
|
+
* Strip auth-response params from the iframe URL. The monitor owns the
|
|
21636
|
+
* iframe for the duration of the poll, mirroring cleanPopup in
|
|
21637
|
+
* PopupMonitor.
|
|
21638
|
+
*/
|
|
21639
|
+
try {
|
|
21640
|
+
if (iframe.contentWindow) {
|
|
21641
|
+
clearAuthResponseFromUrl(iframe.contentWindow);
|
|
21642
|
+
}
|
|
21643
|
+
}
|
|
21644
|
+
catch {
|
|
21645
|
+
// Iframe may already be navigated away or cross-origin; ignore.
|
|
21646
|
+
}
|
|
21647
|
+
});
|
|
21648
|
+
}
|
|
21649
|
+
|
|
20546
21650
|
/*
|
|
20547
21651
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
20548
21652
|
* Licensed under the MIT License.
|
|
@@ -20585,27 +21689,29 @@ class PublicClientApplication {
|
|
|
20585
21689
|
/**
|
|
20586
21690
|
* Waits for the auth response from a popup window opened by MSAL.
|
|
20587
21691
|
*
|
|
20588
|
-
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge
|
|
20589
|
-
*
|
|
20590
|
-
*
|
|
21692
|
+
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge,
|
|
21693
|
+
* or to the v4-style same-origin location poller when
|
|
21694
|
+
* `system.enableLegacyPolling` is set. Subclasses must return the raw response
|
|
21695
|
+
* string (hash/query/fragment), or reject with an `AuthError` on failure.
|
|
20591
21696
|
*
|
|
20592
21697
|
* @internal
|
|
20593
21698
|
* @param request The in-flight authorization or end-session request.
|
|
20594
21699
|
* @param popupWindow The popup window opened by MSAL.
|
|
20595
21700
|
* @param popupWindowParent The parent window that opened the popup.
|
|
20596
21701
|
*/
|
|
20597
|
-
async waitForPopupResponse(request,
|
|
20598
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20599
|
-
popupWindow,
|
|
20600
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20601
|
-
popupWindowParent) {
|
|
21702
|
+
async waitForPopupResponse(request, popupWindow, popupWindowParent) {
|
|
20602
21703
|
const controller = this.controller;
|
|
20603
|
-
|
|
21704
|
+
const config = controller.getConfiguration();
|
|
21705
|
+
if (config.system.enableLegacyPolling) {
|
|
21706
|
+
return waitForPopupPollingResponse(config, controller.getLogger(), controller.getPerformanceClient(), request, popupWindow, popupWindowParent);
|
|
21707
|
+
}
|
|
21708
|
+
return waitForBridgeResponse(config.system.popupBridgeTimeout, controller.getLogger(), request, controller.getPerformanceClient());
|
|
20604
21709
|
}
|
|
20605
21710
|
/**
|
|
20606
21711
|
* Waits for the auth response from a hidden iframe used by MSAL silent flows.
|
|
20607
21712
|
*
|
|
20608
|
-
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge
|
|
21713
|
+
* The default implementation delegates to MSAL's `BroadcastChannel`-based bridge,
|
|
21714
|
+
* or to the v4-style location poller when `system.enableLegacyPolling` is set.
|
|
20609
21715
|
* Subclasses must return the raw response string (hash/query/fragment), or reject
|
|
20610
21716
|
* with an `AuthError` on failure.
|
|
20611
21717
|
*
|
|
@@ -20613,11 +21719,12 @@ class PublicClientApplication {
|
|
|
20613
21719
|
* @param iframe The hidden iframe MSAL attached to the document.
|
|
20614
21720
|
* @param request The in-flight authorization request.
|
|
20615
21721
|
*/
|
|
20616
|
-
async waitForIframeResponse(
|
|
20617
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
20618
|
-
iframe, request) {
|
|
21722
|
+
async waitForIframeResponse(iframe, request) {
|
|
20619
21723
|
const controller = this.controller;
|
|
20620
21724
|
const config = controller.getConfiguration();
|
|
21725
|
+
if (config.system.enableLegacyPolling) {
|
|
21726
|
+
return waitForIframePollingResponse(config, controller.getLogger(), controller.getPerformanceClient(), iframe, request);
|
|
21727
|
+
}
|
|
20621
21728
|
return waitForBridgeResponse(config.system.iframeBridgeTimeout, controller.getLogger(), request, controller.getPerformanceClient(), config.experimental);
|
|
20622
21729
|
}
|
|
20623
21730
|
/**
|
|
@@ -20886,6 +21993,40 @@ async function createStandardPublicClientApplication(configuration) {
|
|
|
20886
21993
|
const pca = new PublicClientApplication(configuration);
|
|
20887
21994
|
await pca.initialize();
|
|
20888
21995
|
return pca;
|
|
21996
|
+
}
|
|
21997
|
+
/**
|
|
21998
|
+
* Collects a popup auth response using the v4-style same-origin location
|
|
21999
|
+
* poller instead of the `BroadcastChannel` redirect bridge.
|
|
22000
|
+
*/
|
|
22001
|
+
async function waitForPopupPollingResponse(config, logger, performanceClient, request, popupWindow, popupWindowParent) {
|
|
22002
|
+
const responseMode = config.auth.OIDCOptions?.responseMode === ResponseMode$1.QUERY
|
|
22003
|
+
? ResponseMode$1.QUERY
|
|
22004
|
+
: ResponseMode$1.FRAGMENT;
|
|
22005
|
+
performanceClient.addFields({ usesLegacyPolling: true }, request.correlationId);
|
|
22006
|
+
const unloadHandler = () => {
|
|
22007
|
+
try {
|
|
22008
|
+
if (popupWindow && !popupWindow.closed) {
|
|
22009
|
+
popupWindow.close();
|
|
22010
|
+
}
|
|
22011
|
+
}
|
|
22012
|
+
catch {
|
|
22013
|
+
/* ignore */
|
|
22014
|
+
}
|
|
22015
|
+
};
|
|
22016
|
+
popupWindowParent.addEventListener("beforeunload", unloadHandler);
|
|
22017
|
+
return monitorPopupForHash(popupWindow, popupWindowParent, responseMode, logger, unloadHandler, request.correlationId);
|
|
22018
|
+
}
|
|
22019
|
+
/**
|
|
22020
|
+
* Collects a silent-iframe auth response using the v4-style location poller
|
|
22021
|
+
* instead of the `BroadcastChannel` redirect bridge.
|
|
22022
|
+
*/
|
|
22023
|
+
async function waitForIframePollingResponse(config, logger, performanceClient, iframe, request) {
|
|
22024
|
+
const responseMode = config.auth.OIDCOptions?.responseMode === ResponseMode$1.QUERY
|
|
22025
|
+
? ResponseMode$1.QUERY
|
|
22026
|
+
: ResponseMode$1.FRAGMENT;
|
|
22027
|
+
const iframePollTimeout = config.system.iframeBridgeTimeout;
|
|
22028
|
+
performanceClient.addFields({ usesLegacyPolling: true, iframePollTimeout }, request.correlationId);
|
|
22029
|
+
return monitorIframeForHash(iframe, iframePollTimeout, logger, request.correlationId, responseMode);
|
|
20889
22030
|
}
|
|
20890
22031
|
|
|
20891
22032
|
/*
|
|
@@ -21519,7 +22660,7 @@ exports.ClientAuthError = ClientAuthError;
|
|
|
21519
22660
|
exports.ClientAuthErrorCodes = ClientAuthErrorCodes;
|
|
21520
22661
|
exports.ClientConfigurationError = ClientConfigurationError;
|
|
21521
22662
|
exports.ClientConfigurationErrorCodes = ClientConfigurationErrorCodes;
|
|
21522
|
-
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS;
|
|
22663
|
+
exports.DEFAULT_IFRAME_TIMEOUT_MS = DEFAULT_IFRAME_TIMEOUT_MS$1;
|
|
21523
22664
|
exports.EventHandler = EventHandler;
|
|
21524
22665
|
exports.EventMessageUtils = EventMessageUtils;
|
|
21525
22666
|
exports.EventType = EventType;
|