@azure/msal-browser 5.27.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/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +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 +1 -1
- package/dist/controllers/NestedAppAuthController.mjs +1 -1
- package/dist/controllers/StandardController.mjs +65 -7
- 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 +27 -20
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +29 -14
- 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 +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +59 -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 +21 -13
- 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 +1 -1
- package/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/IframeMonitor.mjs +1 -1
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/utils/PopupMonitor.mjs +1 -1
- package/dist/utils/PopupOriginCheck.mjs +1 -1
- 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 +51 -11
- package/lib/custom-auth-path/msal-custom-auth.cjs +1563 -424
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +1563 -424
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +19 -11
- package/lib/msal-browser.cjs +914 -259
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +914 -259
- 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/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/controllers/StandardController.ts +107 -11
- 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 +104 -83
- package/src/interaction_client/RedirectClient.ts +88 -34
- package/src/interaction_client/SilentIframeClient.ts +121 -95
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +46 -18
- package/src/request/RequestHelpers.ts +64 -11
- package/src/request/SilentRequestHelpers.ts +8 -9
- package/src/telemetry/BrowserPerformanceEvents.ts +1 -0
- 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/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.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/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
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @azure/msal-browser v5.
|
|
1
|
+
/*! @azure/msal-browser v5.28.0 2026-11-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
(function (global, factory) {
|
|
4
4
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msalCustomAuth = {}));
|
|
7
7
|
})(this, (function (exports) { 'use strict';
|
|
8
8
|
|
|
9
|
-
/*! @azure/msal-common v16.
|
|
9
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
10
10
|
/*
|
|
11
11
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12
12
|
* Licensed under the MIT License.
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
*/
|
|
67
67
|
const POPUP_ORIGIN_CHECK_DONE = "pocd";
|
|
68
68
|
|
|
69
|
-
/*! @azure/msal-common v16.
|
|
69
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
70
70
|
/*
|
|
71
71
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
72
72
|
* Licensed under the MIT License.
|
|
@@ -300,7 +300,7 @@
|
|
|
300
300
|
// Token renewal offset default in seconds
|
|
301
301
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
302
302
|
|
|
303
|
-
/*! @azure/msal-common v16.
|
|
303
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
304
304
|
/*
|
|
305
305
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
306
306
|
* Licensed under the MIT License.
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
/*! @azure/msal-common v16.
|
|
332
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
333
333
|
|
|
334
334
|
/*
|
|
335
335
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -352,7 +352,7 @@
|
|
|
352
352
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
353
353
|
}
|
|
354
354
|
|
|
355
|
-
/*! @azure/msal-common v16.
|
|
355
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
356
356
|
/*
|
|
357
357
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
358
358
|
* Licensed under the MIT License.
|
|
@@ -390,7 +390,7 @@
|
|
|
390
390
|
const resourceParameterRequired = "resource_parameter_required";
|
|
391
391
|
const misplacedResourceParam = "misplaced_resource_parameter";
|
|
392
392
|
|
|
393
|
-
/*! @azure/msal-common v16.
|
|
393
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
394
394
|
|
|
395
395
|
/*
|
|
396
396
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -428,7 +428,7 @@
|
|
|
428
428
|
};
|
|
429
429
|
}
|
|
430
430
|
|
|
431
|
-
/*! @azure/msal-common v16.
|
|
431
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
432
432
|
|
|
433
433
|
/*
|
|
434
434
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -494,7 +494,7 @@
|
|
|
494
494
|
return matches[2];
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
/*! @azure/msal-common v16.
|
|
497
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
498
498
|
|
|
499
499
|
/*
|
|
500
500
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -582,7 +582,7 @@
|
|
|
582
582
|
return updatedAccountInfo;
|
|
583
583
|
}
|
|
584
584
|
|
|
585
|
-
/*! @azure/msal-common v16.
|
|
585
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
586
586
|
/*
|
|
587
587
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
588
588
|
* Licensed under the MIT License.
|
|
@@ -596,7 +596,7 @@
|
|
|
596
596
|
Ciam: 3,
|
|
597
597
|
};
|
|
598
598
|
|
|
599
|
-
/*! @azure/msal-common v16.
|
|
599
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
600
600
|
/*
|
|
601
601
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
602
602
|
* Licensed under the MIT License.
|
|
@@ -618,7 +618,7 @@
|
|
|
618
618
|
return null;
|
|
619
619
|
}
|
|
620
620
|
|
|
621
|
-
/*! @azure/msal-common v16.
|
|
621
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
622
622
|
/*
|
|
623
623
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
624
624
|
* Licensed under the MIT License.
|
|
@@ -642,7 +642,7 @@
|
|
|
642
642
|
EAR: "EAR",
|
|
643
643
|
};
|
|
644
644
|
|
|
645
|
-
/*! @azure/msal-common v16.
|
|
645
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
646
646
|
/**
|
|
647
647
|
* Returns the AccountInfo interface for this account.
|
|
648
648
|
* @internal
|
|
@@ -831,7 +831,7 @@
|
|
|
831
831
|
entity.hasOwnProperty("authorityType"));
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
-
/*! @azure/msal-common v16.
|
|
834
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
835
835
|
/*
|
|
836
836
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
837
837
|
* Licensed under the MIT License.
|
|
@@ -841,7 +841,7 @@
|
|
|
841
841
|
*/
|
|
842
842
|
const unexpectedError = "unexpected_error";
|
|
843
843
|
|
|
844
|
-
/*! @azure/msal-common v16.
|
|
844
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
845
845
|
|
|
846
846
|
/*
|
|
847
847
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -861,7 +861,7 @@
|
|
|
861
861
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
862
862
|
}
|
|
863
863
|
|
|
864
|
-
/*! @azure/msal-common v16.
|
|
864
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
865
865
|
/*
|
|
866
866
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
867
867
|
* Licensed under the MIT License.
|
|
@@ -901,7 +901,7 @@
|
|
|
901
901
|
return headerName === undefined ? undefined : headers[headerName];
|
|
902
902
|
}
|
|
903
903
|
|
|
904
|
-
/*! @azure/msal-common v16.
|
|
904
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
905
905
|
/*
|
|
906
906
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
907
907
|
* Licensed under the MIT License.
|
|
@@ -932,7 +932,7 @@
|
|
|
932
932
|
const invalidDpopNonce = "invalid_dpop_nonce";
|
|
933
933
|
const dpopMissingResourceContext = "dpop_missing_resource_context";
|
|
934
934
|
|
|
935
|
-
/*! @azure/msal-common v16.
|
|
935
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
936
936
|
/*
|
|
937
937
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
938
938
|
* Licensed under the MIT License.
|
|
@@ -944,7 +944,7 @@
|
|
|
944
944
|
response.hasOwnProperty("jwks_uri"));
|
|
945
945
|
}
|
|
946
946
|
|
|
947
|
-
/*! @azure/msal-common v16.
|
|
947
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
948
948
|
/*
|
|
949
949
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
950
950
|
* Licensed under the MIT License.
|
|
@@ -1024,7 +1024,7 @@
|
|
|
1024
1024
|
}
|
|
1025
1025
|
}
|
|
1026
1026
|
|
|
1027
|
-
/*! @azure/msal-common v16.
|
|
1027
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1028
1028
|
|
|
1029
1029
|
/*
|
|
1030
1030
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1182,7 +1182,7 @@
|
|
|
1182
1182
|
}
|
|
1183
1183
|
}
|
|
1184
1184
|
|
|
1185
|
-
/*! @azure/msal-common v16.
|
|
1185
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1186
1186
|
|
|
1187
1187
|
/*
|
|
1188
1188
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1336,7 +1336,7 @@
|
|
|
1336
1336
|
return null;
|
|
1337
1337
|
}
|
|
1338
1338
|
|
|
1339
|
-
/*! @azure/msal-common v16.
|
|
1339
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1340
1340
|
/*
|
|
1341
1341
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1342
1342
|
* Licensed under the MIT License.
|
|
@@ -1345,7 +1345,7 @@
|
|
|
1345
1345
|
// AzureCloudInstance is not specified.
|
|
1346
1346
|
None: "none"};
|
|
1347
1347
|
|
|
1348
|
-
/*! @azure/msal-common v16.
|
|
1348
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1349
1349
|
/*
|
|
1350
1350
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1351
1351
|
* Licensed under the MIT License.
|
|
@@ -1355,7 +1355,7 @@
|
|
|
1355
1355
|
response.hasOwnProperty("metadata"));
|
|
1356
1356
|
}
|
|
1357
1357
|
|
|
1358
|
-
/*! @azure/msal-common v16.
|
|
1358
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1359
1359
|
/*
|
|
1360
1360
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1361
1361
|
* Licensed under the MIT License.
|
|
@@ -1365,7 +1365,7 @@
|
|
|
1365
1365
|
response.hasOwnProperty("error_description"));
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
|
-
/*! @azure/msal-common v16.
|
|
1368
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1369
1369
|
/*
|
|
1370
1370
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1371
1371
|
* Licensed under the MIT License.
|
|
@@ -1436,7 +1436,7 @@
|
|
|
1436
1436
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1437
1437
|
const SetUserData = "setUserData";
|
|
1438
1438
|
|
|
1439
|
-
/*! @azure/msal-common v16.
|
|
1439
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1440
1440
|
/*
|
|
1441
1441
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1442
1442
|
* Licensed under the MIT License.
|
|
@@ -1529,7 +1529,7 @@
|
|
|
1529
1529
|
};
|
|
1530
1530
|
};
|
|
1531
1531
|
|
|
1532
|
-
/*! @azure/msal-common v16.
|
|
1532
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1533
1533
|
|
|
1534
1534
|
/*
|
|
1535
1535
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1640,7 +1640,7 @@
|
|
|
1640
1640
|
},
|
|
1641
1641
|
};
|
|
1642
1642
|
|
|
1643
|
-
/*! @azure/msal-common v16.
|
|
1643
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1644
1644
|
/*
|
|
1645
1645
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1646
1646
|
* Licensed under the MIT License.
|
|
@@ -1705,7 +1705,7 @@
|
|
|
1705
1705
|
return cachedAtSec > nowSeconds();
|
|
1706
1706
|
}
|
|
1707
1707
|
|
|
1708
|
-
/*! @azure/msal-common v16.
|
|
1708
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1709
1709
|
|
|
1710
1710
|
/*
|
|
1711
1711
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1992,7 +1992,7 @@
|
|
|
1992
1992
|
return [...attributeTokens].sort().join(" ");
|
|
1993
1993
|
}
|
|
1994
1994
|
|
|
1995
|
-
/*! @azure/msal-common v16.
|
|
1995
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
1996
1996
|
|
|
1997
1997
|
/*
|
|
1998
1998
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2960,7 +2960,7 @@
|
|
|
2960
2960
|
};
|
|
2961
2961
|
}
|
|
2962
2962
|
|
|
2963
|
-
/*! @azure/msal-common v16.
|
|
2963
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
2964
2964
|
|
|
2965
2965
|
/*
|
|
2966
2966
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -2994,7 +2994,7 @@
|
|
|
2994
2994
|
}
|
|
2995
2995
|
}
|
|
2996
2996
|
|
|
2997
|
-
/*! @azure/msal-common v16.
|
|
2997
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
2998
2998
|
|
|
2999
2999
|
/*
|
|
3000
3000
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3190,7 +3190,7 @@
|
|
|
3190
3190
|
}
|
|
3191
3191
|
}
|
|
3192
3192
|
|
|
3193
|
-
/*! @azure/msal-common v16.
|
|
3193
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3194
3194
|
|
|
3195
3195
|
/*
|
|
3196
3196
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3690,7 +3690,7 @@
|
|
|
3690
3690
|
}
|
|
3691
3691
|
}
|
|
3692
3692
|
|
|
3693
|
-
/*! @azure/msal-common v16.
|
|
3693
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3694
3694
|
|
|
3695
3695
|
/*
|
|
3696
3696
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3821,7 +3821,7 @@
|
|
|
3821
3821
|
}
|
|
3822
3822
|
}
|
|
3823
3823
|
|
|
3824
|
-
/*! @azure/msal-common v16.
|
|
3824
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3825
3825
|
|
|
3826
3826
|
/*
|
|
3827
3827
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3869,7 +3869,7 @@
|
|
|
3869
3869
|
},
|
|
3870
3870
|
};
|
|
3871
3871
|
|
|
3872
|
-
/*! @azure/msal-common v16.
|
|
3872
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3873
3873
|
|
|
3874
3874
|
/*
|
|
3875
3875
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3892,7 +3892,7 @@
|
|
|
3892
3892
|
},
|
|
3893
3893
|
};
|
|
3894
3894
|
|
|
3895
|
-
/*! @azure/msal-common v16.
|
|
3895
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
3896
3896
|
/*
|
|
3897
3897
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3898
3898
|
* Licensed under the MIT License.
|
|
@@ -4167,12 +4167,12 @@
|
|
|
4167
4167
|
}
|
|
4168
4168
|
}
|
|
4169
4169
|
|
|
4170
|
-
/*! @azure/msal-common v16.
|
|
4170
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4171
4171
|
/* eslint-disable header/header */
|
|
4172
4172
|
const name$1 = "@azure/msal-common";
|
|
4173
|
-
const version$1 = "16.
|
|
4173
|
+
const version$1 = "16.16.0";
|
|
4174
4174
|
|
|
4175
|
-
/*! @azure/msal-common v16.
|
|
4175
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4176
4176
|
/*
|
|
4177
4177
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4178
4178
|
* Licensed under the MIT License.
|
|
@@ -4180,7 +4180,7 @@
|
|
|
4180
4180
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4181
4181
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4182
4182
|
|
|
4183
|
-
/*! @azure/msal-common v16.
|
|
4183
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4184
4184
|
|
|
4185
4185
|
/*
|
|
4186
4186
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4218,7 +4218,7 @@
|
|
|
4218
4218
|
}
|
|
4219
4219
|
}
|
|
4220
4220
|
|
|
4221
|
-
/*! @azure/msal-common v16.
|
|
4221
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
4222
4222
|
|
|
4223
4223
|
/*
|
|
4224
4224
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4467,6 +4467,7 @@
|
|
|
4467
4467
|
};
|
|
4468
4468
|
const tokenKeys = this.getTokenKeys();
|
|
4469
4469
|
const currentScopes = ScopeSet.fromString(credential.target, correlationId);
|
|
4470
|
+
const accessTokenKeysToRemove = [];
|
|
4470
4471
|
tokenKeys.accessToken.forEach((key) => {
|
|
4471
4472
|
if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
|
|
4472
4473
|
return;
|
|
@@ -4476,10 +4477,13 @@
|
|
|
4476
4477
|
this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
|
|
4477
4478
|
const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
|
|
4478
4479
|
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
|
|
4479
|
-
|
|
4480
|
+
accessTokenKeysToRemove.push(key);
|
|
4480
4481
|
}
|
|
4481
4482
|
}
|
|
4482
4483
|
});
|
|
4484
|
+
for (const key of accessTokenKeysToRemove) {
|
|
4485
|
+
await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
|
|
4486
|
+
}
|
|
4483
4487
|
await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
|
|
4484
4488
|
}
|
|
4485
4489
|
/**
|
|
@@ -4715,12 +4719,32 @@
|
|
|
4715
4719
|
* @param correlationId
|
|
4716
4720
|
*/
|
|
4717
4721
|
removeAccessToken(key, correlationId) {
|
|
4722
|
+
const credential = this.removeAccessTokenCredential(key, correlationId);
|
|
4723
|
+
if (credential) {
|
|
4724
|
+
void this.removeTokenBindingKeyForCredential(credential, correlationId);
|
|
4725
|
+
}
|
|
4726
|
+
}
|
|
4727
|
+
/**
|
|
4728
|
+
* Removes an access token and waits for any unreferenced token-binding key
|
|
4729
|
+
* cleanup. Internal callers that require deterministic cleanup should use
|
|
4730
|
+
* this method instead of the synchronous public cache contract.
|
|
4731
|
+
*/
|
|
4732
|
+
async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId) {
|
|
4733
|
+
const credential = this.removeAccessTokenCredential(key, correlationId);
|
|
4734
|
+
if (credential) {
|
|
4735
|
+
await this.removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId);
|
|
4736
|
+
}
|
|
4737
|
+
}
|
|
4738
|
+
removeAccessTokenCredential(key, correlationId) {
|
|
4718
4739
|
const credential = this.getAccessTokenCredential(key, correlationId);
|
|
4719
4740
|
if (!credential) {
|
|
4720
|
-
return;
|
|
4741
|
+
return null;
|
|
4721
4742
|
}
|
|
4722
4743
|
this.removeItem(key, correlationId);
|
|
4723
4744
|
this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
|
|
4745
|
+
return credential;
|
|
4746
|
+
}
|
|
4747
|
+
async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
|
|
4724
4748
|
// Remove Token Binding Key from key store for token-bound access token credentials
|
|
4725
4749
|
if (credential.credentialType.toLowerCase() ===
|
|
4726
4750
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
|
|
@@ -4730,19 +4754,28 @@
|
|
|
4730
4754
|
case AuthenticationScheme.DPOP.toLowerCase(): {
|
|
4731
4755
|
const accessTokenWithAuthSchemeEntity = credential;
|
|
4732
4756
|
const kid = accessTokenWithAuthSchemeEntity.keyId;
|
|
4733
|
-
if (kid
|
|
4734
|
-
|
|
4735
|
-
|
|
4736
|
-
|
|
4757
|
+
if (kid &&
|
|
4758
|
+
kid !== preservedKeyId &&
|
|
4759
|
+
!this.isTokenBindingKeyReferenced(kid, correlationId)) {
|
|
4760
|
+
try {
|
|
4761
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
|
|
4762
|
+
}
|
|
4763
|
+
catch {
|
|
4737
4764
|
this.commonLogger.error("0id34f", correlationId);
|
|
4738
4765
|
this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
|
|
4739
|
-
}
|
|
4766
|
+
}
|
|
4740
4767
|
}
|
|
4741
4768
|
break;
|
|
4742
4769
|
}
|
|
4743
4770
|
}
|
|
4744
4771
|
}
|
|
4745
4772
|
}
|
|
4773
|
+
isTokenBindingKeyReferenced(keyId, correlationId) {
|
|
4774
|
+
return this.getTokenKeys().accessToken.some((accessTokenKey) => {
|
|
4775
|
+
const accessToken = this.getAccessTokenCredential(accessTokenKey, correlationId);
|
|
4776
|
+
return accessToken?.keyId === keyId;
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4746
4779
|
/**
|
|
4747
4780
|
* Removes all app metadata objects from cache.
|
|
4748
4781
|
*/
|
|
@@ -4881,6 +4914,7 @@
|
|
|
4881
4914
|
const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
|
|
4882
4915
|
const authScheme = request.authenticationScheme ||
|
|
4883
4916
|
AuthenticationScheme.BEARER;
|
|
4917
|
+
const normalizedAuthScheme = authScheme.toLowerCase();
|
|
4884
4918
|
/*
|
|
4885
4919
|
* Distinguish between Bearer and PoP/SSH token cache types
|
|
4886
4920
|
* Cast to lowercase to handle "bearer" from ADFS
|
|
@@ -4905,7 +4939,10 @@
|
|
|
4905
4939
|
tokenType: authScheme,
|
|
4906
4940
|
keyId: authScheme === AuthenticationScheme.SSH
|
|
4907
4941
|
? request.sshKid
|
|
4908
|
-
:
|
|
4942
|
+
: normalizedAuthScheme ===
|
|
4943
|
+
AuthenticationScheme.DPOP.toLowerCase()
|
|
4944
|
+
? request.popKid || request.dpopJkt
|
|
4945
|
+
: undefined,
|
|
4909
4946
|
additionalCacheKeyComponents: additionalCacheKeyComponents,
|
|
4910
4947
|
};
|
|
4911
4948
|
const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
|
|
@@ -5405,7 +5442,7 @@
|
|
|
5405
5442
|
}
|
|
5406
5443
|
}
|
|
5407
5444
|
|
|
5408
|
-
/*! @azure/msal-common v16.
|
|
5445
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5409
5446
|
/*
|
|
5410
5447
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5411
5448
|
* Licensed under the MIT License.
|
|
@@ -5419,7 +5456,7 @@
|
|
|
5419
5456
|
const PerformanceEventStatus = {
|
|
5420
5457
|
InProgress: 1};
|
|
5421
5458
|
|
|
5422
|
-
/*! @azure/msal-common v16.
|
|
5459
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5423
5460
|
|
|
5424
5461
|
/*
|
|
5425
5462
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5477,7 +5514,7 @@
|
|
|
5477
5514
|
}
|
|
5478
5515
|
}
|
|
5479
5516
|
|
|
5480
|
-
/*! @azure/msal-common v16.
|
|
5517
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5481
5518
|
|
|
5482
5519
|
/*
|
|
5483
5520
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5575,7 +5612,7 @@
|
|
|
5575
5612
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5576
5613
|
}
|
|
5577
5614
|
|
|
5578
|
-
/*! @azure/msal-common v16.
|
|
5615
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5579
5616
|
/*
|
|
5580
5617
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5581
5618
|
* Licensed under the MIT License.
|
|
@@ -5602,7 +5639,7 @@
|
|
|
5602
5639
|
}
|
|
5603
5640
|
}
|
|
5604
5641
|
|
|
5605
|
-
/*! @azure/msal-common v16.
|
|
5642
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5606
5643
|
|
|
5607
5644
|
/*
|
|
5608
5645
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5623,7 +5660,7 @@
|
|
|
5623
5660
|
return new JoseHeaderError(code, correlationId);
|
|
5624
5661
|
}
|
|
5625
5662
|
|
|
5626
|
-
/*! @azure/msal-common v16.
|
|
5663
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5627
5664
|
/*
|
|
5628
5665
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5629
5666
|
* Licensed under the MIT License.
|
|
@@ -5648,7 +5685,7 @@
|
|
|
5648
5685
|
return Object.getPrototypeOf(value) === proto;
|
|
5649
5686
|
}
|
|
5650
5687
|
|
|
5651
|
-
/*! @azure/msal-common v16.
|
|
5688
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5652
5689
|
/*
|
|
5653
5690
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5654
5691
|
* Licensed under the MIT License.
|
|
@@ -5658,7 +5695,7 @@
|
|
|
5658
5695
|
const missingJwkError = "missing_jwk_error";
|
|
5659
5696
|
const invalidJwkError = "invalid_jwk_error";
|
|
5660
5697
|
|
|
5661
|
-
/*! @azure/msal-common v16.
|
|
5698
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5662
5699
|
|
|
5663
5700
|
/*
|
|
5664
5701
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5724,7 +5761,7 @@
|
|
|
5724
5761
|
}
|
|
5725
5762
|
}
|
|
5726
5763
|
|
|
5727
|
-
/*! @azure/msal-common v16.
|
|
5764
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5728
5765
|
|
|
5729
5766
|
/*
|
|
5730
5767
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5825,7 +5862,7 @@
|
|
|
5825
5862
|
}
|
|
5826
5863
|
}
|
|
5827
5864
|
|
|
5828
|
-
/*! @azure/msal-common v16.
|
|
5865
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5829
5866
|
|
|
5830
5867
|
/*
|
|
5831
5868
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5875,13 +5912,22 @@
|
|
|
5875
5912
|
throw createClientConfigurationError(invalidDpopNonce, correlationId);
|
|
5876
5913
|
}
|
|
5877
5914
|
}
|
|
5915
|
+
/**
|
|
5916
|
+
* Validates and normalizes the HTTP resource context for a DPoP-bound request.
|
|
5917
|
+
* @internal
|
|
5918
|
+
*/
|
|
5919
|
+
function normalizeDpopResourceRequestContext(context, correlationId = "") {
|
|
5920
|
+
return {
|
|
5921
|
+
htm: normalizeHtm(context.htm, correlationId),
|
|
5922
|
+
htu: normalizeHtu(context.htu, correlationId),
|
|
5923
|
+
};
|
|
5924
|
+
}
|
|
5878
5925
|
/**
|
|
5879
5926
|
* Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
|
|
5880
5927
|
* resource-endpoint proof bindings.
|
|
5881
5928
|
*
|
|
5882
|
-
*
|
|
5883
|
-
* This helper
|
|
5884
|
-
* in a subsequent work item.
|
|
5929
|
+
* Exported from package entry points for use by MSAL Browser.
|
|
5930
|
+
* This helper remains an unsupported internal API for direct consumers.
|
|
5885
5931
|
*
|
|
5886
5932
|
* DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
|
|
5887
5933
|
* @internal
|
|
@@ -5936,10 +5982,11 @@
|
|
|
5936
5982
|
*/
|
|
5937
5983
|
buildResourceProofClaims(params, correlationId = "") {
|
|
5938
5984
|
validateDpopNonce(params.nonce, correlationId);
|
|
5985
|
+
const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
|
|
5939
5986
|
const claims = {
|
|
5940
5987
|
jti: this.cryptoUtils.createNewGuid(),
|
|
5941
|
-
htm:
|
|
5942
|
-
htu:
|
|
5988
|
+
htm: resourceContext.htm,
|
|
5989
|
+
htu: resourceContext.htu,
|
|
5943
5990
|
ath: params.ath,
|
|
5944
5991
|
iat: nowSeconds(),
|
|
5945
5992
|
};
|
|
@@ -5970,7 +6017,7 @@
|
|
|
5970
6017
|
}
|
|
5971
6018
|
}
|
|
5972
6019
|
|
|
5973
|
-
/*! @azure/msal-common v16.
|
|
6020
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
5974
6021
|
/*
|
|
5975
6022
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5976
6023
|
* Licensed under the MIT License.
|
|
@@ -6021,7 +6068,7 @@
|
|
|
6021
6068
|
*/
|
|
6022
6069
|
const interruptedUser = "interrupted_user";
|
|
6023
6070
|
|
|
6024
|
-
/*! @azure/msal-common v16.
|
|
6071
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6025
6072
|
|
|
6026
6073
|
/*
|
|
6027
6074
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6088,7 +6135,7 @@
|
|
|
6088
6135
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
6089
6136
|
}
|
|
6090
6137
|
|
|
6091
|
-
/*! @azure/msal-common v16.
|
|
6138
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6092
6139
|
|
|
6093
6140
|
/*
|
|
6094
6141
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6107,7 +6154,7 @@
|
|
|
6107
6154
|
}
|
|
6108
6155
|
}
|
|
6109
6156
|
|
|
6110
|
-
/*! @azure/msal-common v16.
|
|
6157
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6111
6158
|
|
|
6112
6159
|
/*
|
|
6113
6160
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6178,7 +6225,7 @@
|
|
|
6178
6225
|
}
|
|
6179
6226
|
}
|
|
6180
6227
|
|
|
6181
|
-
/*! @azure/msal-common v16.
|
|
6228
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6182
6229
|
|
|
6183
6230
|
/*
|
|
6184
6231
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6606,7 +6653,7 @@
|
|
|
6606
6653
|
return baseAccount;
|
|
6607
6654
|
}
|
|
6608
6655
|
|
|
6609
|
-
/*! @azure/msal-common v16.
|
|
6656
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6610
6657
|
/*
|
|
6611
6658
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6612
6659
|
* Licensed under the MIT License.
|
|
@@ -6616,7 +6663,7 @@
|
|
|
6616
6663
|
UPN: "UPN",
|
|
6617
6664
|
};
|
|
6618
6665
|
|
|
6619
|
-
/*! @azure/msal-common v16.
|
|
6666
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6620
6667
|
/*
|
|
6621
6668
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6622
6669
|
* Licensed under the MIT License.
|
|
@@ -6635,7 +6682,7 @@
|
|
|
6635
6682
|
}
|
|
6636
6683
|
}
|
|
6637
6684
|
|
|
6638
|
-
/*! @azure/msal-common v16.
|
|
6685
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6639
6686
|
|
|
6640
6687
|
/*
|
|
6641
6688
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6659,7 +6706,7 @@
|
|
|
6659
6706
|
};
|
|
6660
6707
|
}
|
|
6661
6708
|
|
|
6662
|
-
/*! @azure/msal-common v16.
|
|
6709
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6663
6710
|
|
|
6664
6711
|
/*
|
|
6665
6712
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6749,7 +6796,7 @@
|
|
|
6749
6796
|
return undefined;
|
|
6750
6797
|
}
|
|
6751
6798
|
|
|
6752
|
-
/*! @azure/msal-common v16.
|
|
6799
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6753
6800
|
|
|
6754
6801
|
/*
|
|
6755
6802
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6780,7 +6827,7 @@
|
|
|
6780
6827
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6781
6828
|
}
|
|
6782
6829
|
|
|
6783
|
-
/*! @azure/msal-common v16.
|
|
6830
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6784
6831
|
|
|
6785
6832
|
/*
|
|
6786
6833
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6914,7 +6961,7 @@
|
|
|
6914
6961
|
return response;
|
|
6915
6962
|
}
|
|
6916
6963
|
|
|
6917
|
-
/*! @azure/msal-common v16.
|
|
6964
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
6918
6965
|
|
|
6919
6966
|
/*
|
|
6920
6967
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7181,7 +7228,7 @@
|
|
|
7181
7228
|
}
|
|
7182
7229
|
}
|
|
7183
7230
|
|
|
7184
|
-
/*! @azure/msal-common v16.
|
|
7231
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7185
7232
|
|
|
7186
7233
|
/*
|
|
7187
7234
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7411,7 +7458,7 @@
|
|
|
7411
7458
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
7412
7459
|
}
|
|
7413
7460
|
|
|
7414
|
-
/*! @azure/msal-common v16.
|
|
7461
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7415
7462
|
|
|
7416
7463
|
/*
|
|
7417
7464
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7646,7 +7693,7 @@
|
|
|
7646
7693
|
}
|
|
7647
7694
|
}
|
|
7648
7695
|
|
|
7649
|
-
/*! @azure/msal-common v16.
|
|
7696
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7650
7697
|
|
|
7651
7698
|
/*
|
|
7652
7699
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7939,7 +7986,7 @@
|
|
|
7939
7986
|
clearNativeBrokerErrorCode() { }
|
|
7940
7987
|
}
|
|
7941
7988
|
|
|
7942
|
-
/*! @azure/msal-common v16.
|
|
7989
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
7943
7990
|
|
|
7944
7991
|
/*
|
|
7945
7992
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8066,7 +8113,7 @@
|
|
|
8066
8113
|
}
|
|
8067
8114
|
}
|
|
8068
8115
|
|
|
8069
|
-
/*! @azure/msal-common v16.
|
|
8116
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8070
8117
|
|
|
8071
8118
|
/*
|
|
8072
8119
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8082,7 +8129,7 @@
|
|
|
8082
8129
|
},
|
|
8083
8130
|
};
|
|
8084
8131
|
|
|
8085
|
-
/*! @azure/msal-common v16.
|
|
8132
|
+
/*! @azure/msal-common v16.16.0 2026-11-05 */
|
|
8086
8133
|
|
|
8087
8134
|
/*
|
|
8088
8135
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8518,7 +8565,7 @@
|
|
|
8518
8565
|
|
|
8519
8566
|
/* eslint-disable header/header */
|
|
8520
8567
|
const name = "@azure/msal-browser";
|
|
8521
|
-
const version = "5.
|
|
8568
|
+
const version = "5.28.0";
|
|
8522
8569
|
|
|
8523
8570
|
/*
|
|
8524
8571
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -9144,6 +9191,7 @@
|
|
|
9144
9191
|
const PlatformAuthHandleNativeResponse = "platformAuthHandleNativeResponse";
|
|
9145
9192
|
const PlatformAuthCacheAccount = "platformAuthCacheAccount";
|
|
9146
9193
|
const PlatformAuthCacheNativeTokens = "platformAuthCacheNativeTokens";
|
|
9194
|
+
const PlatformAuthDpopKeyCleanup = "platformAuthDpopKeyCleanup";
|
|
9147
9195
|
const RemoveHiddenIframe = "removeHiddenIframe";
|
|
9148
9196
|
const ImportExistingCache = "importExistingCache";
|
|
9149
9197
|
/**
|
|
@@ -9215,7 +9263,6 @@
|
|
|
9215
9263
|
const uninitializedPublicClientApplication = "uninitialized_public_client_application";
|
|
9216
9264
|
const nativePromptNotSupported = "native_prompt_not_supported";
|
|
9217
9265
|
const invalidBase64String = "invalid_base64_string";
|
|
9218
|
-
const invalidPopTokenRequest = "invalid_pop_token_request";
|
|
9219
9266
|
const unsupportedTokenBindingAlgorithm = "unsupported_token_binding_algorithm";
|
|
9220
9267
|
const tokenBindingKeyAlgorithmMismatch = "token_binding_key_algorithm_mismatch";
|
|
9221
9268
|
const tokenBindingKeyJwkThumbprintMismatch = "token_binding_key_jwk_thumbprint_mismatch";
|
|
@@ -10568,6 +10615,19 @@
|
|
|
10568
10615
|
return cacheKeys;
|
|
10569
10616
|
}
|
|
10570
10617
|
}
|
|
10618
|
+
/**
|
|
10619
|
+
* Returns whether a key is available in persistent storage. Unlike
|
|
10620
|
+
* containsKey, this does not consult the in-memory fallback.
|
|
10621
|
+
*/
|
|
10622
|
+
async containsKeyInPersistentStorage(key, correlationId) {
|
|
10623
|
+
try {
|
|
10624
|
+
return await this.indexedDBCache.containsKey(key);
|
|
10625
|
+
}
|
|
10626
|
+
catch (e) {
|
|
10627
|
+
this.handleDatabaseAccessError(e, correlationId);
|
|
10628
|
+
return false;
|
|
10629
|
+
}
|
|
10630
|
+
}
|
|
10571
10631
|
/**
|
|
10572
10632
|
* Returns true or false if the given key is present in the cache.
|
|
10573
10633
|
* @param key
|
|
@@ -10673,6 +10733,12 @@
|
|
|
10673
10733
|
throw createClientAuthError(bindingKeyNotRemoved, correlationId);
|
|
10674
10734
|
}
|
|
10675
10735
|
}
|
|
10736
|
+
/**
|
|
10737
|
+
* Returns whether a browser token-binding key is available.
|
|
10738
|
+
*/
|
|
10739
|
+
async hasTokenBindingKey(keyId, correlationId) {
|
|
10740
|
+
return this.cache.containsKey(keyId, correlationId);
|
|
10741
|
+
}
|
|
10676
10742
|
/**
|
|
10677
10743
|
* Clears browser token-binding keys from memory and persistent storage.
|
|
10678
10744
|
* @param correlationId - Request correlation identifier.
|
|
@@ -10734,6 +10800,13 @@
|
|
|
10734
10800
|
}
|
|
10735
10801
|
return cachedKeyPair;
|
|
10736
10802
|
}
|
|
10803
|
+
/**
|
|
10804
|
+
* Returns whether a browser token-binding key survived in persistent
|
|
10805
|
+
* storage and can be restored after a redirect navigation.
|
|
10806
|
+
*/
|
|
10807
|
+
async isTokenBindingKeyPersisted(keyId, correlationId) {
|
|
10808
|
+
return this.cache.containsKeyInPersistentStorage(keyId, correlationId);
|
|
10809
|
+
}
|
|
10737
10810
|
/** @internal */
|
|
10738
10811
|
getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
|
|
10739
10812
|
return {
|
|
@@ -11064,19 +11137,13 @@
|
|
|
11064
11137
|
}
|
|
11065
11138
|
/**
|
|
11066
11139
|
* Resolves the token-binding parameters needed before building authorize or token requests.
|
|
11067
|
-
*
|
|
11068
|
-
*
|
|
11069
|
-
*
|
|
11140
|
+
* DPoP requests provision a browser key for token endpoint redemption. Platform broker
|
|
11141
|
+
* authorization requests retain the key for auth-code fallback but suppress dpop_jkt on
|
|
11142
|
+
* /authorize. Platform broker PoP requests use a reqCnf confirmation claim.
|
|
11070
11143
|
*/
|
|
11071
11144
|
async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
|
|
11072
11145
|
switch (request.authenticationScheme) {
|
|
11073
11146
|
case AuthenticationScheme.DPOP:
|
|
11074
|
-
if (request.platformBroker) {
|
|
11075
|
-
return {};
|
|
11076
|
-
}
|
|
11077
|
-
if (request.dpopJkt) {
|
|
11078
|
-
return { dpopJkt: request.dpopJkt };
|
|
11079
|
-
}
|
|
11080
11147
|
return {
|
|
11081
11148
|
dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
|
|
11082
11149
|
tokenBindingKeyType: AuthenticationScheme.DPOP.toLowerCase(),
|
|
@@ -11099,6 +11166,36 @@
|
|
|
11099
11166
|
return {};
|
|
11100
11167
|
}
|
|
11101
11168
|
}
|
|
11169
|
+
/**
|
|
11170
|
+
* Removes a DPoP key that was provisioned for an authorization attempt which
|
|
11171
|
+
* did not complete. Cleanup failures are recorded without replacing the
|
|
11172
|
+
* original authorization error.
|
|
11173
|
+
*/
|
|
11174
|
+
async function removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient) {
|
|
11175
|
+
if (request.authenticationScheme !== AuthenticationScheme.DPOP ||
|
|
11176
|
+
!request.dpopJkt) {
|
|
11177
|
+
return;
|
|
11178
|
+
}
|
|
11179
|
+
try {
|
|
11180
|
+
await tokenBindingKeyManager.removeTokenBindingKey(request.dpopJkt, request.correlationId);
|
|
11181
|
+
}
|
|
11182
|
+
catch {
|
|
11183
|
+
logger.error("Failed to remove unused DPoP key after authorization failure.", request.correlationId);
|
|
11184
|
+
performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, request.correlationId);
|
|
11185
|
+
}
|
|
11186
|
+
}
|
|
11187
|
+
/**
|
|
11188
|
+
* Returns whether an MSAL-owned DPoP key is available in persistent storage
|
|
11189
|
+
* before a redirect navigation. Custom managers without a persistence probe
|
|
11190
|
+
* retain their existing behavior.
|
|
11191
|
+
*/
|
|
11192
|
+
async function isTokenBindingKeyPersistedForRedirect(request, tokenBindingKeyManager) {
|
|
11193
|
+
const keyId = request.dpopJkt ?? request.keyId;
|
|
11194
|
+
if (!keyId || !tokenBindingKeyManager.isTokenBindingKeyPersisted) {
|
|
11195
|
+
return true;
|
|
11196
|
+
}
|
|
11197
|
+
return tokenBindingKeyManager.isTokenBindingKeyPersisted(keyId, request.correlationId);
|
|
11198
|
+
}
|
|
11102
11199
|
/**
|
|
11103
11200
|
* Initializer function for all request APIs
|
|
11104
11201
|
* @param request
|
|
@@ -11619,7 +11716,13 @@
|
|
|
11619
11716
|
const SIGN_UP_V2_SUBMIT_CODE = 100213;
|
|
11620
11717
|
const SIGN_UP_V2_SUBMIT_ATTRIBUTES = 100214;
|
|
11621
11718
|
const SIGN_UP_V2_RESEND_CODE = 100215;
|
|
11622
|
-
const SIGN_UP_V2_COMPLETE = 100216;
|
|
11719
|
+
const SIGN_UP_V2_COMPLETE = 100216;
|
|
11720
|
+
const JIT_V2_ENROLL_AUTH_METHOD = 100217;
|
|
11721
|
+
const JIT_V2_SUBMIT_CHALLENGE = 100218;
|
|
11722
|
+
const JIT_V2_RESEND_CHALLENGE = 100219;
|
|
11723
|
+
const MFA_V2_SELECT_AUTH_METHOD = 100220;
|
|
11724
|
+
const MFA_V2_SUBMIT_CHALLENGE = 100221;
|
|
11725
|
+
const MFA_V2_RESEND_CHALLENGE = 100222;
|
|
11623
11726
|
|
|
11624
11727
|
/*
|
|
11625
11728
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -12449,7 +12552,7 @@
|
|
|
12449
12552
|
}
|
|
12450
12553
|
// Required href; throws when it is absent.
|
|
12451
12554
|
requireHref(href, relation, correlationId, missingHrefError) {
|
|
12452
|
-
if (!href) {
|
|
12555
|
+
if (typeof href !== "string" || !href.trim()) {
|
|
12453
12556
|
const errorCode = missingHrefError?.code ?? INVALID_HAL_RESPONSE;
|
|
12454
12557
|
const errorMessage = missingHrefError?.message ??
|
|
12455
12558
|
`Invalid HAL response: missing '${relation}' link`;
|
|
@@ -12563,9 +12666,17 @@
|
|
|
12563
12666
|
const VERIFY_RELATION = "verify";
|
|
12564
12667
|
const RISK_VERIFY_RELATION = "riskverify";
|
|
12565
12668
|
const COLLECT_ATTRIBUTES_RELATION = "collectAttributes";
|
|
12669
|
+
const ENROLL_RELATION = "enroll";
|
|
12670
|
+
const ACTIVATE_RELATION = "activate";
|
|
12671
|
+
const RESEND_RELATION = "resend";
|
|
12672
|
+
const POLL_RELATION = "poll";
|
|
12566
12673
|
const AuthenticationMethodTypeV2 = {
|
|
12567
12674
|
EMAIL: "email",
|
|
12568
12675
|
PASSWORD: "password",
|
|
12676
|
+
PHONE: "phone",
|
|
12677
|
+
SMS: "sms",
|
|
12678
|
+
};
|
|
12679
|
+
const PhoneRegistrationChannelV2 = {
|
|
12569
12680
|
SMS: "sms",
|
|
12570
12681
|
};
|
|
12571
12682
|
/*
|
|
@@ -12783,16 +12894,6 @@
|
|
|
12783
12894
|
const AuthenticationFactorV2 = {
|
|
12784
12895
|
SINGLE_FACTOR: "singleFactor",
|
|
12785
12896
|
MULTI_FACTOR: "multiFactor",
|
|
12786
|
-
};
|
|
12787
|
-
const ChallengeNextActionV2 = {
|
|
12788
|
-
VERIFY: "verify",
|
|
12789
|
-
RISK_VERIFY: "riskVerify",
|
|
12790
|
-
};
|
|
12791
|
-
const VerifyNextActionV2 = {
|
|
12792
|
-
UPDATE: "update",
|
|
12793
|
-
CONTINUE: "continue",
|
|
12794
|
-
CHALLENGE: "challenge",
|
|
12795
|
-
COLLECT_ATTRIBUTES: "collectAttributes",
|
|
12796
12897
|
};
|
|
12797
12898
|
|
|
12798
12899
|
/*
|
|
@@ -12803,6 +12904,7 @@
|
|
|
12803
12904
|
VERIFY: "verify",
|
|
12804
12905
|
COLLECT_ATTRIBUTES: "collectAttributes",
|
|
12805
12906
|
CONTINUE: "continue",
|
|
12907
|
+
ENROLL: "enroll",
|
|
12806
12908
|
};
|
|
12807
12909
|
|
|
12808
12910
|
/*
|
|
@@ -12866,6 +12968,13 @@
|
|
|
12866
12968
|
attributes: parsedResponse.body.attributes,
|
|
12867
12969
|
};
|
|
12868
12970
|
}
|
|
12971
|
+
if (parsedResponse.body.action === ENROLL_RELATION) {
|
|
12972
|
+
return {
|
|
12973
|
+
nextAction: ENROLL_RELATION,
|
|
12974
|
+
continuationToken,
|
|
12975
|
+
methods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
|
|
12976
|
+
};
|
|
12977
|
+
}
|
|
12869
12978
|
const message = "Invalid HAL response: sign-up attribute submission returned no known next action";
|
|
12870
12979
|
this.logger?.error(message, correlationId);
|
|
12871
12980
|
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
|
|
@@ -12895,6 +13004,39 @@
|
|
|
12895
13004
|
const parsedResponse = await this.sendActionRequest(verifyHref, HttpMethod.POST, request, context);
|
|
12896
13005
|
return this.toVerifyResult(parsedResponse);
|
|
12897
13006
|
}
|
|
13007
|
+
async enrollAuthMethod(enrollHref, request, context) {
|
|
13008
|
+
return this.sendEnrollmentRequest(enrollHref, request, context);
|
|
13009
|
+
}
|
|
13010
|
+
async resendAuthMethodRegistrationChallenge(resendHref, request, context) {
|
|
13011
|
+
return this.sendEnrollmentRequest(resendHref, request, context);
|
|
13012
|
+
}
|
|
13013
|
+
async sendEnrollmentRequest(href, request, context) {
|
|
13014
|
+
const parsedResponse = await this.sendActionRequest(href, HttpMethod.POST, request, context);
|
|
13015
|
+
if (parsedResponse.body.action !== ACTIVATE_RELATION) {
|
|
13016
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: enrollment returned no activation action", parsedResponse.correlationId);
|
|
13017
|
+
}
|
|
13018
|
+
const links = parsedResponse.body._links;
|
|
13019
|
+
return {
|
|
13020
|
+
nextAction: ACTIVATE_RELATION,
|
|
13021
|
+
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
13022
|
+
hint: parsedResponse.body.hint,
|
|
13023
|
+
codeLength: this.normalizeCodeLength(parsedResponse.body.codeLength),
|
|
13024
|
+
activateHref: this.handler.requireHref(links?.activate?.href, ACTIVATE_RELATION, parsedResponse.correlationId),
|
|
13025
|
+
resendHref: links && "resend" in links
|
|
13026
|
+
? this.handler.requireHref(links.resend?.href, RESEND_RELATION, parsedResponse.correlationId)
|
|
13027
|
+
: undefined,
|
|
13028
|
+
};
|
|
13029
|
+
}
|
|
13030
|
+
async activateAuthMethod(activateHref, request, context) {
|
|
13031
|
+
const parsedResponse = await this.sendActionRequest(activateHref, HttpMethod.POST, request, context);
|
|
13032
|
+
if (parsedResponse.body.state !== ResponseStateV2.CONTINUE) {
|
|
13033
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: activation returned no continuation state", parsedResponse.correlationId);
|
|
13034
|
+
}
|
|
13035
|
+
return {
|
|
13036
|
+
nextAction: ResponseStateV2.CONTINUE,
|
|
13037
|
+
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
13038
|
+
};
|
|
13039
|
+
}
|
|
12898
13040
|
/*
|
|
12899
13041
|
* Submits the new password and returns the link used to poll for completion.
|
|
12900
13042
|
*/
|
|
@@ -12907,25 +13049,43 @@
|
|
|
12907
13049
|
};
|
|
12908
13050
|
}
|
|
12909
13051
|
/*
|
|
12910
|
-
*
|
|
13052
|
+
* Sends a poll request and validates the data needed for the next flow step.
|
|
12911
13053
|
*/
|
|
12912
13054
|
async poll(pollHref, request, context) {
|
|
12913
13055
|
const parsedResponse = await this.sendActionRequest(pollHref, HttpMethod.POST, request, context);
|
|
12914
|
-
const
|
|
12915
|
-
|
|
12916
|
-
|
|
12917
|
-
|
|
12918
|
-
|
|
12919
|
-
|
|
12920
|
-
|
|
12921
|
-
|
|
13056
|
+
const correlationId = parsedResponse.correlationId;
|
|
13057
|
+
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
|
|
13058
|
+
const nextAction = parsedResponse.body.action ?? parsedResponse.body.state;
|
|
13059
|
+
if (nextAction === ENROLL_RELATION) {
|
|
13060
|
+
return {
|
|
13061
|
+
nextAction,
|
|
13062
|
+
continuationToken,
|
|
13063
|
+
enrollmentMethods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
|
|
13064
|
+
};
|
|
13065
|
+
}
|
|
13066
|
+
if (nextAction === POLL_RELATION) {
|
|
13067
|
+
return {
|
|
13068
|
+
nextAction: POLL_RELATION,
|
|
13069
|
+
continuationToken,
|
|
13070
|
+
pollHref: this.handler.requireHref(parsedResponse.body._links?.poll?.href, POLL_RELATION, correlationId),
|
|
13071
|
+
};
|
|
13072
|
+
}
|
|
13073
|
+
if (nextAction === ResponseStateV2.CONTINUE) {
|
|
13074
|
+
return {
|
|
13075
|
+
nextAction,
|
|
13076
|
+
continuationToken,
|
|
13077
|
+
};
|
|
13078
|
+
}
|
|
13079
|
+
const message = `Password reset poll next action '${nextAction}' is not supported.`;
|
|
13080
|
+
this.logger?.error(message, correlationId);
|
|
13081
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, message, correlationId);
|
|
12922
13082
|
}
|
|
12923
13083
|
async sendStartRequest(startHref, request, context) {
|
|
12924
13084
|
const parsedResponse = await this.sendActionRequest(startHref, HttpMethod.POST, request, context);
|
|
12925
13085
|
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId);
|
|
12926
13086
|
return {
|
|
12927
13087
|
continuationToken,
|
|
12928
|
-
methods: this.resolveMethods(parsedResponse.body, parsedResponse.correlationId),
|
|
13088
|
+
methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, parsedResponse.correlationId), parsedResponse.correlationId),
|
|
12929
13089
|
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, parsedResponse.correlationId),
|
|
12930
13090
|
scenario: parsedResponse.body.scenario,
|
|
12931
13091
|
};
|
|
@@ -12935,13 +13095,13 @@
|
|
|
12935
13095
|
const continuationToken = this.handler.requireContinuationToken(parsedResponse.continuationToken, correlationId);
|
|
12936
13096
|
if (parsedResponse.body.state === ResponseStateV2.CONTINUE) {
|
|
12937
13097
|
return {
|
|
12938
|
-
nextAction:
|
|
13098
|
+
nextAction: ResponseStateV2.CONTINUE,
|
|
12939
13099
|
continuationToken,
|
|
12940
13100
|
};
|
|
12941
13101
|
}
|
|
12942
13102
|
if (parsedResponse.body.action === COLLECT_ATTRIBUTES_RELATION) {
|
|
12943
13103
|
return {
|
|
12944
|
-
nextAction:
|
|
13104
|
+
nextAction: COLLECT_ATTRIBUTES_RELATION,
|
|
12945
13105
|
continuationToken,
|
|
12946
13106
|
attributes: parsedResponse.body.attributes ?? [],
|
|
12947
13107
|
submitAttributesHref: this.handler.requireHref(parsedResponse.body._links?.submitAttributes?.href, "submitAttributes", correlationId),
|
|
@@ -12949,21 +13109,45 @@
|
|
|
12949
13109
|
}
|
|
12950
13110
|
if (parsedResponse.body.action === UPDATE_RELATION) {
|
|
12951
13111
|
return {
|
|
12952
|
-
nextAction:
|
|
13112
|
+
nextAction: UPDATE_RELATION,
|
|
12953
13113
|
continuationToken,
|
|
12954
13114
|
updateHref: this.handler.requireHref(parsedResponse.body._links?.update?.href, "update", correlationId),
|
|
12955
13115
|
};
|
|
12956
13116
|
}
|
|
12957
13117
|
if (parsedResponse.body.action === CHALLENGE_RELATION) {
|
|
12958
13118
|
return {
|
|
12959
|
-
nextAction:
|
|
13119
|
+
nextAction: CHALLENGE_RELATION,
|
|
12960
13120
|
continuationToken,
|
|
12961
13121
|
authenticationFactor: this.resolveAuthenticationFactor(parsedResponse.body.challengeContext?.authenticationFactor, correlationId),
|
|
12962
|
-
methods: this.resolveMethods(parsedResponse.body, correlationId),
|
|
13122
|
+
methods: this.resolveMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
|
|
13123
|
+
};
|
|
13124
|
+
}
|
|
13125
|
+
if (parsedResponse.body.action === ENROLL_RELATION) {
|
|
13126
|
+
return {
|
|
13127
|
+
nextAction: ENROLL_RELATION,
|
|
13128
|
+
continuationToken,
|
|
13129
|
+
methods: this.resolveEnrollmentMethods(this.handler.requireMethods(parsedResponse.body._embedded?.methods, correlationId), correlationId),
|
|
12963
13130
|
};
|
|
12964
13131
|
}
|
|
12965
13132
|
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: verify returned no known next action", correlationId);
|
|
12966
13133
|
}
|
|
13134
|
+
resolveEnrollmentMethods(methods, correlationId) {
|
|
13135
|
+
return methods.map((method) => {
|
|
13136
|
+
if (typeof method.type !== "string" || !method.type.trim()) {
|
|
13137
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: enrollment method type is malformed", correlationId);
|
|
13138
|
+
}
|
|
13139
|
+
if (method.channels !== undefined &&
|
|
13140
|
+
(!Array.isArray(method.channels) ||
|
|
13141
|
+
method.channels.length === 0)) {
|
|
13142
|
+
throw new CustomAuthApiError(INVALID_HAL_RESPONSE, "Invalid HAL response: enrollment method channels are malformed", correlationId);
|
|
13143
|
+
}
|
|
13144
|
+
return {
|
|
13145
|
+
type: method.type,
|
|
13146
|
+
channels: method.channels,
|
|
13147
|
+
enrollHref: this.handler.requireHref(method._links?.enroll?.href, ENROLL_RELATION, correlationId),
|
|
13148
|
+
};
|
|
13149
|
+
});
|
|
13150
|
+
}
|
|
12967
13151
|
resolveAuthenticationFactor(authenticationFactor, correlationId) {
|
|
12968
13152
|
if (authenticationFactor === AuthenticationFactorV2.SINGLE_FACTOR ||
|
|
12969
13153
|
authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
|
|
@@ -12979,7 +13163,7 @@
|
|
|
12979
13163
|
if (parsedResponse.body.action === RISK_VERIFY_RELATION) {
|
|
12980
13164
|
const riskResponse = parsedResponse.body;
|
|
12981
13165
|
return {
|
|
12982
|
-
nextAction:
|
|
13166
|
+
nextAction: RISK_VERIFY_RELATION,
|
|
12983
13167
|
continuationToken: this.handler.requireContinuationToken(parsedResponse.continuationToken, parsedResponse.correlationId),
|
|
12984
13168
|
riskVerifyHref: this.handler.requireHref(riskResponse._links?.riskverify?.href, RISK_VERIFY_RELATION, parsedResponse.correlationId),
|
|
12985
13169
|
};
|
|
@@ -12997,18 +13181,29 @@
|
|
|
12997
13181
|
"payload" in parsedResponse.body
|
|
12998
13182
|
? parsedResponse.body
|
|
12999
13183
|
: undefined;
|
|
13184
|
+
const isPasswordChallenge = parsedResponse.body.type?.toLowerCase() ===
|
|
13185
|
+
AuthenticationMethodTypeV2.PASSWORD;
|
|
13186
|
+
const verifyHref = this.handler.requireHref(links?.verify?.href, VERIFY_RELATION, parsedResponse.correlationId);
|
|
13187
|
+
const resendHref = !isPasswordChallenge && links && "resend" in links
|
|
13188
|
+
? this.handler.requireHref(links.resend?.href, RESEND_RELATION, parsedResponse.correlationId)
|
|
13189
|
+
: undefined;
|
|
13190
|
+
const codeLength = isPasswordChallenge
|
|
13191
|
+
? undefined
|
|
13192
|
+
: this.normalizeCodeLength(codeMetadata?.codeLength ?? codeMetadata?.payload?.codeLength);
|
|
13000
13193
|
return {
|
|
13001
|
-
nextAction:
|
|
13194
|
+
nextAction: VERIFY_RELATION,
|
|
13002
13195
|
continuationToken,
|
|
13003
|
-
verifyHref
|
|
13004
|
-
resendHref
|
|
13005
|
-
codeLength
|
|
13196
|
+
verifyHref,
|
|
13197
|
+
resendHref,
|
|
13198
|
+
codeLength,
|
|
13006
13199
|
hint: codeMetadata?.hint,
|
|
13007
13200
|
type: parsedResponse.body.type,
|
|
13008
13201
|
};
|
|
13009
13202
|
}
|
|
13010
|
-
|
|
13011
|
-
|
|
13203
|
+
normalizeCodeLength(value) {
|
|
13204
|
+
return typeof value === "number" && Number.isInteger(value) ? value : 0;
|
|
13205
|
+
}
|
|
13206
|
+
resolveMethods(methods, correlationId) {
|
|
13012
13207
|
const resolved = [];
|
|
13013
13208
|
methods.forEach((method, index) => {
|
|
13014
13209
|
const href = method._links?.challenge?.href;
|
|
@@ -13104,6 +13299,8 @@
|
|
|
13104
13299
|
const FLOW_ATTRIBUTES_REQUIRED_V2 = "FlowAttributesRequiredResultV2";
|
|
13105
13300
|
const FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 = "FlowSignInContinuationRequiredResultV2";
|
|
13106
13301
|
const FLOW_COMPLETED_V2 = "FlowCompletedResultV2";
|
|
13302
|
+
const FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2 = "FlowAuthMethodRegistrationRequiredResultV2";
|
|
13303
|
+
const FLOW_AUTH_METHOD_VERIFICATION_REQUIRED_V2 = "FlowAuthMethodVerificationRequiredResultV2";
|
|
13107
13304
|
function createFlowMethodSelectionRequiredResultV2(input) {
|
|
13108
13305
|
return { type: FLOW_METHOD_SELECTION_REQUIRED_V2, ...input };
|
|
13109
13306
|
}
|
|
@@ -13130,6 +13327,12 @@
|
|
|
13130
13327
|
}
|
|
13131
13328
|
function createFlowCompletedResultV2(input) {
|
|
13132
13329
|
return { type: FLOW_COMPLETED_V2, ...input };
|
|
13330
|
+
}
|
|
13331
|
+
function createFlowAuthMethodRegistrationRequiredResultV2(input) {
|
|
13332
|
+
return { type: FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2, ...input };
|
|
13333
|
+
}
|
|
13334
|
+
function createFlowAuthMethodVerificationRequiredResultV2(input) {
|
|
13335
|
+
return { type: FLOW_AUTH_METHOD_VERIFICATION_REQUIRED_V2, ...input };
|
|
13133
13336
|
}
|
|
13134
13337
|
|
|
13135
13338
|
/*
|
|
@@ -13176,7 +13379,20 @@
|
|
|
13176
13379
|
signInWithContinuation: SIGN_UP_V2_COMPLETE,
|
|
13177
13380
|
},
|
|
13178
13381
|
};
|
|
13179
|
-
|
|
13382
|
+
const MFA_STEP_API_IDS_V2 = {
|
|
13383
|
+
requestChallenge: MFA_V2_SELECT_AUTH_METHOD,
|
|
13384
|
+
submitCode: MFA_V2_SUBMIT_CHALLENGE,
|
|
13385
|
+
resendCode: MFA_V2_RESEND_CHALLENGE,
|
|
13386
|
+
};
|
|
13387
|
+
/**
|
|
13388
|
+
* Resolves the telemetry API ID for a flow step. MFA challenge operations use
|
|
13389
|
+
* distinct IDs when the sign-in caller identifies the second factor.
|
|
13390
|
+
*/
|
|
13391
|
+
function getPublicApiIdV2(scenario, step, authenticationFactor) {
|
|
13392
|
+
if (scenario === CustomAuthFlowScenarioV2.SignIn &&
|
|
13393
|
+
authenticationFactor === AuthenticationFactorV2.MULTI_FACTOR) {
|
|
13394
|
+
return (MFA_STEP_API_IDS_V2[step] ?? FLOW_STEP_API_IDS_V2[scenario]?.[step]);
|
|
13395
|
+
}
|
|
13180
13396
|
return FLOW_STEP_API_IDS_V2[scenario]?.[step];
|
|
13181
13397
|
}
|
|
13182
13398
|
|
|
@@ -13300,8 +13516,9 @@
|
|
|
13300
13516
|
},
|
|
13301
13517
|
};
|
|
13302
13518
|
const result = this.toSignUpActionResult(submitResult, continuationState, correlationId);
|
|
13303
|
-
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2
|
|
13304
|
-
|
|
13519
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2 ||
|
|
13520
|
+
result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
13521
|
+
const message = `Initial sign-up attribute submission returned unsupported next action '${submitResult.nextAction}'.`;
|
|
13305
13522
|
this.logger.error(message, correlationId);
|
|
13306
13523
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13307
13524
|
}
|
|
@@ -13408,6 +13625,47 @@
|
|
|
13408
13625
|
this.logger.error(message, parameters.correlationId);
|
|
13409
13626
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, parameters.correlationId);
|
|
13410
13627
|
}
|
|
13628
|
+
/*
|
|
13629
|
+
* Registers the selected offered method and returns activation metadata.
|
|
13630
|
+
*/
|
|
13631
|
+
async registerAuthMethod(parameters) {
|
|
13632
|
+
const { continuationState, correlationId } = parameters;
|
|
13633
|
+
if (!parameters.verificationContact?.trim()) {
|
|
13634
|
+
throw new InvalidArgumentError("verificationContact", correlationId);
|
|
13635
|
+
}
|
|
13636
|
+
const registrationRequest = this.createRegistrationRequest(parameters.method, parameters.verificationContact, continuationState.continuationToken, correlationId);
|
|
13637
|
+
const context = this.createRequestContext(JIT_V2_ENROLL_AUTH_METHOD, correlationId);
|
|
13638
|
+
this.logger.verbose("Registering a V2 authentication method.", correlationId);
|
|
13639
|
+
const result = await this.apiClient.enrollAuthMethod(this.requireLink(correlationId, parameters.method.enrollHref), registrationRequest, context);
|
|
13640
|
+
return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
|
|
13641
|
+
}
|
|
13642
|
+
/*
|
|
13643
|
+
* Activates the registered method and redeems the resulting continuation
|
|
13644
|
+
* for tokens.
|
|
13645
|
+
*/
|
|
13646
|
+
async verifyAuthMethodRegistration(parameters) {
|
|
13647
|
+
const { continuationState, correlationId } = parameters;
|
|
13648
|
+
const context = this.createRequestContext(JIT_V2_SUBMIT_CHALLENGE, correlationId);
|
|
13649
|
+
this.logger.verbose("Activating a V2 authentication method.", correlationId);
|
|
13650
|
+
const result = await this.apiClient.activateAuthMethod(this.requireLink(correlationId, continuationState.links.activate), {
|
|
13651
|
+
continuationToken: continuationState.continuationToken,
|
|
13652
|
+
otp: parameters.code,
|
|
13653
|
+
}, context);
|
|
13654
|
+
return this.completeSignInAfterVerification(continuationState, result.continuationToken, correlationId);
|
|
13655
|
+
}
|
|
13656
|
+
/*
|
|
13657
|
+
* Requests a replacement activation challenge through the server-provided
|
|
13658
|
+
* resend link using the latest continuation token.
|
|
13659
|
+
*/
|
|
13660
|
+
async resendAuthMethodRegistrationChallenge(parameters) {
|
|
13661
|
+
const { continuationState, correlationId } = parameters;
|
|
13662
|
+
const context = this.createRequestContext(JIT_V2_RESEND_CHALLENGE, correlationId);
|
|
13663
|
+
this.logger.verbose("Resending a V2 authentication-method activation challenge.", correlationId);
|
|
13664
|
+
const result = await this.apiClient.resendAuthMethodRegistrationChallenge(this.requireLink(correlationId, continuationState.links.resend), {
|
|
13665
|
+
continuationToken: continuationState.continuationToken,
|
|
13666
|
+
}, context);
|
|
13667
|
+
return this.createAuthMethodVerificationRequiredResult(continuationState, result, correlationId);
|
|
13668
|
+
}
|
|
13411
13669
|
/*
|
|
13412
13670
|
* Verifies the submitted one-time code using the server-provided link. The
|
|
13413
13671
|
* response determines the next required action.
|
|
@@ -13415,7 +13673,7 @@
|
|
|
13415
13673
|
async submitCode(parameters) {
|
|
13416
13674
|
const continuationState = parameters.continuationState;
|
|
13417
13675
|
const correlationId = parameters.correlationId;
|
|
13418
|
-
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitCode", correlationId), correlationId);
|
|
13676
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, "submitCode", correlationId, parameters.authenticationFactor), correlationId);
|
|
13419
13677
|
this.logger.verbose("Submitting V2 one-time code.", correlationId);
|
|
13420
13678
|
const verifyHref = this.requireLink(correlationId, continuationState.links.verify);
|
|
13421
13679
|
const verifyRequest = {
|
|
@@ -13425,7 +13683,7 @@
|
|
|
13425
13683
|
const verifyResult = await this.apiClient.verifyChallenge(verifyHref, verifyRequest, context);
|
|
13426
13684
|
if (continuationState.scenario ===
|
|
13427
13685
|
CustomAuthFlowScenarioV2.PasswordReset &&
|
|
13428
|
-
verifyResult.nextAction ===
|
|
13686
|
+
verifyResult.nextAction === UPDATE_RELATION) {
|
|
13429
13687
|
return createFlowNewPasswordRequiredResultV2({
|
|
13430
13688
|
correlationId,
|
|
13431
13689
|
continuationState: {
|
|
@@ -13439,46 +13697,8 @@
|
|
|
13439
13697
|
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignIn) {
|
|
13440
13698
|
return this.handleSignInVerification(continuationState, verifyResult, correlationId);
|
|
13441
13699
|
}
|
|
13442
|
-
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp
|
|
13443
|
-
|
|
13444
|
-
const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
13445
|
-
attribute.required === true);
|
|
13446
|
-
const nextContinuationState = {
|
|
13447
|
-
continuationToken: verifyResult.continuationToken,
|
|
13448
|
-
scenario: continuationState.scenario,
|
|
13449
|
-
scopes: continuationState.scopes,
|
|
13450
|
-
links: {
|
|
13451
|
-
submitAttributes: verifyResult.submitAttributesHref,
|
|
13452
|
-
},
|
|
13453
|
-
signUp: continuationState.signUp,
|
|
13454
|
-
};
|
|
13455
|
-
const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
|
|
13456
|
-
if (requiredPasswordAttribute &&
|
|
13457
|
-
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
13458
|
-
return createFlowSignUpPasswordRequiredResultV2({
|
|
13459
|
-
correlationId,
|
|
13460
|
-
continuationState: nextContinuationState,
|
|
13461
|
-
attributes,
|
|
13462
|
-
requiredPasswordAttribute,
|
|
13463
|
-
});
|
|
13464
|
-
}
|
|
13465
|
-
return createFlowAttributesRequiredResultV2({
|
|
13466
|
-
correlationId,
|
|
13467
|
-
continuationState: nextContinuationState,
|
|
13468
|
-
attributes,
|
|
13469
|
-
});
|
|
13470
|
-
}
|
|
13471
|
-
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp &&
|
|
13472
|
-
verifyResult.nextAction === VerifyNextActionV2.CONTINUE) {
|
|
13473
|
-
return createFlowSignInContinuationRequiredResultV2({
|
|
13474
|
-
correlationId,
|
|
13475
|
-
continuationState: {
|
|
13476
|
-
continuationToken: verifyResult.continuationToken,
|
|
13477
|
-
scenario: continuationState.scenario,
|
|
13478
|
-
scopes: continuationState.scopes,
|
|
13479
|
-
links: {},
|
|
13480
|
-
},
|
|
13481
|
-
});
|
|
13700
|
+
if (continuationState.scenario === CustomAuthFlowScenarioV2.SignUp) {
|
|
13701
|
+
return this.handleSignUpVerification(continuationState, verifyResult, correlationId);
|
|
13482
13702
|
}
|
|
13483
13703
|
const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
|
|
13484
13704
|
this.logger.error(message, correlationId);
|
|
@@ -13529,34 +13749,52 @@
|
|
|
13529
13749
|
}, context);
|
|
13530
13750
|
let pollToken = updateResult.continuationToken;
|
|
13531
13751
|
let pollHref = updateResult.pollHref;
|
|
13532
|
-
let
|
|
13752
|
+
let pollResult;
|
|
13753
|
+
let isPolling = false;
|
|
13533
13754
|
for (let attempt = 1; attempt <= POLL_MAX_ATTEMPTS; attempt++) {
|
|
13534
|
-
|
|
13535
|
-
|
|
13536
|
-
|
|
13755
|
+
pollResult = await this.apiClient.poll(pollHref, { continuationToken: pollToken }, context);
|
|
13756
|
+
isPolling = pollResult.nextAction === POLL_RELATION;
|
|
13757
|
+
if (!isPolling) {
|
|
13537
13758
|
break;
|
|
13538
13759
|
}
|
|
13539
13760
|
pollToken = pollResult.continuationToken;
|
|
13540
|
-
pollHref = pollResult.pollHref
|
|
13761
|
+
pollHref = this.requireLink(correlationId, pollResult.pollHref);
|
|
13541
13762
|
if (attempt < POLL_MAX_ATTEMPTS) {
|
|
13542
13763
|
await delay(POLL_INTERVAL_MS);
|
|
13543
13764
|
}
|
|
13544
13765
|
}
|
|
13545
|
-
if (!
|
|
13766
|
+
if (!pollResult || isPolling) {
|
|
13546
13767
|
const message = "The password reset did not complete within the allotted number of polling attempts.";
|
|
13547
13768
|
this.logger.error(message, correlationId);
|
|
13548
13769
|
throw new CustomAuthError(RESET_PASSWORD_TIMEOUT, message, correlationId);
|
|
13549
13770
|
}
|
|
13550
|
-
|
|
13551
|
-
|
|
13552
|
-
|
|
13553
|
-
|
|
13554
|
-
|
|
13555
|
-
|
|
13556
|
-
|
|
13557
|
-
|
|
13558
|
-
|
|
13559
|
-
|
|
13771
|
+
if (pollResult.nextAction === ENROLL_RELATION &&
|
|
13772
|
+
pollResult.enrollmentMethods) {
|
|
13773
|
+
return this.createAuthMethodRegistrationRequiredResult({
|
|
13774
|
+
correlationId,
|
|
13775
|
+
continuationState: {
|
|
13776
|
+
...continuationState,
|
|
13777
|
+
continuationToken: pollResult.continuationToken,
|
|
13778
|
+
links: {},
|
|
13779
|
+
},
|
|
13780
|
+
methods: pollResult.enrollmentMethods,
|
|
13781
|
+
});
|
|
13782
|
+
}
|
|
13783
|
+
if (pollResult.nextAction === ResponseStateV2.CONTINUE) {
|
|
13784
|
+
this.logger.verbose("V2 password reset applied; sign-in required.", correlationId);
|
|
13785
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13786
|
+
correlationId,
|
|
13787
|
+
continuationState: {
|
|
13788
|
+
continuationToken: pollResult.continuationToken,
|
|
13789
|
+
scenario: continuationState.scenario,
|
|
13790
|
+
scopes: continuationState.scopes,
|
|
13791
|
+
links: {},
|
|
13792
|
+
},
|
|
13793
|
+
});
|
|
13794
|
+
}
|
|
13795
|
+
const message = `Password reset poll next action '${pollResult.nextAction}' is not supported.`;
|
|
13796
|
+
this.logger.error(message, correlationId);
|
|
13797
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13560
13798
|
}
|
|
13561
13799
|
/*
|
|
13562
13800
|
* Verifies a sign-in password and returns the next sign-in action.
|
|
@@ -13586,7 +13824,18 @@
|
|
|
13586
13824
|
});
|
|
13587
13825
|
}
|
|
13588
13826
|
async handleSignInVerification(continuationState, verifyResult, correlationId) {
|
|
13589
|
-
if (verifyResult.nextAction ===
|
|
13827
|
+
if (verifyResult.nextAction === ENROLL_RELATION) {
|
|
13828
|
+
return this.createAuthMethodRegistrationRequiredResult({
|
|
13829
|
+
correlationId,
|
|
13830
|
+
continuationState: {
|
|
13831
|
+
...continuationState,
|
|
13832
|
+
continuationToken: verifyResult.continuationToken,
|
|
13833
|
+
links: {},
|
|
13834
|
+
},
|
|
13835
|
+
methods: verifyResult.methods,
|
|
13836
|
+
});
|
|
13837
|
+
}
|
|
13838
|
+
if (verifyResult.nextAction === CHALLENGE_RELATION) {
|
|
13590
13839
|
this.ensureAuthenticationFactor(verifyResult.authenticationFactor, AuthenticationFactorV2.MULTI_FACTOR, "after sign-in verification", correlationId);
|
|
13591
13840
|
return createFlowMFARequiredResultV2({
|
|
13592
13841
|
correlationId,
|
|
@@ -13604,61 +13853,27 @@
|
|
|
13604
13853
|
})),
|
|
13605
13854
|
});
|
|
13606
13855
|
}
|
|
13607
|
-
if (verifyResult.nextAction ===
|
|
13856
|
+
if (verifyResult.nextAction === ResponseStateV2.CONTINUE) {
|
|
13608
13857
|
return this.completeSignInAfterVerification(continuationState, verifyResult.continuationToken, correlationId);
|
|
13609
13858
|
}
|
|
13610
13859
|
const message = `Verification next action '${verifyResult.nextAction}' is not supported for sign-in.`;
|
|
13611
13860
|
this.logger.error(message, correlationId);
|
|
13612
13861
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13613
13862
|
}
|
|
13614
|
-
|
|
13615
|
-
|
|
13616
|
-
const
|
|
13617
|
-
return (methodType === AuthenticationMethodTypeV2.EMAIL ||
|
|
13618
|
-
methodType === AuthenticationMethodTypeV2.PASSWORD ||
|
|
13619
|
-
methodType === AuthenticationMethodTypeV2.SMS);
|
|
13620
|
-
});
|
|
13621
|
-
if (supportedMethods.length > 0) {
|
|
13622
|
-
return supportedMethods;
|
|
13623
|
-
}
|
|
13624
|
-
const message = "The sign-in start response did not include a supported email, SMS, or password method.";
|
|
13625
|
-
this.logger.error(message, correlationId);
|
|
13626
|
-
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13627
|
-
}
|
|
13628
|
-
toSignUpActionResult(result, continuationState, correlationId) {
|
|
13629
|
-
const nextAction = result.nextAction;
|
|
13630
|
-
if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
|
|
13631
|
-
return createFlowCodeRequiredResultV2({
|
|
13632
|
-
correlationId,
|
|
13633
|
-
continuationState: {
|
|
13634
|
-
continuationToken: result.continuationToken,
|
|
13635
|
-
scenario: continuationState.scenario,
|
|
13636
|
-
scopes: continuationState.scopes,
|
|
13637
|
-
links: {
|
|
13638
|
-
verify: result.verifyHref,
|
|
13639
|
-
resend: result.resendHref,
|
|
13640
|
-
},
|
|
13641
|
-
signUp: continuationState.signUp,
|
|
13642
|
-
},
|
|
13643
|
-
channel: result.type,
|
|
13644
|
-
sentTo: result.hint,
|
|
13645
|
-
codeLength: result.codeLength,
|
|
13646
|
-
});
|
|
13647
|
-
}
|
|
13648
|
-
if (result.nextAction ===
|
|
13649
|
-
SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
|
|
13650
|
-
const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
13863
|
+
handleSignUpVerification(continuationState, verifyResult, correlationId) {
|
|
13864
|
+
if (verifyResult.nextAction === COLLECT_ATTRIBUTES_RELATION) {
|
|
13865
|
+
const requiredPasswordAttribute = verifyResult.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
13651
13866
|
attribute.required === true);
|
|
13652
13867
|
const nextContinuationState = {
|
|
13653
|
-
continuationToken:
|
|
13868
|
+
continuationToken: verifyResult.continuationToken,
|
|
13654
13869
|
scenario: continuationState.scenario,
|
|
13655
13870
|
scopes: continuationState.scopes,
|
|
13656
13871
|
links: {
|
|
13657
|
-
submitAttributes:
|
|
13872
|
+
submitAttributes: verifyResult.submitAttributesHref,
|
|
13658
13873
|
},
|
|
13659
13874
|
signUp: continuationState.signUp,
|
|
13660
13875
|
};
|
|
13661
|
-
const attributes =
|
|
13876
|
+
const attributes = verifyResult.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
|
|
13662
13877
|
if (requiredPasswordAttribute &&
|
|
13663
13878
|
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
13664
13879
|
return createFlowSignUpPasswordRequiredResultV2({
|
|
@@ -13674,18 +13889,191 @@
|
|
|
13674
13889
|
attributes,
|
|
13675
13890
|
});
|
|
13676
13891
|
}
|
|
13677
|
-
if (
|
|
13678
|
-
return
|
|
13892
|
+
if (verifyResult.nextAction === ENROLL_RELATION) {
|
|
13893
|
+
return this.createAuthMethodRegistrationRequiredResult({
|
|
13679
13894
|
correlationId,
|
|
13680
13895
|
continuationState: {
|
|
13681
|
-
|
|
13682
|
-
|
|
13683
|
-
scopes: continuationState.scopes,
|
|
13896
|
+
...continuationState,
|
|
13897
|
+
continuationToken: verifyResult.continuationToken,
|
|
13684
13898
|
links: {},
|
|
13685
13899
|
},
|
|
13900
|
+
methods: verifyResult.methods,
|
|
13686
13901
|
});
|
|
13687
13902
|
}
|
|
13688
|
-
|
|
13903
|
+
if (verifyResult.nextAction === ResponseStateV2.CONTINUE) {
|
|
13904
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
13905
|
+
correlationId,
|
|
13906
|
+
continuationState: {
|
|
13907
|
+
continuationToken: verifyResult.continuationToken,
|
|
13908
|
+
scenario: continuationState.scenario,
|
|
13909
|
+
scopes: continuationState.scopes,
|
|
13910
|
+
links: {},
|
|
13911
|
+
},
|
|
13912
|
+
});
|
|
13913
|
+
}
|
|
13914
|
+
const message = `Verification next action '${verifyResult.nextAction}' is not supported for the '${continuationState.scenario}' flow.`;
|
|
13915
|
+
this.logger.error(message, correlationId);
|
|
13916
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13917
|
+
}
|
|
13918
|
+
getSupportedSignInMethods(methods, correlationId) {
|
|
13919
|
+
const supportedMethods = methods.filter((method) => {
|
|
13920
|
+
const methodType = method.type.toLowerCase();
|
|
13921
|
+
return (methodType === AuthenticationMethodTypeV2.EMAIL ||
|
|
13922
|
+
methodType === AuthenticationMethodTypeV2.PASSWORD ||
|
|
13923
|
+
methodType === AuthenticationMethodTypeV2.SMS);
|
|
13924
|
+
});
|
|
13925
|
+
if (supportedMethods.length > 0) {
|
|
13926
|
+
return supportedMethods;
|
|
13927
|
+
}
|
|
13928
|
+
const message = "The sign-in start response did not include a supported email, SMS, or password method.";
|
|
13929
|
+
this.logger.error(message, correlationId);
|
|
13930
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13931
|
+
}
|
|
13932
|
+
createRegistrationRequest(method, verificationContact, continuationToken, correlationId) {
|
|
13933
|
+
if (method.type === AuthenticationMethodTypeV2.EMAIL) {
|
|
13934
|
+
return {
|
|
13935
|
+
continuationToken,
|
|
13936
|
+
email: verificationContact,
|
|
13937
|
+
};
|
|
13938
|
+
}
|
|
13939
|
+
const [channel] = method.channels ?? [];
|
|
13940
|
+
if (method.type === AuthenticationMethodTypeV2.PHONE &&
|
|
13941
|
+
channel === PhoneRegistrationChannelV2.SMS) {
|
|
13942
|
+
return {
|
|
13943
|
+
continuationToken,
|
|
13944
|
+
phoneNumber: verificationContact,
|
|
13945
|
+
channel,
|
|
13946
|
+
};
|
|
13947
|
+
}
|
|
13948
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, "The selected authentication method is not supported for registration.", correlationId);
|
|
13949
|
+
}
|
|
13950
|
+
createAuthMethodRegistrationRequiredResult(parameters) {
|
|
13951
|
+
const { correlationId, continuationState } = parameters;
|
|
13952
|
+
const supportedMethods = parameters.methods.filter((method) => {
|
|
13953
|
+
const methodType = method.type.trim().toLowerCase();
|
|
13954
|
+
return (methodType === AuthenticationMethodTypeV2.EMAIL ||
|
|
13955
|
+
(methodType === AuthenticationMethodTypeV2.PHONE &&
|
|
13956
|
+
method.channels?.includes(PhoneRegistrationChannelV2.SMS)));
|
|
13957
|
+
});
|
|
13958
|
+
if (supportedMethods.length === 0) {
|
|
13959
|
+
const message = "The enrollment response did not include a supported registration method.";
|
|
13960
|
+
this.logger.error(message, correlationId);
|
|
13961
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13962
|
+
}
|
|
13963
|
+
const methods = supportedMethods.map((method) => {
|
|
13964
|
+
const methodType = method.type.trim().toLowerCase();
|
|
13965
|
+
const channel = method.channels?.find((candidate) => candidate === PhoneRegistrationChannelV2.SMS);
|
|
13966
|
+
if (methodType === AuthenticationMethodTypeV2.EMAIL) {
|
|
13967
|
+
return {
|
|
13968
|
+
type: AuthenticationMethodTypeV2.EMAIL,
|
|
13969
|
+
enrollHref: this.requireLink(correlationId, method.enrollHref),
|
|
13970
|
+
};
|
|
13971
|
+
}
|
|
13972
|
+
if (methodType === AuthenticationMethodTypeV2.PHONE &&
|
|
13973
|
+
channel === PhoneRegistrationChannelV2.SMS) {
|
|
13974
|
+
return {
|
|
13975
|
+
type: AuthenticationMethodTypeV2.PHONE,
|
|
13976
|
+
channels: [channel],
|
|
13977
|
+
enrollHref: this.requireLink(correlationId, method.enrollHref),
|
|
13978
|
+
};
|
|
13979
|
+
}
|
|
13980
|
+
const message = "The enrollment response included an unsupported registration method.";
|
|
13981
|
+
this.logger.error(message, correlationId);
|
|
13982
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13983
|
+
});
|
|
13984
|
+
return createFlowAuthMethodRegistrationRequiredResultV2({
|
|
13985
|
+
correlationId,
|
|
13986
|
+
continuationState,
|
|
13987
|
+
methods,
|
|
13988
|
+
});
|
|
13989
|
+
}
|
|
13990
|
+
createAuthMethodVerificationRequiredResult(continuationState, result, correlationId) {
|
|
13991
|
+
return createFlowAuthMethodVerificationRequiredResultV2({
|
|
13992
|
+
correlationId,
|
|
13993
|
+
continuationState: {
|
|
13994
|
+
...continuationState,
|
|
13995
|
+
continuationToken: result.continuationToken,
|
|
13996
|
+
links: {
|
|
13997
|
+
activate: this.requireLink(correlationId, result.activateHref),
|
|
13998
|
+
resend: result.resendHref,
|
|
13999
|
+
},
|
|
14000
|
+
},
|
|
14001
|
+
sentTo: result.hint,
|
|
14002
|
+
codeLength: result.codeLength,
|
|
14003
|
+
});
|
|
14004
|
+
}
|
|
14005
|
+
toSignUpActionResult(result, continuationState, correlationId) {
|
|
14006
|
+
const nextAction = result.nextAction;
|
|
14007
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.VERIFY) {
|
|
14008
|
+
return createFlowCodeRequiredResultV2({
|
|
14009
|
+
correlationId,
|
|
14010
|
+
continuationState: {
|
|
14011
|
+
continuationToken: result.continuationToken,
|
|
14012
|
+
scenario: continuationState.scenario,
|
|
14013
|
+
scopes: continuationState.scopes,
|
|
14014
|
+
links: {
|
|
14015
|
+
verify: result.verifyHref,
|
|
14016
|
+
resend: result.resendHref,
|
|
14017
|
+
},
|
|
14018
|
+
signUp: continuationState.signUp,
|
|
14019
|
+
},
|
|
14020
|
+
channel: result.type,
|
|
14021
|
+
sentTo: result.hint,
|
|
14022
|
+
codeLength: result.codeLength,
|
|
14023
|
+
});
|
|
14024
|
+
}
|
|
14025
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.ENROLL) {
|
|
14026
|
+
return this.createAuthMethodRegistrationRequiredResult({
|
|
14027
|
+
correlationId,
|
|
14028
|
+
continuationState: {
|
|
14029
|
+
...continuationState,
|
|
14030
|
+
continuationToken: result.continuationToken,
|
|
14031
|
+
links: {},
|
|
14032
|
+
},
|
|
14033
|
+
methods: result.methods,
|
|
14034
|
+
});
|
|
14035
|
+
}
|
|
14036
|
+
if (result.nextAction ===
|
|
14037
|
+
SignUpSubmitAttributesNextActionV2.COLLECT_ATTRIBUTES) {
|
|
14038
|
+
const requiredPasswordAttribute = result.attributes.find((attribute) => attribute.attributeId.toLowerCase() === "password" &&
|
|
14039
|
+
attribute.required === true);
|
|
14040
|
+
const nextContinuationState = {
|
|
14041
|
+
continuationToken: result.continuationToken,
|
|
14042
|
+
scenario: continuationState.scenario,
|
|
14043
|
+
scopes: continuationState.scopes,
|
|
14044
|
+
links: {
|
|
14045
|
+
submitAttributes: result.submitAttributesHref,
|
|
14046
|
+
},
|
|
14047
|
+
signUp: continuationState.signUp,
|
|
14048
|
+
};
|
|
14049
|
+
const attributes = result.attributes.filter((attribute) => attribute.attributeId.toLowerCase() !== "password");
|
|
14050
|
+
if (requiredPasswordAttribute &&
|
|
14051
|
+
continuationState.signUp?.passwordWasSupplied !== true) {
|
|
14052
|
+
return createFlowSignUpPasswordRequiredResultV2({
|
|
14053
|
+
correlationId,
|
|
14054
|
+
continuationState: nextContinuationState,
|
|
14055
|
+
attributes,
|
|
14056
|
+
requiredPasswordAttribute,
|
|
14057
|
+
});
|
|
14058
|
+
}
|
|
14059
|
+
return createFlowAttributesRequiredResultV2({
|
|
14060
|
+
correlationId,
|
|
14061
|
+
continuationState: nextContinuationState,
|
|
14062
|
+
attributes,
|
|
14063
|
+
});
|
|
14064
|
+
}
|
|
14065
|
+
if (result.nextAction === SignUpSubmitAttributesNextActionV2.CONTINUE) {
|
|
14066
|
+
return createFlowSignInContinuationRequiredResultV2({
|
|
14067
|
+
correlationId,
|
|
14068
|
+
continuationState: {
|
|
14069
|
+
continuationToken: result.continuationToken,
|
|
14070
|
+
scenario: continuationState.scenario,
|
|
14071
|
+
scopes: continuationState.scopes,
|
|
14072
|
+
links: {},
|
|
14073
|
+
},
|
|
14074
|
+
});
|
|
14075
|
+
}
|
|
14076
|
+
const message = `Sign-up attribute submission next action '${nextAction}' is not supported.`;
|
|
13689
14077
|
this.logger.error(message, correlationId);
|
|
13690
14078
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, message, correlationId);
|
|
13691
14079
|
}
|
|
@@ -13723,16 +14111,16 @@
|
|
|
13723
14111
|
const challengeHref = step === "resendCode"
|
|
13724
14112
|
? continuationState.links.resend
|
|
13725
14113
|
: continuationState.links.challenge;
|
|
13726
|
-
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, step, correlationId), correlationId);
|
|
14114
|
+
const context = this.createRequestContext(this.resolveStepApiId(continuationState.scenario, step, correlationId, parameters.authenticationFactor), correlationId);
|
|
13727
14115
|
this.logger.verbose(step === "resendCode"
|
|
13728
14116
|
? "Resending V2 one-time code."
|
|
13729
14117
|
: "Requesting V2 challenge.", correlationId);
|
|
13730
14118
|
const challengeResult = await this.apiClient.requestChallenge(this.requireLink(correlationId, challengeHref), { continuationToken: continuationState.continuationToken }, context);
|
|
13731
14119
|
const nextAction = challengeResult.nextAction;
|
|
13732
|
-
if (challengeResult.nextAction ===
|
|
14120
|
+
if (challengeResult.nextAction === VERIFY_RELATION) {
|
|
13733
14121
|
return challengeResult;
|
|
13734
14122
|
}
|
|
13735
|
-
if (challengeResult.nextAction ===
|
|
14123
|
+
if (challengeResult.nextAction === RISK_VERIFY_RELATION) {
|
|
13736
14124
|
return this.apiClient.verifyRisk(challengeResult.riskVerifyHref, { continuationToken: challengeResult.continuationToken }, context);
|
|
13737
14125
|
}
|
|
13738
14126
|
const message = `Challenge next action '${nextAction}' is not supported.`;
|
|
@@ -13755,8 +14143,8 @@
|
|
|
13755
14143
|
}),
|
|
13756
14144
|
};
|
|
13757
14145
|
}
|
|
13758
|
-
resolveStepApiId(scenario, step, correlationId) {
|
|
13759
|
-
const apiId = getPublicApiIdV2(scenario, step);
|
|
14146
|
+
resolveStepApiId(scenario, step, correlationId, authenticationFactor) {
|
|
14147
|
+
const apiId = getPublicApiIdV2(scenario, step, authenticationFactor);
|
|
13760
14148
|
if (apiId === undefined) {
|
|
13761
14149
|
const message = `No telemetry API id is registered for step '${step}' of the '${scenario}' flow.`;
|
|
13762
14150
|
this.logger.error(message, correlationId);
|
|
@@ -13765,7 +14153,7 @@
|
|
|
13765
14153
|
return apiId;
|
|
13766
14154
|
}
|
|
13767
14155
|
requireLink(correlationId, href, missingLinkError) {
|
|
13768
|
-
if (!href) {
|
|
14156
|
+
if (typeof href !== "string" || !href.trim()) {
|
|
13769
14157
|
const errorCode = missingLinkError?.code ?? CONTINUATION_LINK_MISSING;
|
|
13770
14158
|
const message = missingLinkError?.message ??
|
|
13771
14159
|
"The continuation state is missing a link required to advance the flow.";
|
|
@@ -14051,6 +14439,141 @@
|
|
|
14051
14439
|
}
|
|
14052
14440
|
}
|
|
14053
14441
|
|
|
14442
|
+
/*
|
|
14443
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14444
|
+
* Licensed under the MIT License.
|
|
14445
|
+
*/
|
|
14446
|
+
/**
|
|
14447
|
+
* State returned when a newly registered authentication method must be
|
|
14448
|
+
* activated with the challenge sent by the service.
|
|
14449
|
+
*/
|
|
14450
|
+
class AuthMethodVerificationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14451
|
+
constructor(stateParameters) {
|
|
14452
|
+
super(stateParameters);
|
|
14453
|
+
this.stateType = "authMethodVerificationRequired";
|
|
14454
|
+
this.type = stateParameters.type;
|
|
14455
|
+
this.sentTo = stateParameters.sentTo;
|
|
14456
|
+
this.codeLength = stateParameters.codeLength;
|
|
14457
|
+
}
|
|
14458
|
+
/**
|
|
14459
|
+
* Submits the activation challenge for the registered method.
|
|
14460
|
+
* @param challenge - The activation challenge to submit.
|
|
14461
|
+
* @returns The completed authentication result or a failed state.
|
|
14462
|
+
*/
|
|
14463
|
+
async submitChallenge(challenge) {
|
|
14464
|
+
const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
|
|
14465
|
+
try {
|
|
14466
|
+
ensureArgumentIsNotNullOrUndefined("challenge", challenge, correlationId);
|
|
14467
|
+
logger.verbose("Submitting a V2 authentication-method activation challenge.", correlationId);
|
|
14468
|
+
const result = await flowClient.verifyAuthMethodRegistration({
|
|
14469
|
+
correlationId,
|
|
14470
|
+
continuationState,
|
|
14471
|
+
code: challenge,
|
|
14472
|
+
});
|
|
14473
|
+
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14474
|
+
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14475
|
+
}
|
|
14476
|
+
catch (error) {
|
|
14477
|
+
logger.errorPii(`Failed to submit the V2 authentication-method activation challenge. Error: '${error}'.`, correlationId);
|
|
14478
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14479
|
+
scenario: continuationState.scenario,
|
|
14480
|
+
correlationId,
|
|
14481
|
+
});
|
|
14482
|
+
}
|
|
14483
|
+
}
|
|
14484
|
+
/**
|
|
14485
|
+
* Requests a replacement activation challenge using the retained server
|
|
14486
|
+
* resend link.
|
|
14487
|
+
* @returns Refreshed activation metadata or a failed state.
|
|
14488
|
+
*/
|
|
14489
|
+
async resendChallenge() {
|
|
14490
|
+
const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
|
|
14491
|
+
try {
|
|
14492
|
+
logger.verbose("Resending a V2 authentication-method activation challenge.", correlationId);
|
|
14493
|
+
const result = await flowClient.resendAuthMethodRegistrationChallenge({
|
|
14494
|
+
correlationId,
|
|
14495
|
+
continuationState,
|
|
14496
|
+
});
|
|
14497
|
+
return new CustomAuthResultV2(new AuthMethodVerificationRequiredStateV2({
|
|
14498
|
+
correlationId: result.correlationId,
|
|
14499
|
+
logger,
|
|
14500
|
+
config: this.stateParameters.config,
|
|
14501
|
+
flowClient,
|
|
14502
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14503
|
+
continuationState: result.continuationState,
|
|
14504
|
+
type: this.type,
|
|
14505
|
+
sentTo: result.sentTo ?? this.sentTo,
|
|
14506
|
+
codeLength: result.codeLength,
|
|
14507
|
+
}), undefined, result.continuationState.scenario);
|
|
14508
|
+
}
|
|
14509
|
+
catch (error) {
|
|
14510
|
+
logger.errorPii(`Failed to resend the V2 authentication-method activation challenge. Error: '${error}'.`, correlationId);
|
|
14511
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14512
|
+
scenario: continuationState.scenario,
|
|
14513
|
+
correlationId,
|
|
14514
|
+
});
|
|
14515
|
+
}
|
|
14516
|
+
}
|
|
14517
|
+
}
|
|
14518
|
+
|
|
14519
|
+
/*
|
|
14520
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14521
|
+
* Licensed under the MIT License.
|
|
14522
|
+
*/
|
|
14523
|
+
/**
|
|
14524
|
+
* State returned when an authentication method must be registered. Applications
|
|
14525
|
+
* select one of the sanitized offered methods and provide its contact value.
|
|
14526
|
+
*/
|
|
14527
|
+
class AuthMethodRegistrationRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14528
|
+
constructor(stateParameters) {
|
|
14529
|
+
super(stateParameters);
|
|
14530
|
+
this.stateType = "authMethodRegistrationRequired";
|
|
14531
|
+
this.methods = stateParameters.methods;
|
|
14532
|
+
}
|
|
14533
|
+
/**
|
|
14534
|
+
* Selects an authentication method for strong-auth registration and requests
|
|
14535
|
+
* its activation challenge.
|
|
14536
|
+
* @param method - A method from {@link methods}.
|
|
14537
|
+
* @param verificationContact - The email address or phone number to register.
|
|
14538
|
+
* @returns The registration activation result.
|
|
14539
|
+
*/
|
|
14540
|
+
async selectAuthMethod(method, verificationContact) {
|
|
14541
|
+
const { correlationId, continuationState, flowClient, logger } = this.stateParameters;
|
|
14542
|
+
try {
|
|
14543
|
+
const selectedMethod = this.methods.find((candidate) => candidate.type === method.type);
|
|
14544
|
+
if (!selectedMethod) {
|
|
14545
|
+
throw new InvalidArgumentError("method", correlationId);
|
|
14546
|
+
}
|
|
14547
|
+
ensureArgumentIsNotEmptyString("verificationContact", verificationContact, correlationId);
|
|
14548
|
+
logger.verbose("Registering the selected V2 authentication method.", correlationId);
|
|
14549
|
+
const result = await flowClient.registerAuthMethod({
|
|
14550
|
+
correlationId,
|
|
14551
|
+
continuationState,
|
|
14552
|
+
method: selectedMethod,
|
|
14553
|
+
verificationContact,
|
|
14554
|
+
});
|
|
14555
|
+
return new CustomAuthResultV2(new AuthMethodVerificationRequiredStateV2({
|
|
14556
|
+
correlationId: result.correlationId,
|
|
14557
|
+
logger,
|
|
14558
|
+
config: this.stateParameters.config,
|
|
14559
|
+
flowClient,
|
|
14560
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14561
|
+
continuationState: result.continuationState,
|
|
14562
|
+
type: selectedMethod.type,
|
|
14563
|
+
sentTo: result.sentTo,
|
|
14564
|
+
codeLength: result.codeLength,
|
|
14565
|
+
}), undefined, result.continuationState.scenario);
|
|
14566
|
+
}
|
|
14567
|
+
catch (error) {
|
|
14568
|
+
logger.errorPii(`Failed to register the selected V2 authentication method. Error: '${error}'.`, correlationId);
|
|
14569
|
+
return CustomAuthResultV2.createWithError(error, {
|
|
14570
|
+
scenario: continuationState.scenario,
|
|
14571
|
+
correlationId,
|
|
14572
|
+
});
|
|
14573
|
+
}
|
|
14574
|
+
}
|
|
14575
|
+
}
|
|
14576
|
+
|
|
14054
14577
|
/*
|
|
14055
14578
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14056
14579
|
* Licensed under the MIT License.
|
|
@@ -14098,8 +14621,8 @@
|
|
|
14098
14621
|
*/
|
|
14099
14622
|
/**
|
|
14100
14623
|
* State returned when the user must supply a new password to complete the flow.
|
|
14101
|
-
* A successful submission
|
|
14102
|
-
* sign
|
|
14624
|
+
* A successful submission can require registration or return a continuation
|
|
14625
|
+
* for sign-in.
|
|
14103
14626
|
*/
|
|
14104
14627
|
class NewPasswordRequiredStateV2 extends AuthFlowActionRequiredStateBase {
|
|
14105
14628
|
constructor() {
|
|
@@ -14107,8 +14630,8 @@
|
|
|
14107
14630
|
this.stateType = "newPasswordRequired";
|
|
14108
14631
|
}
|
|
14109
14632
|
/**
|
|
14110
|
-
* Submits the new password to complete the reset.
|
|
14111
|
-
* sign-in
|
|
14633
|
+
* Submits the new password to complete the reset. Enrollment may be
|
|
14634
|
+
* required before sign-in; a rejected password returns an error.
|
|
14112
14635
|
* @param password - The new password to set.
|
|
14113
14636
|
* @returns The result of submitting the new password.
|
|
14114
14637
|
*/
|
|
@@ -14122,14 +14645,29 @@
|
|
|
14122
14645
|
continuationState,
|
|
14123
14646
|
newPassword: password,
|
|
14124
14647
|
});
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
|
|
14132
|
-
|
|
14648
|
+
const resultType = result.type;
|
|
14649
|
+
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
14650
|
+
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
14651
|
+
correlationId: result.correlationId,
|
|
14652
|
+
logger,
|
|
14653
|
+
config: this.stateParameters.config,
|
|
14654
|
+
flowClient,
|
|
14655
|
+
continuationState: result.continuationState,
|
|
14656
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14657
|
+
methods: result.methods,
|
|
14658
|
+
}), undefined, result.continuationState.scenario);
|
|
14659
|
+
}
|
|
14660
|
+
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14661
|
+
return new CustomAuthResultV2(new SignInContinuationStateV2({
|
|
14662
|
+
correlationId: result.correlationId,
|
|
14663
|
+
logger,
|
|
14664
|
+
config: this.stateParameters.config,
|
|
14665
|
+
flowClient,
|
|
14666
|
+
continuationState: result.continuationState,
|
|
14667
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14668
|
+
}), undefined, result.continuationState.scenario);
|
|
14669
|
+
}
|
|
14670
|
+
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Password submission result type '${resultType}' is not supported.`, correlationId);
|
|
14133
14671
|
}
|
|
14134
14672
|
catch (error) {
|
|
14135
14673
|
logger.errorPii(`Failed to submit V2 new password. Error: '${error}'.`, correlationId);
|
|
@@ -14153,18 +14691,20 @@
|
|
|
14153
14691
|
this.channel = stateParameters.channel;
|
|
14154
14692
|
this.codeLength = stateParameters.codeLength;
|
|
14155
14693
|
}
|
|
14156
|
-
async submitCodeCore(code) {
|
|
14694
|
+
async submitCodeCore(code, authenticationFactor) {
|
|
14157
14695
|
ensureArgumentIsNotNullOrUndefined("code", code, this.stateParameters.correlationId);
|
|
14158
14696
|
return this.stateParameters.flowClient.submitCode({
|
|
14159
14697
|
correlationId: this.stateParameters.correlationId,
|
|
14160
14698
|
continuationState: this.stateParameters.continuationState,
|
|
14699
|
+
authenticationFactor,
|
|
14161
14700
|
code,
|
|
14162
14701
|
});
|
|
14163
14702
|
}
|
|
14164
|
-
async resendCodeCore() {
|
|
14703
|
+
async resendCodeCore(authenticationFactor) {
|
|
14165
14704
|
return this.stateParameters.flowClient.resendCode({
|
|
14166
14705
|
correlationId: this.stateParameters.correlationId,
|
|
14167
14706
|
continuationState: this.stateParameters.continuationState,
|
|
14707
|
+
authenticationFactor,
|
|
14168
14708
|
});
|
|
14169
14709
|
}
|
|
14170
14710
|
}
|
|
@@ -14225,6 +14765,17 @@
|
|
|
14225
14765
|
cacheClient: this.stateParameters.cacheClient,
|
|
14226
14766
|
}), undefined, result.continuationState.scenario);
|
|
14227
14767
|
}
|
|
14768
|
+
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
14769
|
+
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
14770
|
+
correlationId: result.correlationId,
|
|
14771
|
+
logger,
|
|
14772
|
+
config: this.stateParameters.config,
|
|
14773
|
+
flowClient: this.stateParameters.flowClient,
|
|
14774
|
+
continuationState: result.continuationState,
|
|
14775
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
14776
|
+
methods: result.methods,
|
|
14777
|
+
}), undefined, result.continuationState.scenario);
|
|
14778
|
+
}
|
|
14228
14779
|
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
14229
14780
|
const signInStateTransitionHandler = this.stateParameters.signInStateTransitionHandler;
|
|
14230
14781
|
if (!signInStateTransitionHandler) {
|
|
@@ -14304,7 +14855,7 @@
|
|
|
14304
14855
|
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14305
14856
|
try {
|
|
14306
14857
|
logger.verbose("Submitting V2 MFA challenge.", correlationId);
|
|
14307
|
-
const result = await this.submitCodeCore(challenge);
|
|
14858
|
+
const result = await this.submitCodeCore(challenge, AuthenticationFactorV2.MULTI_FACTOR);
|
|
14308
14859
|
if (result.type !== FLOW_COMPLETED_V2) {
|
|
14309
14860
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `MFA challenge submission result type '${result.type}' is not supported.`, correlationId);
|
|
14310
14861
|
}
|
|
@@ -14328,7 +14879,7 @@
|
|
|
14328
14879
|
const { correlationId, logger, continuationState } = this.stateParameters;
|
|
14329
14880
|
try {
|
|
14330
14881
|
logger.verbose("Resending V2 MFA challenge.", correlationId);
|
|
14331
|
-
const result = await this.resendCodeCore();
|
|
14882
|
+
const result = await this.resendCodeCore(AuthenticationFactorV2.MULTI_FACTOR);
|
|
14332
14883
|
return new CustomAuthResultV2(new MFAVerificationRequiredStateV2({
|
|
14333
14884
|
correlationId: result.correlationId,
|
|
14334
14885
|
logger,
|
|
@@ -14443,13 +14994,14 @@
|
|
|
14443
14994
|
}
|
|
14444
14995
|
}
|
|
14445
14996
|
async requestSelectedMethodChallenge(method) {
|
|
14446
|
-
const { correlationId, continuationState, flowClient } = this.stateParameters;
|
|
14997
|
+
const { correlationId, continuationState, flowClient, authenticationFactor, } = this.stateParameters;
|
|
14447
14998
|
const selectedMethod = this.methods.find((candidate) => candidate.id === method.id);
|
|
14448
14999
|
if (!selectedMethod) {
|
|
14449
15000
|
throw new InvalidArgumentError("method", correlationId);
|
|
14450
15001
|
}
|
|
14451
15002
|
const result = await flowClient.requestChallenge({
|
|
14452
15003
|
correlationId,
|
|
15004
|
+
authenticationFactor,
|
|
14453
15005
|
continuationState: {
|
|
14454
15006
|
...continuationState,
|
|
14455
15007
|
links: {
|
|
@@ -14494,6 +15046,17 @@
|
|
|
14494
15046
|
const account = new CustomAuthAccountData(result.authenticationResult.account, this.stateParameters.config, this.stateParameters.cacheClient, logger, correlationId);
|
|
14495
15047
|
return new CustomAuthResultV2(new CompletedStateV2(), account, continuationState.scenario);
|
|
14496
15048
|
}
|
|
15049
|
+
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
15050
|
+
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
15051
|
+
correlationId: result.correlationId,
|
|
15052
|
+
logger,
|
|
15053
|
+
config: this.stateParameters.config,
|
|
15054
|
+
flowClient,
|
|
15055
|
+
continuationState: result.continuationState,
|
|
15056
|
+
cacheClient: this.stateParameters.cacheClient,
|
|
15057
|
+
methods: result.methods,
|
|
15058
|
+
}), undefined, result.continuationState.scenario);
|
|
15059
|
+
}
|
|
14497
15060
|
if (result.type === FLOW_MFA_REQUIRED_V2) {
|
|
14498
15061
|
return new CustomAuthResultV2(new AuthMethodSelectionRequiredStateV2({
|
|
14499
15062
|
correlationId: result.correlationId,
|
|
@@ -14650,6 +15213,12 @@
|
|
|
14650
15213
|
if (result.type === FLOW_SIGN_IN_CONTINUATION_REQUIRED_V2) {
|
|
14651
15214
|
return new CustomAuthResultV2(new SignInContinuationStateV2(commonStateParameters), undefined, result.continuationState.scenario);
|
|
14652
15215
|
}
|
|
15216
|
+
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
15217
|
+
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
15218
|
+
...commonStateParameters,
|
|
15219
|
+
methods: result.methods,
|
|
15220
|
+
}), undefined, result.continuationState.scenario);
|
|
15221
|
+
}
|
|
14653
15222
|
throw new CustomAuthError(UNSUPPORTED_FLOW_TRANSITION, `Sign-up ${submission} submission result type '${result.type}' is not supported.`, stateParameters.correlationId);
|
|
14654
15223
|
}
|
|
14655
15224
|
handleVerification(result, stateParameters) {
|
|
@@ -19123,7 +19692,7 @@
|
|
|
19123
19692
|
throw cacheError;
|
|
19124
19693
|
}
|
|
19125
19694
|
// When cache quota is exceeded, start removing access tokens until we can successfully set the item
|
|
19126
|
-
this.
|
|
19695
|
+
await this.removeAccessTokenAndTokenBindingKey(accessTokenKeys[i], correlationId, undefined, false // Don't save token keys yet, do it at the end
|
|
19127
19696
|
);
|
|
19128
19697
|
}
|
|
19129
19698
|
else {
|
|
@@ -19265,6 +19834,13 @@
|
|
|
19265
19834
|
super.removeAccessToken(key, correlationId);
|
|
19266
19835
|
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
|
|
19267
19836
|
}
|
|
19837
|
+
/**
|
|
19838
|
+
* Removes an access token and awaits token-binding key cleanup.
|
|
19839
|
+
*/
|
|
19840
|
+
async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId, updateTokenKeys = true) {
|
|
19841
|
+
await super.removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId);
|
|
19842
|
+
updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
|
|
19843
|
+
}
|
|
19268
19844
|
/**
|
|
19269
19845
|
* Remove access token key from the key map
|
|
19270
19846
|
* @param key
|
|
@@ -20529,12 +21105,26 @@
|
|
|
20529
21105
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
20530
21106
|
* Licensed under the MIT License.
|
|
20531
21107
|
*/
|
|
21108
|
+
/**
|
|
21109
|
+
* Key storage enclaves supported by the platform broker.
|
|
21110
|
+
*/
|
|
21111
|
+
const PlatformAuthEnclave = {
|
|
21112
|
+
/**
|
|
21113
|
+
* Persisted software key using MS_KEY_STORAGE_PROVIDER.
|
|
21114
|
+
*/
|
|
21115
|
+
SOFTWARE: "sw"};
|
|
20532
21116
|
/**
|
|
20533
21117
|
* Token types supported by the platform broker request contract.
|
|
20534
21118
|
*/
|
|
20535
21119
|
const PlatformAuthTokenType = {
|
|
20536
21120
|
DPOP_WITH_PROOF: "dpop+proof",
|
|
20537
21121
|
};
|
|
21122
|
+
/**
|
|
21123
|
+
* Token binding preferences supported by the platform broker.
|
|
21124
|
+
*/
|
|
21125
|
+
const PlatformAuthBindingPreference = {
|
|
21126
|
+
ATTESTED: "attested",
|
|
21127
|
+
};
|
|
20538
21128
|
const PROOF_OF_POSSESSION_TOKEN_TYPES = [
|
|
20539
21129
|
AuthenticationScheme.POP,
|
|
20540
21130
|
AuthenticationScheme.DPOP,
|
|
@@ -20550,19 +21140,19 @@
|
|
|
20550
21140
|
/**
|
|
20551
21141
|
* Adds canonical proof request fields to the broker no-cache property bag.
|
|
20552
21142
|
*/
|
|
20553
|
-
function createPlatformAuthExtraParametersNoCache(
|
|
20554
|
-
if (!
|
|
20555
|
-
return
|
|
21143
|
+
function createPlatformAuthExtraParametersNoCache(tokenType, resourceRequestMethod, resourceRequestUri, dpopNonce) {
|
|
21144
|
+
if (!isProofOfPossessionTokenType(tokenType)) {
|
|
21145
|
+
return undefined;
|
|
20556
21146
|
}
|
|
20557
21147
|
return {
|
|
20558
|
-
...extraParametersNoCache,
|
|
20559
21148
|
...(resourceRequestMethod && {
|
|
20560
21149
|
pop_method: resourceRequestMethod,
|
|
20561
21150
|
}),
|
|
20562
21151
|
...(resourceRequestUri && {
|
|
20563
21152
|
pop_url: resourceRequestUri,
|
|
20564
21153
|
}),
|
|
20565
|
-
...(
|
|
21154
|
+
...(tokenType === PlatformAuthTokenType.DPOP_WITH_PROOF &&
|
|
21155
|
+
dpopNonce && {
|
|
20566
21156
|
pop_nonce: dpopNonce,
|
|
20567
21157
|
}),
|
|
20568
21158
|
};
|
|
@@ -20709,6 +21299,7 @@
|
|
|
20709
21299
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
20710
21300
|
* Licensed under the MIT License.
|
|
20711
21301
|
*/
|
|
21302
|
+
const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
|
|
20712
21303
|
class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
20713
21304
|
constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
|
|
20714
21305
|
super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
|
|
@@ -20767,17 +21358,9 @@
|
|
|
20767
21358
|
throw e;
|
|
20768
21359
|
}
|
|
20769
21360
|
// check if the tokens can be retrieved from internal cache
|
|
21361
|
+
let cachedResult;
|
|
20770
21362
|
try {
|
|
20771
|
-
|
|
20772
|
-
// Served from the native internal cache; token did not come directly from the broker
|
|
20773
|
-
nativeATMeasurement.add({
|
|
20774
|
-
isNativeBroker: false,
|
|
20775
|
-
});
|
|
20776
|
-
nativeATMeasurement.end({
|
|
20777
|
-
success: true,
|
|
20778
|
-
fromCache: true,
|
|
20779
|
-
});
|
|
20780
|
-
return result;
|
|
21363
|
+
cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
|
|
20781
21364
|
}
|
|
20782
21365
|
catch (e) {
|
|
20783
21366
|
if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
|
|
@@ -20788,13 +21371,28 @@
|
|
|
20788
21371
|
nativeATMeasurement.end({
|
|
20789
21372
|
success: false,
|
|
20790
21373
|
});
|
|
21374
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
20791
21375
|
throw e;
|
|
20792
21376
|
}
|
|
20793
21377
|
// continue with a native call for any and all errors
|
|
20794
21378
|
this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call", this.correlationId);
|
|
20795
21379
|
}
|
|
21380
|
+
if (cachedResult) {
|
|
21381
|
+
// Served from the native internal cache; token did not come directly from the broker
|
|
21382
|
+
nativeATMeasurement.add({
|
|
21383
|
+
isNativeBroker: false,
|
|
21384
|
+
});
|
|
21385
|
+
nativeATMeasurement.end({
|
|
21386
|
+
success: true,
|
|
21387
|
+
fromCache: true,
|
|
21388
|
+
});
|
|
21389
|
+
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
21390
|
+
return cachedResult;
|
|
21391
|
+
}
|
|
20796
21392
|
// dispatch the request to the broker
|
|
20797
21393
|
try {
|
|
21394
|
+
await this.prepareDpopBrokerRequest(nativeRequest);
|
|
21395
|
+
this.addDpopBrokerAttemptTelemetry(nativeRequest);
|
|
20798
21396
|
const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
|
|
20799
21397
|
const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
|
|
20800
21398
|
nativeATMeasurement.end({
|
|
@@ -20812,6 +21410,7 @@
|
|
|
20812
21410
|
success: false,
|
|
20813
21411
|
}, e);
|
|
20814
21412
|
this.setBrokerErrorTelemetry(e);
|
|
21413
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
20815
21414
|
throw e;
|
|
20816
21415
|
}
|
|
20817
21416
|
}
|
|
@@ -20846,6 +21445,7 @@
|
|
|
20846
21445
|
scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
|
|
20847
21446
|
account: cachedAccount,
|
|
20848
21447
|
forceRefresh: false,
|
|
21448
|
+
...this.createSilentCacheTokenBindingParameters(request),
|
|
20849
21449
|
resource: request.extraParameters?.resource,
|
|
20850
21450
|
};
|
|
20851
21451
|
// Preserve FMI partition semantics for silent cache filtering.
|
|
@@ -20854,6 +21454,29 @@
|
|
|
20854
21454
|
}
|
|
20855
21455
|
return silentRequest;
|
|
20856
21456
|
}
|
|
21457
|
+
/**
|
|
21458
|
+
* Maps platform-broker token-binding state to silent-cache request fields.
|
|
21459
|
+
* @param request
|
|
21460
|
+
*/
|
|
21461
|
+
createSilentCacheTokenBindingParameters(request) {
|
|
21462
|
+
const authenticationScheme = this.isDpopBrokerRequest(request)
|
|
21463
|
+
? AuthenticationScheme.DPOP
|
|
21464
|
+
: request.tokenType;
|
|
21465
|
+
if (authenticationScheme !== AuthenticationScheme.DPOP &&
|
|
21466
|
+
authenticationScheme !== AuthenticationScheme.POP) {
|
|
21467
|
+
return { authenticationScheme };
|
|
21468
|
+
}
|
|
21469
|
+
return {
|
|
21470
|
+
authenticationScheme,
|
|
21471
|
+
...(authenticationScheme === AuthenticationScheme.DPOP &&
|
|
21472
|
+
request.keyId && { dpopJkt: request.keyId }),
|
|
21473
|
+
...(authenticationScheme === AuthenticationScheme.POP &&
|
|
21474
|
+
request.signPopToken === false &&
|
|
21475
|
+
request.keyId && { popKid: request.keyId }),
|
|
21476
|
+
resourceRequestMethod: request.resourceRequestMethod,
|
|
21477
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
21478
|
+
};
|
|
21479
|
+
}
|
|
20857
21480
|
/**
|
|
20858
21481
|
* Fetches the tokens from the cache if un-expired
|
|
20859
21482
|
* @param nativeAccountId
|
|
@@ -20902,10 +21525,22 @@
|
|
|
20902
21525
|
const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
|
|
20903
21526
|
const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
|
|
20904
21527
|
try {
|
|
20905
|
-
await this.
|
|
21528
|
+
await this.prepareDpopBrokerRequest(nativeRequest);
|
|
21529
|
+
this.addDpopBrokerAttemptTelemetry(nativeRequest);
|
|
21530
|
+
const response = await this.platformAuthProvider.sendMessage(nativeRequest);
|
|
21531
|
+
const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
|
|
21532
|
+
if (dpopBrokerOutcome === "L3") {
|
|
21533
|
+
await this.resetGeneratedDpopRequestKey(nativeRequest);
|
|
21534
|
+
}
|
|
20906
21535
|
}
|
|
20907
21536
|
catch (e) {
|
|
20908
|
-
|
|
21537
|
+
/*
|
|
21538
|
+
* Raw persistent/transient broker errors are retrieved again in
|
|
21539
|
+
* phase two. Availability errors are thrown for controller-managed
|
|
21540
|
+
* web fallback, while translated cancellation, network, and
|
|
21541
|
+
* interaction-required errors are surfaced without being swallowed.
|
|
21542
|
+
*/
|
|
21543
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
20909
21544
|
if (e instanceof NativeAuthError) {
|
|
20910
21545
|
const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
|
|
20911
21546
|
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
@@ -20920,6 +21555,16 @@
|
|
|
20920
21555
|
throw e;
|
|
20921
21556
|
}
|
|
20922
21557
|
}
|
|
21558
|
+
else if (this.isDpopBrokerRequest(nativeRequest)) {
|
|
21559
|
+
throw e;
|
|
21560
|
+
}
|
|
21561
|
+
}
|
|
21562
|
+
try {
|
|
21563
|
+
await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
|
|
21564
|
+
}
|
|
21565
|
+
catch (e) {
|
|
21566
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
21567
|
+
throw e;
|
|
20923
21568
|
}
|
|
20924
21569
|
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
|
|
20925
21570
|
...nativeRequest,
|
|
@@ -20934,7 +21579,14 @@
|
|
|
20934
21579
|
? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
|
|
20935
21580
|
: getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
|
|
20936
21581
|
rootMeasurement.end({ success: true });
|
|
20937
|
-
|
|
21582
|
+
try {
|
|
21583
|
+
await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
|
|
21584
|
+
}
|
|
21585
|
+
catch (e) {
|
|
21586
|
+
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
21587
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
|
|
21588
|
+
throw e;
|
|
21589
|
+
}
|
|
20938
21590
|
}
|
|
20939
21591
|
/**
|
|
20940
21592
|
* If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
|
|
@@ -20967,6 +21619,8 @@
|
|
|
20967
21619
|
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
|
20968
21620
|
const reqTimestamp = nowSeconds();
|
|
20969
21621
|
try {
|
|
21622
|
+
await this.prepareDpopBrokerRequest(request, true);
|
|
21623
|
+
this.addDpopBrokerAttemptTelemetry(request);
|
|
20970
21624
|
this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.", this.correlationId);
|
|
20971
21625
|
const response = await this.platformAuthProvider.sendMessage(request);
|
|
20972
21626
|
const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
|
|
@@ -20975,7 +21629,12 @@
|
|
|
20975
21629
|
return authResult;
|
|
20976
21630
|
}
|
|
20977
21631
|
catch (e) {
|
|
21632
|
+
if (e instanceof NativeAuthError) {
|
|
21633
|
+
const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
|
|
21634
|
+
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
|
21635
|
+
}
|
|
20978
21636
|
this.setBrokerErrorTelemetry(e);
|
|
21637
|
+
await this.resetGeneratedDpopRequestKeyBestEffort(request);
|
|
20979
21638
|
throw e;
|
|
20980
21639
|
}
|
|
20981
21640
|
}
|
|
@@ -20995,6 +21654,7 @@
|
|
|
20995
21654
|
*/
|
|
20996
21655
|
async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
|
|
20997
21656
|
this.logger.trace("NativeInteractionClient - handleNativeResponse called.", this.correlationId);
|
|
21657
|
+
const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
|
|
20998
21658
|
// generate identifiers
|
|
20999
21659
|
const idTokenClaims = extractTokenClaims(response.id_token, base64Decode, this.correlationId);
|
|
21000
21660
|
const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
|
|
@@ -21020,10 +21680,17 @@
|
|
|
21020
21680
|
response.expires_in = Number(response.expires_in);
|
|
21021
21681
|
// generate authenticationResult
|
|
21022
21682
|
const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
|
|
21683
|
+
const isL3DpopResponse = dpopBrokerOutcome === "L3";
|
|
21023
21684
|
// cache accounts and tokens in the appropriate storage
|
|
21024
|
-
|
|
21685
|
+
const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
|
|
21686
|
+
(this.isDpopBrokerRequest(request) &&
|
|
21687
|
+
storeInCache?.accessToken === false);
|
|
21688
|
+
if (shouldRemoveGeneratedDpopKey) {
|
|
21689
|
+
await this.resetGeneratedDpopRequestKey(request);
|
|
21690
|
+
}
|
|
21691
|
+
await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims), !isL3DpopResponse);
|
|
21025
21692
|
await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
|
|
21026
|
-
storeInCache);
|
|
21693
|
+
storeInCache, dpopBrokerOutcome);
|
|
21027
21694
|
return result;
|
|
21028
21695
|
}
|
|
21029
21696
|
/**
|
|
@@ -21099,7 +21766,7 @@
|
|
|
21099
21766
|
*/
|
|
21100
21767
|
async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
|
|
21101
21768
|
// Add Native Broker fields to Telemetry
|
|
21102
|
-
const mats = this.addTelemetryFromNativeResponse(response.properties
|
|
21769
|
+
const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
|
|
21103
21770
|
// If scopes not returned in server response, use request scopes
|
|
21104
21771
|
const responseScopes = this.generateScopes(request.scope, response.scope);
|
|
21105
21772
|
const accountProperties = response.account.properties || {};
|
|
@@ -21125,9 +21792,17 @@
|
|
|
21125
21792
|
}
|
|
21126
21793
|
// generate PoP token as needed
|
|
21127
21794
|
const responseAccessToken = await this.generatePopAccessToken(response, request);
|
|
21128
|
-
const
|
|
21129
|
-
|
|
21130
|
-
|
|
21795
|
+
const isDpopRequest = this.isDpopBrokerRequest(request);
|
|
21796
|
+
let tokenType = AuthenticationScheme.BEARER;
|
|
21797
|
+
if (isDpopRequest) {
|
|
21798
|
+
tokenType = AuthenticationScheme.DPOP;
|
|
21799
|
+
}
|
|
21800
|
+
else if (request.tokenType === AuthenticationScheme.POP) {
|
|
21801
|
+
tokenType = AuthenticationScheme.POP;
|
|
21802
|
+
}
|
|
21803
|
+
const dpopProof = isDpopRequest
|
|
21804
|
+
? await this.generateDpopProof(response, request)
|
|
21805
|
+
: undefined;
|
|
21131
21806
|
const result = {
|
|
21132
21807
|
authority: authority,
|
|
21133
21808
|
uniqueId: uid,
|
|
@@ -21141,6 +21816,7 @@
|
|
|
21141
21816
|
// Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
|
|
21142
21817
|
expiresOn: toDateFromSeconds(reqTimestamp + response.expires_in),
|
|
21143
21818
|
tokenType: tokenType,
|
|
21819
|
+
dpopProof,
|
|
21144
21820
|
correlationId: this.correlationId,
|
|
21145
21821
|
state: response.state,
|
|
21146
21822
|
fromPlatformBroker: true,
|
|
@@ -21154,11 +21830,13 @@
|
|
|
21154
21830
|
* cache the account entity in browser storage
|
|
21155
21831
|
* @param accountEntity
|
|
21156
21832
|
*/
|
|
21157
|
-
async cacheAccount(accountEntity, kmsi) {
|
|
21833
|
+
async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
|
|
21158
21834
|
// Store the account info and hence `nativeAccountId` in browser cache
|
|
21159
21835
|
await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
|
|
21160
21836
|
// Remove any existing cached tokens for this account in browser storage
|
|
21161
|
-
|
|
21837
|
+
if (clearExistingTokens) {
|
|
21838
|
+
this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
|
|
21839
|
+
}
|
|
21162
21840
|
}
|
|
21163
21841
|
/**
|
|
21164
21842
|
* Stores the access_token and id_token in inmemory storage
|
|
@@ -21170,8 +21848,18 @@
|
|
|
21170
21848
|
* @param tenantId
|
|
21171
21849
|
* @param reqTimestamp
|
|
21172
21850
|
*/
|
|
21173
|
-
async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
|
|
21851
|
+
async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
|
|
21174
21852
|
const cachedIdToken = createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
|
|
21853
|
+
// save idtoken credential in configured browser storage
|
|
21854
|
+
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
21855
|
+
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
21856
|
+
}
|
|
21857
|
+
if (dpopBrokerOutcome === "L3") {
|
|
21858
|
+
return;
|
|
21859
|
+
}
|
|
21860
|
+
if (storeInCache?.accessToken === false) {
|
|
21861
|
+
return;
|
|
21862
|
+
}
|
|
21175
21863
|
// cache accessToken in inmemory storage
|
|
21176
21864
|
const expiresIn = request.tokenType === AuthenticationScheme.POP
|
|
21177
21865
|
? SHR_NONCE_VALIDITY
|
|
@@ -21181,18 +21869,14 @@
|
|
|
21181
21869
|
const tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
21182
21870
|
const responseScopes = this.generateScopes(response.scope, request.scope);
|
|
21183
21871
|
const additionalCacheKeyComponents = request.attributeTokens
|
|
21184
|
-
? {
|
|
21185
|
-
attribute_tokens: request.attributeTokens,
|
|
21186
|
-
}
|
|
21872
|
+
? { attribute_tokens: request.attributeTokens }
|
|
21187
21873
|
: undefined;
|
|
21188
|
-
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined,
|
|
21874
|
+
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
|
|
21875
|
+
? AuthenticationScheme.DPOP
|
|
21876
|
+
: request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
|
|
21189
21877
|
if (request.extraParameters?.resource) {
|
|
21190
21878
|
cachedAccessToken.resource = request.extraParameters.resource;
|
|
21191
21879
|
}
|
|
21192
|
-
// save idtoken credential in configured browser storage
|
|
21193
|
-
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
21194
|
-
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
21195
|
-
}
|
|
21196
21880
|
// save access token credential in memory storage
|
|
21197
21881
|
const nativeCacheRecord = {
|
|
21198
21882
|
accessToken: cachedAccessToken,
|
|
@@ -21269,11 +21953,7 @@
|
|
|
21269
21953
|
const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
|
|
21270
21954
|
? undefined
|
|
21271
21955
|
: this.config.auth.clientCapabilities;
|
|
21272
|
-
|
|
21273
|
-
* 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.
|
|
21274
|
-
* attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
|
|
21275
|
-
*/
|
|
21276
|
-
const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
|
|
21956
|
+
const { scopes, claims, dpopNonce } = request;
|
|
21277
21957
|
const scopeSet = new ScopeSet([...(scopes || []), ...OIDC_DEFAULT_SCOPES], this.correlationId);
|
|
21278
21958
|
const mergedClaims = buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
|
|
21279
21959
|
const hasAttributeTokens = !!request.attributeTokens?.length;
|
|
@@ -21297,57 +21977,391 @@
|
|
|
21297
21977
|
loginHint: request.loginHint,
|
|
21298
21978
|
extraParameters: {
|
|
21299
21979
|
...request.extraParameters,
|
|
21300
|
-
|
|
21980
|
+
// Native broker resource is set for MCP scenarios.
|
|
21981
|
+
...(request.resource && { resource: request.resource }),
|
|
21301
21982
|
},
|
|
21302
21983
|
extendedExpiryToken: false,
|
|
21303
21984
|
keyId: request.popKid,
|
|
21304
|
-
resourceRequestMethod: request.resourceRequestMethod,
|
|
21305
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
21306
|
-
shrClaims: request.shrClaims,
|
|
21307
|
-
shrNonce: request.shrNonce,
|
|
21308
|
-
extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
|
|
21309
21985
|
};
|
|
21310
21986
|
if (hasAttributeTokens) {
|
|
21311
21987
|
validatedRequest.attributeTokens =
|
|
21312
21988
|
serializeAttributeTokens(request.attributeTokens);
|
|
21313
21989
|
}
|
|
21314
|
-
// Check for PoP token requests: signPopToken should only be set to true if popKid is not set
|
|
21315
|
-
if (validatedRequest.signPopToken && !!request.popKid) {
|
|
21316
|
-
throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
|
|
21317
|
-
}
|
|
21318
21990
|
this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
|
|
21319
21991
|
validatedRequest.extraParameters =
|
|
21320
21992
|
validatedRequest.extraParameters || {};
|
|
21321
21993
|
validatedRequest.extraParameters.telemetry =
|
|
21322
21994
|
PlatformAuthConstants.MATS_TELEMETRY;
|
|
21323
21995
|
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
|
21324
|
-
// add POP request type
|
|
21325
21996
|
const shrParameters = {
|
|
21326
|
-
resourceRequestUri: request.resourceRequestUri,
|
|
21327
21997
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
21998
|
+
resourceRequestUri: request.resourceRequestUri,
|
|
21328
21999
|
shrClaims: request.shrClaims,
|
|
21329
22000
|
shrNonce: request.shrNonce,
|
|
21330
22001
|
correlationId: this.correlationId,
|
|
21331
22002
|
};
|
|
21332
22003
|
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
|
|
21333
|
-
// generate reqCnf if not provided in the request
|
|
21334
|
-
let reqCnfData;
|
|
21335
22004
|
if (!validatedRequest.keyId) {
|
|
21336
22005
|
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
|
|
21337
|
-
|
|
22006
|
+
validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
|
|
21338
22007
|
validatedRequest.keyId = generatedReqCnfData.kid;
|
|
21339
22008
|
validatedRequest.signPopToken = true;
|
|
21340
22009
|
}
|
|
21341
22010
|
else {
|
|
21342
|
-
|
|
22011
|
+
validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
|
|
21343
22012
|
validatedRequest.signPopToken = false;
|
|
21344
22013
|
}
|
|
21345
|
-
|
|
21346
|
-
|
|
22014
|
+
validatedRequest.resourceRequestMethod =
|
|
22015
|
+
request.resourceRequestMethod;
|
|
22016
|
+
validatedRequest.resourceRequestUri = request.resourceRequestUri;
|
|
22017
|
+
validatedRequest.shrClaims = request.shrClaims;
|
|
22018
|
+
validatedRequest.shrNonce = request.shrNonce;
|
|
22019
|
+
}
|
|
22020
|
+
else if (request.authenticationScheme === AuthenticationScheme.DPOP) {
|
|
22021
|
+
Object.assign(validatedRequest, this.createDpopRequestParameters(request));
|
|
21347
22022
|
}
|
|
22023
|
+
validatedRequest.extraParametersNoCache =
|
|
22024
|
+
createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
|
|
21348
22025
|
this.addRequestSKUs(validatedRequest);
|
|
21349
22026
|
return validatedRequest;
|
|
21350
22027
|
}
|
|
22028
|
+
/**
|
|
22029
|
+
* Creates and validates the broker-specific parameters for a DPoP request.
|
|
22030
|
+
* @param request - Developer-provided token request.
|
|
22031
|
+
* @returns Broker parameters for a DPoP token and resource proof.
|
|
22032
|
+
*/
|
|
22033
|
+
createDpopRequestParameters(request) {
|
|
22034
|
+
if (request.popKid) {
|
|
22035
|
+
throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
|
|
22036
|
+
}
|
|
22037
|
+
if (!request.resourceRequestMethod?.trim() ||
|
|
22038
|
+
!request.resourceRequestUri?.trim()) {
|
|
22039
|
+
throw createClientConfigurationError(dpopMissingResourceContext, this.correlationId);
|
|
22040
|
+
}
|
|
22041
|
+
const resourceContext = normalizeDpopResourceRequestContext({
|
|
22042
|
+
htm: request.resourceRequestMethod,
|
|
22043
|
+
htu: request.resourceRequestUri,
|
|
22044
|
+
}, this.correlationId);
|
|
22045
|
+
return {
|
|
22046
|
+
tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
|
|
22047
|
+
preferBinding: PlatformAuthBindingPreference.ATTESTED,
|
|
22048
|
+
keyId: request.dpopJkt,
|
|
22049
|
+
resourceRequestMethod: resourceContext.htm,
|
|
22050
|
+
resourceRequestUri: resourceContext.htu,
|
|
22051
|
+
};
|
|
22052
|
+
}
|
|
22053
|
+
/**
|
|
22054
|
+
* Provisions the local key and confirmation data for a DPoP broker request.
|
|
22055
|
+
* @param request - Broker request to prepare.
|
|
22056
|
+
* @param reuseExistingKey - Whether a complete existing key binding may be reused.
|
|
22057
|
+
*/
|
|
22058
|
+
async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
|
|
22059
|
+
if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
|
|
22060
|
+
return;
|
|
22061
|
+
}
|
|
22062
|
+
/*
|
|
22063
|
+
* Phase one clears both fields after an L3 response or non-fatal broker
|
|
22064
|
+
* error. In that case phase two must provision a replacement. If either
|
|
22065
|
+
* field remains, treat it as a retained binding and validate it fully.
|
|
22066
|
+
*/
|
|
22067
|
+
if (reuseExistingKey && (request.keyId || request.reqCnf)) {
|
|
22068
|
+
if (!request.keyId || !request.reqCnf) {
|
|
22069
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
|
|
22070
|
+
}
|
|
22071
|
+
const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
|
|
22072
|
+
if (request.reqCnf !== expectedReqCnf) {
|
|
22073
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
|
|
22074
|
+
}
|
|
22075
|
+
const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
|
|
22076
|
+
? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
|
|
22077
|
+
: await this.tokenBindingKeyManager
|
|
22078
|
+
.getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
|
|
22079
|
+
.then(() => true, () => false);
|
|
22080
|
+
if (!hasKey) {
|
|
22081
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
|
|
22082
|
+
}
|
|
22083
|
+
return;
|
|
22084
|
+
}
|
|
22085
|
+
if (request.reqCnf) {
|
|
22086
|
+
throw createAuthError(unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
|
|
22087
|
+
}
|
|
22088
|
+
if (!request.keyId) {
|
|
22089
|
+
request.keyId =
|
|
22090
|
+
await this.tokenBindingKeyManager.provisionTokenBindingKey({
|
|
22091
|
+
tokenBindingKeyType: AuthenticationScheme.DPOP.toLowerCase(),
|
|
22092
|
+
tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
|
|
22093
|
+
correlationId: this.correlationId,
|
|
22094
|
+
});
|
|
22095
|
+
}
|
|
22096
|
+
request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
|
|
22097
|
+
}
|
|
22098
|
+
/**
|
|
22099
|
+
* Creates the confirmation claim for an MSAL-owned broker DPoP key.
|
|
22100
|
+
* @param keyId - Browser-managed DPoP key identifier.
|
|
22101
|
+
* @returns Encoded broker confirmation claim.
|
|
22102
|
+
*/
|
|
22103
|
+
createDpopBrokerReqCnf(keyId) {
|
|
22104
|
+
return this.browserCrypto.base64UrlEncode(JSON.stringify({
|
|
22105
|
+
kid: keyId,
|
|
22106
|
+
xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
|
|
22107
|
+
}));
|
|
22108
|
+
}
|
|
22109
|
+
/**
|
|
22110
|
+
* Ensures an owned DPoP key can survive redirect navigation before the
|
|
22111
|
+
* request metadata is persisted for phase two.
|
|
22112
|
+
*/
|
|
22113
|
+
async ensureRedirectDpopKeyIsPersisted(request) {
|
|
22114
|
+
if (!this.isDpopBrokerRequest(request) || !request.keyId) {
|
|
22115
|
+
return;
|
|
22116
|
+
}
|
|
22117
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
|
|
22118
|
+
throw createAuthError(unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
|
|
22119
|
+
}
|
|
22120
|
+
}
|
|
22121
|
+
/**
|
|
22122
|
+
* Validates and normalizes the DPoP binding outcome returned by the broker.
|
|
22123
|
+
* @param response - Broker response to validate.
|
|
22124
|
+
* @param request - Broker request associated with the response.
|
|
22125
|
+
* @returns The validated DPoP binding level, or `none` for non-DPoP requests.
|
|
22126
|
+
*/
|
|
22127
|
+
validateDpopBrokerOutcome(response, request) {
|
|
22128
|
+
const isDpopRequest = this.isDpopBrokerRequest(request);
|
|
22129
|
+
const normalizedResponse = this.normalizeDpopBrokerResponse(response);
|
|
22130
|
+
const normalizedRequestTokenType = request.tokenType
|
|
22131
|
+
?.trim()
|
|
22132
|
+
.toLowerCase();
|
|
22133
|
+
const bindingPreferenceSent = request.bindingPreferenceSent ??
|
|
22134
|
+
request.preferBinding !== undefined;
|
|
22135
|
+
const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
|
|
22136
|
+
normalizedResponse.proof !== undefined ||
|
|
22137
|
+
normalizedResponse.hasBindingAttested;
|
|
22138
|
+
if (!isDpopRequest) {
|
|
22139
|
+
if (hasDpopResponse) {
|
|
22140
|
+
this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
|
|
22141
|
+
}
|
|
22142
|
+
return "none";
|
|
22143
|
+
}
|
|
22144
|
+
if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
|
|
22145
|
+
this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
|
|
22146
|
+
}
|
|
22147
|
+
this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
|
|
22148
|
+
if (normalizedResponse.tokenType ===
|
|
22149
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
|
|
22150
|
+
return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
|
|
22151
|
+
}
|
|
22152
|
+
return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
|
|
22153
|
+
}
|
|
22154
|
+
/**
|
|
22155
|
+
* Normalizes the canonical DPoP fields returned under response properties.
|
|
22156
|
+
*/
|
|
22157
|
+
normalizeDpopBrokerResponse(response) {
|
|
22158
|
+
const responseProperties = response.properties;
|
|
22159
|
+
const rawTokenType = responseProperties?.token_type;
|
|
22160
|
+
const tokenType = typeof rawTokenType === "string"
|
|
22161
|
+
? rawTokenType.trim().toLowerCase()
|
|
22162
|
+
: undefined;
|
|
22163
|
+
const rawBindingAttested = responseProperties?.binding_attested;
|
|
22164
|
+
let bindingAttested;
|
|
22165
|
+
if (typeof rawBindingAttested === "string") {
|
|
22166
|
+
const normalizedBindingAttested = rawBindingAttested
|
|
22167
|
+
.trim()
|
|
22168
|
+
.toLowerCase();
|
|
22169
|
+
if (normalizedBindingAttested === "true") {
|
|
22170
|
+
bindingAttested = true;
|
|
22171
|
+
}
|
|
22172
|
+
else if (normalizedBindingAttested === "false") {
|
|
22173
|
+
bindingAttested = false;
|
|
22174
|
+
}
|
|
22175
|
+
}
|
|
22176
|
+
return {
|
|
22177
|
+
tokenType,
|
|
22178
|
+
proof: responseProperties?.DPoP,
|
|
22179
|
+
bindingAttested,
|
|
22180
|
+
hasBindingAttested: rawBindingAttested !== undefined,
|
|
22181
|
+
hasMalformedBindingAttested: rawBindingAttested !== undefined &&
|
|
22182
|
+
bindingAttested === undefined,
|
|
22183
|
+
};
|
|
22184
|
+
}
|
|
22185
|
+
/**
|
|
22186
|
+
* Validates normalized fields shared by L1 and L3 broker DPoP responses.
|
|
22187
|
+
*/
|
|
22188
|
+
validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
|
|
22189
|
+
if (normalizedResponse.hasMalformedBindingAttested) {
|
|
22190
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
|
|
22191
|
+
}
|
|
22192
|
+
if (bindingPreferenceSent &&
|
|
22193
|
+
normalizedResponse.bindingAttested === undefined) {
|
|
22194
|
+
this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
|
|
22195
|
+
}
|
|
22196
|
+
}
|
|
22197
|
+
/**
|
|
22198
|
+
* Validates a broker-returned L3 DPoP proof outcome.
|
|
22199
|
+
*/
|
|
22200
|
+
validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
|
|
22201
|
+
const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
|
|
22202
|
+
if (typeof normalizedResponse.proof !== "string" ||
|
|
22203
|
+
normalizedResponse.proof.trim().length === 0) {
|
|
22204
|
+
this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
|
|
22205
|
+
}
|
|
22206
|
+
if (normalizedResponse.bindingAttested !== true) {
|
|
22207
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
|
|
22208
|
+
}
|
|
22209
|
+
if (normalizedRequestTokenType !== dpopWithProofTokenType ||
|
|
22210
|
+
normalizedResponse.tokenType !== dpopWithProofTokenType) {
|
|
22211
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
|
|
22212
|
+
}
|
|
22213
|
+
this.performanceClient.addFields({
|
|
22214
|
+
"ext.brokerDpopOutcome": "l3",
|
|
22215
|
+
"ext.brokerDpopBindingLevel": "L3",
|
|
22216
|
+
}, this.correlationId);
|
|
22217
|
+
return "L3";
|
|
22218
|
+
}
|
|
22219
|
+
/**
|
|
22220
|
+
* Validates an L1 DPoP outcome that MSAL will sign with its local key.
|
|
22221
|
+
*/
|
|
22222
|
+
validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
|
|
22223
|
+
if (normalizedResponse.proof !== undefined) {
|
|
22224
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
|
|
22225
|
+
}
|
|
22226
|
+
if (normalizedRequestTokenType !==
|
|
22227
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
|
|
22228
|
+
this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
|
|
22229
|
+
}
|
|
22230
|
+
if (normalizedResponse.bindingAttested !== false &&
|
|
22231
|
+
!(!bindingPreferenceSent &&
|
|
22232
|
+
normalizedResponse.bindingAttested === undefined)) {
|
|
22233
|
+
this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
|
|
22234
|
+
}
|
|
22235
|
+
if (!request.reqCnf || !request.keyId) {
|
|
22236
|
+
this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
|
|
22237
|
+
}
|
|
22238
|
+
this.performanceClient.addFields({
|
|
22239
|
+
"ext.brokerDpopOutcome": "l1",
|
|
22240
|
+
"ext.brokerDpopBindingLevel": "L1",
|
|
22241
|
+
}, this.correlationId);
|
|
22242
|
+
return "L1";
|
|
22243
|
+
}
|
|
22244
|
+
/**
|
|
22245
|
+
* Emits bounded failure telemetry and rejects an invalid DPoP response.
|
|
22246
|
+
*/
|
|
22247
|
+
throwInvalidDpopResponse(failureReason, message) {
|
|
22248
|
+
this.performanceClient.addFields({
|
|
22249
|
+
"ext.brokerDpopOutcome": "invalid_response",
|
|
22250
|
+
"ext.brokerDpopFailureReason": failureReason,
|
|
22251
|
+
}, this.correlationId);
|
|
22252
|
+
throw createAuthError(unexpectedError, this.correlationId, message);
|
|
22253
|
+
}
|
|
22254
|
+
/**
|
|
22255
|
+
* Returns the broker proof or signs an L1 resource proof with the local key.
|
|
22256
|
+
* @param response - Broker response containing the access token and optional proof.
|
|
22257
|
+
* @param request - Broker request containing the proof context and local key.
|
|
22258
|
+
* @returns The resource proof for the broker access token.
|
|
22259
|
+
*/
|
|
22260
|
+
async generateDpopProof(response, request) {
|
|
22261
|
+
const brokerProof = response.properties?.DPoP;
|
|
22262
|
+
if (brokerProof !== undefined) {
|
|
22263
|
+
return brokerProof;
|
|
22264
|
+
}
|
|
22265
|
+
const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
|
|
22266
|
+
return dpopProofGenerator.generateResourceProof({
|
|
22267
|
+
htu: request.resourceRequestUri,
|
|
22268
|
+
htm: request.resourceRequestMethod,
|
|
22269
|
+
accessToken: response.access_token,
|
|
22270
|
+
nonce: request.extraParametersNoCache?.pop_nonce,
|
|
22271
|
+
}, request.keyId, this.correlationId);
|
|
22272
|
+
}
|
|
22273
|
+
/**
|
|
22274
|
+
* Removes a generated DPoP request key and clears its request metadata.
|
|
22275
|
+
* @param request - Broker request whose generated key should be removed.
|
|
22276
|
+
*/
|
|
22277
|
+
async resetGeneratedDpopRequestKey(request) {
|
|
22278
|
+
if (!this.isDpopBrokerRequest(request) || !request.keyId) {
|
|
22279
|
+
return;
|
|
22280
|
+
}
|
|
22281
|
+
const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
|
|
22282
|
+
this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
|
|
22283
|
+
try {
|
|
22284
|
+
if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
|
|
22285
|
+
throw createAuthError(unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
|
|
22286
|
+
}
|
|
22287
|
+
this.performanceClient.addFields({
|
|
22288
|
+
"ext.brokerDpopKeyCleanupOutcome": "succeeded",
|
|
22289
|
+
}, this.correlationId);
|
|
22290
|
+
cleanupMeasurement.end({ success: true });
|
|
22291
|
+
request.keyId = undefined;
|
|
22292
|
+
request.reqCnf = undefined;
|
|
22293
|
+
}
|
|
22294
|
+
catch (error) {
|
|
22295
|
+
this.performanceClient.addFields({
|
|
22296
|
+
"ext.brokerDpopKeyCleanupOutcome": "failed",
|
|
22297
|
+
}, this.correlationId);
|
|
22298
|
+
this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
|
|
22299
|
+
cleanupMeasurement.end({ success: false }, error);
|
|
22300
|
+
throw error;
|
|
22301
|
+
}
|
|
22302
|
+
}
|
|
22303
|
+
/**
|
|
22304
|
+
* Attempts to remove a generated DPoP request key without replacing an
|
|
22305
|
+
* existing operation error with a cleanup failure.
|
|
22306
|
+
* @param request - Broker request whose generated key should be removed.
|
|
22307
|
+
*/
|
|
22308
|
+
async resetGeneratedDpopRequestKeyBestEffort(request) {
|
|
22309
|
+
try {
|
|
22310
|
+
await this.resetGeneratedDpopRequestKey(request);
|
|
22311
|
+
}
|
|
22312
|
+
catch {
|
|
22313
|
+
this.logger.error("Failed to remove generated DPoP request key after an operation error.", this.correlationId);
|
|
22314
|
+
this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
|
|
22315
|
+
request.keyId = undefined;
|
|
22316
|
+
request.reqCnf = undefined;
|
|
22317
|
+
}
|
|
22318
|
+
}
|
|
22319
|
+
/**
|
|
22320
|
+
* Records that a DPoP request is about to be dispatched to the platform broker.
|
|
22321
|
+
* @param request - Broker request about to cross the provider boundary.
|
|
22322
|
+
*/
|
|
22323
|
+
addDpopBrokerAttemptTelemetry(request) {
|
|
22324
|
+
if (!this.isDpopBrokerRequest(request)) {
|
|
22325
|
+
return;
|
|
22326
|
+
}
|
|
22327
|
+
this.performanceClient.addFields({
|
|
22328
|
+
"ext.brokerDpopAttempted": 1,
|
|
22329
|
+
}, this.correlationId);
|
|
22330
|
+
}
|
|
22331
|
+
/**
|
|
22332
|
+
* Determines whether a request uses the DPoP broker protocol.
|
|
22333
|
+
* @param request - Broker request to inspect.
|
|
22334
|
+
* @returns Whether the request uses a DPoP token type.
|
|
22335
|
+
*/
|
|
22336
|
+
isDpopBrokerRequest(request) {
|
|
22337
|
+
return this.isDpopBrokerTokenType(request.tokenType);
|
|
22338
|
+
}
|
|
22339
|
+
/**
|
|
22340
|
+
* Determines whether a token type represents a DPoP broker request.
|
|
22341
|
+
* @param tokenType - Token type to inspect.
|
|
22342
|
+
* @returns Whether the token type is a supported DPoP broker token type.
|
|
22343
|
+
*/
|
|
22344
|
+
isDpopBrokerTokenType(tokenType) {
|
|
22345
|
+
const normalizedTokenType = tokenType?.trim().toLowerCase();
|
|
22346
|
+
return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
|
|
22347
|
+
normalizedTokenType ===
|
|
22348
|
+
AuthenticationScheme.DPOP.toLowerCase());
|
|
22349
|
+
}
|
|
22350
|
+
/**
|
|
22351
|
+
* Removes a DPoP key while reporting cleanup failures.
|
|
22352
|
+
* @param keyId - Identifier of the DPoP key to remove.
|
|
22353
|
+
* @returns Whether the key was removed successfully.
|
|
22354
|
+
*/
|
|
22355
|
+
async removeDpopKey(keyId) {
|
|
22356
|
+
try {
|
|
22357
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
|
|
22358
|
+
return true;
|
|
22359
|
+
}
|
|
22360
|
+
catch {
|
|
22361
|
+
this.logger.error("Failed to remove unused DPoP key", this.correlationId);
|
|
22362
|
+
return false;
|
|
22363
|
+
}
|
|
22364
|
+
}
|
|
21351
22365
|
async getCanonicalAuthority(request) {
|
|
21352
22366
|
const requestAuthority = request.authority || this.config.auth.authority;
|
|
21353
22367
|
const { azureCloudOptions, account } = request;
|
|
@@ -21386,29 +22400,28 @@
|
|
|
21386
22400
|
}
|
|
21387
22401
|
}
|
|
21388
22402
|
/**
|
|
21389
|
-
* Handles extra broker request parameters
|
|
21390
|
-
* @param request
|
|
21391
|
-
* @
|
|
22403
|
+
* Handles extra broker request parameters.
|
|
22404
|
+
* @param request - Platform broker request.
|
|
22405
|
+
* @param embeddedClientId - Embedded application client identifier.
|
|
21392
22406
|
*/
|
|
21393
22407
|
handleExtraBrokerParams(request, embeddedClientId) {
|
|
21394
|
-
const
|
|
21395
|
-
|
|
21396
|
-
|
|
21397
|
-
|
|
22408
|
+
const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
|
|
22409
|
+
const hasExtraBrokerParams = hasOwnParameter(BROKER_CLIENT_ID) &&
|
|
22410
|
+
hasOwnParameter(BROKER_REDIRECT_URI) &&
|
|
22411
|
+
hasOwnParameter(CLIENT_ID);
|
|
21398
22412
|
if (!embeddedClientId && !hasExtraBrokerParams) {
|
|
21399
22413
|
return;
|
|
21400
22414
|
}
|
|
21401
|
-
|
|
21402
|
-
const
|
|
22415
|
+
const childRedirectUri = request.redirectUri;
|
|
22416
|
+
const childClientId = embeddedClientId ||
|
|
22417
|
+
request.extraParameters?.[CLIENT_ID] ||
|
|
22418
|
+
"";
|
|
21403
22419
|
if (embeddedClientId) {
|
|
21404
22420
|
request.redirectUri = this.config.auth.redirectUri;
|
|
21405
|
-
child_client_id = embeddedClientId;
|
|
21406
22421
|
}
|
|
21407
22422
|
else if (request.extraParameters) {
|
|
21408
22423
|
request.redirectUri =
|
|
21409
22424
|
request.extraParameters[BROKER_REDIRECT_URI];
|
|
21410
|
-
child_client_id =
|
|
21411
|
-
request.extraParameters[CLIENT_ID];
|
|
21412
22425
|
}
|
|
21413
22426
|
const {
|
|
21414
22427
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
@@ -21419,15 +22432,20 @@
|
|
|
21419
22432
|
[CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
|
|
21420
22433
|
request.extraParameters = {
|
|
21421
22434
|
...remainingExtraParameters,
|
|
21422
|
-
child_client_id,
|
|
21423
|
-
child_redirect_uri,
|
|
22435
|
+
child_client_id: childClientId,
|
|
22436
|
+
child_redirect_uri: childRedirectUri,
|
|
21424
22437
|
};
|
|
21425
22438
|
this.performanceClient?.addFields({
|
|
21426
|
-
embeddedClientId:
|
|
21427
|
-
embeddedRedirectUri:
|
|
22439
|
+
embeddedClientId: childClientId,
|
|
22440
|
+
embeddedRedirectUri: childRedirectUri,
|
|
21428
22441
|
}, this.correlationId);
|
|
21429
22442
|
}
|
|
21430
|
-
}
|
|
22443
|
+
}
|
|
22444
|
+
/**
|
|
22445
|
+
* Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
|
|
22446
|
+
* This does not constrain the binding selected by the platform broker.
|
|
22447
|
+
*/
|
|
22448
|
+
PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
|
|
21431
22449
|
|
|
21432
22450
|
/*
|
|
21433
22451
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -21533,6 +22551,7 @@
|
|
|
21533
22551
|
}
|
|
21534
22552
|
}
|
|
21535
22553
|
if (request.authenticationScheme === AuthenticationScheme.DPOP &&
|
|
22554
|
+
!request.platformBroker &&
|
|
21536
22555
|
request.dpopJkt) {
|
|
21537
22556
|
parameters.set(DPOP_JKT, request.dpopJkt);
|
|
21538
22557
|
}
|
|
@@ -21656,19 +22675,25 @@
|
|
|
21656
22675
|
* @param nativeMessageHandler
|
|
21657
22676
|
* @returns
|
|
21658
22677
|
*/
|
|
21659
|
-
async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
22678
|
+
async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
21660
22679
|
logger.verbose("Account id found, calling WAM for token", request.correlationId);
|
|
21661
22680
|
if (!platformAuthProvider) {
|
|
21662
22681
|
throw createBrowserAuthError(nativeConnectionNotEstablished, request.correlationId);
|
|
21663
22682
|
}
|
|
21664
22683
|
const browserCrypto = new CryptoOps(logger, performanceClient);
|
|
21665
|
-
const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId);
|
|
22684
|
+
const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
|
|
21666
22685
|
const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
|
|
21667
|
-
|
|
21668
|
-
|
|
21669
|
-
|
|
21670
|
-
|
|
21671
|
-
|
|
22686
|
+
try {
|
|
22687
|
+
return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
|
|
22688
|
+
...request,
|
|
22689
|
+
state: userRequestState,
|
|
22690
|
+
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
22691
|
+
});
|
|
22692
|
+
}
|
|
22693
|
+
catch (e) {
|
|
22694
|
+
await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
|
|
22695
|
+
throw e;
|
|
22696
|
+
}
|
|
21672
22697
|
}
|
|
21673
22698
|
/**
|
|
21674
22699
|
* Response handler when server returns code on the /authorize request
|
|
@@ -21681,13 +22706,13 @@
|
|
|
21681
22706
|
* @param performanceClient
|
|
21682
22707
|
* @returns
|
|
21683
22708
|
*/
|
|
21684
|
-
async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
22709
|
+
async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
21685
22710
|
// Remove throttle if it exists
|
|
21686
22711
|
ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
|
|
21687
22712
|
// Instrument clientdata telemetry fields from the authorize response
|
|
21688
22713
|
instrumentClientData(response, request.correlationId, performanceClient);
|
|
21689
22714
|
if (response.accountId) {
|
|
21690
|
-
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
|
|
22715
|
+
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
|
|
21691
22716
|
}
|
|
21692
22717
|
const authCodeRequest = {
|
|
21693
22718
|
...request,
|
|
@@ -21715,7 +22740,7 @@
|
|
|
21715
22740
|
* @param nativeMessageHandler
|
|
21716
22741
|
* @returns
|
|
21717
22742
|
*/
|
|
21718
|
-
async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
|
|
22743
|
+
async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
|
|
21719
22744
|
// Remove throttle if it exists
|
|
21720
22745
|
ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
|
|
21721
22746
|
// Instrument clientdata telemetry fields from the authorize response
|
|
@@ -21730,9 +22755,9 @@
|
|
|
21730
22755
|
}
|
|
21731
22756
|
const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
|
|
21732
22757
|
if (decryptedData.accountId) {
|
|
21733
|
-
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
|
|
22758
|
+
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
|
|
21734
22759
|
}
|
|
21735
|
-
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null,
|
|
22760
|
+
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, tokenBindingKeyManager);
|
|
21736
22761
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
21737
22762
|
responseHandler.validateTokenResponse(decryptedData, request.correlationId);
|
|
21738
22763
|
// Temporary until response handler is refactored to be more flow agnostic.
|
|
@@ -22179,6 +23204,7 @@
|
|
|
22179
23204
|
const extensionRequest = { ...request };
|
|
22180
23205
|
delete extensionRequest.resourceRequestMethod;
|
|
22181
23206
|
delete extensionRequest.resourceRequestUri;
|
|
23207
|
+
delete extensionRequest.bindingPreferenceSent;
|
|
22182
23208
|
const messageBody = {
|
|
22183
23209
|
method: NativeExtensionMethod.GetToken,
|
|
22184
23210
|
request: extensionRequest,
|
|
@@ -22190,8 +23216,9 @@
|
|
|
22190
23216
|
body: messageBody,
|
|
22191
23217
|
};
|
|
22192
23218
|
this.logger.trace(`'${this.platformAuthType}' - Sending request to browser extension`, correlationId);
|
|
22193
|
-
this.logger.tracePii(`'${this.platformAuthType}' - Sending request to browser extension: '${JSON.stringify(req)}'`, correlationId);
|
|
22194
23219
|
this.messageChannel.port1.postMessage(req);
|
|
23220
|
+
request.bindingPreferenceSent =
|
|
23221
|
+
extensionRequest.preferBinding !== undefined;
|
|
22195
23222
|
const response = await new Promise((resolve, reject) => {
|
|
22196
23223
|
this.resolvers.set(req.responseId, {
|
|
22197
23224
|
resolve,
|
|
@@ -22388,13 +23415,11 @@
|
|
|
22388
23415
|
try {
|
|
22389
23416
|
const response = request.body.response;
|
|
22390
23417
|
this.logger.trace(`'${this.platformAuthType}' - Received response from browser extension`, correlationId);
|
|
22391
|
-
this.logger.tracePii(`'${this.platformAuthType}' - Received response from browser extension: '${JSON.stringify(response)}'`, correlationId);
|
|
22392
23418
|
if (response.status !== "Success") {
|
|
22393
23419
|
resolver.reject(createNativeAuthError(response.code, correlationId, response.description, response.ext));
|
|
22394
23420
|
}
|
|
22395
23421
|
else if (response.result) {
|
|
22396
|
-
if (response.result["code"]
|
|
22397
|
-
response.result["description"]) {
|
|
23422
|
+
if (response.result["code"]) {
|
|
22398
23423
|
resolver.reject(createNativeAuthError(response.result["code"], correlationId, response.result["description"], response.result["ext"]));
|
|
22399
23424
|
}
|
|
22400
23425
|
else {
|
|
@@ -22475,11 +23500,12 @@
|
|
|
22475
23500
|
Object.prototype.hasOwnProperty.call(response, "account") &&
|
|
22476
23501
|
Object.prototype.hasOwnProperty.call(response, "scope") &&
|
|
22477
23502
|
Object.prototype.hasOwnProperty.call(response, "expires_in")) {
|
|
23503
|
+
const validatedResponse = response;
|
|
22478
23504
|
validationMeasurement.end({
|
|
22479
23505
|
success: true,
|
|
22480
23506
|
platformAuthProviderType: this.platformAuthType,
|
|
22481
23507
|
});
|
|
22482
|
-
return
|
|
23508
|
+
return validatedResponse;
|
|
22483
23509
|
}
|
|
22484
23510
|
else {
|
|
22485
23511
|
const error = createAuthError(unexpectedError, responseCorrelationId, "Response missing expected properties.");
|
|
@@ -22521,6 +23547,7 @@
|
|
|
22521
23547
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
22522
23548
|
* Licensed under the MIT License.
|
|
22523
23549
|
*/
|
|
23550
|
+
const PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED = "platform_auth_dom_dpop_not_supported";
|
|
22524
23551
|
class PlatformAuthDOMHandler {
|
|
22525
23552
|
constructor(logger, performanceClient, correlationId) {
|
|
22526
23553
|
this.logger = logger;
|
|
@@ -22600,6 +23627,10 @@
|
|
|
22600
23627
|
});
|
|
22601
23628
|
this.logger.trace(`'${this.platformAuthType}' - Sending request to browser DOM API`, correlationId);
|
|
22602
23629
|
try {
|
|
23630
|
+
if (request.tokenType?.trim().toLowerCase() ===
|
|
23631
|
+
PlatformAuthTokenType.DPOP_WITH_PROOF) {
|
|
23632
|
+
throw createBrowserAuthError(PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED, correlationId);
|
|
23633
|
+
}
|
|
22603
23634
|
const platformDOMRequest = invoke(this.initializePlatformDOMRequest.bind(this), PlatformAuthDOMInitializeRequest, this.logger, this.performanceClient, correlationId)(request);
|
|
22604
23635
|
const response =
|
|
22605
23636
|
// @ts-ignore
|
|
@@ -22626,6 +23657,7 @@
|
|
|
22626
23657
|
this.logger.trace(`'${this.platformAuthType}' - initializeNativeDOMRequest called`, requestCorrelationId);
|
|
22627
23658
|
delete remainingProperties.resourceRequestMethod;
|
|
22628
23659
|
delete remainingProperties.resourceRequestUri;
|
|
23660
|
+
delete remainingProperties.bindingPreferenceSent;
|
|
22629
23661
|
const validExtraParameters = this.getDOMExtraParams(remainingProperties, requestCorrelationId);
|
|
22630
23662
|
const platformDOMRequest = {
|
|
22631
23663
|
accountId: accountId,
|
|
@@ -22836,7 +23868,9 @@
|
|
|
22836
23868
|
logger.trace("isPlatformAuthAllowed called", correlationId);
|
|
22837
23869
|
const schemeSupported = !authenticationScheme ||
|
|
22838
23870
|
authenticationScheme === AuthenticationScheme.BEARER ||
|
|
22839
|
-
authenticationScheme === AuthenticationScheme.POP
|
|
23871
|
+
authenticationScheme === AuthenticationScheme.POP ||
|
|
23872
|
+
(authenticationScheme === AuthenticationScheme.DPOP &&
|
|
23873
|
+
!(platformAuthProvider instanceof PlatformAuthDOMHandler));
|
|
22840
23874
|
const fields = {
|
|
22841
23875
|
allowPlatformBroker: config.system.allowPlatformBroker,
|
|
22842
23876
|
...(config.system.allowPlatformBroker && {
|
|
@@ -23033,12 +24067,13 @@
|
|
|
23033
24067
|
// Wait for the redirect bridge response
|
|
23034
24068
|
const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
|
|
23035
24069
|
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
23036
|
-
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);
|
|
24070
|
+
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);
|
|
23037
24071
|
}
|
|
23038
24072
|
}
|
|
23039
24073
|
catch (e) {
|
|
23040
24074
|
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
|
23041
24075
|
popupParams.popup?.close();
|
|
24076
|
+
await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
23042
24077
|
if (e instanceof AuthError) {
|
|
23043
24078
|
e.correlationId = this.correlationId;
|
|
23044
24079
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -23065,23 +24100,29 @@
|
|
|
23065
24100
|
...tokenBindingParams,
|
|
23066
24101
|
popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
|
|
23067
24102
|
};
|
|
23068
|
-
|
|
23069
|
-
|
|
23070
|
-
|
|
23071
|
-
|
|
23072
|
-
|
|
23073
|
-
|
|
23074
|
-
|
|
23075
|
-
|
|
23076
|
-
|
|
23077
|
-
|
|
23078
|
-
|
|
23079
|
-
|
|
23080
|
-
|
|
23081
|
-
|
|
24103
|
+
try {
|
|
24104
|
+
const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
|
|
24105
|
+
// Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
24106
|
+
const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
|
|
24107
|
+
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
24108
|
+
if (!serverParams.ear_jwe && serverParams.code) {
|
|
24109
|
+
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
|
|
24110
|
+
serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
|
|
24111
|
+
requestAuthority: request.authority,
|
|
24112
|
+
requestAzureCloudOptions: request.azureCloudOptions,
|
|
24113
|
+
requestExtraQueryParameters: request.extraQueryParameters,
|
|
24114
|
+
account: request.account,
|
|
24115
|
+
authority: discoveredAuthority,
|
|
24116
|
+
});
|
|
24117
|
+
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);
|
|
24118
|
+
}
|
|
24119
|
+
else {
|
|
24120
|
+
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);
|
|
24121
|
+
}
|
|
23082
24122
|
}
|
|
23083
|
-
|
|
23084
|
-
|
|
24123
|
+
catch (e) {
|
|
24124
|
+
await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
24125
|
+
throw e;
|
|
23085
24126
|
}
|
|
23086
24127
|
}
|
|
23087
24128
|
async executeCodeFlowWithPost(request, popupParams, authClient, pkceVerifier) {
|
|
@@ -23092,7 +24133,7 @@
|
|
|
23092
24133
|
// Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
23093
24134
|
const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
|
|
23094
24135
|
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
|
|
23095
|
-
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);
|
|
24136
|
+
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);
|
|
23096
24137
|
}
|
|
23097
24138
|
/**
|
|
23098
24139
|
*
|
|
@@ -23480,8 +24521,11 @@
|
|
|
23480
24521
|
codeChallenge: pkceCodes.challenge,
|
|
23481
24522
|
...tokenBindingParams,
|
|
23482
24523
|
};
|
|
23483
|
-
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
23484
24524
|
try {
|
|
24525
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
|
|
24526
|
+
throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
|
|
24527
|
+
}
|
|
24528
|
+
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
23485
24529
|
if (redirectRequest.httpMethod === HttpMethod$1.POST) {
|
|
23486
24530
|
return await this.executeCodeFlowWithPost(redirectRequest);
|
|
23487
24531
|
}
|
|
@@ -23501,6 +24545,7 @@
|
|
|
23501
24545
|
}
|
|
23502
24546
|
}
|
|
23503
24547
|
catch (e) {
|
|
24548
|
+
await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
23504
24549
|
if (e instanceof AuthError) {
|
|
23505
24550
|
e.correlationId = this.correlationId;
|
|
23506
24551
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -23525,14 +24570,23 @@
|
|
|
23525
24570
|
codeChallenge: pkceCodes.challenge,
|
|
23526
24571
|
...tokenBindingParams,
|
|
23527
24572
|
};
|
|
23528
|
-
|
|
23529
|
-
|
|
23530
|
-
|
|
23531
|
-
|
|
23532
|
-
|
|
23533
|
-
|
|
23534
|
-
|
|
23535
|
-
|
|
24573
|
+
try {
|
|
24574
|
+
if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
|
|
24575
|
+
throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
|
|
24576
|
+
}
|
|
24577
|
+
this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
|
|
24578
|
+
const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
|
|
24579
|
+
form.submit();
|
|
24580
|
+
return await new Promise((resolve, reject) => {
|
|
24581
|
+
setTimeout(() => {
|
|
24582
|
+
reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
|
|
24583
|
+
}, this.config.system.redirectNavigationTimeout);
|
|
24584
|
+
});
|
|
24585
|
+
}
|
|
24586
|
+
catch (e) {
|
|
24587
|
+
await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
24588
|
+
throw e;
|
|
24589
|
+
}
|
|
23536
24590
|
}
|
|
23537
24591
|
/**
|
|
23538
24592
|
* Executes classic Authorization Code flow with a POST request.
|
|
@@ -23571,6 +24625,7 @@
|
|
|
23571
24625
|
if (!serverParams) {
|
|
23572
24626
|
// Not a recognized server response hash or hash not associated with a redirect request
|
|
23573
24627
|
this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache.", this.correlationId);
|
|
24628
|
+
await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
23574
24629
|
this.browserStorage.resetRequestCache(this.correlationId);
|
|
23575
24630
|
// Do not instrument "no_server_response" if user clicked back button
|
|
23576
24631
|
if (getNavigationType() !== "back_forward") {
|
|
@@ -23640,6 +24695,7 @@
|
|
|
23640
24695
|
return null;
|
|
23641
24696
|
}
|
|
23642
24697
|
catch (e) {
|
|
24698
|
+
await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
23643
24699
|
if (e instanceof AuthError) {
|
|
23644
24700
|
e.correlationId = this.correlationId;
|
|
23645
24701
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
@@ -23706,10 +24762,10 @@
|
|
|
23706
24762
|
const { authority, azureCloudOptions, extraQueryParameters, account } = request;
|
|
23707
24763
|
if (serverParams.ear_jwe) {
|
|
23708
24764
|
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);
|
|
23709
|
-
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);
|
|
24765
|
+
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);
|
|
23710
24766
|
}
|
|
23711
24767
|
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
|
|
23712
|
-
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);
|
|
24768
|
+
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);
|
|
23713
24769
|
}
|
|
23714
24770
|
/**
|
|
23715
24771
|
* Redirects window to given URL.
|
|
@@ -24040,10 +25096,10 @@
|
|
|
24040
25096
|
account: request.account,
|
|
24041
25097
|
authority: discoveredAuthority,
|
|
24042
25098
|
});
|
|
24043
|
-
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);
|
|
25099
|
+
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);
|
|
24044
25100
|
}
|
|
24045
25101
|
else {
|
|
24046
|
-
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);
|
|
25102
|
+
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);
|
|
24047
25103
|
}
|
|
24048
25104
|
}
|
|
24049
25105
|
/**
|
|
@@ -24093,7 +25149,13 @@
|
|
|
24093
25149
|
*/
|
|
24094
25150
|
async silentTokenHelper(authClient, request) {
|
|
24095
25151
|
const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
|
|
24096
|
-
|
|
25152
|
+
try {
|
|
25153
|
+
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);
|
|
25154
|
+
}
|
|
25155
|
+
catch (e) {
|
|
25156
|
+
await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
25157
|
+
throw e;
|
|
25158
|
+
}
|
|
24097
25159
|
}
|
|
24098
25160
|
/**
|
|
24099
25161
|
* Shared helper that generates PKCE codes, builds the /authorize URL,
|
|
@@ -24110,38 +25172,44 @@
|
|
|
24110
25172
|
codeChallenge: pkceCodes.challenge,
|
|
24111
25173
|
...tokenBindingParams,
|
|
24112
25174
|
};
|
|
24113
|
-
// Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
|
|
24114
|
-
const iframe = createHiddenIframe();
|
|
24115
|
-
const responseType = this.config.auth.OIDCOptions.responseMode;
|
|
24116
|
-
// Wait for response from the redirect bridge.
|
|
24117
|
-
let responseString;
|
|
24118
25175
|
try {
|
|
24119
|
-
|
|
24120
|
-
|
|
24121
|
-
|
|
24122
|
-
|
|
24123
|
-
|
|
24124
|
-
|
|
24125
|
-
|
|
24126
|
-
|
|
24127
|
-
|
|
24128
|
-
|
|
24129
|
-
|
|
24130
|
-
|
|
25176
|
+
// Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
|
|
25177
|
+
const iframe = createHiddenIframe();
|
|
25178
|
+
const responseType = this.config.auth.OIDCOptions.responseMode;
|
|
25179
|
+
// Wait for response from the redirect bridge.
|
|
25180
|
+
let responseString;
|
|
25181
|
+
try {
|
|
25182
|
+
const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
|
|
25183
|
+
responsePromise.catch(() => {
|
|
25184
|
+
/*
|
|
25185
|
+
* If URL creation or navigation below throws before
|
|
25186
|
+
* responsePromise is awaited, the listener still rejects on
|
|
25187
|
+
* timeout. Swallow it here so it does not surface as an
|
|
25188
|
+
* unhandled rejection; the navigation error is propagated
|
|
25189
|
+
* instead.
|
|
25190
|
+
*/
|
|
25191
|
+
});
|
|
25192
|
+
if (request.httpMethod === HttpMethod$1.POST) {
|
|
25193
|
+
await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
25194
|
+
}
|
|
25195
|
+
else {
|
|
25196
|
+
// Create authorize request url
|
|
25197
|
+
const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
25198
|
+
// Navigate the iframe to the authorize request url
|
|
25199
|
+
await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
|
|
25200
|
+
}
|
|
25201
|
+
responseString = await responsePromise;
|
|
24131
25202
|
}
|
|
24132
|
-
|
|
24133
|
-
|
|
24134
|
-
const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
|
|
24135
|
-
// Navigate the iframe to the authorize request url
|
|
24136
|
-
await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
|
|
25203
|
+
finally {
|
|
25204
|
+
invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
|
|
24137
25205
|
}
|
|
24138
|
-
|
|
25206
|
+
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
|
|
25207
|
+
return { serverParams, pkceCodes, silentRequest };
|
|
24139
25208
|
}
|
|
24140
|
-
|
|
24141
|
-
|
|
25209
|
+
catch (e) {
|
|
25210
|
+
await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
|
|
25211
|
+
throw e;
|
|
24142
25212
|
}
|
|
24143
|
-
const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
|
|
24144
|
-
return { serverParams, pkceCodes, silentRequest };
|
|
24145
25213
|
}
|
|
24146
25214
|
async waitForIframeResponse(iframe, request) {
|
|
24147
25215
|
if (this.waitForIframeResponseHook) {
|
|
@@ -24402,7 +25470,6 @@
|
|
|
24402
25470
|
: undefined,
|
|
24403
25471
|
extraParameters: canonicalizeStringDict(request.extraParameters),
|
|
24404
25472
|
extraQueryParameters: canonicalizeStringDict(request.extraQueryParameters),
|
|
24405
|
-
extraParametersNoCache: canonicalizeStringDict(request.extraParametersNoCache),
|
|
24406
25473
|
forceRefresh: !!request.forceRefresh,
|
|
24407
25474
|
cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
|
|
24408
25475
|
});
|
|
@@ -24411,8 +25478,12 @@
|
|
|
24411
25478
|
* Copies caller-owned mutable inputs before asynchronous broker initialization.
|
|
24412
25479
|
*/
|
|
24413
25480
|
function snapshotPlatformSilentRequest(request) {
|
|
24414
|
-
|
|
25481
|
+
const snapshot = {
|
|
24415
25482
|
...request,
|
|
25483
|
+
};
|
|
25484
|
+
delete snapshot.extraParametersNoCache;
|
|
25485
|
+
return {
|
|
25486
|
+
...snapshot,
|
|
24416
25487
|
scopes: [...(request.scopes || [])],
|
|
24417
25488
|
account: { ...request.account },
|
|
24418
25489
|
azureCloudOptions: request.azureCloudOptions
|
|
@@ -24424,9 +25495,6 @@
|
|
|
24424
25495
|
extraQueryParameters: request.extraQueryParameters
|
|
24425
25496
|
? { ...request.extraQueryParameters }
|
|
24426
25497
|
: undefined,
|
|
24427
|
-
extraParametersNoCache: request.extraParametersNoCache
|
|
24428
|
-
? { ...request.extraParametersNoCache }
|
|
24429
|
-
: undefined,
|
|
24430
25498
|
attributeTokens: request.attributeTokens
|
|
24431
25499
|
? [...request.attributeTokens]
|
|
24432
25500
|
: undefined,
|
|
@@ -24791,8 +25859,9 @@
|
|
|
24791
25859
|
let result;
|
|
24792
25860
|
const platformAuthProvider = this.platformAuthProvider;
|
|
24793
25861
|
if (this.canUsePlatformBroker(request) && platformAuthProvider) {
|
|
25862
|
+
const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
|
|
24794
25863
|
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);
|
|
24795
|
-
result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(
|
|
25864
|
+
result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(nativeRequest, atrMeasurement).catch((e) => {
|
|
24796
25865
|
if (e instanceof NativeAuthError &&
|
|
24797
25866
|
isFatalNativeAuthError(e)) {
|
|
24798
25867
|
this.platformAuthProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt platform broker calls
|
|
@@ -25337,6 +26406,13 @@
|
|
|
25337
26406
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
25338
26407
|
redirectPreflightCheck(this.initialized, this.config);
|
|
25339
26408
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
|
|
26409
|
+
try {
|
|
26410
|
+
await this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
26411
|
+
}
|
|
26412
|
+
catch (error) {
|
|
26413
|
+
this.browserStorage.setInteractionInProgress(false);
|
|
26414
|
+
throw error;
|
|
26415
|
+
}
|
|
25340
26416
|
const redirectClient = this.createRedirectClient(correlationId);
|
|
25341
26417
|
return redirectClient.logout(logoutRequest);
|
|
25342
26418
|
}
|
|
@@ -25350,7 +26426,11 @@
|
|
|
25350
26426
|
preflightCheck$1(this.initialized);
|
|
25351
26427
|
this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
|
|
25352
26428
|
const popupClient = this.createPopupClient(correlationId);
|
|
25353
|
-
|
|
26429
|
+
const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
26430
|
+
const popupLogout = popupClient.logout(logoutRequest);
|
|
26431
|
+
return Promise.all([nativeCacheClear, popupLogout])
|
|
26432
|
+
.then(() => undefined)
|
|
26433
|
+
.finally(() => {
|
|
25354
26434
|
this.browserStorage.setInteractionInProgress(false);
|
|
25355
26435
|
});
|
|
25356
26436
|
}
|
|
@@ -25369,7 +26449,30 @@
|
|
|
25369
26449
|
}
|
|
25370
26450
|
const correlationId = this.getRequestCorrelationId(logoutRequest);
|
|
25371
26451
|
const cacheClient = this.createSilentCacheClient(correlationId);
|
|
25372
|
-
|
|
26452
|
+
const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
|
|
26453
|
+
const browserCacheClear = cacheClient.logout(logoutRequest);
|
|
26454
|
+
await Promise.all([nativeCacheClear, browserCacheClear]);
|
|
26455
|
+
}
|
|
26456
|
+
async clearNativeCache(account, correlationId) {
|
|
26457
|
+
const homeAccountId = account?.homeAccountId.toLowerCase();
|
|
26458
|
+
const environment = account?.environment.toLowerCase();
|
|
26459
|
+
const accessTokenKeys = this.nativeInternalStorage
|
|
26460
|
+
.getTokenKeys()
|
|
26461
|
+
.accessToken.filter((key) => {
|
|
26462
|
+
if (!account) {
|
|
26463
|
+
return true;
|
|
26464
|
+
}
|
|
26465
|
+
const accessToken = this.nativeInternalStorage.getAccessTokenCredential(key, correlationId);
|
|
26466
|
+
if (!accessToken) {
|
|
26467
|
+
return false;
|
|
26468
|
+
}
|
|
26469
|
+
return (accessToken.homeAccountId.toLowerCase() === homeAccountId &&
|
|
26470
|
+
accessToken.environment.toLowerCase() === environment);
|
|
26471
|
+
});
|
|
26472
|
+
await Promise.all(accessTokenKeys.map((key) => this.nativeInternalStorage.removeAccessTokenAndTokenBindingKey(key, correlationId)));
|
|
26473
|
+
if (!account) {
|
|
26474
|
+
this.nativeInternalStorage.clear(correlationId);
|
|
26475
|
+
}
|
|
25373
26476
|
}
|
|
25374
26477
|
// #endregion
|
|
25375
26478
|
// #region Account APIs
|
|
@@ -25451,6 +26554,19 @@
|
|
|
25451
26554
|
}
|
|
25452
26555
|
}
|
|
25453
26556
|
// #region Helpers
|
|
26557
|
+
/**
|
|
26558
|
+
* Removes internal DPoP key state from application-originated broker requests.
|
|
26559
|
+
*/
|
|
26560
|
+
sanitizeNativeBrokerRequest(request, correlationId) {
|
|
26561
|
+
if (!request.dpopJkt) {
|
|
26562
|
+
return request;
|
|
26563
|
+
}
|
|
26564
|
+
this.logger.warning("Ignoring caller-provided dpopJkt for a direct platform broker request.", correlationId);
|
|
26565
|
+
return {
|
|
26566
|
+
...request,
|
|
26567
|
+
dpopJkt: undefined,
|
|
26568
|
+
};
|
|
26569
|
+
}
|
|
25454
26570
|
/**
|
|
25455
26571
|
* Acquire a token from native device (e.g. WAM)
|
|
25456
26572
|
* @param request
|
|
@@ -25470,7 +26586,8 @@
|
|
|
25470
26586
|
throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
|
|
25471
26587
|
}
|
|
25472
26588
|
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);
|
|
25473
|
-
|
|
26589
|
+
const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
|
|
26590
|
+
return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(nativeRequest, cacheLookupPolicy);
|
|
25474
26591
|
}
|
|
25475
26592
|
/**
|
|
25476
26593
|
* Returns boolean indicating if this request can use the platform broker
|
|
@@ -25750,14 +26867,23 @@
|
|
|
25750
26867
|
correlationId,
|
|
25751
26868
|
config: this.config,
|
|
25752
26869
|
}, this.platformAuthProvider, this.logger, this.performanceClient);
|
|
25753
|
-
const
|
|
26870
|
+
const shouldDeduplicate = preparedRequest.request.authenticationScheme !==
|
|
26871
|
+
AuthenticationScheme.DPOP;
|
|
26872
|
+
const inProgressRequest = shouldDeduplicate
|
|
26873
|
+
? this.activeSilentTokenRequests.get(preparedRequest.key)
|
|
26874
|
+
: undefined;
|
|
25754
26875
|
if (typeof inProgressRequest === "undefined") {
|
|
25755
|
-
this.logger.verbose(
|
|
26876
|
+
this.logger.verbose(shouldDeduplicate
|
|
26877
|
+
? "acquireTokenSilent called for the first time, storing active request"
|
|
26878
|
+
: "acquireTokenSilent called for DPoP request, starting an independent operation", correlationId);
|
|
25756
26879
|
this.performanceClient.addFields({ deduped: false }, correlationId);
|
|
25757
26880
|
const activeRequest = invokeAsync(this.acquireTokenSilentAsync.bind(this), AcquireTokenSilentAsync, this.logger, this.performanceClient, correlationId)({
|
|
25758
26881
|
...preparedRequest.request,
|
|
25759
26882
|
correlationId,
|
|
25760
26883
|
}, preparedRequest.account);
|
|
26884
|
+
if (!shouldDeduplicate) {
|
|
26885
|
+
return activeRequest;
|
|
26886
|
+
}
|
|
25761
26887
|
this.activeSilentTokenRequests.set(preparedRequest.key, activeRequest);
|
|
25762
26888
|
return activeRequest.finally(() => {
|
|
25763
26889
|
this.activeSilentTokenRequests.delete(preparedRequest.key);
|
|
@@ -26350,6 +27476,17 @@
|
|
|
26350
27476
|
cacheClient: this.cacheClient,
|
|
26351
27477
|
}), undefined, result.continuationState.scenario);
|
|
26352
27478
|
}
|
|
27479
|
+
if (result.type === FLOW_AUTH_METHOD_REGISTRATION_REQUIRED_V2) {
|
|
27480
|
+
return new CustomAuthResultV2(new AuthMethodRegistrationRequiredStateV2({
|
|
27481
|
+
correlationId: result.correlationId,
|
|
27482
|
+
logger: this.logger,
|
|
27483
|
+
config: this.customAuthConfig,
|
|
27484
|
+
flowClient: this.flowClientV2,
|
|
27485
|
+
continuationState: result.continuationState,
|
|
27486
|
+
cacheClient: this.cacheClient,
|
|
27487
|
+
methods: result.methods,
|
|
27488
|
+
}), undefined, result.continuationState.scenario);
|
|
27489
|
+
}
|
|
26353
27490
|
if (result.type === FLOW_CODE_REQUIRED_V2) {
|
|
26354
27491
|
return new CustomAuthResultV2(new CodeRequiredStateV2({
|
|
26355
27492
|
correlationId: result.correlationId,
|
|
@@ -27510,10 +28647,12 @@
|
|
|
27510
28647
|
exports.AuthMethodRegistrationCompletedState = AuthMethodRegistrationCompletedState;
|
|
27511
28648
|
exports.AuthMethodRegistrationFailedState = AuthMethodRegistrationFailedState;
|
|
27512
28649
|
exports.AuthMethodRegistrationRequiredState = AuthMethodRegistrationRequiredState;
|
|
28650
|
+
exports.AuthMethodRegistrationRequiredStateV2 = AuthMethodRegistrationRequiredStateV2;
|
|
27513
28651
|
exports.AuthMethodRegistrationSubmitChallengeError = AuthMethodRegistrationSubmitChallengeError;
|
|
27514
28652
|
exports.AuthMethodRegistrationSubmitChallengeResult = AuthMethodRegistrationSubmitChallengeResult;
|
|
27515
28653
|
exports.AuthMethodSelectionRequiredStateV2 = AuthMethodSelectionRequiredStateV2;
|
|
27516
28654
|
exports.AuthMethodVerificationRequiredState = AuthMethodVerificationRequiredState;
|
|
28655
|
+
exports.AuthMethodVerificationRequiredStateV2 = AuthMethodVerificationRequiredStateV2;
|
|
27517
28656
|
exports.CodeRequiredStateV2 = CodeRequiredStateV2;
|
|
27518
28657
|
exports.CompletedStateV2 = CompletedStateV2;
|
|
27519
28658
|
exports.CustomAuthAccountData = CustomAuthAccountData;
|