@azure/msal-browser 5.17.3 → 5.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/IPublicClientApplication.mjs +1 -1
- package/dist/app/PublicClientApplication.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
- package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
- package/dist/cache/AccountManager.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +9 -12
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +15 -7
- 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 +34 -17
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +19 -19
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.mjs +62 -103
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +4 -2
- package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
- package/dist/crypto/TokenBindingKeyManager.mjs +157 -0
- package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -0
- package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
- package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs +2 -2
- package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
- package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
- package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
- package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
- package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpError.mjs +1 -1
- package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
- package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
- package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
- package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
- package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
- package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
- package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +4 -4
- package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +4 -3
- package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs.map +1 -1
- package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
- package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
- package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
- package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
- package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
- package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
- package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
- package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
- package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
- package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +2 -1
- package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs.map +1 -1
- package/dist/custom_auth/index.mjs +1 -1
- package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
- package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
- package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
- package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
- package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +5 -2
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- package/dist/error/NestedAppAuthError.mjs +1 -1
- package/dist/event/EventHandler.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +6 -2
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs +30 -9
- package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +3 -3
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +3 -3
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +3 -3
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +3 -3
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +2 -1
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +1 -1
- package/dist/log-strings-mapping.json +1196 -1200
- package/dist/naa/BridgeError.mjs +1 -1
- package/dist/naa/BridgeProxy.mjs +27 -32
- package/dist/naa/BridgeProxy.mjs.map +1 -1
- package/dist/naa/BridgeStatusCode.mjs +1 -1
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +54 -25
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/popup_relay/constants.mjs +1 -1
- package/dist/popup_relay/index.mjs +1 -1
- package/dist/popup_relay/relayClient.mjs +1 -1
- package/dist/protocol/Authorize.mjs +5 -3
- package/dist/protocol/Authorize.mjs.map +1 -1
- package/dist/redirect_bridge/index.mjs +1 -1
- package/dist/request/RequestHelpers.mjs +11 -3
- package/dist/request/RequestHelpers.mjs.map +1 -1
- package/dist/response/ResponseHandler.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceEvents.mjs +5 -5
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +1 -1
- package/dist/utils/BrowserUtils.mjs +1 -1
- package/dist/utils/Helpers.mjs +1 -1
- package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs +64 -0
- package/dist/webBrokerBridge/PendingRequestRegistry.mjs.map +1 -0
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +39 -0
- package/dist/webBrokerBridge/WebBrokerBridgeError.mjs.map +1 -0
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +58 -0
- package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs.map +1 -0
- package/lib/custom-auth-path/log-strings-mapping.json +39 -43
- package/lib/custom-auth-path/msal-custom-auth.cjs +4542 -4060
- package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
- package/lib/custom-auth-path/msal-custom-auth.js +4542 -4060
- package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
- package/lib/log-strings-mapping.json +11 -15
- package/lib/msal-browser.cjs +1030 -432
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +1030 -432
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs +2 -2
- package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
- package/lib/popup-relay/msal-popup-relay.js +2 -2
- package/lib/popup-relay/msal-popup-relay.js.map +1 -1
- package/lib/popup-relay/msal-popup-relay.min.js +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
- package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
- package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
- package/package.json +2 -2
- package/src/broker/nativeBroker/PlatformAuthRequest.ts +2 -1
- package/src/cache/AsyncMemoryStorage.ts +7 -13
- package/src/cache/BrowserCacheManager.ts +24 -6
- package/src/controllers/StandardController.ts +58 -15
- package/src/crypto/BrowserCrypto.ts +10 -8
- package/src/crypto/CryptoOps.ts +138 -178
- package/src/crypto/SignedHttpRequest.ts +3 -0
- package/src/crypto/TokenBindingKeyManager.ts +299 -0
- package/src/custom_auth/controller/CustomAuthStandardController.ts +2 -1
- package/src/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.ts +8 -3
- package/src/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.ts +7 -3
- package/src/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.ts +1 -0
- package/src/error/BrowserAuthErrorCodes.ts +6 -0
- package/src/interaction_client/BaseInteractionClient.ts +8 -1
- package/src/interaction_client/PlatformAuthInteractionClient.ts +44 -6
- package/src/interaction_client/PopupClient.ts +5 -2
- package/src/interaction_client/RedirectClient.ts +5 -2
- package/src/interaction_client/SilentAuthCodeClient.ts +5 -2
- package/src/interaction_client/SilentIframeClient.ts +5 -2
- package/src/interaction_client/StandardInteractionClient.ts +1 -0
- package/src/naa/BridgeProxy.ts +38 -44
- package/src/naa/TokenRequest.ts +1 -0
- package/src/naa/mapping/NestedAppAuthAdapter.ts +62 -55
- package/src/packageMetadata.ts +1 -1
- package/src/protocol/Authorize.ts +8 -1
- package/src/request/RequestHelpers.ts +19 -2
- package/src/telemetry/BrowserPerformanceEvents.ts +4 -4
- package/src/webBrokerBridge/IWebBrokerBridgeMessage.ts +42 -0
- package/src/webBrokerBridge/PendingRequestRegistry.ts +76 -0
- package/src/webBrokerBridge/WebBrokerBridgeError.ts +69 -0
- package/src/webBrokerBridge/WebBrokerBridgeErrorMap.ts +108 -0
- package/src/webBrokerBridge/index.ts +25 -0
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +1 -0
- package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
- package/types/cache/AsyncMemoryStorage.d.ts +1 -2
- package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
- package/types/cache/BrowserCacheManager.d.ts +7 -5
- package/types/cache/BrowserCacheManager.d.ts.map +1 -1
- package/types/controllers/StandardController.d.ts +2 -1
- package/types/controllers/StandardController.d.ts.map +1 -1
- package/types/crypto/BrowserCrypto.d.ts +2 -2
- package/types/crypto/BrowserCrypto.d.ts.map +1 -1
- package/types/crypto/CryptoOps.d.ts +7 -21
- package/types/crypto/CryptoOps.d.ts.map +1 -1
- package/types/crypto/SignedHttpRequest.d.ts.map +1 -1
- package/types/crypto/TokenBindingKeyManager.d.ts +83 -0
- package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -0
- package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
- package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts +2 -2
- package/types/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.d.ts.map +1 -1
- package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts +4 -3
- package/types/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.d.ts.map +1 -1
- package/types/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.d.ts.map +1 -1
- package/types/error/BrowserAuthErrorCodes.d.ts +3 -0
- package/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/types/index.d.ts +1 -0
- package/types/index.d.ts.map +1 -1
- package/types/interaction_client/BaseInteractionClient.d.ts +3 -2
- package/types/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts +2 -2
- package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
- package/types/interaction_client/PopupClient.d.ts +2 -2
- package/types/interaction_client/PopupClient.d.ts.map +1 -1
- package/types/interaction_client/RedirectClient.d.ts +2 -2
- package/types/interaction_client/RedirectClient.d.ts.map +1 -1
- package/types/interaction_client/SilentAuthCodeClient.d.ts +2 -2
- package/types/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/types/interaction_client/SilentIframeClient.d.ts +2 -2
- package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/types/naa/BridgeProxy.d.ts +14 -2
- package/types/naa/BridgeProxy.d.ts.map +1 -1
- package/types/naa/TokenRequest.d.ts +1 -0
- package/types/naa/TokenRequest.d.ts.map +1 -1
- package/types/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
- package/types/packageMetadata.d.ts +1 -1
- package/types/protocol/Authorize.d.ts.map +1 -1
- package/types/request/RequestHelpers.d.ts.map +1 -1
- package/types/telemetry/BrowserPerformanceEvents.d.ts +4 -4
- package/types/webBrokerBridge/IWebBrokerBridgeMessage.d.ts +35 -0
- package/types/webBrokerBridge/IWebBrokerBridgeMessage.d.ts.map +1 -0
- package/types/webBrokerBridge/PendingRequestRegistry.d.ts +27 -0
- package/types/webBrokerBridge/PendingRequestRegistry.d.ts.map +1 -0
- package/types/webBrokerBridge/WebBrokerBridgeError.d.ts +50 -0
- package/types/webBrokerBridge/WebBrokerBridgeError.d.ts.map +1 -0
- package/types/webBrokerBridge/WebBrokerBridgeErrorMap.d.ts +10 -0
- package/types/webBrokerBridge/WebBrokerBridgeErrorMap.d.ts.map +1 -0
- package/types/webBrokerBridge/index.d.ts +16 -0
- package/types/webBrokerBridge/index.d.ts.map +1 -0
- package/src/naa/BridgeRequest.ts +0 -16
- package/types/naa/BridgeRequest.d.ts +0 -8
- package/types/naa/BridgeRequest.d.ts.map +0 -1
package/lib/msal-browser.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/*! @azure/msal-browser v5.
|
|
1
|
+
/*! @azure/msal-browser v5.19.0 2026-08-18 */
|
|
2
2
|
'use strict';
|
|
3
3
|
'use strict';
|
|
4
4
|
|
|
5
|
-
/*! @azure/msal-common v16.
|
|
5
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6
6
|
/*
|
|
7
7
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
8
8
|
* Licensed under the MIT License.
|
|
@@ -52,9 +52,10 @@ const INSTANCE_AWARE = "instance_aware";
|
|
|
52
52
|
const EAR_JWK = "ear_jwk";
|
|
53
53
|
const EAR_JWE_CRYPTO = "ear_jwe_crypto";
|
|
54
54
|
const RESOURCE = "resource";
|
|
55
|
-
const CLI_DATA = "clidata";
|
|
55
|
+
const CLI_DATA = "clidata";
|
|
56
|
+
const ATTRIBUTE_TOKENS = "attribute_tokens";
|
|
56
57
|
|
|
57
|
-
/*! @azure/msal-common v16.
|
|
58
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
58
59
|
/*
|
|
59
60
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
60
61
|
* Licensed under the MIT License.
|
|
@@ -286,11 +287,12 @@ const JsonWebTokenTypes$1 = {
|
|
|
286
287
|
Jwt: "JWT",
|
|
287
288
|
Jwk: "JWK",
|
|
288
289
|
Pop: "pop",
|
|
290
|
+
Dpop: "dpop+jwt",
|
|
289
291
|
};
|
|
290
292
|
// Token renewal offset default in seconds
|
|
291
293
|
const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
|
|
292
294
|
|
|
293
|
-
/*! @azure/msal-common v16.
|
|
295
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
294
296
|
/*
|
|
295
297
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
296
298
|
* Licensed under the MIT License.
|
|
@@ -319,7 +321,7 @@ function createAuthError(code, correlationId, additionalMessage) {
|
|
|
319
321
|
return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
|
|
320
322
|
}
|
|
321
323
|
|
|
322
|
-
/*! @azure/msal-common v16.
|
|
324
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
323
325
|
|
|
324
326
|
/*
|
|
325
327
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -342,7 +344,7 @@ function createClientAuthError(errorCode, correlationId, additionalMessage) {
|
|
|
342
344
|
return new ClientAuthError(errorCode, correlationId, additionalMessage);
|
|
343
345
|
}
|
|
344
346
|
|
|
345
|
-
/*! @azure/msal-common v16.
|
|
347
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
346
348
|
/*
|
|
347
349
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
348
350
|
* Licensed under the MIT License.
|
|
@@ -426,7 +428,7 @@ var ClientAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
426
428
|
userCanceled: userCanceled
|
|
427
429
|
});
|
|
428
430
|
|
|
429
|
-
/*! @azure/msal-common v16.
|
|
431
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
430
432
|
|
|
431
433
|
/*
|
|
432
434
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -464,7 +466,7 @@ function buildClientInfoFromHomeAccountId(homeAccountId) {
|
|
|
464
466
|
};
|
|
465
467
|
}
|
|
466
468
|
|
|
467
|
-
/*! @azure/msal-common v16.
|
|
469
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
468
470
|
|
|
469
471
|
/*
|
|
470
472
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -530,7 +532,7 @@ function getJWSPayload(authToken, correlationId) {
|
|
|
530
532
|
return matches[2];
|
|
531
533
|
}
|
|
532
534
|
|
|
533
|
-
/*! @azure/msal-common v16.
|
|
535
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
534
536
|
|
|
535
537
|
/*
|
|
536
538
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -618,7 +620,7 @@ function updateAccountTenantProfileData(baseAccountInfo, tenantProfile, idTokenC
|
|
|
618
620
|
return updatedAccountInfo;
|
|
619
621
|
}
|
|
620
622
|
|
|
621
|
-
/*! @azure/msal-common v16.
|
|
623
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
622
624
|
/*
|
|
623
625
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
624
626
|
* Licensed under the MIT License.
|
|
@@ -633,7 +635,7 @@ const AuthorityType = {
|
|
|
633
635
|
Ciam: 3,
|
|
634
636
|
};
|
|
635
637
|
|
|
636
|
-
/*! @azure/msal-common v16.
|
|
638
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
637
639
|
/*
|
|
638
640
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
639
641
|
* Licensed under the MIT License.
|
|
@@ -655,7 +657,7 @@ function getTenantIdFromIdTokenClaims(idTokenClaims) {
|
|
|
655
657
|
return null;
|
|
656
658
|
}
|
|
657
659
|
|
|
658
|
-
/*! @azure/msal-common v16.
|
|
660
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
659
661
|
/*
|
|
660
662
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
661
663
|
* Licensed under the MIT License.
|
|
@@ -679,7 +681,7 @@ const ProtocolMode = {
|
|
|
679
681
|
EAR: "EAR",
|
|
680
682
|
};
|
|
681
683
|
|
|
682
|
-
/*! @azure/msal-common v16.
|
|
684
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
683
685
|
/**
|
|
684
686
|
* Returns the AccountInfo interface for this account.
|
|
685
687
|
* @internal
|
|
@@ -868,7 +870,7 @@ function isAccountEntity(entity) {
|
|
|
868
870
|
entity.hasOwnProperty("authorityType"));
|
|
869
871
|
}
|
|
870
872
|
|
|
871
|
-
/*! @azure/msal-common v16.
|
|
873
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
872
874
|
/*
|
|
873
875
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
874
876
|
* Licensed under the MIT License.
|
|
@@ -885,7 +887,7 @@ var AuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
885
887
|
unexpectedError: unexpectedError
|
|
886
888
|
});
|
|
887
889
|
|
|
888
|
-
/*! @azure/msal-common v16.
|
|
890
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
889
891
|
|
|
890
892
|
/*
|
|
891
893
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -905,7 +907,7 @@ function createClientConfigurationError(errorCode, correlationId) {
|
|
|
905
907
|
return new ClientConfigurationError(errorCode, correlationId);
|
|
906
908
|
}
|
|
907
909
|
|
|
908
|
-
/*! @azure/msal-common v16.
|
|
910
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
909
911
|
/*
|
|
910
912
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
911
913
|
* Licensed under the MIT License.
|
|
@@ -926,6 +928,7 @@ const invalidAuthorityMetadata = "invalid_authority_metadata";
|
|
|
926
928
|
const untrustedAuthority = "untrusted_authority";
|
|
927
929
|
const missingSshJwk = "missing_ssh_jwk";
|
|
928
930
|
const missingSshKid = "missing_ssh_kid";
|
|
931
|
+
const unsupportedAuthenticationScheme = "unsupported_authentication_scheme";
|
|
929
932
|
const missingNonceAuthenticationHeader = "missing_nonce_authentication_header";
|
|
930
933
|
const invalidAuthenticationHeader = "invalid_authentication_header";
|
|
931
934
|
const cannotSetOIDCOptions = "cannot_set_OIDCOptions";
|
|
@@ -964,12 +967,13 @@ var ClientConfigurationErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
964
967
|
pkceParamsMissing: pkceParamsMissing,
|
|
965
968
|
redirectUriEmpty: redirectUriEmpty,
|
|
966
969
|
tokenRequestEmpty: tokenRequestEmpty,
|
|
970
|
+
unsupportedAuthenticationScheme: unsupportedAuthenticationScheme,
|
|
967
971
|
untrustedAuthority: untrustedAuthority,
|
|
968
972
|
urlEmptyError: urlEmptyError,
|
|
969
973
|
urlParseError: urlParseError
|
|
970
974
|
});
|
|
971
975
|
|
|
972
|
-
/*! @azure/msal-common v16.
|
|
976
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
973
977
|
|
|
974
978
|
/*
|
|
975
979
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1027,7 +1031,7 @@ class AuthenticationHeaderParser {
|
|
|
1027
1031
|
}
|
|
1028
1032
|
}
|
|
1029
1033
|
|
|
1030
|
-
/*! @azure/msal-common v16.
|
|
1034
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1031
1035
|
/*
|
|
1032
1036
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1033
1037
|
* Licensed under the MIT License.
|
|
@@ -1039,7 +1043,7 @@ function isOpenIdConfigResponse(response) {
|
|
|
1039
1043
|
response.hasOwnProperty("jwks_uri"));
|
|
1040
1044
|
}
|
|
1041
1045
|
|
|
1042
|
-
/*! @azure/msal-common v16.
|
|
1046
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1043
1047
|
/*
|
|
1044
1048
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1045
1049
|
* Licensed under the MIT License.
|
|
@@ -1119,7 +1123,7 @@ class StringUtils {
|
|
|
1119
1123
|
}
|
|
1120
1124
|
}
|
|
1121
1125
|
|
|
1122
|
-
/*! @azure/msal-common v16.
|
|
1126
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1123
1127
|
|
|
1124
1128
|
/*
|
|
1125
1129
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1277,7 +1281,7 @@ class UrlString {
|
|
|
1277
1281
|
}
|
|
1278
1282
|
}
|
|
1279
1283
|
|
|
1280
|
-
/*! @azure/msal-common v16.
|
|
1284
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1281
1285
|
|
|
1282
1286
|
/*
|
|
1283
1287
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1286,10 +1290,7 @@ class UrlString {
|
|
|
1286
1290
|
// Build endpoint metadata dynamically to avoid string duplication
|
|
1287
1291
|
const endpointHosts = [
|
|
1288
1292
|
{ host: "login.microsoftonline.com" },
|
|
1289
|
-
{
|
|
1290
|
-
host: "login.chinacloudapi.cn",
|
|
1291
|
-
issuerHost: "login.partner.microsoftonline.cn", // Issuer differs
|
|
1292
|
-
},
|
|
1293
|
+
{ host: "login.partner.microsoftonline.cn" },
|
|
1293
1294
|
{ host: "login.microsoftonline.us" },
|
|
1294
1295
|
{ host: "login.sovcloud-identity.fr" },
|
|
1295
1296
|
{ host: "login.sovcloud-identity.de" },
|
|
@@ -1443,7 +1444,7 @@ function getCloudDiscoveryMetadataFromNetworkResponse(response, authorityHost) {
|
|
|
1443
1444
|
return null;
|
|
1444
1445
|
}
|
|
1445
1446
|
|
|
1446
|
-
/*! @azure/msal-common v16.
|
|
1447
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1447
1448
|
/*
|
|
1448
1449
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1449
1450
|
* Licensed under the MIT License.
|
|
@@ -1463,7 +1464,7 @@ const AzureCloudInstance = {
|
|
|
1463
1464
|
AzureUsGovernment: "https://login.microsoftonline.us",
|
|
1464
1465
|
};
|
|
1465
1466
|
|
|
1466
|
-
/*! @azure/msal-common v16.
|
|
1467
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1467
1468
|
/*
|
|
1468
1469
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1469
1470
|
* Licensed under the MIT License.
|
|
@@ -1473,7 +1474,7 @@ function isCloudInstanceDiscoveryResponse(response) {
|
|
|
1473
1474
|
response.hasOwnProperty("metadata"));
|
|
1474
1475
|
}
|
|
1475
1476
|
|
|
1476
|
-
/*! @azure/msal-common v16.
|
|
1477
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1477
1478
|
/*
|
|
1478
1479
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1479
1480
|
* Licensed under the MIT License.
|
|
@@ -1483,7 +1484,7 @@ function isCloudInstanceDiscoveryErrorResponse(response) {
|
|
|
1483
1484
|
response.hasOwnProperty("error_description"));
|
|
1484
1485
|
}
|
|
1485
1486
|
|
|
1486
|
-
/*! @azure/msal-common v16.
|
|
1487
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1487
1488
|
/*
|
|
1488
1489
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1489
1490
|
* Licensed under the MIT License.
|
|
@@ -1554,7 +1555,7 @@ const RegionDiscoveryGetCurrentVersion = "regionDiscoveryGetCurrentVersion";
|
|
|
1554
1555
|
const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
|
|
1555
1556
|
const SetUserData = "setUserData";
|
|
1556
1557
|
|
|
1557
|
-
/*! @azure/msal-common v16.
|
|
1558
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1558
1559
|
/*
|
|
1559
1560
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1560
1561
|
* Licensed under the MIT License.
|
|
@@ -1647,7 +1648,7 @@ const invokeAsync = (callback, eventName, logger, telemetryClient, correlationId
|
|
|
1647
1648
|
};
|
|
1648
1649
|
};
|
|
1649
1650
|
|
|
1650
|
-
/*! @azure/msal-common v16.
|
|
1651
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1651
1652
|
|
|
1652
1653
|
/*
|
|
1653
1654
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1758,7 +1759,7 @@ RegionDiscovery.IMDS_OPTIONS = {
|
|
|
1758
1759
|
},
|
|
1759
1760
|
};
|
|
1760
1761
|
|
|
1761
|
-
/*! @azure/msal-common v16.
|
|
1762
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1762
1763
|
/*
|
|
1763
1764
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
1764
1765
|
* Licensed under the MIT License.
|
|
@@ -1823,7 +1824,7 @@ function wasClockTurnedBack(cachedAt) {
|
|
|
1823
1824
|
return cachedAtSec > nowSeconds();
|
|
1824
1825
|
}
|
|
1825
1826
|
|
|
1826
|
-
/*! @azure/msal-common v16.
|
|
1827
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
1827
1828
|
|
|
1828
1829
|
/*
|
|
1829
1830
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -1880,6 +1881,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
|
|
|
1880
1881
|
if (refreshOn) {
|
|
1881
1882
|
atEntity.refreshOn = refreshOn.toString();
|
|
1882
1883
|
}
|
|
1884
|
+
const normalizedTokenType = atEntity.tokenType?.toLowerCase();
|
|
1883
1885
|
/*
|
|
1884
1886
|
* Create Access Token With Auth Scheme instead of regular access token
|
|
1885
1887
|
* Cast to lower to handle "bearer" from ADFS
|
|
@@ -1888,7 +1890,7 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
|
|
|
1888
1890
|
AuthenticationScheme$1.BEARER.toLowerCase()) {
|
|
1889
1891
|
atEntity.credentialType =
|
|
1890
1892
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
1891
|
-
switch (
|
|
1893
|
+
switch (normalizedTokenType) {
|
|
1892
1894
|
case AuthenticationScheme$1.POP:
|
|
1893
1895
|
// Make sure keyId is present and add it to credential
|
|
1894
1896
|
const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
|
|
@@ -1897,6 +1899,12 @@ function createAccessTokenEntity(homeAccountId, environment, accessToken, client
|
|
|
1897
1899
|
}
|
|
1898
1900
|
atEntity.keyId = tokenClaims.cnf.kid;
|
|
1899
1901
|
break;
|
|
1902
|
+
case "dpop":
|
|
1903
|
+
if (!keyId) {
|
|
1904
|
+
throw createClientAuthError(keyIdMissing, correlationId);
|
|
1905
|
+
}
|
|
1906
|
+
atEntity.keyId = keyId;
|
|
1907
|
+
break;
|
|
1900
1908
|
case AuthenticationScheme$1.SSH:
|
|
1901
1909
|
atEntity.keyId = keyId;
|
|
1902
1910
|
}
|
|
@@ -2088,9 +2096,22 @@ function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetw
|
|
|
2088
2096
|
*/
|
|
2089
2097
|
function isAuthorityMetadataExpired(metadata) {
|
|
2090
2098
|
return metadata.expiresAt <= nowSeconds();
|
|
2099
|
+
}
|
|
2100
|
+
/**
|
|
2101
|
+
* Serialize attribute tokens synchronously (sort and join).
|
|
2102
|
+
* This is a sync-only operation for use at request construction time.
|
|
2103
|
+
* @param attributeTokens - array of tokens
|
|
2104
|
+
* @returns serialized partition string or undefined if no tokens
|
|
2105
|
+
*/
|
|
2106
|
+
function serializeAttributeTokens(attributeTokens) {
|
|
2107
|
+
if (!attributeTokens || attributeTokens.length === 0) {
|
|
2108
|
+
return undefined;
|
|
2109
|
+
}
|
|
2110
|
+
// Serialize: sort and join tokens
|
|
2111
|
+
return [...attributeTokens].sort().join(" ");
|
|
2091
2112
|
}
|
|
2092
2113
|
|
|
2093
|
-
/*! @azure/msal-common v16.
|
|
2114
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
2094
2115
|
|
|
2095
2116
|
/*
|
|
2096
2117
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3060,7 +3081,7 @@ function buildStaticAuthorityOptions(authOptions) {
|
|
|
3060
3081
|
};
|
|
3061
3082
|
}
|
|
3062
3083
|
|
|
3063
|
-
/*! @azure/msal-common v16.
|
|
3084
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3064
3085
|
|
|
3065
3086
|
/*
|
|
3066
3087
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3094,7 +3115,7 @@ async function createDiscoveredInstance(authorityUri, networkClient, cacheManage
|
|
|
3094
3115
|
}
|
|
3095
3116
|
}
|
|
3096
3117
|
|
|
3097
|
-
/*! @azure/msal-common v16.
|
|
3118
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3098
3119
|
|
|
3099
3120
|
/*
|
|
3100
3121
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3290,7 +3311,7 @@ class ScopeSet {
|
|
|
3290
3311
|
}
|
|
3291
3312
|
}
|
|
3292
3313
|
|
|
3293
|
-
/*! @azure/msal-common v16.
|
|
3314
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3294
3315
|
|
|
3295
3316
|
/*
|
|
3296
3317
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3418,13 +3439,14 @@ function addSid(parameters, sid) {
|
|
|
3418
3439
|
* @param claims - The claims string from the request
|
|
3419
3440
|
* @param clientCapabilities - The client capabilities from configuration
|
|
3420
3441
|
* @param skipBrokerClaims - When true and BROKER_CLIENT_ID is present, excludes clientCapabilities from claims
|
|
3442
|
+
* @param claimsToMerge - Optional client-originated claims JSON string (e.g. `claimsFromClient`) deep-merged into `claims` with precedence on conflicts
|
|
3421
3443
|
*/
|
|
3422
|
-
function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims) {
|
|
3444
|
+
function addClaims(parameters, correlationId, claims, clientCapabilities, skipBrokerClaims, claimsToMerge) {
|
|
3423
3445
|
// Skip clientCapabilities if skipBrokerClaims is set to true and this is a brokered authentication flow
|
|
3424
3446
|
const configClaims = skipBrokerClaims && parameters.has(BROKER_CLIENT_ID)
|
|
3425
3447
|
? undefined
|
|
3426
3448
|
: clientCapabilities;
|
|
3427
|
-
const mergedClaims = buildMergedClaims$1(claims, configClaims, correlationId);
|
|
3449
|
+
const mergedClaims = buildMergedClaims$1(claims, configClaims, correlationId, claimsToMerge);
|
|
3428
3450
|
parameters.set(CLAIMS, mergedClaims);
|
|
3429
3451
|
}
|
|
3430
3452
|
/**
|
|
@@ -3590,32 +3612,79 @@ const DEFAULT_ID_TOKEN_CLAIMS = {
|
|
|
3590
3612
|
[ClaimsRequestKeys.LOGIN_HINT]: { essential: false },
|
|
3591
3613
|
};
|
|
3592
3614
|
/**
|
|
3593
|
-
* Parses claims JSON
|
|
3594
|
-
*
|
|
3615
|
+
* Parses a claims JSON string into an object, throwing a ClientConfigurationError
|
|
3616
|
+
* (error code `invalid_claims`) if the value is not a valid JSON object. The raw
|
|
3617
|
+
* claims value is never included in the error - it may contain sensitive data.
|
|
3618
|
+
* @param claims - Claims JSON string. Must be valid JSON representing an object.
|
|
3619
|
+
* @param correlationId - The request correlation id
|
|
3620
|
+
* @returns The parsed claims object
|
|
3621
|
+
*/
|
|
3622
|
+
function parseClaims(claims, correlationId = "") {
|
|
3623
|
+
let parsed;
|
|
3624
|
+
try {
|
|
3625
|
+
parsed = JSON.parse(claims);
|
|
3626
|
+
}
|
|
3627
|
+
catch (e) {
|
|
3628
|
+
// Malformed JSON
|
|
3629
|
+
throw createClientConfigurationError(invalidClaims, correlationId);
|
|
3630
|
+
}
|
|
3631
|
+
if (!isPlainObject$1(parsed)) {
|
|
3632
|
+
// Valid JSON, but not an object (e.g. an array, a scalar, or the literal `null`).
|
|
3633
|
+
throw createClientConfigurationError(invalidClaims, correlationId);
|
|
3634
|
+
}
|
|
3635
|
+
return parsed;
|
|
3636
|
+
}
|
|
3637
|
+
/**
|
|
3638
|
+
* Type guard for a non-null, non-array object (a JSON "object" value).
|
|
3639
|
+
* @param value - The value to test
|
|
3640
|
+
* @returns True when value is a plain object that can be deep-merged
|
|
3641
|
+
*/
|
|
3642
|
+
function isPlainObject$1(value) {
|
|
3643
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
3644
|
+
}
|
|
3645
|
+
/**
|
|
3646
|
+
* Recursively deep-merges two parsed claims objects. Nested objects are merged key-by-key;
|
|
3647
|
+
* for any other value type (arrays, scalars, null) the value from `claimsToMerge` replaces
|
|
3648
|
+
* the base. This mirrors the deep merge used by msal-dotnet so that, for example, a server
|
|
3649
|
+
* `access_token` challenge and a client-originated `access_token` claim are combined rather
|
|
3650
|
+
* than one clobbering the other.
|
|
3651
|
+
* @param baseClaims - The parsed base claims object
|
|
3652
|
+
* @param claimsToMerge - The parsed claims object merged in with precedence
|
|
3653
|
+
* @returns The deep-merged claims object
|
|
3654
|
+
*/
|
|
3655
|
+
function deepMergeClaims(baseClaims, claimsToMerge) {
|
|
3656
|
+
const merged = { ...baseClaims };
|
|
3657
|
+
for (const [key, mergeInValue] of Object.entries(claimsToMerge)) {
|
|
3658
|
+
const baseValue = merged[key];
|
|
3659
|
+
if (isPlainObject$1(baseValue) && isPlainObject$1(mergeInValue)) {
|
|
3660
|
+
merged[key] = deepMergeClaims(baseValue, mergeInValue);
|
|
3661
|
+
}
|
|
3662
|
+
else {
|
|
3663
|
+
merged[key] = mergeInValue;
|
|
3664
|
+
}
|
|
3665
|
+
}
|
|
3666
|
+
return merged;
|
|
3667
|
+
}
|
|
3668
|
+
/**
|
|
3669
|
+
* Parses claims JSON, optionally deep-merges a second client-originated claims string
|
|
3670
|
+
* (`claimsToMerge`, e.g. `claimsFromClient`) with precedence on conflicting keys, merges
|
|
3671
|
+
* default optional idToken claims (signin_state, login_hint), and appends client
|
|
3672
|
+
* capabilities (xms_cc) to the access_token section.
|
|
3595
3673
|
* Does not overwrite idToken claims already specified by the caller.
|
|
3596
3674
|
* @param claims - Existing claims JSON string from the request (may be undefined)
|
|
3597
3675
|
* @param clientCapabilities - Client capabilities array from configuration
|
|
3676
|
+
* @param correlationId - The request correlation id
|
|
3677
|
+
* @param claimsToMerge - Optional second claims JSON string (e.g. client-originated `claimsFromClient`)
|
|
3678
|
+
* deep-merged into `claims` with precedence on conflicts; parsed and validated when present. Nested
|
|
3679
|
+
* objects are merged recursively; arrays and scalar values are replaced.
|
|
3598
3680
|
* @returns Merged claims JSON string
|
|
3599
3681
|
*/
|
|
3600
|
-
function buildMergedClaims$1(claims, clientCapabilities, correlationId = "") {
|
|
3601
|
-
let mergedClaims;
|
|
3682
|
+
function buildMergedClaims$1(claims, clientCapabilities, correlationId = "", claimsToMerge) {
|
|
3602
3683
|
// Parse provided claims into JSON object or initialize empty object
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
try {
|
|
3608
|
-
const parsed = JSON.parse(claims);
|
|
3609
|
-
if (typeof parsed !== "object" ||
|
|
3610
|
-
parsed === null ||
|
|
3611
|
-
Array.isArray(parsed)) {
|
|
3612
|
-
throw new Error("Claims must be a JSON object");
|
|
3613
|
-
}
|
|
3614
|
-
mergedClaims = parsed;
|
|
3615
|
-
}
|
|
3616
|
-
catch (e) {
|
|
3617
|
-
throw createClientConfigurationError(invalidClaims, correlationId);
|
|
3618
|
-
}
|
|
3684
|
+
let mergedClaims = claims ? parseClaims(claims, correlationId) : {};
|
|
3685
|
+
// Deep-merge client-originated claims (e.g. `claimsFromClient`) with precedence on conflicts
|
|
3686
|
+
if (claimsToMerge?.trim()) {
|
|
3687
|
+
mergedClaims = deepMergeClaims(mergedClaims, parseClaims(claimsToMerge, correlationId));
|
|
3619
3688
|
}
|
|
3620
3689
|
// Add default optional idToken claims
|
|
3621
3690
|
if (!Object.prototype.hasOwnProperty.call(mergedClaims, ClaimsRequestKeys.ID_TOKEN)) {
|
|
@@ -3703,9 +3772,28 @@ function addResource(parameters, resource) {
|
|
|
3703
3772
|
if (resource) {
|
|
3704
3773
|
parameters.set(RESOURCE, resource);
|
|
3705
3774
|
}
|
|
3775
|
+
}
|
|
3776
|
+
/**
|
|
3777
|
+
* Add the `attribute_tokens` parameter to a /token request body.
|
|
3778
|
+
*
|
|
3779
|
+
* When `attributeTokens` is a non-empty array the values are sorted lexicographically and joined
|
|
3780
|
+
* with a single space, then written to the request body. When `attributeTokens` is an empty array
|
|
3781
|
+
* the parameter is deleted from the request body.
|
|
3782
|
+
*
|
|
3783
|
+
* @param parameters - request parameter map that will be serialized into the /token body
|
|
3784
|
+
* @param attributeTokens - caller-provided attribute token strings
|
|
3785
|
+
*/
|
|
3786
|
+
function addAttributeTokens(parameters, attributeTokens) {
|
|
3787
|
+
const serialized = serializeAttributeTokens(attributeTokens);
|
|
3788
|
+
if (serialized) {
|
|
3789
|
+
parameters.set(ATTRIBUTE_TOKENS, serialized);
|
|
3790
|
+
}
|
|
3791
|
+
else {
|
|
3792
|
+
parameters.delete(ATTRIBUTE_TOKENS);
|
|
3793
|
+
}
|
|
3706
3794
|
}
|
|
3707
3795
|
|
|
3708
|
-
/*! @azure/msal-common v16.
|
|
3796
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3709
3797
|
|
|
3710
3798
|
/*
|
|
3711
3799
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -3827,12 +3915,20 @@ function validateUrl(url, logger, correlationId) {
|
|
|
3827
3915
|
}
|
|
3828
3916
|
}
|
|
3829
3917
|
|
|
3830
|
-
/*! @azure/msal-common v16.
|
|
3918
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3831
3919
|
|
|
3832
3920
|
/*
|
|
3833
3921
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3834
3922
|
* Licensed under the MIT License.
|
|
3835
3923
|
*/
|
|
3924
|
+
/**
|
|
3925
|
+
* Shared JOSE algorithm literals used by MSAL package internals.
|
|
3926
|
+
* @internal
|
|
3927
|
+
*/
|
|
3928
|
+
const JsonWebTokenAlgorithms = {
|
|
3929
|
+
ES256: "ES256",
|
|
3930
|
+
RS256: "RS256",
|
|
3931
|
+
};
|
|
3836
3932
|
/**
|
|
3837
3933
|
* Default crypto implementation used when a platform-specific implementation has
|
|
3838
3934
|
* not been provided.
|
|
@@ -3853,24 +3949,44 @@ const DEFAULT_CRYPTO_IMPLEMENTATION = {
|
|
|
3853
3949
|
encodeKid: () => {
|
|
3854
3950
|
throw createClientAuthError(methodNotImplemented, "");
|
|
3855
3951
|
},
|
|
3856
|
-
async
|
|
3857
|
-
throw createClientAuthError(methodNotImplemented,
|
|
3858
|
-
},
|
|
3859
|
-
async removeTokenBindingKey() {
|
|
3860
|
-
throw createClientAuthError(methodNotImplemented, "");
|
|
3952
|
+
async removeTokenBindingKey(kid, correlationId) {
|
|
3953
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3861
3954
|
},
|
|
3862
|
-
async clearKeystore() {
|
|
3863
|
-
throw createClientAuthError(methodNotImplemented,
|
|
3955
|
+
async clearKeystore(correlationId) {
|
|
3956
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3864
3957
|
},
|
|
3865
|
-
async
|
|
3866
|
-
throw createClientAuthError(methodNotImplemented,
|
|
3958
|
+
async signTokenBindingJwt(header, payload, kid, correlationId) {
|
|
3959
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3867
3960
|
},
|
|
3868
3961
|
async hashString() {
|
|
3869
3962
|
throw createClientAuthError(methodNotImplemented, "");
|
|
3870
3963
|
},
|
|
3871
3964
|
};
|
|
3872
3965
|
|
|
3873
|
-
/*! @azure/msal-common v16.
|
|
3966
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3967
|
+
|
|
3968
|
+
/*
|
|
3969
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3970
|
+
* Licensed under the MIT License.
|
|
3971
|
+
*/
|
|
3972
|
+
/**
|
|
3973
|
+
* Default token-binding key manager used when a platform-specific implementation
|
|
3974
|
+
* has not been provided.
|
|
3975
|
+
* @internal
|
|
3976
|
+
*/
|
|
3977
|
+
const DEFAULT_TOKEN_BINDING_KEY_MANAGER = {
|
|
3978
|
+
async provisionTokenBindingKey(request) {
|
|
3979
|
+
throw createClientAuthError(methodNotImplemented, request.correlationId);
|
|
3980
|
+
},
|
|
3981
|
+
async removeTokenBindingKey(_kid, correlationId) {
|
|
3982
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3983
|
+
},
|
|
3984
|
+
async getTokenBindingPublicKeyJwk(_kid, correlationId) {
|
|
3985
|
+
throw createClientAuthError(methodNotImplemented, correlationId);
|
|
3986
|
+
},
|
|
3987
|
+
};
|
|
3988
|
+
|
|
3989
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
3874
3990
|
/*
|
|
3875
3991
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3876
3992
|
* Licensed under the MIT License.
|
|
@@ -4159,12 +4275,12 @@ class Logger {
|
|
|
4159
4275
|
}
|
|
4160
4276
|
}
|
|
4161
4277
|
|
|
4162
|
-
/*! @azure/msal-common v16.
|
|
4278
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4163
4279
|
/* eslint-disable header/header */
|
|
4164
4280
|
const name$1 = "@azure/msal-common";
|
|
4165
|
-
const version$1 = "16.
|
|
4281
|
+
const version$1 = "16.13.0";
|
|
4166
4282
|
|
|
4167
|
-
/*! @azure/msal-common v16.
|
|
4283
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4168
4284
|
/*
|
|
4169
4285
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
4170
4286
|
* Licensed under the MIT License.
|
|
@@ -4172,7 +4288,7 @@ const version$1 = "16.11.3";
|
|
|
4172
4288
|
const cacheQuotaExceeded = "cache_quota_exceeded";
|
|
4173
4289
|
const cacheErrorUnknown = "cache_error_unknown";
|
|
4174
4290
|
|
|
4175
|
-
/*! @azure/msal-common v16.
|
|
4291
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4176
4292
|
|
|
4177
4293
|
/*
|
|
4178
4294
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4210,7 +4326,7 @@ function createCacheError(e) {
|
|
|
4210
4326
|
}
|
|
4211
4327
|
}
|
|
4212
4328
|
|
|
4213
|
-
/*! @azure/msal-common v16.
|
|
4329
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
4214
4330
|
|
|
4215
4331
|
/*
|
|
4216
4332
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -4437,9 +4553,17 @@ class CacheManager {
|
|
|
4437
4553
|
}
|
|
4438
4554
|
/**
|
|
4439
4555
|
* saves access token credential
|
|
4440
|
-
* @param credential
|
|
4556
|
+
* @param credential - the access token entity to save
|
|
4557
|
+
* @param correlationId - unique identifier for the request
|
|
4558
|
+
* @param kmsi - keep me signed in flag
|
|
4441
4559
|
*/
|
|
4442
4560
|
async saveAccessToken(credential, correlationId, kmsi) {
|
|
4561
|
+
// Compute hash from components on the entity itself — no need to thread externally.
|
|
4562
|
+
let additionalCacheKeyHash;
|
|
4563
|
+
if (credential.additionalCacheKeyComponents &&
|
|
4564
|
+
Object.keys(credential.additionalCacheKeyComponents).length > 0) {
|
|
4565
|
+
additionalCacheKeyHash = await this.cryptoImpl.hashString(JSON.stringify(credential.additionalCacheKeyComponents));
|
|
4566
|
+
}
|
|
4443
4567
|
const accessTokenFilter = {
|
|
4444
4568
|
clientId: credential.clientId,
|
|
4445
4569
|
credentialType: credential.credentialType,
|
|
@@ -4463,7 +4587,7 @@ class CacheManager {
|
|
|
4463
4587
|
}
|
|
4464
4588
|
}
|
|
4465
4589
|
});
|
|
4466
|
-
await this.setAccessTokenCredential(credential, correlationId, kmsi);
|
|
4590
|
+
await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
|
|
4467
4591
|
}
|
|
4468
4592
|
/**
|
|
4469
4593
|
* Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
|
|
@@ -4563,16 +4687,9 @@ class CacheManager {
|
|
|
4563
4687
|
// Access Token with Auth Scheme specific matching
|
|
4564
4688
|
if (entity.credentialType ===
|
|
4565
4689
|
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
|
|
4566
|
-
if (
|
|
4567
|
-
!this.matchTokenType(entity, filter.tokenType)) {
|
|
4690
|
+
if (!this.matchAccessTokenWithAuthScheme(entity, filter)) {
|
|
4568
4691
|
return false;
|
|
4569
4692
|
}
|
|
4570
|
-
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
|
|
4571
|
-
if (filter.tokenType === AuthenticationScheme$1.SSH) {
|
|
4572
|
-
if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
|
|
4573
|
-
return false;
|
|
4574
|
-
}
|
|
4575
|
-
}
|
|
4576
4693
|
}
|
|
4577
4694
|
// Additional cache key components matching (bidirectional isolation)
|
|
4578
4695
|
const entityComponents = entity.additionalCacheKeyComponents;
|
|
@@ -4875,6 +4992,12 @@ class CacheManager {
|
|
|
4875
4992
|
AuthenticationScheme$1.BEARER.toLowerCase()
|
|
4876
4993
|
? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME
|
|
4877
4994
|
: CredentialType.ACCESS_TOKEN;
|
|
4995
|
+
const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
|
|
4996
|
+
const additionalCacheKeyComponents = attributeTokenPartition
|
|
4997
|
+
? {
|
|
4998
|
+
attribute_tokens: attributeTokenPartition,
|
|
4999
|
+
}
|
|
5000
|
+
: undefined;
|
|
4878
5001
|
const accessTokenFilter = {
|
|
4879
5002
|
homeAccountId: account.homeAccountId,
|
|
4880
5003
|
environment: account.environment,
|
|
@@ -4883,11 +5006,15 @@ class CacheManager {
|
|
|
4883
5006
|
realm: targetRealm || account.tenantId,
|
|
4884
5007
|
target: scopes,
|
|
4885
5008
|
tokenType: authScheme,
|
|
4886
|
-
keyId:
|
|
5009
|
+
keyId: authScheme === AuthenticationScheme$1.SSH
|
|
5010
|
+
? request.sshKid
|
|
5011
|
+
: undefined,
|
|
5012
|
+
additionalCacheKeyComponents: additionalCacheKeyComponents,
|
|
4887
5013
|
};
|
|
4888
5014
|
const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
|
|
4889
5015
|
this.getTokenKeys().accessToken;
|
|
4890
5016
|
const accessTokens = [];
|
|
5017
|
+
const matchedKeys = [];
|
|
4891
5018
|
accessTokenKeys.forEach((key) => {
|
|
4892
5019
|
// Validate key
|
|
4893
5020
|
if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
|
|
@@ -4896,18 +5023,18 @@ class CacheManager {
|
|
|
4896
5023
|
if (accessToken &&
|
|
4897
5024
|
this.credentialMatchesFilter(accessToken, accessTokenFilter, correlationId)) {
|
|
4898
5025
|
accessTokens.push(accessToken);
|
|
5026
|
+
matchedKeys.push(key);
|
|
4899
5027
|
}
|
|
4900
5028
|
}
|
|
4901
5029
|
});
|
|
4902
|
-
|
|
4903
|
-
if (numAccessTokens < 1) {
|
|
5030
|
+
if (accessTokens.length < 1) {
|
|
4904
5031
|
this.commonLogger.info("1nckna", correlationId);
|
|
4905
5032
|
return null;
|
|
4906
5033
|
}
|
|
4907
|
-
else if (
|
|
5034
|
+
else if (accessTokens.length > 1) {
|
|
4908
5035
|
this.commonLogger.info("1wkfwp", correlationId);
|
|
4909
|
-
|
|
4910
|
-
this.removeAccessToken(
|
|
5036
|
+
matchedKeys.forEach((key) => {
|
|
5037
|
+
this.removeAccessToken(key, correlationId);
|
|
4911
5038
|
});
|
|
4912
5039
|
this.performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);
|
|
4913
5040
|
return null;
|
|
@@ -5243,7 +5370,29 @@ class CacheManager {
|
|
|
5243
5370
|
* @param tokenType
|
|
5244
5371
|
*/
|
|
5245
5372
|
matchTokenType(entity, tokenType) {
|
|
5246
|
-
return !!(entity.tokenType &&
|
|
5373
|
+
return !!(entity.tokenType &&
|
|
5374
|
+
entity.tokenType.toLowerCase() === tokenType.toLowerCase());
|
|
5375
|
+
}
|
|
5376
|
+
matchAccessTokenWithAuthScheme(entity, filter) {
|
|
5377
|
+
const normalizedFilterTokenType = filter.tokenType?.toLowerCase();
|
|
5378
|
+
if (!!filter.tokenType &&
|
|
5379
|
+
!this.matchTokenType(entity, filter.tokenType)) {
|
|
5380
|
+
return false;
|
|
5381
|
+
}
|
|
5382
|
+
switch (normalizedFilterTokenType) {
|
|
5383
|
+
case "dpop":
|
|
5384
|
+
return this.matchKeyBoundAccessToken(entity, filter, true);
|
|
5385
|
+
case AuthenticationScheme$1.SSH:
|
|
5386
|
+
return this.matchKeyBoundAccessToken(entity, filter, false);
|
|
5387
|
+
default:
|
|
5388
|
+
return true;
|
|
5389
|
+
}
|
|
5390
|
+
}
|
|
5391
|
+
matchKeyBoundAccessToken(entity, filter, requireKeyId) {
|
|
5392
|
+
if (!filter.keyId) {
|
|
5393
|
+
return !requireKeyId;
|
|
5394
|
+
}
|
|
5395
|
+
return this.matchKeyId(entity, filter.keyId);
|
|
5247
5396
|
}
|
|
5248
5397
|
/**
|
|
5249
5398
|
* Returns true if the credential's keyId matches the one in the request, false otherwise
|
|
@@ -5350,7 +5499,9 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5350
5499
|
getTokenKeys() {
|
|
5351
5500
|
throw createClientAuthError(methodNotImplemented, "");
|
|
5352
5501
|
}
|
|
5353
|
-
|
|
5502
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
5503
|
+
generateCredentialKey(_credential, _hash) {
|
|
5504
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
5354
5505
|
throw createClientAuthError(methodNotImplemented, "");
|
|
5355
5506
|
}
|
|
5356
5507
|
generateAccountKey() {
|
|
@@ -5358,7 +5509,7 @@ class DefaultStorageClass extends CacheManager {
|
|
|
5358
5509
|
}
|
|
5359
5510
|
}
|
|
5360
5511
|
|
|
5361
|
-
/*! @azure/msal-common v16.
|
|
5512
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5362
5513
|
/*
|
|
5363
5514
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5364
5515
|
* Licensed under the MIT License.
|
|
@@ -5423,7 +5574,7 @@ const IntFields = new Set([
|
|
|
5423
5574
|
"fetchRetryCount",
|
|
5424
5575
|
]);
|
|
5425
5576
|
|
|
5426
|
-
/*! @azure/msal-common v16.
|
|
5577
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5427
5578
|
|
|
5428
5579
|
/*
|
|
5429
5580
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5481,7 +5632,7 @@ class StubPerformanceClient {
|
|
|
5481
5632
|
}
|
|
5482
5633
|
}
|
|
5483
5634
|
|
|
5484
|
-
/*! @azure/msal-common v16.
|
|
5635
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5485
5636
|
|
|
5486
5637
|
/*
|
|
5487
5638
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5535,7 +5686,7 @@ const DEFAULT_TELEMETRY_OPTIONS = {
|
|
|
5535
5686
|
* @returns Configuration
|
|
5536
5687
|
* @internal
|
|
5537
5688
|
*/
|
|
5538
|
-
function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
|
|
5689
|
+
function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, tokenBindingKeyManager: tokenBindingKeyManager, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {
|
|
5539
5690
|
const loggerOptions = {
|
|
5540
5691
|
...DEFAULT_LOGGER_IMPLEMENTATION,
|
|
5541
5692
|
...userLoggerOption,
|
|
@@ -5548,6 +5699,7 @@ function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions:
|
|
|
5548
5699
|
new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions, name$1, version$1), new StubPerformanceClient()),
|
|
5549
5700
|
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,
|
|
5550
5701
|
cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,
|
|
5702
|
+
tokenBindingKeyManager: tokenBindingKeyManager || DEFAULT_TOKEN_BINDING_KEY_MANAGER,
|
|
5551
5703
|
clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,
|
|
5552
5704
|
libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },
|
|
5553
5705
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
|
|
@@ -5577,7 +5729,7 @@ function isOidcProtocolMode(config) {
|
|
|
5577
5729
|
return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
|
|
5578
5730
|
}
|
|
5579
5731
|
|
|
5580
|
-
/*! @azure/msal-common v16.
|
|
5732
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5581
5733
|
/*
|
|
5582
5734
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5583
5735
|
* Licensed under the MIT License.
|
|
@@ -5604,7 +5756,129 @@ function isOidcProtocolMode(config) {
|
|
|
5604
5756
|
}
|
|
5605
5757
|
}
|
|
5606
5758
|
|
|
5607
|
-
/*! @azure/msal-common v16.
|
|
5759
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5760
|
+
|
|
5761
|
+
/*
|
|
5762
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5763
|
+
* Licensed under the MIT License.
|
|
5764
|
+
*/
|
|
5765
|
+
/**
|
|
5766
|
+
* Error thrown when there is an error in the client code running on the browser.
|
|
5767
|
+
*/
|
|
5768
|
+
class JoseHeaderError extends AuthError {
|
|
5769
|
+
constructor(errorCode, correlationId, errorMessage) {
|
|
5770
|
+
super(errorCode, correlationId, errorMessage);
|
|
5771
|
+
this.name = "JoseHeaderError";
|
|
5772
|
+
Object.setPrototypeOf(this, JoseHeaderError.prototype);
|
|
5773
|
+
}
|
|
5774
|
+
}
|
|
5775
|
+
/** Returns JoseHeaderError object */
|
|
5776
|
+
function createJoseHeaderError(code, correlationId) {
|
|
5777
|
+
return new JoseHeaderError(code, correlationId);
|
|
5778
|
+
}
|
|
5779
|
+
|
|
5780
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5781
|
+
/*
|
|
5782
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5783
|
+
* Licensed under the MIT License.
|
|
5784
|
+
*/
|
|
5785
|
+
/**
|
|
5786
|
+
* Checks whether a value is a plain JSON-like object.
|
|
5787
|
+
* Allows objects with null prototypes, but rejects arrays and object subclasses.
|
|
5788
|
+
*/
|
|
5789
|
+
function isPlainObject(value) {
|
|
5790
|
+
if (typeof value !== "object" ||
|
|
5791
|
+
value === null ||
|
|
5792
|
+
Object.prototype.toString.call(value) !== "[object Object]") {
|
|
5793
|
+
return false;
|
|
5794
|
+
}
|
|
5795
|
+
if (Object.getPrototypeOf(value) === null) {
|
|
5796
|
+
return true;
|
|
5797
|
+
}
|
|
5798
|
+
let proto = value;
|
|
5799
|
+
while (Object.getPrototypeOf(proto) !== null) {
|
|
5800
|
+
proto = Object.getPrototypeOf(proto);
|
|
5801
|
+
}
|
|
5802
|
+
return Object.getPrototypeOf(value) === proto;
|
|
5803
|
+
}
|
|
5804
|
+
|
|
5805
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5806
|
+
/*
|
|
5807
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5808
|
+
* Licensed under the MIT License.
|
|
5809
|
+
*/
|
|
5810
|
+
const missingKidError = "missing_kid_error";
|
|
5811
|
+
const missingAlgError = "missing_alg_error";
|
|
5812
|
+
const missingJwkError = "missing_jwk_error";
|
|
5813
|
+
const invalidJwkError = "invalid_jwk_error";
|
|
5814
|
+
|
|
5815
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5816
|
+
|
|
5817
|
+
/*
|
|
5818
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5819
|
+
* Licensed under the MIT License.
|
|
5820
|
+
*/
|
|
5821
|
+
/** @internal */
|
|
5822
|
+
class JoseHeader {
|
|
5823
|
+
constructor(options, correlationId) {
|
|
5824
|
+
if (typeof options.alg !== "string" || !options.alg) {
|
|
5825
|
+
throw createJoseHeaderError(missingAlgError, correlationId);
|
|
5826
|
+
}
|
|
5827
|
+
this.typ = options.typ;
|
|
5828
|
+
this.alg = options.alg;
|
|
5829
|
+
this.kid = options.kid;
|
|
5830
|
+
this.jwk = options.jwk;
|
|
5831
|
+
}
|
|
5832
|
+
/**
|
|
5833
|
+
* Builds SignedHttpRequest formatted JOSE Header from the
|
|
5834
|
+
* JOSE Header options provided or previously set on the object.
|
|
5835
|
+
* Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
|
|
5836
|
+
* @param shrHeaderOptions
|
|
5837
|
+
* @param correlationId
|
|
5838
|
+
* @returns
|
|
5839
|
+
*/
|
|
5840
|
+
static getShrHeader(shrHeaderOptions, correlationId) {
|
|
5841
|
+
// KeyID is required on the SHR header
|
|
5842
|
+
if (!shrHeaderOptions.kid) {
|
|
5843
|
+
throw createJoseHeaderError(missingKidError, correlationId);
|
|
5844
|
+
}
|
|
5845
|
+
// Alg is required on the SHR header
|
|
5846
|
+
if (!shrHeaderOptions.alg) {
|
|
5847
|
+
throw createJoseHeaderError(missingAlgError, correlationId);
|
|
5848
|
+
}
|
|
5849
|
+
return new JoseHeader({
|
|
5850
|
+
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
|
|
5851
|
+
typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
|
|
5852
|
+
kid: shrHeaderOptions.kid,
|
|
5853
|
+
alg: shrHeaderOptions.alg,
|
|
5854
|
+
}, correlationId);
|
|
5855
|
+
}
|
|
5856
|
+
/**
|
|
5857
|
+
* Builds a DPoP formatted JOSE Header from the JOSE Header options provided.
|
|
5858
|
+
* Throws if public JWK or algorithm aren't provided since they are required for DPoP.
|
|
5859
|
+
* @param dpopHeaderOptions
|
|
5860
|
+
* @param correlationId
|
|
5861
|
+
* @returns
|
|
5862
|
+
*/
|
|
5863
|
+
static getDpopHeader(dpopHeaderOptions, correlationId) {
|
|
5864
|
+
if (!isPlainObject(dpopHeaderOptions.jwk)) {
|
|
5865
|
+
throw createJoseHeaderError(missingJwkError, correlationId);
|
|
5866
|
+
}
|
|
5867
|
+
if (!dpopHeaderOptions.alg) {
|
|
5868
|
+
throw createJoseHeaderError(missingAlgError, correlationId);
|
|
5869
|
+
}
|
|
5870
|
+
if (Object.keys(dpopHeaderOptions.jwk).length === 0) {
|
|
5871
|
+
throw createJoseHeaderError(invalidJwkError, correlationId);
|
|
5872
|
+
}
|
|
5873
|
+
return new JoseHeader({
|
|
5874
|
+
typ: JsonWebTokenTypes$1.Dpop,
|
|
5875
|
+
alg: dpopHeaderOptions.alg,
|
|
5876
|
+
jwk: dpopHeaderOptions.jwk,
|
|
5877
|
+
}, correlationId);
|
|
5878
|
+
}
|
|
5879
|
+
}
|
|
5880
|
+
|
|
5881
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5608
5882
|
|
|
5609
5883
|
/*
|
|
5610
5884
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5612,10 +5886,13 @@ function isOidcProtocolMode(config) {
|
|
|
5612
5886
|
*/
|
|
5613
5887
|
const KeyLocation = {
|
|
5614
5888
|
SW: "sw"};
|
|
5889
|
+
const SHR_TOKEN_BINDING_KEY_TYPE = "shr";
|
|
5890
|
+
const SHR_TOKEN_BINDING_KEY_ALGORITHM = JsonWebTokenAlgorithms.RS256;
|
|
5615
5891
|
/** @internal */
|
|
5616
5892
|
class PopTokenGenerator {
|
|
5617
|
-
constructor(cryptoUtils, performanceClient) {
|
|
5893
|
+
constructor(cryptoUtils, tokenBindingKeyManager, performanceClient) {
|
|
5618
5894
|
this.cryptoUtils = cryptoUtils;
|
|
5895
|
+
this.tokenBindingKeyManager = tokenBindingKeyManager;
|
|
5619
5896
|
this.performanceClient = performanceClient;
|
|
5620
5897
|
}
|
|
5621
5898
|
/**
|
|
@@ -5638,7 +5915,11 @@ class PopTokenGenerator {
|
|
|
5638
5915
|
* @returns
|
|
5639
5916
|
*/
|
|
5640
5917
|
async generateKid(request) {
|
|
5641
|
-
const kidThumbprint = await this.
|
|
5918
|
+
const kidThumbprint = await this.tokenBindingKeyManager.provisionTokenBindingKey({
|
|
5919
|
+
correlationId: request.correlationId,
|
|
5920
|
+
tokenBindingKeyType: SHR_TOKEN_BINDING_KEY_TYPE,
|
|
5921
|
+
tokenBindingKeyAlgorithm: SHR_TOKEN_BINDING_KEY_ALGORITHM,
|
|
5922
|
+
});
|
|
5642
5923
|
return {
|
|
5643
5924
|
kid: kidThumbprint,
|
|
5644
5925
|
xms_ksl: KeyLocation.SW,
|
|
@@ -5668,7 +5949,17 @@ class PopTokenGenerator {
|
|
|
5668
5949
|
? new UrlString(resourceRequestUri, request.correlationId)
|
|
5669
5950
|
: undefined;
|
|
5670
5951
|
const resourceUrlComponents = resourceUrlString?.getUrlComponents();
|
|
5671
|
-
|
|
5952
|
+
const publicKeyJwk = await this.tokenBindingKeyManager.getTokenBindingPublicKeyJwk(keyId, request.correlationId);
|
|
5953
|
+
const encodedKeyIdThumbprint = this.cryptoUtils.base64UrlEncode(JSON.stringify({ kid: keyId }));
|
|
5954
|
+
const shrAlgorithm = shrOptions?.header?.alg ||
|
|
5955
|
+
publicKeyJwk.alg ||
|
|
5956
|
+
SHR_TOKEN_BINDING_KEY_ALGORITHM;
|
|
5957
|
+
const shrHeader = JoseHeader.getShrHeader({
|
|
5958
|
+
...shrOptions?.header,
|
|
5959
|
+
alg: shrAlgorithm,
|
|
5960
|
+
kid: encodedKeyIdThumbprint,
|
|
5961
|
+
}, request.correlationId);
|
|
5962
|
+
const shrPayload = {
|
|
5672
5963
|
at: payload,
|
|
5673
5964
|
ts: nowSeconds(),
|
|
5674
5965
|
m: resourceRequestMethod?.toUpperCase(),
|
|
@@ -5680,11 +5971,15 @@ class PopTokenGenerator {
|
|
|
5680
5971
|
: undefined,
|
|
5681
5972
|
client_claims: shrClaims || undefined,
|
|
5682
5973
|
...claims,
|
|
5683
|
-
|
|
5974
|
+
cnf: {
|
|
5975
|
+
jwk: publicKeyJwk,
|
|
5976
|
+
},
|
|
5977
|
+
};
|
|
5978
|
+
return this.cryptoUtils.signTokenBindingJwt(shrHeader, shrPayload, keyId, request.correlationId);
|
|
5684
5979
|
}
|
|
5685
5980
|
}
|
|
5686
5981
|
|
|
5687
|
-
/*! @azure/msal-common v16.
|
|
5982
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5688
5983
|
/*
|
|
5689
5984
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5690
5985
|
* Licensed under the MIT License.
|
|
@@ -5748,7 +6043,7 @@ var InteractionRequiredAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
5748
6043
|
uiNotAllowed: uiNotAllowed
|
|
5749
6044
|
});
|
|
5750
6045
|
|
|
5751
|
-
/*! @azure/msal-common v16.
|
|
6046
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5752
6047
|
|
|
5753
6048
|
/*
|
|
5754
6049
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5815,7 +6110,7 @@ function createInteractionRequiredAuthError(errorCode, correlationId, errorMessa
|
|
|
5815
6110
|
return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
|
|
5816
6111
|
}
|
|
5817
6112
|
|
|
5818
|
-
/*! @azure/msal-common v16.
|
|
6113
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5819
6114
|
|
|
5820
6115
|
/*
|
|
5821
6116
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5834,7 +6129,7 @@ class ServerError extends AuthError {
|
|
|
5834
6129
|
}
|
|
5835
6130
|
}
|
|
5836
6131
|
|
|
5837
|
-
/*! @azure/msal-common v16.
|
|
6132
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5838
6133
|
|
|
5839
6134
|
/*
|
|
5840
6135
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5905,7 +6200,7 @@ function parseRequestState(base64Decode, state, correlationId) {
|
|
|
5905
6200
|
}
|
|
5906
6201
|
}
|
|
5907
6202
|
|
|
5908
|
-
/*! @azure/msal-common v16.
|
|
6203
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
5909
6204
|
|
|
5910
6205
|
/*
|
|
5911
6206
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -5916,10 +6211,11 @@ function parseRequestState(base64Decode, state, correlationId) {
|
|
|
5916
6211
|
* @internal
|
|
5917
6212
|
*/
|
|
5918
6213
|
class ResponseHandler {
|
|
5919
|
-
constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin) {
|
|
6214
|
+
constructor(clientId, cacheStorage, cryptoObj, logger, performanceClient, serializableCache, persistencePlugin, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER) {
|
|
5920
6215
|
this.clientId = clientId;
|
|
5921
6216
|
this.cacheStorage = cacheStorage;
|
|
5922
6217
|
this.cryptoObj = cryptoObj;
|
|
6218
|
+
this.tokenBindingKeyManager = tokenBindingKeyManager;
|
|
5923
6219
|
this.logger = logger;
|
|
5924
6220
|
this.performanceClient = performanceClient;
|
|
5925
6221
|
this.serializableCache = serializableCache;
|
|
@@ -5994,7 +6290,15 @@ class ResponseHandler {
|
|
|
5994
6290
|
// Add keyId from request to serverTokenResponse if defined
|
|
5995
6291
|
serverTokenResponse.key_id =
|
|
5996
6292
|
serverTokenResponse.key_id || request.sshKid || undefined;
|
|
5997
|
-
|
|
6293
|
+
// Compute components once for entity storage (fallback if hash not provided by client)
|
|
6294
|
+
const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
|
|
6295
|
+
const cacheKeyComponents = additionalCacheKeyComponents ??
|
|
6296
|
+
(attributeTokenPartition
|
|
6297
|
+
? {
|
|
6298
|
+
attribute_tokens: attributeTokenPartition,
|
|
6299
|
+
}
|
|
6300
|
+
: undefined);
|
|
6301
|
+
const cacheRecord = this.generateCacheRecord(serverTokenResponse, authority, reqTimestamp, request, idTokenClaims, userAssertionHash, authCodePayload, cacheKeyComponents);
|
|
5998
6302
|
let cacheContext;
|
|
5999
6303
|
try {
|
|
6000
6304
|
if (this.persistencePlugin && this.serializableCache) {
|
|
@@ -6020,7 +6324,12 @@ class ResponseHandler {
|
|
|
6020
6324
|
this.performanceClient?.addFields({
|
|
6021
6325
|
acntLoggedOut: true,
|
|
6022
6326
|
}, request.correlationId);
|
|
6023
|
-
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient,
|
|
6327
|
+
return await ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
|
|
6328
|
+
idTokenClaims,
|
|
6329
|
+
requestState: requestStateObj,
|
|
6330
|
+
requestId: serverRequestId,
|
|
6331
|
+
tokenBindingKeyManager: this.tokenBindingKeyManager,
|
|
6332
|
+
});
|
|
6024
6333
|
}
|
|
6025
6334
|
}
|
|
6026
6335
|
await this.cacheStorage.saveCacheRecord(cacheRecord, request.correlationId, isKmsi(idTokenClaims || {}), apiId, request.storeInCache);
|
|
@@ -6033,7 +6342,13 @@ class ResponseHandler {
|
|
|
6033
6342
|
await this.persistencePlugin.afterCacheAccess(cacheContext);
|
|
6034
6343
|
}
|
|
6035
6344
|
}
|
|
6036
|
-
return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient,
|
|
6345
|
+
return ResponseHandler.generateAuthenticationResult(this.cryptoObj, authority, cacheRecord, false, request, this.performanceClient, {
|
|
6346
|
+
idTokenClaims,
|
|
6347
|
+
requestState: requestStateObj,
|
|
6348
|
+
serverTokenResponse,
|
|
6349
|
+
requestId: serverRequestId,
|
|
6350
|
+
tokenBindingKeyManager: this.tokenBindingKeyManager,
|
|
6351
|
+
});
|
|
6037
6352
|
}
|
|
6038
6353
|
/**
|
|
6039
6354
|
* Generates CacheRecord
|
|
@@ -6129,7 +6444,8 @@ class ResponseHandler {
|
|
|
6129
6444
|
* @param fromTokenCache
|
|
6130
6445
|
* @param stateString
|
|
6131
6446
|
*/
|
|
6132
|
-
static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient,
|
|
6447
|
+
static async generateAuthenticationResult(cryptoObj, authority, cacheRecord, fromTokenCache, request, performanceClient, options = {}) {
|
|
6448
|
+
const { idTokenClaims, requestState, serverTokenResponse, requestId, tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER, } = options;
|
|
6133
6449
|
let accessToken = "";
|
|
6134
6450
|
let responseScopes = [];
|
|
6135
6451
|
let expiresOn = null;
|
|
@@ -6144,7 +6460,7 @@ class ResponseHandler {
|
|
|
6144
6460
|
if (cacheRecord.accessToken.tokenType ===
|
|
6145
6461
|
AuthenticationScheme$1.POP &&
|
|
6146
6462
|
!request.popKid) {
|
|
6147
|
-
const popTokenGenerator = new PopTokenGenerator(cryptoObj, performanceClient);
|
|
6463
|
+
const popTokenGenerator = new PopTokenGenerator(cryptoObj, tokenBindingKeyManager, performanceClient);
|
|
6148
6464
|
const { secret, keyId } = cacheRecord.accessToken;
|
|
6149
6465
|
if (!keyId) {
|
|
6150
6466
|
throw createClientAuthError(keyIdMissing, request.correlationId);
|
|
@@ -6256,7 +6572,7 @@ function buildAccountToCache(cacheStorage, authority, homeAccountId, base64Decod
|
|
|
6256
6572
|
return baseAccount;
|
|
6257
6573
|
}
|
|
6258
6574
|
|
|
6259
|
-
/*! @azure/msal-common v16.
|
|
6575
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6260
6576
|
/*
|
|
6261
6577
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6262
6578
|
* Licensed under the MIT License.
|
|
@@ -6266,7 +6582,7 @@ const CcsCredentialType = {
|
|
|
6266
6582
|
UPN: "UPN",
|
|
6267
6583
|
};
|
|
6268
6584
|
|
|
6269
|
-
/*! @azure/msal-common v16.
|
|
6585
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6270
6586
|
/*
|
|
6271
6587
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6272
6588
|
* Licensed under the MIT License.
|
|
@@ -6285,7 +6601,8 @@ async function getClientAssertion(clientAssertion, clientId, tokenEndpoint, fmiP
|
|
|
6285
6601
|
}
|
|
6286
6602
|
}
|
|
6287
6603
|
|
|
6288
|
-
/*! @azure/msal-common v16.
|
|
6604
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6605
|
+
|
|
6289
6606
|
/*
|
|
6290
6607
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
6291
6608
|
* Licensed under the MIT License.
|
|
@@ -6304,10 +6621,11 @@ function getRequestThumbprint(clientId, request, homeAccountId) {
|
|
|
6304
6621
|
sshKid: request.sshKid,
|
|
6305
6622
|
embeddedClientId: request.embeddedClientId || request.extraParameters?.clientId,
|
|
6306
6623
|
resource: request.resource,
|
|
6624
|
+
attributeTokens: serializeAttributeTokens(request.attributeTokens),
|
|
6307
6625
|
};
|
|
6308
6626
|
}
|
|
6309
6627
|
|
|
6310
|
-
/*! @azure/msal-common v16.
|
|
6628
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6311
6629
|
|
|
6312
6630
|
/*
|
|
6313
6631
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6393,7 +6711,7 @@ class ThrottlingUtils {
|
|
|
6393
6711
|
}
|
|
6394
6712
|
}
|
|
6395
6713
|
|
|
6396
|
-
/*! @azure/msal-common v16.
|
|
6714
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6397
6715
|
|
|
6398
6716
|
/*
|
|
6399
6717
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6424,7 +6742,7 @@ function createNetworkError(error, httpStatus, responseHeaders, additionalError)
|
|
|
6424
6742
|
return new NetworkError(error, httpStatus, responseHeaders);
|
|
6425
6743
|
}
|
|
6426
6744
|
|
|
6427
|
-
/*! @azure/msal-common v16.
|
|
6745
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6428
6746
|
|
|
6429
6747
|
/*
|
|
6430
6748
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6540,7 +6858,7 @@ async function sendPostRequest(thumbprint, tokenEndpoint, options, correlationId
|
|
|
6540
6858
|
return response;
|
|
6541
6859
|
}
|
|
6542
6860
|
|
|
6543
|
-
/*! @azure/msal-common v16.
|
|
6861
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6544
6862
|
|
|
6545
6863
|
/*
|
|
6546
6864
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -6590,7 +6908,7 @@ class AuthorizationCodeClient {
|
|
|
6590
6908
|
const response = await invokeAsync(this.executeTokenRequest.bind(this), AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request, this.serverTelemetryManager);
|
|
6591
6909
|
// Retrieve requestId from response headers
|
|
6592
6910
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
6593
|
-
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
|
|
6911
|
+
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
|
|
6594
6912
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
6595
6913
|
responseHandler.validateTokenResponse(response.body, request.correlationId);
|
|
6596
6914
|
return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, apiId, authCodePayload, undefined, undefined, undefined, requestId);
|
|
@@ -6661,6 +6979,12 @@ class AuthorizationCodeClient {
|
|
|
6661
6979
|
// Add scope array, parameter builder will add default scopes and dedupe
|
|
6662
6980
|
addScopes(parameters, request.scopes, request.correlationId, true, this.oidcDefaultScopes);
|
|
6663
6981
|
addResource(parameters, request.resource);
|
|
6982
|
+
if (request.attributeTokens) {
|
|
6983
|
+
addAttributeTokens(parameters, request.attributeTokens);
|
|
6984
|
+
}
|
|
6985
|
+
this.performanceClient?.addFields({
|
|
6986
|
+
hasAttributeTokens: !!request.attributeTokens?.length,
|
|
6987
|
+
}, request.correlationId);
|
|
6664
6988
|
// add code: user set, not validated
|
|
6665
6989
|
addAuthorizationCode(parameters, request.code);
|
|
6666
6990
|
// Add library metadata
|
|
@@ -6685,7 +7009,7 @@ class AuthorizationCodeClient {
|
|
|
6685
7009
|
addGrantType(parameters, GrantType.AUTHORIZATION_CODE_GRANT);
|
|
6686
7010
|
addClientInfo(parameters);
|
|
6687
7011
|
if (request.authenticationScheme === AuthenticationScheme$1.POP) {
|
|
6688
|
-
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
7012
|
+
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
|
|
6689
7013
|
let reqCnfData;
|
|
6690
7014
|
if (!request.popKid) {
|
|
6691
7015
|
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
@@ -6797,7 +7121,7 @@ class AuthorizationCodeClient {
|
|
|
6797
7121
|
}
|
|
6798
7122
|
}
|
|
6799
7123
|
|
|
6800
|
-
/*! @azure/msal-common v16.
|
|
7124
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
6801
7125
|
|
|
6802
7126
|
/*
|
|
6803
7127
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7024,76 +7348,7 @@ function extractLoginHint(account) {
|
|
|
7024
7348
|
return account.loginHint || account.idTokenClaims?.login_hint || null;
|
|
7025
7349
|
}
|
|
7026
7350
|
|
|
7027
|
-
/*! @azure/msal-common v16.
|
|
7028
|
-
|
|
7029
|
-
/*
|
|
7030
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7031
|
-
* Licensed under the MIT License.
|
|
7032
|
-
*/
|
|
7033
|
-
/**
|
|
7034
|
-
* Error thrown when there is an error in the client code running on the browser.
|
|
7035
|
-
*/
|
|
7036
|
-
class JoseHeaderError extends AuthError {
|
|
7037
|
-
constructor(errorCode, correlationId, errorMessage) {
|
|
7038
|
-
super(errorCode, correlationId, errorMessage);
|
|
7039
|
-
this.name = "JoseHeaderError";
|
|
7040
|
-
Object.setPrototypeOf(this, JoseHeaderError.prototype);
|
|
7041
|
-
}
|
|
7042
|
-
}
|
|
7043
|
-
/** Returns JoseHeaderError object */
|
|
7044
|
-
function createJoseHeaderError(code, correlationId) {
|
|
7045
|
-
return new JoseHeaderError(code, correlationId);
|
|
7046
|
-
}
|
|
7047
|
-
|
|
7048
|
-
/*! @azure/msal-common v16.11.3 2026-07-29 */
|
|
7049
|
-
/*
|
|
7050
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7051
|
-
* Licensed under the MIT License.
|
|
7052
|
-
*/
|
|
7053
|
-
const missingKidError = "missing_kid_error";
|
|
7054
|
-
const missingAlgError = "missing_alg_error";
|
|
7055
|
-
|
|
7056
|
-
/*! @azure/msal-common v16.11.3 2026-07-29 */
|
|
7057
|
-
|
|
7058
|
-
/*
|
|
7059
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
7060
|
-
* Licensed under the MIT License.
|
|
7061
|
-
*/
|
|
7062
|
-
/** @internal */
|
|
7063
|
-
class JoseHeader {
|
|
7064
|
-
constructor(options) {
|
|
7065
|
-
this.typ = options.typ;
|
|
7066
|
-
this.alg = options.alg;
|
|
7067
|
-
this.kid = options.kid;
|
|
7068
|
-
}
|
|
7069
|
-
/**
|
|
7070
|
-
* Builds SignedHttpRequest formatted JOSE Header from the
|
|
7071
|
-
* JOSE Header options provided or previously set on the object and returns
|
|
7072
|
-
* the stringified header object.
|
|
7073
|
-
* Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
|
|
7074
|
-
* @param shrHeaderOptions
|
|
7075
|
-
* @returns
|
|
7076
|
-
*/
|
|
7077
|
-
static getShrHeaderString(shrHeaderOptions) {
|
|
7078
|
-
// KeyID is required on the SHR header
|
|
7079
|
-
if (!shrHeaderOptions.kid) {
|
|
7080
|
-
throw createJoseHeaderError(missingKidError, "");
|
|
7081
|
-
}
|
|
7082
|
-
// Alg is required on the SHR header
|
|
7083
|
-
if (!shrHeaderOptions.alg) {
|
|
7084
|
-
throw createJoseHeaderError(missingAlgError, "");
|
|
7085
|
-
}
|
|
7086
|
-
const shrHeader = new JoseHeader({
|
|
7087
|
-
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
|
|
7088
|
-
typ: shrHeaderOptions.typ || JsonWebTokenTypes$1.Pop,
|
|
7089
|
-
kid: shrHeaderOptions.kid,
|
|
7090
|
-
alg: shrHeaderOptions.alg,
|
|
7091
|
-
});
|
|
7092
|
-
return JSON.stringify(shrHeader);
|
|
7093
|
-
}
|
|
7094
|
-
}
|
|
7095
|
-
|
|
7096
|
-
/*! @azure/msal-common v16.11.3 2026-07-29 */
|
|
7351
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
7097
7352
|
|
|
7098
7353
|
/*
|
|
7099
7354
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7642,7 +7897,7 @@ class PerformanceClient {
|
|
|
7642
7897
|
}
|
|
7643
7898
|
}
|
|
7644
7899
|
|
|
7645
|
-
/*! @azure/msal-common v16.
|
|
7900
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
7646
7901
|
|
|
7647
7902
|
/*
|
|
7648
7903
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -7677,7 +7932,7 @@ class RefreshTokenClient {
|
|
|
7677
7932
|
const response = await invokeAsync(this.executeTokenRequest.bind(this), RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);
|
|
7678
7933
|
// Retrieve requestId from response headers
|
|
7679
7934
|
const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];
|
|
7680
|
-
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin);
|
|
7935
|
+
const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.performanceClient, this.config.serializableCache, this.config.persistencePlugin, this.config.tokenBindingKeyManager);
|
|
7681
7936
|
responseHandler.validateTokenResponse(response.body, request.correlationId);
|
|
7682
7937
|
return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, apiId, undefined, undefined, true, request.forceCache, requestId);
|
|
7683
7938
|
}
|
|
@@ -7803,6 +8058,12 @@ class RefreshTokenClient {
|
|
|
7803
8058
|
addServerTelemetry(parameters, this.serverTelemetryManager);
|
|
7804
8059
|
}
|
|
7805
8060
|
addRefreshToken(parameters, request.refreshToken);
|
|
8061
|
+
if (request.attributeTokens) {
|
|
8062
|
+
addAttributeTokens(parameters, request.attributeTokens);
|
|
8063
|
+
}
|
|
8064
|
+
this.performanceClient?.addFields({
|
|
8065
|
+
hasAttributeTokens: !!request.attributeTokens?.length,
|
|
8066
|
+
}, request.correlationId);
|
|
7806
8067
|
if (this.config.clientCredentials.clientSecret) {
|
|
7807
8068
|
addClientSecret(parameters, this.config.clientCredentials.clientSecret);
|
|
7808
8069
|
}
|
|
@@ -7812,7 +8073,7 @@ class RefreshTokenClient {
|
|
|
7812
8073
|
addClientAssertionType(parameters, clientAssertion.assertionType);
|
|
7813
8074
|
}
|
|
7814
8075
|
if (request.authenticationScheme === AuthenticationScheme$1.POP) {
|
|
7815
|
-
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);
|
|
8076
|
+
const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.config.tokenBindingKeyManager, this.performanceClient);
|
|
7816
8077
|
let reqCnfData;
|
|
7817
8078
|
if (!request.popKid) {
|
|
7818
8079
|
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);
|
|
@@ -7863,7 +8124,7 @@ class RefreshTokenClient {
|
|
|
7863
8124
|
}
|
|
7864
8125
|
}
|
|
7865
8126
|
|
|
7866
|
-
/*! @azure/msal-common v16.
|
|
8127
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
7867
8128
|
|
|
7868
8129
|
/*
|
|
7869
8130
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8156,7 +8417,7 @@ class StubServerTelemetryManager extends ServerTelemetryManager {
|
|
|
8156
8417
|
clearNativeBrokerErrorCode() { }
|
|
8157
8418
|
}
|
|
8158
8419
|
|
|
8159
|
-
/*! @azure/msal-common v16.
|
|
8420
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
8160
8421
|
|
|
8161
8422
|
/*
|
|
8162
8423
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8260,11 +8521,14 @@ class SilentFlowClient {
|
|
|
8260
8521
|
if (cacheRecord.idToken) {
|
|
8261
8522
|
idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode, request.correlationId);
|
|
8262
8523
|
}
|
|
8263
|
-
return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient,
|
|
8524
|
+
return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, this.performanceClient, {
|
|
8525
|
+
idTokenClaims,
|
|
8526
|
+
tokenBindingKeyManager: this.config.tokenBindingKeyManager,
|
|
8527
|
+
});
|
|
8264
8528
|
}
|
|
8265
8529
|
}
|
|
8266
8530
|
|
|
8267
|
-
/*! @azure/msal-common v16.
|
|
8531
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
8268
8532
|
|
|
8269
8533
|
/*
|
|
8270
8534
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8280,7 +8544,7 @@ const StubbedNetworkModule = {
|
|
|
8280
8544
|
},
|
|
8281
8545
|
};
|
|
8282
8546
|
|
|
8283
|
-
/*! @azure/msal-common v16.
|
|
8547
|
+
/*! @azure/msal-common v16.13.0 2026-08-18 */
|
|
8284
8548
|
|
|
8285
8549
|
/*
|
|
8286
8550
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -8333,13 +8597,13 @@ const AcquireTokenByRefreshToken = "acquireTokenByRefreshToken";
|
|
|
8333
8597
|
*/
|
|
8334
8598
|
const AcquireTokenSilentAsync = "acquireTokenSilentAsync";
|
|
8335
8599
|
/**
|
|
8336
|
-
*
|
|
8337
|
-
* Used to
|
|
8600
|
+
* provisionTokenBindingKey API in TokenBindingKeyManager class (msal-browser).
|
|
8601
|
+
* Used to provision token-binding key material and return a key identifier.
|
|
8338
8602
|
*/
|
|
8339
8603
|
const CryptoOptsGetPublicKeyThumbprint = "cryptoOptsGetPublicKeyThumbprint";
|
|
8340
8604
|
/**
|
|
8341
|
-
*
|
|
8342
|
-
* Used to
|
|
8605
|
+
* signTokenBindingJwt API in CryptoOpts class (msal-browser).
|
|
8606
|
+
* Used to sign token-binding JWTs.
|
|
8343
8607
|
*/
|
|
8344
8608
|
const CryptoOptsSignJwt = "cryptoOptsSignJwt";
|
|
8345
8609
|
/**
|
|
@@ -8496,6 +8760,9 @@ const uninitializedPublicClientApplication = "uninitialized_public_client_applic
|
|
|
8496
8760
|
const nativePromptNotSupported = "native_prompt_not_supported";
|
|
8497
8761
|
const invalidBase64String = "invalid_base64_string";
|
|
8498
8762
|
const invalidPopTokenRequest = "invalid_pop_token_request";
|
|
8763
|
+
const unsupportedTokenBindingAlgorithm = "unsupported_token_binding_algorithm";
|
|
8764
|
+
const tokenBindingKeyAlgorithmMismatch = "token_binding_key_algorithm_mismatch";
|
|
8765
|
+
const tokenBindingKeyJwkThumbprintMismatch = "token_binding_key_jwk_thumbprint_mismatch";
|
|
8499
8766
|
const failedToBuildHeaders = "failed_to_build_headers";
|
|
8500
8767
|
const failedToParseHeaders = "failed_to_parse_headers";
|
|
8501
8768
|
const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
|
|
@@ -8552,11 +8819,14 @@ var BrowserAuthErrorCodes = /*#__PURE__*/Object.freeze({
|
|
|
8552
8819
|
spaCodeAndNativeAccountIdPresent: spaCodeAndNativeAccountIdPresent,
|
|
8553
8820
|
stateInteractionTypeMismatch: stateInteractionTypeMismatch,
|
|
8554
8821
|
timedOut: timedOut,
|
|
8822
|
+
tokenBindingKeyAlgorithmMismatch: tokenBindingKeyAlgorithmMismatch,
|
|
8823
|
+
tokenBindingKeyJwkThumbprintMismatch: tokenBindingKeyJwkThumbprintMismatch,
|
|
8555
8824
|
unableToAcquireTokenFromNativePlatform: unableToAcquireTokenFromNativePlatform,
|
|
8556
8825
|
unableToLoadToken: unableToLoadToken,
|
|
8557
8826
|
unableToParseState: unableToParseState,
|
|
8558
8827
|
unableToParseTokenRequestCacheError: unableToParseTokenRequestCacheError,
|
|
8559
8828
|
uninitializedPublicClientApplication: uninitializedPublicClientApplication,
|
|
8829
|
+
unsupportedTokenBindingAlgorithm: unsupportedTokenBindingAlgorithm,
|
|
8560
8830
|
userCancelled: userCancelled
|
|
8561
8831
|
});
|
|
8562
8832
|
|
|
@@ -8894,6 +9164,8 @@ const AES_GCM = "AES-GCM";
|
|
|
8894
9164
|
const HKDF = "HKDF";
|
|
8895
9165
|
// SHA-256 hashing algorithm
|
|
8896
9166
|
const S256_HASH_ALG = "SHA-256";
|
|
9167
|
+
// JWK values used by browser-internal WebCrypto helpers.
|
|
9168
|
+
const JSON_WEB_KEY_CURVE_P256 = "P-256";
|
|
8897
9169
|
const JSON_WEB_KEY_TYPE_EC = "EC";
|
|
8898
9170
|
const JSON_WEB_KEY_TYPE_RSA = "RSA";
|
|
8899
9171
|
const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
|
|
@@ -8925,6 +9197,14 @@ const RSA_KEYGEN_ALGORITHM_OPTIONS = {
|
|
|
8925
9197
|
const RSA_SIGN_ALGORITHM_OPTIONS = {
|
|
8926
9198
|
name: PKCS1_V15_KEYGEN_ALG,
|
|
8927
9199
|
};
|
|
9200
|
+
const ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS = {
|
|
9201
|
+
name: "ECDSA",
|
|
9202
|
+
namedCurve: JSON_WEB_KEY_CURVE_P256,
|
|
9203
|
+
};
|
|
9204
|
+
const ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS = {
|
|
9205
|
+
name: "ECDSA",
|
|
9206
|
+
hash: { name: S256_HASH_ALG },
|
|
9207
|
+
};
|
|
8928
9208
|
/**
|
|
8929
9209
|
* Check whether browser crypto is available.
|
|
8930
9210
|
*/
|
|
@@ -9023,16 +9303,6 @@ async function generateKeyPair(extractable, usages, algorithm) {
|
|
|
9023
9303
|
async function exportJwk(key) {
|
|
9024
9304
|
return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
|
|
9025
9305
|
}
|
|
9026
|
-
/**
|
|
9027
|
-
* Imports key as Json Web Key (JWK), can set extractable and usages.
|
|
9028
|
-
* @param key
|
|
9029
|
-
* @param extractable
|
|
9030
|
-
* @param usages
|
|
9031
|
-
* @param algorithm
|
|
9032
|
-
*/
|
|
9033
|
-
async function importJwk(key, extractable, usages, algorithm) {
|
|
9034
|
-
return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, algorithm, extractable, usages);
|
|
9035
|
-
}
|
|
9036
9306
|
/**
|
|
9037
9307
|
* Signs given data with given key.
|
|
9038
9308
|
* @param key
|
|
@@ -9188,22 +9458,22 @@ const JWK_THUMBPRINT_REQUIRED_MEMBERS = {
|
|
|
9188
9458
|
[JSON_WEB_KEY_TYPE_EC]: ["crv", "kty", "x", "y"],
|
|
9189
9459
|
[JSON_WEB_KEY_TYPE_RSA]: ["e", "kty", "n"],
|
|
9190
9460
|
};
|
|
9191
|
-
function getJwkThumbprintMembers(publicJwk) {
|
|
9461
|
+
function getJwkThumbprintMembers(publicJwk, correlationId) {
|
|
9192
9462
|
const kty = publicJwk.kty;
|
|
9193
9463
|
if (typeof kty !== "string" || kty.length === 0) {
|
|
9194
|
-
throw createBrowserAuthError(invalidPublicJwk,
|
|
9464
|
+
throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_KTY_SUBERROR);
|
|
9195
9465
|
}
|
|
9196
9466
|
const requiredMembers = JWK_THUMBPRINT_REQUIRED_MEMBERS[kty];
|
|
9197
9467
|
if (!requiredMembers) {
|
|
9198
|
-
throw createBrowserAuthError(invalidPublicJwk,
|
|
9468
|
+
throw createBrowserAuthError(invalidPublicJwk, correlationId, UNSUPPORTED_JWK_KTY_SUBERROR);
|
|
9199
9469
|
}
|
|
9200
9470
|
return requiredMembers.reduce((thumbprintMembers, memberName) => {
|
|
9201
9471
|
const memberValue = publicJwk[memberName];
|
|
9202
9472
|
if (typeof memberValue !== "string") {
|
|
9203
|
-
throw createBrowserAuthError(invalidPublicJwk,
|
|
9473
|
+
throw createBrowserAuthError(invalidPublicJwk, correlationId, MISSING_JWK_MEMBER_SUBERROR);
|
|
9204
9474
|
}
|
|
9205
9475
|
if (memberValue.length === 0) {
|
|
9206
|
-
throw createBrowserAuthError(invalidPublicJwk,
|
|
9476
|
+
throw createBrowserAuthError(invalidPublicJwk, correlationId, EMPTY_JWK_MEMBER_SUBERROR);
|
|
9207
9477
|
}
|
|
9208
9478
|
thumbprintMembers[memberName] = memberValue;
|
|
9209
9479
|
return thumbprintMembers;
|
|
@@ -9215,8 +9485,8 @@ function getJwkThumbprintMembers(publicJwk) {
|
|
|
9215
9485
|
* and the SHA-256 digest is returned as a base64url string.
|
|
9216
9486
|
* @internal
|
|
9217
9487
|
*/
|
|
9218
|
-
async function computeJwkThumbprint(publicJwk) {
|
|
9219
|
-
const thumbprintMembers = getJwkThumbprintMembers(publicJwk);
|
|
9488
|
+
async function computeJwkThumbprint(publicJwk, correlationId) {
|
|
9489
|
+
const thumbprintMembers = getJwkThumbprintMembers(publicJwk, correlationId);
|
|
9220
9490
|
// RFC 7638 §3.3: use only required members, sorted lexicographically
|
|
9221
9491
|
const thumbprintJson = JSON.stringify(thumbprintMembers, Object.keys(thumbprintMembers).sort());
|
|
9222
9492
|
return hashString(thumbprintJson);
|
|
@@ -9950,22 +10220,19 @@ class AsyncMemoryStorage {
|
|
|
9950
10220
|
}
|
|
9951
10221
|
}
|
|
9952
10222
|
/**
|
|
9953
|
-
* Get all
|
|
9954
|
-
* asynchronous storage object.
|
|
10223
|
+
* Get all keys from both in-memory and persistent storage.
|
|
9955
10224
|
* @param correlationId
|
|
9956
10225
|
*/
|
|
9957
10226
|
async getKeys(correlationId) {
|
|
9958
10227
|
const cacheKeys = this.inMemoryCache.getKeys();
|
|
9959
|
-
|
|
9960
|
-
|
|
9961
|
-
|
|
9962
|
-
|
|
9963
|
-
|
|
9964
|
-
|
|
9965
|
-
|
|
9966
|
-
}
|
|
10228
|
+
try {
|
|
10229
|
+
const persistentCacheKeys = await this.indexedDBCache.getKeys();
|
|
10230
|
+
return Array.from(new Set([...cacheKeys, ...persistentCacheKeys]));
|
|
10231
|
+
}
|
|
10232
|
+
catch (e) {
|
|
10233
|
+
this.handleDatabaseAccessError(e, correlationId);
|
|
10234
|
+
return cacheKeys;
|
|
9967
10235
|
}
|
|
9968
|
-
return cacheKeys;
|
|
9969
10236
|
}
|
|
9970
10237
|
/**
|
|
9971
10238
|
* Returns true or false if the given key is present in the cache.
|
|
@@ -10016,6 +10283,152 @@ class AsyncMemoryStorage {
|
|
|
10016
10283
|
}
|
|
10017
10284
|
}
|
|
10018
10285
|
|
|
10286
|
+
/*
|
|
10287
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10288
|
+
* Licensed under the MIT License.
|
|
10289
|
+
*/
|
|
10290
|
+
/**
|
|
10291
|
+
* Owns browser token-binding key lifecycle and storage lookup.
|
|
10292
|
+
* @internal
|
|
10293
|
+
*/
|
|
10294
|
+
class TokenBindingKeyManager {
|
|
10295
|
+
constructor(logger, performanceClient) {
|
|
10296
|
+
this.logger = logger;
|
|
10297
|
+
this.cache = TokenBindingKeyManager.getTokenBindingKeyStorage(this.logger);
|
|
10298
|
+
this.performanceClient = performanceClient;
|
|
10299
|
+
}
|
|
10300
|
+
static getTokenBindingKeyStorage(logger) {
|
|
10301
|
+
if (!TokenBindingKeyManager.tokenBindingKeyStorage) {
|
|
10302
|
+
TokenBindingKeyManager.tokenBindingKeyStorage =
|
|
10303
|
+
new AsyncMemoryStorage(logger);
|
|
10304
|
+
}
|
|
10305
|
+
return TokenBindingKeyManager.tokenBindingKeyStorage;
|
|
10306
|
+
}
|
|
10307
|
+
/**
|
|
10308
|
+
* Provisions a browser token-binding key and returns its key identifier.
|
|
10309
|
+
* @param request - Key provisioning policy.
|
|
10310
|
+
*/
|
|
10311
|
+
async provisionTokenBindingKey(request) {
|
|
10312
|
+
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
|
|
10313
|
+
try {
|
|
10314
|
+
const activeKeyPair = await this.createTokenBindingKey(request);
|
|
10315
|
+
publicKeyThumbMeasurement?.end({
|
|
10316
|
+
success: true,
|
|
10317
|
+
...this.getTokenBindingKeyTelemetry(activeKeyPair),
|
|
10318
|
+
});
|
|
10319
|
+
return activeKeyPair.keyId;
|
|
10320
|
+
}
|
|
10321
|
+
catch (e) {
|
|
10322
|
+
publicKeyThumbMeasurement?.end({
|
|
10323
|
+
success: false,
|
|
10324
|
+
tokenBindingKeyType: request.tokenBindingKeyType,
|
|
10325
|
+
tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
|
|
10326
|
+
});
|
|
10327
|
+
throw e;
|
|
10328
|
+
}
|
|
10329
|
+
}
|
|
10330
|
+
/**
|
|
10331
|
+
* Removes a browser token-binding key by identifier.
|
|
10332
|
+
* @param kid - Token-binding key identifier.
|
|
10333
|
+
* @param correlationId - Request correlation identifier.
|
|
10334
|
+
*/
|
|
10335
|
+
async removeTokenBindingKey(kid, correlationId) {
|
|
10336
|
+
await this.cache.removeItem(kid, correlationId);
|
|
10337
|
+
const keyFound = await this.cache.containsKey(kid, correlationId);
|
|
10338
|
+
if (keyFound) {
|
|
10339
|
+
throw createClientAuthError(bindingKeyNotRemoved, correlationId);
|
|
10340
|
+
}
|
|
10341
|
+
}
|
|
10342
|
+
/**
|
|
10343
|
+
* Clears browser token-binding keys from memory and persistent storage.
|
|
10344
|
+
* @param correlationId - Request correlation identifier.
|
|
10345
|
+
*/
|
|
10346
|
+
async clearKeystore(correlationId) {
|
|
10347
|
+
this.cache.clearInMemory(correlationId);
|
|
10348
|
+
try {
|
|
10349
|
+
await this.cache.clearPersistent(correlationId);
|
|
10350
|
+
return true;
|
|
10351
|
+
}
|
|
10352
|
+
catch (e) {
|
|
10353
|
+
if (e instanceof Error) {
|
|
10354
|
+
this.logger.error(`1owpn8 ${e.message}`, correlationId);
|
|
10355
|
+
}
|
|
10356
|
+
else {
|
|
10357
|
+
this.logger.error("0yrmwo", correlationId);
|
|
10358
|
+
}
|
|
10359
|
+
return false;
|
|
10360
|
+
}
|
|
10361
|
+
}
|
|
10362
|
+
/**
|
|
10363
|
+
* Gets a token-binding public key as a JWK by identifier.
|
|
10364
|
+
* @param keyId - Token-binding key identifier.
|
|
10365
|
+
* @param correlationId - Request correlation identifier.
|
|
10366
|
+
*/
|
|
10367
|
+
async getTokenBindingPublicKeyJwk(keyId, correlationId) {
|
|
10368
|
+
const cachedKeyPair = await this.getTokenBindingKeyPair(keyId, correlationId);
|
|
10369
|
+
return exportJwk(cachedKeyPair.publicKey);
|
|
10370
|
+
}
|
|
10371
|
+
async createTokenBindingKey(request) {
|
|
10372
|
+
const keyGenAlgorithm = this.getTokenBindingKeyGenAlgorithmOptions(request.tokenBindingKeyAlgorithm, request.correlationId);
|
|
10373
|
+
const generatedKeyPair = await this.generateKeyPairAndThumbprint(TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES, keyGenAlgorithm, request.correlationId);
|
|
10374
|
+
await this.cache.setItem(generatedKeyPair.keyId, {
|
|
10375
|
+
...generatedKeyPair,
|
|
10376
|
+
tokenBindingKeyType: request.tokenBindingKeyType,
|
|
10377
|
+
tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
|
|
10378
|
+
}, request.correlationId);
|
|
10379
|
+
return {
|
|
10380
|
+
...generatedKeyPair,
|
|
10381
|
+
tokenBindingKeyType: request.tokenBindingKeyType,
|
|
10382
|
+
tokenBindingKeyAlgorithm: request.tokenBindingKeyAlgorithm,
|
|
10383
|
+
};
|
|
10384
|
+
}
|
|
10385
|
+
async generateKeyPairAndThumbprint(usages, keyGenAlgorithm, correlationId) {
|
|
10386
|
+
const keyPair = await generateKeyPair(false, usages, keyGenAlgorithm);
|
|
10387
|
+
const publicJwk = await exportJwk(keyPair.publicKey);
|
|
10388
|
+
const keyId = await computeJwkThumbprint(publicJwk, correlationId);
|
|
10389
|
+
return {
|
|
10390
|
+
publicKey: keyPair.publicKey,
|
|
10391
|
+
privateKey: keyPair.privateKey,
|
|
10392
|
+
keyId,
|
|
10393
|
+
};
|
|
10394
|
+
}
|
|
10395
|
+
/** @internal */
|
|
10396
|
+
async getTokenBindingKeyPair(keyId, correlationId) {
|
|
10397
|
+
const cachedKeyPair = await this.cache.getItem(keyId, correlationId);
|
|
10398
|
+
if (!cachedKeyPair) {
|
|
10399
|
+
throw createBrowserAuthError(cryptoKeyNotFound, correlationId);
|
|
10400
|
+
}
|
|
10401
|
+
return cachedKeyPair;
|
|
10402
|
+
}
|
|
10403
|
+
/** @internal */
|
|
10404
|
+
getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
|
|
10405
|
+
return {
|
|
10406
|
+
...(cachedKeyPair.tokenBindingKeyType && {
|
|
10407
|
+
tokenBindingKeyType: cachedKeyPair.tokenBindingKeyType,
|
|
10408
|
+
}),
|
|
10409
|
+
...(cachedKeyPair.tokenBindingKeyAlgorithm || fallbackAlgorithm
|
|
10410
|
+
? {
|
|
10411
|
+
tokenBindingKeyAlgorithm: cachedKeyPair.tokenBindingKeyAlgorithm ||
|
|
10412
|
+
fallbackAlgorithm,
|
|
10413
|
+
}
|
|
10414
|
+
: {}),
|
|
10415
|
+
};
|
|
10416
|
+
}
|
|
10417
|
+
getTokenBindingKeyGenAlgorithmOptions(tokenBindingKeyAlgorithm, correlationId) {
|
|
10418
|
+
if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.RS256) {
|
|
10419
|
+
return RSA_KEYGEN_ALGORITHM_OPTIONS;
|
|
10420
|
+
}
|
|
10421
|
+
if (tokenBindingKeyAlgorithm === JsonWebTokenAlgorithms.ES256) {
|
|
10422
|
+
return ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS;
|
|
10423
|
+
}
|
|
10424
|
+
throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
|
|
10425
|
+
}
|
|
10426
|
+
}
|
|
10427
|
+
TokenBindingKeyManager.TOKEN_BINDING_KEY_USAGES = [
|
|
10428
|
+
"sign",
|
|
10429
|
+
"verify",
|
|
10430
|
+
];
|
|
10431
|
+
|
|
10019
10432
|
/*
|
|
10020
10433
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
10021
10434
|
* Licensed under the MIT License.
|
|
@@ -10029,8 +10442,8 @@ class CryptoOps {
|
|
|
10029
10442
|
this.logger = logger;
|
|
10030
10443
|
// Browser crypto needs to be validated first before any other classes can be set.
|
|
10031
10444
|
validateCryptoAvailable(skipValidateSubtleCrypto ?? false);
|
|
10032
|
-
this.cache = new AsyncMemoryStorage(this.logger);
|
|
10033
10445
|
this.performanceClient = performanceClient;
|
|
10446
|
+
this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
|
|
10034
10447
|
}
|
|
10035
10448
|
/**
|
|
10036
10449
|
* Creates a new random GUID - used to populate state and nonce.
|
|
@@ -10068,114 +10481,45 @@ class CryptoOps {
|
|
|
10068
10481
|
encodeKid(inputKid) {
|
|
10069
10482
|
return this.base64UrlEncode(JSON.stringify({ kid: inputKid }));
|
|
10070
10483
|
}
|
|
10071
|
-
/**
|
|
10072
|
-
* Generates a keypair, stores it and returns a thumbprint
|
|
10073
|
-
* @param request
|
|
10074
|
-
*/
|
|
10075
|
-
async getPublicKeyThumbprint(request) {
|
|
10076
|
-
const publicKeyThumbMeasurement = this.performanceClient?.startMeasurement(CryptoOptsGetPublicKeyThumbprint, request.correlationId);
|
|
10077
|
-
// Generate Keypair
|
|
10078
|
-
const keyPair = await generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES, RSA_KEYGEN_ALGORITHM_OPTIONS);
|
|
10079
|
-
// Generate Thumbprint for Public Key
|
|
10080
|
-
const publicKeyJwk = await exportJwk(keyPair.publicKey);
|
|
10081
|
-
const publicJwkHash = await computeJwkThumbprint(publicKeyJwk);
|
|
10082
|
-
// Generate Thumbprint for Private Key
|
|
10083
|
-
const privateKeyJwk = await exportJwk(keyPair.privateKey);
|
|
10084
|
-
// Re-import private key to make it unextractable
|
|
10085
|
-
const unextractablePrivateKey = await importJwk(privateKeyJwk, false, ["sign"], RSA_KEYGEN_ALGORITHM_OPTIONS);
|
|
10086
|
-
// Store Keypair data in keystore
|
|
10087
|
-
await this.cache.setItem(publicJwkHash, {
|
|
10088
|
-
privateKey: unextractablePrivateKey,
|
|
10089
|
-
publicKey: keyPair.publicKey,
|
|
10090
|
-
requestMethod: request.resourceRequestMethod,
|
|
10091
|
-
requestUri: request.resourceRequestUri,
|
|
10092
|
-
}, request.correlationId);
|
|
10093
|
-
if (publicKeyThumbMeasurement) {
|
|
10094
|
-
publicKeyThumbMeasurement.end({
|
|
10095
|
-
success: true,
|
|
10096
|
-
});
|
|
10097
|
-
}
|
|
10098
|
-
return publicJwkHash;
|
|
10099
|
-
}
|
|
10100
10484
|
/**
|
|
10101
10485
|
* Removes cryptographic keypair from key store matching the keyId passed in
|
|
10102
10486
|
* @param kid
|
|
10103
10487
|
* @param correlationId
|
|
10104
10488
|
*/
|
|
10105
10489
|
async removeTokenBindingKey(kid, correlationId) {
|
|
10106
|
-
await this.
|
|
10107
|
-
const keyFound = await this.cache.containsKey(kid, correlationId);
|
|
10108
|
-
if (keyFound) {
|
|
10109
|
-
throw createClientAuthError(bindingKeyNotRemoved, correlationId);
|
|
10110
|
-
}
|
|
10490
|
+
await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
|
|
10111
10491
|
}
|
|
10112
10492
|
/**
|
|
10113
10493
|
* Removes all cryptographic keys from IndexedDB storage
|
|
10114
10494
|
* @param correlationId
|
|
10115
10495
|
*/
|
|
10116
10496
|
async clearKeystore(correlationId) {
|
|
10117
|
-
|
|
10118
|
-
|
|
10119
|
-
|
|
10120
|
-
|
|
10121
|
-
|
|
10122
|
-
|
|
10497
|
+
return this.tokenBindingKeyManager.clearKeystore(correlationId);
|
|
10498
|
+
}
|
|
10499
|
+
/** @internal */
|
|
10500
|
+
async signTokenBindingJwt(header, payload, kid, correlationId) {
|
|
10501
|
+
let telemetry = {};
|
|
10502
|
+
const signTokenBindingJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
|
|
10123
10503
|
try {
|
|
10124
|
-
await this.
|
|
10125
|
-
|
|
10504
|
+
const cachedKeyPair = await this.tokenBindingKeyManager.getTokenBindingKeyPair(kid, correlationId);
|
|
10505
|
+
await this.validateTokenBindingJwtHeaderKey(header, kid, correlationId);
|
|
10506
|
+
telemetry = this.tokenBindingKeyManager.getTokenBindingKeyTelemetry(cachedKeyPair, header.alg);
|
|
10507
|
+
const signingAlgorithm = this.getTokenBindingKeySigningAlgorithm(cachedKeyPair, header.alg, correlationId);
|
|
10508
|
+
const tokenString = `${urlEncode(JSON.stringify(header))}.${urlEncode(JSON.stringify(payload))}`;
|
|
10509
|
+
const encodedSignature = await this.signInput(cachedKeyPair, tokenString, signingAlgorithm);
|
|
10510
|
+
signTokenBindingJwtMeasurement?.end({
|
|
10511
|
+
success: true,
|
|
10512
|
+
...telemetry,
|
|
10513
|
+
});
|
|
10514
|
+
return `${tokenString}.${encodedSignature}`;
|
|
10126
10515
|
}
|
|
10127
10516
|
catch (e) {
|
|
10128
|
-
|
|
10129
|
-
|
|
10130
|
-
|
|
10131
|
-
else {
|
|
10132
|
-
this.logger.error("0yrmwo", correlationId);
|
|
10133
|
-
}
|
|
10134
|
-
return false;
|
|
10135
|
-
}
|
|
10136
|
-
}
|
|
10137
|
-
/**
|
|
10138
|
-
* Signs the given object as a jwt payload with private key retrieved by given kid.
|
|
10139
|
-
* @param payload
|
|
10140
|
-
* @param kid
|
|
10141
|
-
*/
|
|
10142
|
-
async signJwt(payload, kid, shrOptions, correlationId) {
|
|
10143
|
-
const signJwtMeasurement = this.performanceClient?.startMeasurement(CryptoOptsSignJwt, correlationId);
|
|
10144
|
-
const cachedKeyPair = await this.cache.getItem(kid, correlationId || "");
|
|
10145
|
-
if (!cachedKeyPair) {
|
|
10146
|
-
throw createBrowserAuthError(cryptoKeyNotFound, correlationId || "");
|
|
10147
|
-
}
|
|
10148
|
-
// Get public key as JWK
|
|
10149
|
-
const publicKeyJwk = await exportJwk(cachedKeyPair.publicKey);
|
|
10150
|
-
const publicKeyJwkString = getSortedObjectString(publicKeyJwk);
|
|
10151
|
-
// Base64URL encode public key thumbprint with keyId only: BASE64URL({ kid: "FULL_PUBLIC_KEY_HASH" })
|
|
10152
|
-
const encodedKeyIdThumbprint = urlEncode(JSON.stringify({ kid: kid }));
|
|
10153
|
-
// Generate header
|
|
10154
|
-
const shrHeader = JoseHeader.getShrHeaderString({
|
|
10155
|
-
...shrOptions?.header,
|
|
10156
|
-
alg: publicKeyJwk.alg,
|
|
10157
|
-
kid: encodedKeyIdThumbprint,
|
|
10158
|
-
});
|
|
10159
|
-
const encodedShrHeader = urlEncode(shrHeader);
|
|
10160
|
-
// Generate payload
|
|
10161
|
-
payload.cnf = {
|
|
10162
|
-
jwk: JSON.parse(publicKeyJwkString),
|
|
10163
|
-
};
|
|
10164
|
-
const encodedPayload = urlEncode(JSON.stringify(payload));
|
|
10165
|
-
// Form token string
|
|
10166
|
-
const tokenString = `${encodedShrHeader}.${encodedPayload}`;
|
|
10167
|
-
// Sign token
|
|
10168
|
-
const encoder = new TextEncoder();
|
|
10169
|
-
const tokenBuffer = encoder.encode(tokenString);
|
|
10170
|
-
const signatureBuffer = await sign(cachedKeyPair.privateKey, tokenBuffer, RSA_SIGN_ALGORITHM_OPTIONS);
|
|
10171
|
-
const encodedSignature = urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
10172
|
-
const signedJwt = `${tokenString}.${encodedSignature}`;
|
|
10173
|
-
if (signJwtMeasurement) {
|
|
10174
|
-
signJwtMeasurement.end({
|
|
10175
|
-
success: true,
|
|
10517
|
+
signTokenBindingJwtMeasurement?.end({
|
|
10518
|
+
success: false,
|
|
10519
|
+
...telemetry,
|
|
10176
10520
|
});
|
|
10521
|
+
throw e;
|
|
10177
10522
|
}
|
|
10178
|
-
return signedJwt;
|
|
10179
10523
|
}
|
|
10180
10524
|
/**
|
|
10181
10525
|
* Returns the SHA-256 hash of an input string
|
|
@@ -10184,11 +10528,39 @@ class CryptoOps {
|
|
|
10184
10528
|
async hashString(plainText) {
|
|
10185
10529
|
return hashString(plainText);
|
|
10186
10530
|
}
|
|
10187
|
-
|
|
10188
|
-
|
|
10189
|
-
|
|
10190
|
-
|
|
10191
|
-
|
|
10531
|
+
async signInput(cachedKeyPair, signingInput, algorithm) {
|
|
10532
|
+
const encoder = new TextEncoder();
|
|
10533
|
+
const signatureBuffer = await sign(cachedKeyPair.privateKey, encoder.encode(signingInput), algorithm);
|
|
10534
|
+
return urlEncodeArr(new Uint8Array(signatureBuffer));
|
|
10535
|
+
}
|
|
10536
|
+
getTokenBindingKeySigningAlgorithm(cachedKeyPair, requestedAlgorithm, correlationId) {
|
|
10537
|
+
const keyAlgorithm = cachedKeyPair.privateKey.algorithm;
|
|
10538
|
+
if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 &&
|
|
10539
|
+
keyAlgorithm.name === RSA_SIGN_ALGORITHM_OPTIONS.name) {
|
|
10540
|
+
return RSA_SIGN_ALGORITHM_OPTIONS;
|
|
10541
|
+
}
|
|
10542
|
+
if (requestedAlgorithm === JsonWebTokenAlgorithms.ES256 &&
|
|
10543
|
+
keyAlgorithm.name ===
|
|
10544
|
+
ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS.name &&
|
|
10545
|
+
keyAlgorithm.namedCurve ===
|
|
10546
|
+
ECDSA_P256_KEYGEN_ALGORITHM_OPTIONS.namedCurve) {
|
|
10547
|
+
return ECDSA_SHA256_SIGN_ALGORITHM_OPTIONS;
|
|
10548
|
+
}
|
|
10549
|
+
if (requestedAlgorithm === JsonWebTokenAlgorithms.RS256 ||
|
|
10550
|
+
requestedAlgorithm === JsonWebTokenAlgorithms.ES256) {
|
|
10551
|
+
throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId, tokenBindingKeyAlgorithmMismatch);
|
|
10552
|
+
}
|
|
10553
|
+
throw createBrowserAuthError(unsupportedTokenBindingAlgorithm, correlationId);
|
|
10554
|
+
}
|
|
10555
|
+
async validateTokenBindingJwtHeaderKey(header, kid, correlationId) {
|
|
10556
|
+
if (!header.jwk) {
|
|
10557
|
+
return;
|
|
10558
|
+
}
|
|
10559
|
+
const headerKeyId = await computeJwkThumbprint(header.jwk, correlationId);
|
|
10560
|
+
if (headerKeyId !== kid) {
|
|
10561
|
+
throw createBrowserAuthError(invalidPublicJwk, correlationId, tokenBindingKeyJwkThumbprintMismatch);
|
|
10562
|
+
}
|
|
10563
|
+
}
|
|
10192
10564
|
}
|
|
10193
10565
|
|
|
10194
10566
|
/*
|
|
@@ -10783,7 +11155,7 @@ const EventType = {
|
|
|
10783
11155
|
|
|
10784
11156
|
/* eslint-disable header/header */
|
|
10785
11157
|
const name = "@azure/msal-browser";
|
|
10786
|
-
const version = "5.
|
|
11158
|
+
const version = "5.19.0";
|
|
10787
11159
|
|
|
10788
11160
|
/*
|
|
10789
11161
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -11676,12 +12048,12 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11676
12048
|
return parsedAccessToken;
|
|
11677
12049
|
}
|
|
11678
12050
|
/**
|
|
11679
|
-
*
|
|
11680
|
-
* @param accessToken
|
|
12051
|
+
* Set accessToken credential to the platform cache
|
|
12052
|
+
* @param accessToken - the access token entity to cache
|
|
11681
12053
|
*/
|
|
11682
|
-
async setAccessTokenCredential(accessToken, correlationId, kmsi) {
|
|
12054
|
+
async setAccessTokenCredential(accessToken, correlationId, kmsi, additionalCacheKeyHash) {
|
|
11683
12055
|
this.logger.trace("1pondb", correlationId);
|
|
11684
|
-
const accessTokenKey = this.generateCredentialKey(accessToken);
|
|
12056
|
+
const accessTokenKey = this.generateCredentialKey(accessToken, additionalCacheKeyHash);
|
|
11685
12057
|
const timestamp = Date.now().toString();
|
|
11686
12058
|
accessToken.lastUpdatedAt = timestamp;
|
|
11687
12059
|
await this.setUserData(accessTokenKey, JSON.stringify(accessToken), correlationId, timestamp, kmsi);
|
|
@@ -11991,11 +12363,13 @@ class BrowserCacheManager extends CacheManager {
|
|
|
11991
12363
|
}
|
|
11992
12364
|
/**
|
|
11993
12365
|
* Generate Credential Key. All changes to the key REQUIRE a schema version update.
|
|
11994
|
-
* Cache Key: msal.<schema_version>|<home_account_id>|<environment>|<credential_type>|<client_id or familyId>|<realm>|<scopes>|<scheme>
|
|
12366
|
+
* Cache Key: msal.<schema_version>|<home_account_id>|<environment>|<credential_type>|<client_id or familyId>|<realm>|<scopes>|<scheme>|<additional_cache_key_components_hash>
|
|
12367
|
+
*
|
|
11995
12368
|
* @param credentialEntity
|
|
12369
|
+
* @param hash - optional precomputed hash of additionalCacheKeyComponents
|
|
11996
12370
|
* @returns
|
|
11997
12371
|
*/
|
|
11998
|
-
generateCredentialKey(credential) {
|
|
12372
|
+
generateCredentialKey(credential, additionalCacheKeyHash) {
|
|
11999
12373
|
const familyId = (credential.credentialType ===
|
|
12000
12374
|
CredentialType.REFRESH_TOKEN &&
|
|
12001
12375
|
credential.familyId) ||
|
|
@@ -12015,6 +12389,12 @@ class BrowserCacheManager extends CacheManager {
|
|
|
12015
12389
|
credential.target || "",
|
|
12016
12390
|
scheme,
|
|
12017
12391
|
];
|
|
12392
|
+
// Append precomputed component-hash segment.
|
|
12393
|
+
if (credential.additionalCacheKeyComponents &&
|
|
12394
|
+
Object.keys(credential.additionalCacheKeyComponents).length > 0 &&
|
|
12395
|
+
additionalCacheKeyHash) {
|
|
12396
|
+
credentialKey.push(additionalCacheKeyHash);
|
|
12397
|
+
}
|
|
12018
12398
|
return credentialKey.join(CACHE_KEY_SEPARATOR).toLowerCase();
|
|
12019
12399
|
}
|
|
12020
12400
|
/**
|
|
@@ -12390,7 +12770,7 @@ class EventHandler {
|
|
|
12390
12770
|
* Licensed under the MIT License.
|
|
12391
12771
|
*/
|
|
12392
12772
|
class BaseInteractionClient {
|
|
12393
|
-
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider) {
|
|
12773
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
|
|
12394
12774
|
this.config = config;
|
|
12395
12775
|
this.browserStorage = storageImpl;
|
|
12396
12776
|
this.browserCrypto = browserCrypto;
|
|
@@ -12401,6 +12781,9 @@ class BaseInteractionClient {
|
|
|
12401
12781
|
this.correlationId = correlationId;
|
|
12402
12782
|
this.logger = logger.clone(name, version);
|
|
12403
12783
|
this.performanceClient = performanceClient;
|
|
12784
|
+
this.tokenBindingKeyManager =
|
|
12785
|
+
tokenBindingKeyManager ||
|
|
12786
|
+
new TokenBindingKeyManager(this.logger, this.performanceClient);
|
|
12404
12787
|
}
|
|
12405
12788
|
}
|
|
12406
12789
|
/**
|
|
@@ -12527,6 +12910,11 @@ async function clearCacheOnLogout(browserStorage, browserCrypto, logger, correla
|
|
|
12527
12910
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
12528
12911
|
* Licensed under the MIT License.
|
|
12529
12912
|
*/
|
|
12913
|
+
const SUPPORTED_AUTHENTICATION_SCHEMES = new Set([
|
|
12914
|
+
AuthenticationScheme$1.BEARER,
|
|
12915
|
+
AuthenticationScheme$1.POP,
|
|
12916
|
+
AuthenticationScheme$1.SSH,
|
|
12917
|
+
]);
|
|
12530
12918
|
/**
|
|
12531
12919
|
* Initializer function for all request APIs
|
|
12532
12920
|
* @param request
|
|
@@ -12551,13 +12939,16 @@ async function initializeBaseRequest(request, config, performanceClient, logger,
|
|
|
12551
12939
|
logger.verbose("1l4fwv", correlationId);
|
|
12552
12940
|
}
|
|
12553
12941
|
else {
|
|
12942
|
+
if (!SUPPORTED_AUTHENTICATION_SCHEMES.has(validatedRequest.authenticationScheme)) {
|
|
12943
|
+
throw createClientConfigurationError(unsupportedAuthenticationScheme, correlationId);
|
|
12944
|
+
}
|
|
12554
12945
|
if (validatedRequest.authenticationScheme ===
|
|
12555
12946
|
AuthenticationScheme$1.SSH) {
|
|
12556
12947
|
if (!request.sshJwk) {
|
|
12557
|
-
throw createClientConfigurationError(missingSshJwk,
|
|
12948
|
+
throw createClientConfigurationError(missingSshJwk, correlationId);
|
|
12558
12949
|
}
|
|
12559
12950
|
if (!request.sshKid) {
|
|
12560
|
-
throw createClientConfigurationError(missingSshKid,
|
|
12951
|
+
throw createClientConfigurationError(missingSshKid, correlationId);
|
|
12561
12952
|
}
|
|
12562
12953
|
}
|
|
12563
12954
|
logger.verbose(`1ecmns ${validatedRequest.authenticationScheme}`, correlationId);
|
|
@@ -12742,6 +13133,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
12742
13133
|
correlationId: this.correlationId,
|
|
12743
13134
|
},
|
|
12744
13135
|
cryptoInterface: this.browserCrypto,
|
|
13136
|
+
tokenBindingKeyManager: this.tokenBindingKeyManager,
|
|
12745
13137
|
networkInterface: this.networkClient,
|
|
12746
13138
|
storageInterface: this.browserStorage,
|
|
12747
13139
|
serverTelemetryManager: serverTelemetryManager,
|
|
@@ -13213,13 +13605,13 @@ class SilentCacheClient extends StandardInteractionClient {
|
|
|
13213
13605
|
* Licensed under the MIT License.
|
|
13214
13606
|
*/
|
|
13215
13607
|
class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
13216
|
-
constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
|
|
13217
|
-
super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
|
|
13608
|
+
constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
|
|
13609
|
+
super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
|
|
13218
13610
|
this.apiId = apiId;
|
|
13219
13611
|
this.accountId = accountId;
|
|
13220
13612
|
this.platformAuthProvider = provider;
|
|
13221
13613
|
this.nativeStorageManager = nativeStorageImpl;
|
|
13222
|
-
this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider);
|
|
13614
|
+
this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, this.tokenBindingKeyManager);
|
|
13223
13615
|
const extensionName = this.platformAuthProvider.getExtensionName();
|
|
13224
13616
|
this.skus = ServerTelemetryManager.makeExtraSkuString({
|
|
13225
13617
|
libraryName: BrowserConstants.MSAL_SKU,
|
|
@@ -13343,13 +13735,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
13343
13735
|
* @returns CommonSilentFlowRequest
|
|
13344
13736
|
*/
|
|
13345
13737
|
createSilentCacheRequest(request, cachedAccount) {
|
|
13346
|
-
|
|
13738
|
+
const silentRequest = {
|
|
13347
13739
|
authority: request.authority,
|
|
13348
13740
|
correlationId: this.correlationId,
|
|
13349
13741
|
scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
|
|
13350
13742
|
account: cachedAccount,
|
|
13351
13743
|
forceRefresh: false,
|
|
13352
13744
|
};
|
|
13745
|
+
// Preserve FMI partition semantics for silent cache filtering.
|
|
13746
|
+
if (request.attributeTokens) {
|
|
13747
|
+
silentRequest.attributeTokens = request.attributeTokens.split(" ");
|
|
13748
|
+
}
|
|
13749
|
+
return silentRequest;
|
|
13353
13750
|
}
|
|
13354
13751
|
/**
|
|
13355
13752
|
* Fetches the tokens from the cache if un-expired
|
|
@@ -13561,7 +13958,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
13561
13958
|
return response.shr;
|
|
13562
13959
|
}
|
|
13563
13960
|
// Generate SHR in msal js if WAM does not compute it when POP is enabled
|
|
13564
|
-
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
|
|
13961
|
+
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
|
|
13565
13962
|
const shrParameters = {
|
|
13566
13963
|
resourceRequestMethod: request.resourceRequestMethod,
|
|
13567
13964
|
resourceRequestUri: request.resourceRequestUri,
|
|
@@ -13675,7 +14072,12 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
13675
14072
|
: response.expires_in) || 0;
|
|
13676
14073
|
const tokenExpirationSeconds = reqTimestamp + expiresIn;
|
|
13677
14074
|
const responseScopes = this.generateScopes(response.scope, request.scope);
|
|
13678
|
-
const
|
|
14075
|
+
const additionalCacheKeyComponents = request.attributeTokens
|
|
14076
|
+
? {
|
|
14077
|
+
attribute_tokens: request.attributeTokens,
|
|
14078
|
+
}
|
|
14079
|
+
: undefined;
|
|
14080
|
+
const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
|
|
13679
14081
|
// save idtoken credential in configured browser storage
|
|
13680
14082
|
if (!!cachedIdToken && storeInCache?.idToken !== false) {
|
|
13681
14083
|
await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
|
|
@@ -13756,11 +14158,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
13756
14158
|
const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
|
|
13757
14159
|
? undefined
|
|
13758
14160
|
: this.config.auth.clientCapabilities;
|
|
13759
|
-
|
|
14161
|
+
/*
|
|
14162
|
+
* 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.
|
|
14163
|
+
* attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
|
|
14164
|
+
*/
|
|
13760
14165
|
const { scopes, claims } = request;
|
|
13761
14166
|
const scopeSet = new ScopeSet(scopes || [], this.correlationId);
|
|
13762
14167
|
scopeSet.appendScopes(OIDC_DEFAULT_SCOPES$1);
|
|
13763
14168
|
const mergedClaims = buildMergedClaims$1(claims, configClaims?.length ? configClaims : undefined);
|
|
14169
|
+
const hasAttributeTokens = !!request.attributeTokens?.length;
|
|
14170
|
+
this.performanceClient?.addFields({
|
|
14171
|
+
hasAttributeTokens,
|
|
14172
|
+
}, this.correlationId);
|
|
13764
14173
|
const validatedRequest = {
|
|
13765
14174
|
claims: mergedClaims,
|
|
13766
14175
|
accountId: this.accountId,
|
|
@@ -13787,6 +14196,10 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
13787
14196
|
shrClaims: request.shrClaims,
|
|
13788
14197
|
shrNonce: request.shrNonce,
|
|
13789
14198
|
};
|
|
14199
|
+
if (hasAttributeTokens) {
|
|
14200
|
+
validatedRequest.attributeTokens =
|
|
14201
|
+
serializeAttributeTokens(request.attributeTokens);
|
|
14202
|
+
}
|
|
13790
14203
|
// Check for PoP token requests: signPopToken should only be set to true if popKid is not set
|
|
13791
14204
|
if (validatedRequest.signPopToken && !!request.popKid) {
|
|
13792
14205
|
throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
|
|
@@ -13805,7 +14218,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
|
|
|
13805
14218
|
shrNonce: request.shrNonce,
|
|
13806
14219
|
correlationId: this.correlationId,
|
|
13807
14220
|
};
|
|
13808
|
-
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.performanceClient);
|
|
14221
|
+
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
|
|
13809
14222
|
// generate reqCnf if not provided in the request
|
|
13810
14223
|
let reqCnfData;
|
|
13811
14224
|
if (!validatedRequest.keyId) {
|
|
@@ -13995,7 +14408,8 @@ async function getStandardParameters(config, authority, request, logger, perform
|
|
|
13995
14408
|
// pass the req_cnf for POP
|
|
13996
14409
|
if (request.authenticationScheme === AuthenticationScheme$1.POP) {
|
|
13997
14410
|
const cryptoOps = new CryptoOps(logger, performanceClient);
|
|
13998
|
-
const
|
|
14411
|
+
const tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient);
|
|
14412
|
+
const popTokenGenerator = new PopTokenGenerator(cryptoOps, tokenBindingKeyManager, performanceClient);
|
|
13999
14413
|
// req_cnf is always sent as a string for SPAs
|
|
14000
14414
|
let reqCnfData;
|
|
14001
14415
|
if (!request.popKid) {
|
|
@@ -14204,7 +14618,7 @@ async function handleResponseEAR(request, response, apiId, config, authority, br
|
|
|
14204
14618
|
if (decryptedData.accountId) {
|
|
14205
14619
|
return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
|
|
14206
14620
|
}
|
|
14207
|
-
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null);
|
|
14621
|
+
const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, new TokenBindingKeyManager(logger, performanceClient));
|
|
14208
14622
|
// Validate response. This function throws a server error if an error is returned by the server.
|
|
14209
14623
|
responseHandler.validateTokenResponse(decryptedData, request.correlationId);
|
|
14210
14624
|
// Temporary until response handler is refactored to be more flow agnostic.
|
|
@@ -15084,8 +15498,8 @@ function isPlatformAuthAllowed(config, logger, correlationId, platformAuthProvid
|
|
|
15084
15498
|
* Licensed under the MIT License.
|
|
15085
15499
|
*/
|
|
15086
15500
|
class PopupClient extends StandardInteractionClient {
|
|
15087
|
-
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook) {
|
|
15088
|
-
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
|
|
15501
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, waitForPopupResponseHook, tokenBindingKeyManager) {
|
|
15502
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
|
|
15089
15503
|
this.nativeStorage = nativeStorageImpl;
|
|
15090
15504
|
this.eventHandler = eventHandler;
|
|
15091
15505
|
this.waitForPopupResponseHook = waitForPopupResponseHook;
|
|
@@ -15599,8 +16013,8 @@ function getNavigationType() {
|
|
|
15599
16013
|
return navigation?.type;
|
|
15600
16014
|
}
|
|
15601
16015
|
class RedirectClient extends StandardInteractionClient {
|
|
15602
|
-
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler) {
|
|
15603
|
-
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler);
|
|
16016
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, correlationId, platformAuthHandler, tokenBindingKeyManager) {
|
|
16017
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthHandler, tokenBindingKeyManager);
|
|
15604
16018
|
this.nativeStorage = nativeStorageImpl;
|
|
15605
16019
|
}
|
|
15606
16020
|
/**
|
|
@@ -16092,8 +16506,8 @@ function removeHiddenIframe(iframe) {
|
|
|
16092
16506
|
* Licensed under the MIT License.
|
|
16093
16507
|
*/
|
|
16094
16508
|
class SilentIframeClient extends StandardInteractionClient {
|
|
16095
|
-
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook) {
|
|
16096
|
-
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
|
|
16509
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, correlationId, platformAuthProvider, waitForIframeResponseHook, tokenBindingKeyManager) {
|
|
16510
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
|
|
16097
16511
|
this.apiId = apiId;
|
|
16098
16512
|
this.nativeStorage = nativeStorageImpl;
|
|
16099
16513
|
this.waitForIframeResponseHook = waitForIframeResponseHook;
|
|
@@ -16400,8 +16814,8 @@ class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {
|
|
|
16400
16814
|
* Licensed under the MIT License.
|
|
16401
16815
|
*/
|
|
16402
16816
|
class SilentAuthCodeClient extends StandardInteractionClient {
|
|
16403
|
-
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider) {
|
|
16404
|
-
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider);
|
|
16817
|
+
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager) {
|
|
16818
|
+
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, platformAuthProvider, tokenBindingKeyManager);
|
|
16405
16819
|
this.apiId = apiId;
|
|
16406
16820
|
}
|
|
16407
16821
|
/**
|
|
@@ -16554,10 +16968,15 @@ class StandardController {
|
|
|
16554
16968
|
this.hybridAuthCodeResponses = new Map();
|
|
16555
16969
|
// Initialize performance client
|
|
16556
16970
|
this.performanceClient = this.config.telemetry.client;
|
|
16557
|
-
// Initialize
|
|
16558
|
-
|
|
16559
|
-
|
|
16560
|
-
|
|
16971
|
+
// Initialize environment-specific crypto and token-binding services.
|
|
16972
|
+
if (this.isBrowserEnvironment) {
|
|
16973
|
+
this.browserCrypto = new CryptoOps(this.logger, this.performanceClient);
|
|
16974
|
+
this.tokenBindingKeyManager = new TokenBindingKeyManager(this.logger, this.performanceClient);
|
|
16975
|
+
}
|
|
16976
|
+
else {
|
|
16977
|
+
this.browserCrypto = DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
16978
|
+
this.tokenBindingKeyManager = DEFAULT_TOKEN_BINDING_KEY_MANAGER;
|
|
16979
|
+
}
|
|
16561
16980
|
this.eventHandler = new EventHandler(this.logger);
|
|
16562
16981
|
// Initialize the browser storage class.
|
|
16563
16982
|
this.browserStorage = this.isBrowserEnvironment
|
|
@@ -16710,7 +17129,7 @@ class StandardController {
|
|
|
16710
17129
|
rootMeasurement.add({
|
|
16711
17130
|
isPlatformBrokerRequest: true,
|
|
16712
17131
|
});
|
|
16713
|
-
const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.platformAuthProvider, platformBrokerRequest.accountId, this.nativeInternalStorage, platformBrokerRequest.correlationId);
|
|
17132
|
+
const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.platformAuthProvider, platformBrokerRequest.accountId, this.nativeInternalStorage, platformBrokerRequest.correlationId, this.tokenBindingKeyManager);
|
|
16714
17133
|
redirectResponse = invokeAsync(nativeClient.handleRedirectPromise.bind(nativeClient), HandleNativeRedirectPromiseMeasurement, this.logger, this.performanceClient, rootMeasurement.event.correlationId)();
|
|
16715
17134
|
}
|
|
16716
17135
|
else {
|
|
@@ -16811,7 +17230,7 @@ class StandardController {
|
|
|
16811
17230
|
let result;
|
|
16812
17231
|
if (this.platformAuthProvider &&
|
|
16813
17232
|
this.canUsePlatformBroker(request)) {
|
|
16814
|
-
const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.platformAuthProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId);
|
|
17233
|
+
const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.platformAuthProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
|
|
16815
17234
|
result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(request, atrMeasurement).catch((e) => {
|
|
16816
17235
|
if (e instanceof NativeAuthError &&
|
|
16817
17236
|
isFatalNativeAuthError(e)) {
|
|
@@ -17436,21 +17855,32 @@ class StandardController {
|
|
|
17436
17855
|
// Create idToken entity and store in browser storage
|
|
17437
17856
|
const idTokenEntity = createIdTokenEntity(result.account.homeAccountId, result.account.environment, result.idToken, this.config.auth.clientId, result.tenantId);
|
|
17438
17857
|
// Create accessToken entity and store in native internal storage
|
|
17858
|
+
const attributeTokenPartition = serializeAttributeTokens(request.attributeTokens);
|
|
17859
|
+
const additionalCacheKeyComponents = attributeTokenPartition
|
|
17860
|
+
? {
|
|
17861
|
+
attribute_tokens: attributeTokenPartition,
|
|
17862
|
+
}
|
|
17863
|
+
: undefined;
|
|
17439
17864
|
const accessTokenEntity = createAccessTokenEntity(result.account.homeAccountId, result.account.environment, result.accessToken, this.config.auth.clientId, result.tenantId, result.scopes.join(" "), result.expiresOn
|
|
17440
17865
|
? toSecondsFromDate(result.expiresOn)
|
|
17441
17866
|
: 0, result.extExpiresOn
|
|
17442
17867
|
? toSecondsFromDate(result.extExpiresOn)
|
|
17443
17868
|
: 0, base64Decode, request.correlationId || "", undefined, // refreshOn
|
|
17444
17869
|
result.tokenType, undefined, // userAssertionHash
|
|
17445
|
-
request.sshKid);
|
|
17870
|
+
request.sshKid, additionalCacheKeyComponents);
|
|
17446
17871
|
if (request.resource) {
|
|
17447
17872
|
accessTokenEntity.resource = request.resource;
|
|
17448
17873
|
}
|
|
17874
|
+
// Get attribute token partition hash for cache key isolation
|
|
17875
|
+
const components = additionalCacheKeyComponents;
|
|
17876
|
+
const additionalCacheKeyHash = components
|
|
17877
|
+
? await this.browserCrypto.hashString(JSON.stringify(components))
|
|
17878
|
+
: undefined;
|
|
17449
17879
|
const kmsi = isKmsi(result.idTokenClaims);
|
|
17450
17880
|
// Store idToken in browser storage
|
|
17451
17881
|
await this.browserStorage.setIdTokenCredential(idTokenEntity, result.correlationId, kmsi);
|
|
17452
17882
|
// Store accessToken in native internal storage
|
|
17453
|
-
await this.nativeInternalStorage.setAccessTokenCredential(accessTokenEntity, result.correlationId, kmsi);
|
|
17883
|
+
await this.nativeInternalStorage.setAccessTokenCredential(accessTokenEntity, result.correlationId, kmsi, additionalCacheKeyHash);
|
|
17454
17884
|
}
|
|
17455
17885
|
else {
|
|
17456
17886
|
return this.browserStorage.hydrateCache(result, request);
|
|
@@ -17475,7 +17905,7 @@ class StandardController {
|
|
|
17475
17905
|
if (!this.platformAuthProvider) {
|
|
17476
17906
|
throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
|
|
17477
17907
|
}
|
|
17478
|
-
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);
|
|
17908
|
+
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);
|
|
17479
17909
|
return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(request, cacheLookupPolicy);
|
|
17480
17910
|
}
|
|
17481
17911
|
/**
|
|
@@ -17532,39 +17962,39 @@ class StandardController {
|
|
|
17532
17962
|
* @param correlationId
|
|
17533
17963
|
*/
|
|
17534
17964
|
createPopupClient(correlationId) {
|
|
17535
|
-
return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForPopupResponse);
|
|
17965
|
+
return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForPopupResponse, this.tokenBindingKeyManager);
|
|
17536
17966
|
}
|
|
17537
17967
|
/**
|
|
17538
17968
|
* Returns new instance of the Redirect Interaction Client
|
|
17539
17969
|
* @param correlationId
|
|
17540
17970
|
*/
|
|
17541
17971
|
createRedirectClient(correlationId) {
|
|
17542
|
-
return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider);
|
|
17972
|
+
return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17543
17973
|
}
|
|
17544
17974
|
/**
|
|
17545
17975
|
* Returns new instance of the Silent Iframe Interaction Client
|
|
17546
17976
|
* @param correlationId
|
|
17547
17977
|
*/
|
|
17548
17978
|
createSilentIframeClient(correlationId) {
|
|
17549
|
-
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForIframeResponse);
|
|
17979
|
+
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, correlationId, this.platformAuthProvider, this.operatingContext.getResponseHandlers()?.waitForIframeResponse, this.tokenBindingKeyManager);
|
|
17550
17980
|
}
|
|
17551
17981
|
/**
|
|
17552
17982
|
* Returns new instance of the Silent Cache Interaction Client
|
|
17553
17983
|
*/
|
|
17554
17984
|
createSilentCacheClient(correlationId) {
|
|
17555
|
-
return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
|
|
17985
|
+
return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17556
17986
|
}
|
|
17557
17987
|
/**
|
|
17558
17988
|
* Returns new instance of the Silent Refresh Interaction Client
|
|
17559
17989
|
*/
|
|
17560
17990
|
createSilentRefreshClient(correlationId) {
|
|
17561
|
-
return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider);
|
|
17991
|
+
return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17562
17992
|
}
|
|
17563
17993
|
/**
|
|
17564
17994
|
* Returns new instance of the Silent AuthCode Interaction Client
|
|
17565
17995
|
*/
|
|
17566
17996
|
createSilentAuthCodeClient(correlationId) {
|
|
17567
|
-
return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider);
|
|
17997
|
+
return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, correlationId, this.platformAuthProvider, this.tokenBindingKeyManager);
|
|
17568
17998
|
}
|
|
17569
17999
|
/**
|
|
17570
18000
|
* Adds event callbacks to array
|
|
@@ -18152,6 +18582,92 @@ const BridgeStatusCode = {
|
|
|
18152
18582
|
NestedAppAuthUnavailable: "NESTED_APP_AUTH_UNAVAILABLE", // NAA is unavailable in the current context, can retry with standard browser based auth
|
|
18153
18583
|
};
|
|
18154
18584
|
|
|
18585
|
+
/*
|
|
18586
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18587
|
+
* Licensed under the MIT License.
|
|
18588
|
+
*/
|
|
18589
|
+
/**
|
|
18590
|
+
* Unified error taxonomy shared by NAA and PWB.
|
|
18591
|
+
*
|
|
18592
|
+
* Each code maps to exactly one of the four base MSAL error classes
|
|
18593
|
+
* (`AuthError`, `ClientAuthError`, `ServerError`,
|
|
18594
|
+
* `InteractionRequiredAuthError`) via `toAuthError` in
|
|
18595
|
+
* `./WebBrokerBridgeErrorMap`.
|
|
18596
|
+
*/
|
|
18597
|
+
const WebBrokerBridgeErrorCode = {
|
|
18598
|
+
/* Interaction / auth outcomes */
|
|
18599
|
+
UserInteractionRequired: "user_interaction_required",
|
|
18600
|
+
UserCanceled: "user_canceled",
|
|
18601
|
+
/* Environment / connectivity */
|
|
18602
|
+
NoNetwork: "no_network",
|
|
18603
|
+
AccountUnavailable: "account_unavailable",
|
|
18604
|
+
BridgeDisabled: "bridge_disabled",
|
|
18605
|
+
BridgeUnavailable: "bridge_unavailable",
|
|
18606
|
+
/* Server-side outcomes */
|
|
18607
|
+
TransientError: "transient_error",
|
|
18608
|
+
PersistentError: "persistent_error",
|
|
18609
|
+
/* Broker-channel failures */
|
|
18610
|
+
BridgeTimeout: "bridge_timeout",
|
|
18611
|
+
BridgeHandshakeFailed: "bridge_handshake_failed",
|
|
18612
|
+
BridgeConnectionReset: "bridge_connection_reset",
|
|
18613
|
+
BridgeResponseInvalid: "bridge_response_invalid",
|
|
18614
|
+
PopupWillRedirect: "popup_will_redirect",
|
|
18615
|
+
ShrGenerationError: "shr_generation_error",
|
|
18616
|
+
/* Fallback */
|
|
18617
|
+
Unknown: "unknown",
|
|
18618
|
+
};
|
|
18619
|
+
|
|
18620
|
+
/*
|
|
18621
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18622
|
+
* Licensed under the MIT License.
|
|
18623
|
+
*/
|
|
18624
|
+
/**
|
|
18625
|
+
* Lift a normalized `WebBrokerBridgeError` to one of the four base
|
|
18626
|
+
* MSAL error classes. Callers are responsible for lowering
|
|
18627
|
+
* transport-specific errors into `WebBrokerBridgeError` before calling
|
|
18628
|
+
* this function.
|
|
18629
|
+
*/
|
|
18630
|
+
function toAuthError(err) {
|
|
18631
|
+
const correlationId = err.correlationId ?? "";
|
|
18632
|
+
switch (err.code) {
|
|
18633
|
+
case WebBrokerBridgeErrorCode.UserInteractionRequired:
|
|
18634
|
+
return new InteractionRequiredAuthError(err.innerErrorCode || "", correlationId, err.description, err.subError);
|
|
18635
|
+
case WebBrokerBridgeErrorCode.TransientError:
|
|
18636
|
+
case WebBrokerBridgeErrorCode.PersistentError:
|
|
18637
|
+
return new ServerError(err.innerErrorCode || "", correlationId, err.description, err.subError);
|
|
18638
|
+
case WebBrokerBridgeErrorCode.UserCanceled:
|
|
18639
|
+
return new ClientAuthError(userCanceled, correlationId);
|
|
18640
|
+
case WebBrokerBridgeErrorCode.NoNetwork:
|
|
18641
|
+
return new ClientAuthError(noNetworkConnectivity$1, correlationId);
|
|
18642
|
+
case WebBrokerBridgeErrorCode.AccountUnavailable:
|
|
18643
|
+
return new ClientAuthError(noAccountFound, correlationId);
|
|
18644
|
+
case WebBrokerBridgeErrorCode.BridgeDisabled:
|
|
18645
|
+
return new ClientAuthError(nestedAppAuthBridgeDisabled, correlationId);
|
|
18646
|
+
case WebBrokerBridgeErrorCode.BridgeUnavailable:
|
|
18647
|
+
/*
|
|
18648
|
+
* NAA parity: pass through inner code when the broker supplied
|
|
18649
|
+
* one, otherwise fall back to the disabled code.
|
|
18650
|
+
*/
|
|
18651
|
+
return new ClientAuthError(err.innerErrorCode ||
|
|
18652
|
+
nestedAppAuthBridgeDisabled, correlationId, err.description);
|
|
18653
|
+
/*
|
|
18654
|
+
* PWB broker-channel failures. The common code doubles as the
|
|
18655
|
+
* concrete errorCode on AuthError so the original error identity
|
|
18656
|
+
* can be recovered by round-tripping the string.
|
|
18657
|
+
*/
|
|
18658
|
+
case WebBrokerBridgeErrorCode.BridgeTimeout:
|
|
18659
|
+
case WebBrokerBridgeErrorCode.BridgeHandshakeFailed:
|
|
18660
|
+
case WebBrokerBridgeErrorCode.BridgeConnectionReset:
|
|
18661
|
+
case WebBrokerBridgeErrorCode.BridgeResponseInvalid:
|
|
18662
|
+
case WebBrokerBridgeErrorCode.PopupWillRedirect:
|
|
18663
|
+
case WebBrokerBridgeErrorCode.ShrGenerationError:
|
|
18664
|
+
return new AuthError(err.code, correlationId, err.description, err.subError);
|
|
18665
|
+
case WebBrokerBridgeErrorCode.Unknown:
|
|
18666
|
+
default:
|
|
18667
|
+
return new AuthError(err.innerErrorCode || "unknown_error", correlationId, err.description || "An unknown error occurred", err.subError);
|
|
18668
|
+
}
|
|
18669
|
+
}
|
|
18670
|
+
|
|
18155
18671
|
/*
|
|
18156
18672
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18157
18673
|
* Licensed under the MIT License.
|
|
@@ -18174,6 +18690,7 @@ class NestedAppAuthAdapter {
|
|
|
18174
18690
|
const correlationId = request.correlationId || this.crypto.createNewGuid();
|
|
18175
18691
|
const claims = buildMergedClaims$1(request.claims, this.clientCapabilities);
|
|
18176
18692
|
const scopes = request.scopes || OIDC_DEFAULT_SCOPES$1;
|
|
18693
|
+
const attributeTokens = serializeAttributeTokens(request.attributeTokens);
|
|
18177
18694
|
const tokenRequest = {
|
|
18178
18695
|
platformBrokerId: request.account?.homeAccountId,
|
|
18179
18696
|
clientId: this.clientId,
|
|
@@ -18186,6 +18703,7 @@ class NestedAppAuthAdapter {
|
|
|
18186
18703
|
authenticationScheme: request.authenticationScheme ||
|
|
18187
18704
|
AuthenticationScheme$1.BEARER,
|
|
18188
18705
|
extraParameters: extraParams,
|
|
18706
|
+
attributeTokens,
|
|
18189
18707
|
};
|
|
18190
18708
|
return tokenRequest;
|
|
18191
18709
|
}
|
|
@@ -18294,30 +18812,9 @@ class NestedAppAuthAdapter {
|
|
|
18294
18812
|
*/
|
|
18295
18813
|
fromBridgeError(error) {
|
|
18296
18814
|
if (isBridgeError(error)) {
|
|
18297
|
-
|
|
18298
|
-
case BridgeStatusCode.UserCancel:
|
|
18299
|
-
return new ClientAuthError(userCanceled, "");
|
|
18300
|
-
case BridgeStatusCode.NoNetwork:
|
|
18301
|
-
return new ClientAuthError(noNetworkConnectivity$1, "");
|
|
18302
|
-
case BridgeStatusCode.AccountUnavailable:
|
|
18303
|
-
return new ClientAuthError(noAccountFound, "");
|
|
18304
|
-
case BridgeStatusCode.Disabled:
|
|
18305
|
-
return new ClientAuthError(nestedAppAuthBridgeDisabled, "");
|
|
18306
|
-
case BridgeStatusCode.NestedAppAuthUnavailable:
|
|
18307
|
-
return new ClientAuthError(error.code ||
|
|
18308
|
-
nestedAppAuthBridgeDisabled, "", error.description);
|
|
18309
|
-
case BridgeStatusCode.TransientError:
|
|
18310
|
-
case BridgeStatusCode.PersistentError:
|
|
18311
|
-
return new ServerError(error.code || "", "", error.description);
|
|
18312
|
-
case BridgeStatusCode.UserInteractionRequired:
|
|
18313
|
-
return new InteractionRequiredAuthError(error.code || "", "", error.description);
|
|
18314
|
-
default:
|
|
18315
|
-
return new AuthError(error.code || "", "", error.description);
|
|
18316
|
-
}
|
|
18317
|
-
}
|
|
18318
|
-
else {
|
|
18319
|
-
return new AuthError("unknown_error", "", "An unknown error occurred");
|
|
18815
|
+
return toAuthError(bridgeErrorToWebBrokerBridgeError(error));
|
|
18320
18816
|
}
|
|
18817
|
+
return new AuthError("unknown_error", "", "An unknown error occurred");
|
|
18321
18818
|
}
|
|
18322
18819
|
/**
|
|
18323
18820
|
* Returns an AuthenticationResult from the given cache items
|
|
@@ -18353,6 +18850,52 @@ class NestedAppAuthAdapter {
|
|
|
18353
18850
|
};
|
|
18354
18851
|
return authenticationResult;
|
|
18355
18852
|
}
|
|
18853
|
+
}
|
|
18854
|
+
/**
|
|
18855
|
+
* Converts NAA `BridgeError` into the shared `WebBrokerBridgeError`
|
|
18856
|
+
* taxonomy.
|
|
18857
|
+
*/
|
|
18858
|
+
function bridgeErrorToWebBrokerBridgeError(error) {
|
|
18859
|
+
switch (error.status) {
|
|
18860
|
+
case BridgeStatusCode.UserCancel:
|
|
18861
|
+
return { code: WebBrokerBridgeErrorCode.UserCanceled };
|
|
18862
|
+
case BridgeStatusCode.NoNetwork:
|
|
18863
|
+
return { code: WebBrokerBridgeErrorCode.NoNetwork };
|
|
18864
|
+
case BridgeStatusCode.AccountUnavailable:
|
|
18865
|
+
return { code: WebBrokerBridgeErrorCode.AccountUnavailable };
|
|
18866
|
+
case BridgeStatusCode.Disabled:
|
|
18867
|
+
return { code: WebBrokerBridgeErrorCode.BridgeDisabled };
|
|
18868
|
+
case BridgeStatusCode.NestedAppAuthUnavailable:
|
|
18869
|
+
return {
|
|
18870
|
+
code: WebBrokerBridgeErrorCode.BridgeUnavailable,
|
|
18871
|
+
innerErrorCode: error.code,
|
|
18872
|
+
description: error.description,
|
|
18873
|
+
};
|
|
18874
|
+
case BridgeStatusCode.TransientError:
|
|
18875
|
+
return {
|
|
18876
|
+
code: WebBrokerBridgeErrorCode.TransientError,
|
|
18877
|
+
innerErrorCode: error.code,
|
|
18878
|
+
description: error.description,
|
|
18879
|
+
};
|
|
18880
|
+
case BridgeStatusCode.PersistentError:
|
|
18881
|
+
return {
|
|
18882
|
+
code: WebBrokerBridgeErrorCode.PersistentError,
|
|
18883
|
+
innerErrorCode: error.code,
|
|
18884
|
+
description: error.description,
|
|
18885
|
+
};
|
|
18886
|
+
case BridgeStatusCode.UserInteractionRequired:
|
|
18887
|
+
return {
|
|
18888
|
+
code: WebBrokerBridgeErrorCode.UserInteractionRequired,
|
|
18889
|
+
innerErrorCode: error.code,
|
|
18890
|
+
description: error.description,
|
|
18891
|
+
};
|
|
18892
|
+
default:
|
|
18893
|
+
return {
|
|
18894
|
+
code: WebBrokerBridgeErrorCode.Unknown,
|
|
18895
|
+
innerErrorCode: error.code,
|
|
18896
|
+
description: error.description,
|
|
18897
|
+
};
|
|
18898
|
+
}
|
|
18356
18899
|
}
|
|
18357
18900
|
|
|
18358
18901
|
/*
|
|
@@ -18838,6 +19381,66 @@ class NestedAppAuthController {
|
|
|
18838
19381
|
}
|
|
18839
19382
|
}
|
|
18840
19383
|
|
|
19384
|
+
/*
|
|
19385
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
19386
|
+
* Licensed under the MIT License.
|
|
19387
|
+
*/
|
|
19388
|
+
/**
|
|
19389
|
+
* Correlates outbound requests with inbound responses by `requestId`.
|
|
19390
|
+
*/
|
|
19391
|
+
class PendingRequestRegistry {
|
|
19392
|
+
constructor() {
|
|
19393
|
+
this.pending = new Map();
|
|
19394
|
+
}
|
|
19395
|
+
/**
|
|
19396
|
+
* Register a pending request. Returns a promise that resolves when a
|
|
19397
|
+
* response with the matching `requestId` arrives, or rejects if the
|
|
19398
|
+
* caller invokes `reject` for that id.
|
|
19399
|
+
*/
|
|
19400
|
+
register(requestId) {
|
|
19401
|
+
return new Promise((resolve, reject) => {
|
|
19402
|
+
this.pending.set(requestId, { resolve, reject });
|
|
19403
|
+
});
|
|
19404
|
+
}
|
|
19405
|
+
/** Resolve a pending request. No-op if `requestId` isn't registered. */
|
|
19406
|
+
resolve(requestId, response) {
|
|
19407
|
+
const entry = this.pending.get(requestId);
|
|
19408
|
+
if (entry === undefined) {
|
|
19409
|
+
return;
|
|
19410
|
+
}
|
|
19411
|
+
this.pending.delete(requestId);
|
|
19412
|
+
entry.resolve(response);
|
|
19413
|
+
}
|
|
19414
|
+
/** Reject a pending request. No-op if `requestId` isn't registered. */
|
|
19415
|
+
reject(requestId, reason) {
|
|
19416
|
+
const entry = this.pending.get(requestId);
|
|
19417
|
+
if (entry === undefined) {
|
|
19418
|
+
return;
|
|
19419
|
+
}
|
|
19420
|
+
this.pending.delete(requestId);
|
|
19421
|
+
entry.reject(reason);
|
|
19422
|
+
}
|
|
19423
|
+
/** True if `requestId` has an in-flight registration. */
|
|
19424
|
+
has(requestId) {
|
|
19425
|
+
return this.pending.has(requestId);
|
|
19426
|
+
}
|
|
19427
|
+
/**
|
|
19428
|
+
* Register, then invoke `send` synchronously. If `send` throws, the
|
|
19429
|
+
* pending entry is cleared and the promise rejects with the thrown
|
|
19430
|
+
* error.
|
|
19431
|
+
*/
|
|
19432
|
+
async sendAndAwait(message, send) {
|
|
19433
|
+
const promise = this.register(message.requestId);
|
|
19434
|
+
try {
|
|
19435
|
+
send(message);
|
|
19436
|
+
}
|
|
19437
|
+
catch (err) {
|
|
19438
|
+
this.reject(message.requestId, err);
|
|
19439
|
+
}
|
|
19440
|
+
return promise;
|
|
19441
|
+
}
|
|
19442
|
+
}
|
|
19443
|
+
|
|
18841
19444
|
/*
|
|
18842
19445
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18843
19446
|
* Licensed under the MIT License.
|
|
@@ -18865,28 +19468,14 @@ class BridgeProxy {
|
|
|
18865
19468
|
window.nestedAppAuthBridge.addEventListener("message", (response) => {
|
|
18866
19469
|
const responsePayload = typeof response === "string" ? response : response.data;
|
|
18867
19470
|
const responseEnvelope = JSON.parse(responsePayload);
|
|
18868
|
-
|
|
18869
|
-
|
|
18870
|
-
|
|
18871
|
-
|
|
18872
|
-
|
|
18873
|
-
}
|
|
18874
|
-
else {
|
|
18875
|
-
request.reject(responseEnvelope.error);
|
|
18876
|
-
}
|
|
19471
|
+
if (responseEnvelope.success) {
|
|
19472
|
+
BridgeProxy.pendingRegistry.resolve(responseEnvelope.requestId, responseEnvelope);
|
|
19473
|
+
}
|
|
19474
|
+
else {
|
|
19475
|
+
BridgeProxy.pendingRegistry.reject(responseEnvelope.requestId, responseEnvelope.error);
|
|
18877
19476
|
}
|
|
18878
19477
|
});
|
|
18879
|
-
const bridgeResponse = await
|
|
18880
|
-
const message = BridgeProxy.buildRequest("GetInitContext");
|
|
18881
|
-
const request = {
|
|
18882
|
-
requestId: message.requestId,
|
|
18883
|
-
method: message.method,
|
|
18884
|
-
resolve: resolve,
|
|
18885
|
-
reject: reject,
|
|
18886
|
-
};
|
|
18887
|
-
BridgeProxy.bridgeRequests.push(request);
|
|
18888
|
-
window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
|
|
18889
|
-
});
|
|
19478
|
+
const bridgeResponse = await BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest("GetInitContext"));
|
|
18890
19479
|
return BridgeProxy.validateBridgeResultOrThrow(bridgeResponse.initContext);
|
|
18891
19480
|
}
|
|
18892
19481
|
catch (error) {
|
|
@@ -18942,18 +19531,22 @@ class BridgeProxy {
|
|
|
18942
19531
|
* @returns a promise that resolves to a response of provided type or rejects with a BridgeError
|
|
18943
19532
|
*/
|
|
18944
19533
|
sendRequest(method, requestParams) {
|
|
18945
|
-
|
|
18946
|
-
|
|
18947
|
-
|
|
18948
|
-
|
|
18949
|
-
|
|
18950
|
-
|
|
18951
|
-
|
|
18952
|
-
|
|
18953
|
-
|
|
19534
|
+
return BridgeProxy.sendRequestViaRegistry(BridgeProxy.buildRequest(method, requestParams));
|
|
19535
|
+
}
|
|
19536
|
+
/**
|
|
19537
|
+
* Registers `message.requestId` with the shared pending-request
|
|
19538
|
+
* registry, then posts the envelope over the host bridge. Resolves
|
|
19539
|
+
* with the matching response envelope; rejects with the raw
|
|
19540
|
+
* `BridgeError` payload.
|
|
19541
|
+
*/
|
|
19542
|
+
static sendRequestViaRegistry(message) {
|
|
19543
|
+
const correlationKey = {
|
|
19544
|
+
requestId: message.requestId,
|
|
19545
|
+
type: message.method,
|
|
19546
|
+
};
|
|
19547
|
+
return BridgeProxy.pendingRegistry.sendAndAwait(correlationKey, () => {
|
|
18954
19548
|
window.nestedAppAuthBridge.postMessage(JSON.stringify(message));
|
|
18955
19549
|
});
|
|
18956
|
-
return promise;
|
|
18957
19550
|
}
|
|
18958
19551
|
static validateBridgeResultOrThrow(input) {
|
|
18959
19552
|
if (input === undefined) {
|
|
@@ -18985,7 +19578,11 @@ class BridgeProxy {
|
|
|
18985
19578
|
return new BridgeProxy(response.sdkName, response.sdkVersion, response.accountContext, response.capabilities);
|
|
18986
19579
|
}
|
|
18987
19580
|
}
|
|
18988
|
-
|
|
19581
|
+
/**
|
|
19582
|
+
* Correlates outbound bridge requests with inbound responses by
|
|
19583
|
+
* `requestId`
|
|
19584
|
+
*/
|
|
19585
|
+
BridgeProxy.pendingRegistry = new PendingRequestRegistry();
|
|
18989
19586
|
|
|
18990
19587
|
/*
|
|
18991
19588
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -19754,7 +20351,8 @@ class SignedHttpRequest {
|
|
|
19754
20351
|
const loggerOptions = (shrOptions && shrOptions.loggerOptions) || {};
|
|
19755
20352
|
this.logger = new Logger(loggerOptions, name, version);
|
|
19756
20353
|
this.cryptoOps = new CryptoOps(this.logger);
|
|
19757
|
-
|
|
20354
|
+
const tokenBindingKeyManager = new TokenBindingKeyManager(this.logger);
|
|
20355
|
+
this.popTokenGenerator = new PopTokenGenerator(this.cryptoOps, tokenBindingKeyManager, new StubPerformanceClient());
|
|
19758
20356
|
this.shrParameters = shrParameters;
|
|
19759
20357
|
}
|
|
19760
20358
|
/**
|