@azure/msal-browser 5.29.0 → 5.30.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.
Files changed (322) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.mjs +1 -1
  3. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  4. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs +1 -1
  5. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +1 -1
  7. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +1 -1
  8. package/dist/cache/AccountManager.mjs +1 -1
  9. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  10. package/dist/cache/BrowserCacheManager.mjs +2 -3
  11. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  12. package/dist/cache/CacheHelpers.mjs +1 -1
  13. package/dist/cache/CacheKeys.mjs +1 -1
  14. package/dist/cache/CookieStorage.mjs +1 -1
  15. package/dist/cache/DatabaseStorage.mjs +1 -1
  16. package/dist/cache/EncryptedData.mjs +1 -1
  17. package/dist/cache/LocalStorage.mjs +1 -1
  18. package/dist/cache/MemoryStorage.mjs +1 -1
  19. package/dist/cache/SessionStorage.mjs +1 -1
  20. package/dist/cache/TokenCache.mjs +1 -1
  21. package/dist/config/Configuration.mjs +11 -2
  22. package/dist/config/Configuration.mjs.map +1 -1
  23. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  24. package/dist/controllers/StandardController.mjs +1 -1
  25. package/dist/crypto/BrowserCrypto.mjs +185 -3
  26. package/dist/crypto/BrowserCrypto.mjs.map +1 -1
  27. package/dist/crypto/CryptoOps.mjs +1 -1
  28. package/dist/crypto/PkceGenerator.mjs +1 -1
  29. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  30. package/dist/crypto/TokenBindingKeyManager.mjs +1 -1
  31. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  32. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  33. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +1 -1
  34. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  35. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  36. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  37. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  38. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  39. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  40. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +1 -1
  56. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +1 -1
  57. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +1 -1
  58. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +1 -1
  59. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +1 -1
  60. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +1 -1
  61. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +1 -1
  62. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +1 -1
  63. package/dist/custom_auth/core/auth_flow/v2/state/PasswordRequiredStateV2.mjs +1 -1
  64. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  65. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  66. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  67. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  68. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  69. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  70. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  71. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  72. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  73. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  74. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  75. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  76. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  77. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  78. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  79. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  80. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  81. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  82. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  83. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  84. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  85. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  86. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +1 -1
  87. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +1 -1
  88. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +1 -1
  89. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  90. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  91. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  92. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  93. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  94. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  95. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  96. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  97. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  98. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +1 -1
  99. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
  100. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +1 -1
  101. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
  102. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
  103. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +1 -1
  104. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
  105. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +1 -1
  106. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +1 -1
  107. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  108. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  109. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +1 -1
  110. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +1 -1
  111. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
  112. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  113. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  114. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  115. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  116. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  117. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  118. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  119. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  120. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  121. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  122. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  123. package/dist/custom_auth/index.mjs +1 -1
  124. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  125. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  126. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  127. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  128. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  129. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  130. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  131. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  132. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  133. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  134. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  135. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +1 -1
  136. package/dist/custom_auth/reset_password/auth_flow/v2/state/ResetPasswordStateTransitionHandlerV2.mjs +1 -1
  137. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  138. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  139. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  140. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  141. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  142. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  143. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  144. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  145. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  146. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  147. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  148. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  149. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  150. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +1 -1
  151. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +1 -1
  152. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  153. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  154. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  155. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  156. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  157. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  158. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  159. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  160. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  161. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  162. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  163. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  164. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  165. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  166. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +1 -1
  167. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountCodeRequiredStateV2.mjs +1 -1
  168. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountPasswordRequiredStateV2.mjs +1 -1
  169. package/dist/custom_auth/sign_up/auth_flow/v2/state/ExistingAccountStateTransitionHelperV2.mjs +1 -1
  170. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +1 -1
  171. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  172. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  173. package/dist/encode/Base64Decode.mjs +1 -1
  174. package/dist/encode/Base64Encode.mjs +1 -1
  175. package/dist/error/BrowserAuthError.mjs +1 -1
  176. package/dist/error/BrowserAuthErrorCodes.mjs +3 -2
  177. package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
  178. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  179. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  180. package/dist/error/NativeAuthError.mjs +1 -1
  181. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  182. package/dist/error/NestedAppAuthError.mjs +1 -1
  183. package/dist/event/EventHandler.mjs +1 -1
  184. package/dist/event/EventMessage.mjs +1 -1
  185. package/dist/event/EventType.mjs +1 -1
  186. package/dist/index.mjs +1 -1
  187. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  188. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  189. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +1 -1
  190. package/dist/interaction_client/PopupClient.mjs +27 -21
  191. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  192. package/dist/interaction_client/RedirectClient.mjs +13 -11
  193. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  194. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  195. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  196. package/dist/interaction_client/SilentIframeClient.mjs +5 -8
  197. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  198. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  199. package/dist/interaction_client/StandardInteractionClient.mjs +5 -1
  200. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  201. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  202. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  203. package/dist/log-strings-mapping.json +701 -697
  204. package/dist/naa/BridgeError.mjs +1 -1
  205. package/dist/naa/BridgeProxy.mjs +1 -1
  206. package/dist/naa/BridgeStatusCode.mjs +1 -1
  207. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  208. package/dist/navigation/NavigationClient.mjs +1 -1
  209. package/dist/network/FetchClient.mjs +1 -1
  210. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  211. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  212. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  213. package/dist/packageMetadata.mjs +2 -2
  214. package/dist/popup_relay/constants.mjs +24 -6
  215. package/dist/popup_relay/constants.mjs.map +1 -1
  216. package/dist/popup_relay/index.mjs +142 -44
  217. package/dist/popup_relay/index.mjs.map +1 -1
  218. package/dist/popup_relay/relayClient.mjs +66 -23
  219. package/dist/popup_relay/relayClient.mjs.map +1 -1
  220. package/dist/protocol/Authorize.mjs +70 -13
  221. package/dist/protocol/Authorize.mjs.map +1 -1
  222. package/dist/redirect_bridge/index.mjs +1 -1
  223. package/dist/request/RequestHelpers.mjs +1 -1
  224. package/dist/request/SilentRequestHelpers.mjs +2 -1
  225. package/dist/request/SilentRequestHelpers.mjs.map +1 -1
  226. package/dist/response/ResponseHandler.mjs +1 -1
  227. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  228. package/dist/telemetry/BrowserPerformanceEvents.mjs +9 -2
  229. package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
  230. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  231. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  232. package/dist/utils/BrowserConstants.mjs +1 -1
  233. package/dist/utils/BrowserDetection.mjs +1 -1
  234. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  235. package/dist/utils/BrowserUtils.mjs +1 -1
  236. package/dist/utils/Helpers.mjs +1 -1
  237. package/dist/utils/IframeMonitor.mjs +1 -1
  238. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  239. package/dist/utils/PopupMonitor.mjs +1 -1
  240. package/dist/utils/PopupOriginCheck.mjs +1 -1
  241. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  242. package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
  243. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  244. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  245. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  246. package/dist/webBrokerBridge/index.mjs +1 -1
  247. package/lib/custom-auth-path/log-strings-mapping.json +13 -9
  248. package/lib/custom-auth-path/msal-custom-auth.cjs +519 -143
  249. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  250. package/lib/custom-auth-path/msal-custom-auth.js +519 -143
  251. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  252. package/lib/log-strings-mapping.json +13 -9
  253. package/lib/msal-browser.cjs +523 -145
  254. package/lib/msal-browser.cjs.map +1 -1
  255. package/lib/msal-browser.js +523 -145
  256. package/lib/msal-browser.js.map +1 -1
  257. package/lib/msal-browser.min.js +2 -2
  258. package/lib/popup-relay/msal-popup-relay.cjs +231 -60
  259. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  260. package/lib/popup-relay/msal-popup-relay.js +231 -60
  261. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  262. package/lib/popup-relay/msal-popup-relay.min.js +2 -2
  263. package/lib/redirect-bridge/msal-redirect-bridge.cjs +39 -10
  264. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  265. package/lib/redirect-bridge/msal-redirect-bridge.js +39 -10
  266. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  267. package/lib/redirect-bridge/msal-redirect-bridge.min.js +2 -2
  268. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
  269. package/package.json +2 -2
  270. package/src/cache/BrowserCacheManager.ts +1 -5
  271. package/src/config/Configuration.ts +35 -0
  272. package/src/crypto/BrowserCrypto.ts +363 -0
  273. package/src/error/AsymmetricEarSubErrors.ts +18 -0
  274. package/src/error/BrowserAuthErrorCodes.ts +1 -0
  275. package/src/interaction_client/PopupClient.ts +59 -29
  276. package/src/interaction_client/RedirectClient.ts +15 -14
  277. package/src/interaction_client/SilentIframeClient.ts +9 -13
  278. package/src/interaction_client/StandardInteractionClient.ts +4 -0
  279. package/src/packageMetadata.ts +1 -1
  280. package/src/popup_relay/constants.ts +34 -3
  281. package/src/popup_relay/index.ts +200 -45
  282. package/src/popup_relay/relayClient.ts +108 -24
  283. package/src/protocol/Authorize.ts +118 -11
  284. package/src/request/PopupRequest.ts +1 -0
  285. package/src/request/RedirectRequest.ts +1 -0
  286. package/src/request/SilentRequestHelpers.ts +1 -0
  287. package/src/request/SsoSilentRequest.ts +1 -0
  288. package/src/telemetry/BrowserPerformanceEvents.ts +7 -0
  289. package/types/cache/BrowserCacheManager.d.ts.map +1 -1
  290. package/types/config/Configuration.d.ts +14 -0
  291. package/types/config/Configuration.d.ts.map +1 -1
  292. package/types/crypto/BrowserCrypto.d.ts +34 -0
  293. package/types/crypto/BrowserCrypto.d.ts.map +1 -1
  294. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  295. package/types/error/AsymmetricEarSubErrors.d.ts +14 -0
  296. package/types/error/AsymmetricEarSubErrors.d.ts.map +1 -0
  297. package/types/error/BrowserAuthErrorCodes.d.ts +1 -0
  298. package/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
  299. package/types/interaction_client/PopupClient.d.ts +3 -1
  300. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  301. package/types/interaction_client/RedirectClient.d.ts +0 -1
  302. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  303. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  304. package/types/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  305. package/types/packageMetadata.d.ts +1 -1
  306. package/types/popup_relay/constants.d.ts +10 -3
  307. package/types/popup_relay/constants.d.ts.map +1 -1
  308. package/types/popup_relay/index.d.ts +27 -11
  309. package/types/popup_relay/index.d.ts.map +1 -1
  310. package/types/popup_relay/relayClient.d.ts +9 -11
  311. package/types/popup_relay/relayClient.d.ts.map +1 -1
  312. package/types/protocol/Authorize.d.ts +5 -0
  313. package/types/protocol/Authorize.d.ts.map +1 -1
  314. package/types/request/PopupRequest.d.ts +1 -1
  315. package/types/request/PopupRequest.d.ts.map +1 -1
  316. package/types/request/RedirectRequest.d.ts +1 -1
  317. package/types/request/RedirectRequest.d.ts.map +1 -1
  318. package/types/request/SilentRequestHelpers.d.ts.map +1 -1
  319. package/types/request/SsoSilentRequest.d.ts +1 -1
  320. package/types/request/SsoSilentRequest.d.ts.map +1 -1
  321. package/types/telemetry/BrowserPerformanceEvents.d.ts +7 -0
  322. package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v5.29.0 2026-11-06 */
1
+ /*! @azure/msal-browser v5.30.0 2026-11-18 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -6,7 +6,7 @@
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msalCustomAuth = {}));
7
7
  })(this, (function (exports) { 'use strict';
8
8
 
9
- /*! @azure/msal-common v16.16.1 2026-11-06 */
9
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -66,7 +66,7 @@
66
66
  */
67
67
  const POPUP_ORIGIN_CHECK_DONE = "pocd";
68
68
 
69
- /*! @azure/msal-common v16.16.1 2026-11-06 */
69
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
70
70
  /*
71
71
  * Copyright (c) Microsoft Corporation. All rights reserved.
72
72
  * Licensed under the MIT License.
@@ -300,7 +300,7 @@
300
300
  // Token renewal offset default in seconds
301
301
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
302
302
 
303
- /*! @azure/msal-common v16.16.1 2026-11-06 */
303
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
304
304
  /*
305
305
  * Copyright (c) Microsoft Corporation. All rights reserved.
306
306
  * Licensed under the MIT License.
@@ -329,7 +329,7 @@
329
329
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
330
330
  }
331
331
 
332
- /*! @azure/msal-common v16.16.1 2026-11-06 */
332
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
333
333
 
334
334
  /*
335
335
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -352,7 +352,7 @@
352
352
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
353
353
  }
354
354
 
355
- /*! @azure/msal-common v16.16.1 2026-11-06 */
355
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
356
356
  /*
357
357
  * Copyright (c) Microsoft Corporation. All rights reserved.
358
358
  * Licensed under the MIT License.
@@ -390,7 +390,7 @@
390
390
  const resourceParameterRequired = "resource_parameter_required";
391
391
  const misplacedResourceParam = "misplaced_resource_parameter";
392
392
 
393
- /*! @azure/msal-common v16.16.1 2026-11-06 */
393
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
394
394
 
395
395
  /*
396
396
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -428,7 +428,7 @@
428
428
  };
429
429
  }
430
430
 
431
- /*! @azure/msal-common v16.16.1 2026-11-06 */
431
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
432
432
 
433
433
  /*
434
434
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -494,7 +494,7 @@
494
494
  return matches[2];
495
495
  }
496
496
 
497
- /*! @azure/msal-common v16.16.1 2026-11-06 */
497
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
498
498
 
499
499
  /*
500
500
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -582,7 +582,7 @@
582
582
  return updatedAccountInfo;
583
583
  }
584
584
 
585
- /*! @azure/msal-common v16.16.1 2026-11-06 */
585
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
586
586
  /*
587
587
  * Copyright (c) Microsoft Corporation. All rights reserved.
588
588
  * Licensed under the MIT License.
@@ -596,7 +596,7 @@
596
596
  Ciam: 3,
597
597
  };
598
598
 
599
- /*! @azure/msal-common v16.16.1 2026-11-06 */
599
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
600
600
  /*
601
601
  * Copyright (c) Microsoft Corporation. All rights reserved.
602
602
  * Licensed under the MIT License.
@@ -618,7 +618,7 @@
618
618
  return null;
619
619
  }
620
620
 
621
- /*! @azure/msal-common v16.16.1 2026-11-06 */
621
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
622
622
  /*
623
623
  * Copyright (c) Microsoft Corporation. All rights reserved.
624
624
  * Licensed under the MIT License.
@@ -642,7 +642,7 @@
642
642
  EAR: "EAR",
643
643
  };
644
644
 
645
- /*! @azure/msal-common v16.16.1 2026-11-06 */
645
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
646
646
  /**
647
647
  * Returns the AccountInfo interface for this account.
648
648
  * @internal
@@ -831,7 +831,7 @@
831
831
  entity.hasOwnProperty("authorityType"));
832
832
  }
833
833
 
834
- /*! @azure/msal-common v16.16.1 2026-11-06 */
834
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
835
835
  /*
836
836
  * Copyright (c) Microsoft Corporation. All rights reserved.
837
837
  * Licensed under the MIT License.
@@ -841,7 +841,7 @@
841
841
  */
842
842
  const unexpectedError = "unexpected_error";
843
843
 
844
- /*! @azure/msal-common v16.16.1 2026-11-06 */
844
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
845
845
 
846
846
  /*
847
847
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -861,7 +861,7 @@
861
861
  return new ClientConfigurationError(errorCode, correlationId);
862
862
  }
863
863
 
864
- /*! @azure/msal-common v16.16.1 2026-11-06 */
864
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
865
865
  /*
866
866
  * Copyright (c) Microsoft Corporation. All rights reserved.
867
867
  * Licensed under the MIT License.
@@ -901,7 +901,7 @@
901
901
  return headerName === undefined ? undefined : headers[headerName];
902
902
  }
903
903
 
904
- /*! @azure/msal-common v16.16.1 2026-11-06 */
904
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
905
905
  /*
906
906
  * Copyright (c) Microsoft Corporation. All rights reserved.
907
907
  * Licensed under the MIT License.
@@ -932,7 +932,7 @@
932
932
  const invalidDpopNonce = "invalid_dpop_nonce";
933
933
  const dpopMissingResourceContext = "dpop_missing_resource_context";
934
934
 
935
- /*! @azure/msal-common v16.16.1 2026-11-06 */
935
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
936
936
  /*
937
937
  * Copyright (c) Microsoft Corporation. All rights reserved.
938
938
  * Licensed under the MIT License.
@@ -944,7 +944,7 @@
944
944
  response.hasOwnProperty("jwks_uri"));
945
945
  }
946
946
 
947
- /*! @azure/msal-common v16.16.1 2026-11-06 */
947
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
948
948
  /*
949
949
  * Copyright (c) Microsoft Corporation. All rights reserved.
950
950
  * Licensed under the MIT License.
@@ -1024,12 +1024,18 @@
1024
1024
  }
1025
1025
  }
1026
1026
 
1027
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1027
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1028
1028
 
1029
1029
  /*
1030
1030
  * Copyright (c) Microsoft Corporation. All rights reserved.
1031
1031
  * Licensed under the MIT License.
1032
1032
  */
1033
+ // Matches ASCII controls, space, DEL, backslash, or the userinfo separator (@).
1034
+ const UNSAFE_AUTHORITY = /[\x00-\x20\x7f\\@]/;
1035
+ const DEFAULT_PORTS = {
1036
+ "https:": ":443",
1037
+ "http:": ":80",
1038
+ };
1033
1039
  /**
1034
1040
  * Url object class which can perform various transformations on url strings.
1035
1041
  */
@@ -1145,6 +1151,29 @@
1145
1151
  AbsolutePath: match[5],
1146
1152
  QueryString: match[7],
1147
1153
  };
1154
+ let parsedUrl;
1155
+ try {
1156
+ parsedUrl = new URL(this.urlString);
1157
+ }
1158
+ catch {
1159
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1160
+ }
1161
+ const host = urlComponents.HostNameAndPort?.toLowerCase();
1162
+ const schemeAndAuthority = `${urlComponents.Protocol}//${host}`;
1163
+ const defaultPort = DEFAULT_PORTS[parsedUrl.protocol] ?? "";
1164
+ /*
1165
+ * Cross-check the original host; reparsing parsedUrl would hide parser differences.
1166
+ * URL has validated IPv6 syntax, so only bracketed hosts need a normalization comparison.
1167
+ */
1168
+ const hostMatches = host === parsedUrl.host ||
1169
+ host === `${parsedUrl.host}${defaultPort}` ||
1170
+ (host?.startsWith("[") &&
1171
+ new URL(`${urlComponents.Protocol}//${host}`).host ===
1172
+ parsedUrl.host);
1173
+ // Check authority ambiguity without restricting resource paths, queries, or fragments.
1174
+ if (UNSAFE_AUTHORITY.test(schemeAndAuthority) || !hostMatches) {
1175
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1176
+ }
1148
1177
  let pathSegments = urlComponents.AbsolutePath.split("/");
1149
1178
  pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements
1150
1179
  urlComponents.PathSegments = pathSegments;
@@ -1182,7 +1211,7 @@
1182
1211
  }
1183
1212
  }
1184
1213
 
1185
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1214
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1186
1215
 
1187
1216
  /*
1188
1217
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1336,7 +1365,7 @@
1336
1365
  return null;
1337
1366
  }
1338
1367
 
1339
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1368
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1340
1369
  /*
1341
1370
  * Copyright (c) Microsoft Corporation. All rights reserved.
1342
1371
  * Licensed under the MIT License.
@@ -1345,7 +1374,7 @@
1345
1374
  // AzureCloudInstance is not specified.
1346
1375
  None: "none"};
1347
1376
 
1348
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1377
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1349
1378
  /*
1350
1379
  * Copyright (c) Microsoft Corporation. All rights reserved.
1351
1380
  * Licensed under the MIT License.
@@ -1355,7 +1384,7 @@
1355
1384
  response.hasOwnProperty("metadata"));
1356
1385
  }
1357
1386
 
1358
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1387
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1359
1388
  /*
1360
1389
  * Copyright (c) Microsoft Corporation. All rights reserved.
1361
1390
  * Licensed under the MIT License.
@@ -1365,7 +1394,7 @@
1365
1394
  response.hasOwnProperty("error_description"));
1366
1395
  }
1367
1396
 
1368
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1397
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1369
1398
  /*
1370
1399
  * Copyright (c) Microsoft Corporation. All rights reserved.
1371
1400
  * Licensed under the MIT License.
@@ -1436,7 +1465,7 @@
1436
1465
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1437
1466
  const SetUserData = "setUserData";
1438
1467
 
1439
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1468
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1440
1469
  /*
1441
1470
  * Copyright (c) Microsoft Corporation. All rights reserved.
1442
1471
  * Licensed under the MIT License.
@@ -1472,7 +1501,8 @@
1472
1501
  catch (e) {
1473
1502
  logger.trace(`0cfd8i ${eventName}`, correlationId);
1474
1503
  try {
1475
- logger.trace(JSON.stringify(e), correlationId);
1504
+ // Prevent numeric error details from being treated as minified log hashes.
1505
+ logger.tracePii(`028ef8 ${JSON.stringify(e)}`, correlationId);
1476
1506
  }
1477
1507
  catch (e) {
1478
1508
  logger.trace("00dty7", correlationId);
@@ -1516,7 +1546,7 @@
1516
1546
  .catch((e) => {
1517
1547
  logger.trace(`0cfd8i ${eventName}`, correlationId);
1518
1548
  try {
1519
- logger.trace(JSON.stringify(e), correlationId);
1549
+ logger.tracePii(`028ef8 ${JSON.stringify(e)}`, correlationId);
1520
1550
  }
1521
1551
  catch (e) {
1522
1552
  logger.trace("00dty7", correlationId);
@@ -1529,12 +1559,26 @@
1529
1559
  };
1530
1560
  };
1531
1561
 
1532
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1562
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1533
1563
 
1534
1564
  /*
1535
1565
  * Copyright (c) Microsoft Corporation. All rights reserved.
1536
1566
  * Licensed under the MIT License.
1537
1567
  */
1568
+ // Starts with an ASCII letter; remaining characters are ASCII letters, digits, or hyphens.
1569
+ const REGION_NAME_PATTERN = /^[a-z][a-z0-9-]*$/i;
1570
+ // A region becomes a DNS label, limited to 63 octets by RFC 1035 section 2.3.4.
1571
+ const MAX_REGION_NAME_LENGTH = 63;
1572
+ /**
1573
+ * Whether a region can safely be used as a single DNS label.
1574
+ */
1575
+ function isValidRegion(region) {
1576
+ return (typeof region === "string" &&
1577
+ region.length <= MAX_REGION_NAME_LENGTH &&
1578
+ REGION_NAME_PATTERN.test(region) &&
1579
+ // Keep the trailing-hyphen rule explicit rather than complicating the pattern.
1580
+ !region.endsWith("-"));
1581
+ }
1538
1582
  class RegionDiscovery {
1539
1583
  constructor(networkInterface, logger, performanceClient, correlationId) {
1540
1584
  this.networkInterface = networkInterface;
@@ -1594,12 +1638,16 @@
1594
1638
  regionDiscoveryMetadata.region_source =
1595
1639
  RegionDiscoverySources.ENVIRONMENT_VARIABLE;
1596
1640
  }
1597
- // If no region was auto detected from the environment or from the IMDS endpoint, mark the attempt as a FAILED_AUTO_DETECTION
1598
- if (!autodetectedRegionName) {
1641
+ // Untrusted discovery values must be a single DNS label before becoming a host prefix.
1642
+ if (!autodetectedRegionName || !isValidRegion(autodetectedRegionName)) {
1643
+ if (autodetectedRegionName) {
1644
+ this.logger.warning("0n83q0", this.correlationId);
1645
+ }
1599
1646
  regionDiscoveryMetadata.region_source =
1600
1647
  RegionDiscoverySources.FAILED_AUTO_DETECTION;
1648
+ return null;
1601
1649
  }
1602
- return autodetectedRegionName || null;
1650
+ return autodetectedRegionName;
1603
1651
  }
1604
1652
  /**
1605
1653
  * Make the call to the IMDS endpoint
@@ -1640,7 +1688,7 @@
1640
1688
  },
1641
1689
  };
1642
1690
 
1643
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1691
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1644
1692
  /*
1645
1693
  * Copyright (c) Microsoft Corporation. All rights reserved.
1646
1694
  * Licensed under the MIT License.
@@ -1705,7 +1753,7 @@
1705
1753
  return cachedAtSec > nowSeconds();
1706
1754
  }
1707
1755
 
1708
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1756
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1709
1757
 
1710
1758
  /*
1711
1759
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1992,7 +2040,7 @@
1992
2040
  return [...attributeTokens].sort().join(" ");
1993
2041
  }
1994
2042
 
1995
- /*! @azure/msal-common v16.16.1 2026-11-06 */
2043
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1996
2044
 
1997
2045
  /*
1998
2046
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2845,6 +2893,9 @@
2845
2893
  * @param region string
2846
2894
  */
2847
2895
  static buildRegionalAuthorityString(host, region, correlationId, queryString) {
2896
+ if (!isValidRegion(region)) {
2897
+ throw createClientConfigurationError(urlParseError, correlationId);
2898
+ }
2848
2899
  // Create and validate a Url string object with the initial authority string
2849
2900
  const authorityUrlInstance = new UrlString(host, correlationId);
2850
2901
  authorityUrlInstance.validateAsUri();
@@ -2855,7 +2906,7 @@
2855
2906
  }
2856
2907
  // Include the query string portion of the url
2857
2908
  const url = UrlString.constructAuthorityUriFromObject({
2858
- ...authorityUrlInstance.getUrlComponents(),
2909
+ ...authorityUrlParts,
2859
2910
  HostNameAndPort: hostNameAndPort,
2860
2911
  }, correlationId).urlString;
2861
2912
  // Add the query string if a query string was provided
@@ -2960,7 +3011,7 @@
2960
3011
  };
2961
3012
  }
2962
3013
 
2963
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3014
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
2964
3015
 
2965
3016
  /*
2966
3017
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2994,7 +3045,7 @@
2994
3045
  }
2995
3046
  }
2996
3047
 
2997
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3048
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
2998
3049
 
2999
3050
  /*
3000
3051
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3190,7 +3241,7 @@
3190
3241
  }
3191
3242
  }
3192
3243
 
3193
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3244
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3194
3245
 
3195
3246
  /*
3196
3247
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3658,12 +3709,13 @@
3658
3709
  * Add EAR (Encrypted Authorize Response) request parameters
3659
3710
  * @param parameters
3660
3711
  * @param jwk
3712
+ * @param jweCrypto - Base64-encoded encryption metadata; defaults to symmetric EAR.
3661
3713
  */
3662
- function addEARParameters(parameters, jwk) {
3714
+ function addEARParameters(parameters, jwk, jweCrypto) {
3663
3715
  parameters.set(EAR_JWK, encodeURIComponent(jwk));
3664
- // ear_jwe_crypto will always have value: {"alg":"dir","enc":"A256GCM"} so we can hardcode this
3716
+ // Default symmetric EAR metadata; asymmetric requests supply their APV.
3665
3717
  const jweCryptoB64Encoded = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0";
3666
- parameters.set(EAR_JWE_CRYPTO, jweCryptoB64Encoded);
3718
+ parameters.set(EAR_JWE_CRYPTO, jweCrypto ?? jweCryptoB64Encoded);
3667
3719
  }
3668
3720
  function addResource(parameters, resource) {
3669
3721
  if (resource) {
@@ -3690,7 +3742,7 @@
3690
3742
  }
3691
3743
  }
3692
3744
 
3693
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3745
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3694
3746
 
3695
3747
  /*
3696
3748
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3821,7 +3873,7 @@
3821
3873
  }
3822
3874
  }
3823
3875
 
3824
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3876
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3825
3877
 
3826
3878
  /*
3827
3879
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3869,7 +3921,7 @@
3869
3921
  },
3870
3922
  };
3871
3923
 
3872
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3924
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3873
3925
 
3874
3926
  /*
3875
3927
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3892,7 +3944,7 @@
3892
3944
  },
3893
3945
  };
3894
3946
 
3895
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3947
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3896
3948
  /*
3897
3949
  * Copyright (c) Microsoft Corporation. All rights reserved.
3898
3950
  * Licensed under the MIT License.
@@ -4167,12 +4219,12 @@
4167
4219
  }
4168
4220
  }
4169
4221
 
4170
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4222
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4171
4223
  /* eslint-disable header/header */
4172
4224
  const name$1 = "@azure/msal-common";
4173
- const version$1 = "16.16.1";
4225
+ const version$1 = "16.17.0";
4174
4226
 
4175
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4227
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4176
4228
  /*
4177
4229
  * Copyright (c) Microsoft Corporation. All rights reserved.
4178
4230
  * Licensed under the MIT License.
@@ -4180,7 +4232,7 @@
4180
4232
  const cacheQuotaExceeded = "cache_quota_exceeded";
4181
4233
  const cacheErrorUnknown = "cache_error_unknown";
4182
4234
 
4183
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4235
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4184
4236
 
4185
4237
  /*
4186
4238
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4218,7 +4270,7 @@
4218
4270
  }
4219
4271
  }
4220
4272
 
4221
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4273
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4222
4274
 
4223
4275
  /*
4224
4276
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5445,7 +5497,7 @@
5445
5497
  }
5446
5498
  }
5447
5499
 
5448
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5500
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5449
5501
  /*
5450
5502
  * Copyright (c) Microsoft Corporation. All rights reserved.
5451
5503
  * Licensed under the MIT License.
@@ -5459,7 +5511,7 @@
5459
5511
  const PerformanceEventStatus = {
5460
5512
  InProgress: 1};
5461
5513
 
5462
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5514
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5463
5515
 
5464
5516
  /*
5465
5517
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5517,7 +5569,7 @@
5517
5569
  }
5518
5570
  }
5519
5571
 
5520
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5572
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5521
5573
 
5522
5574
  /*
5523
5575
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5615,7 +5667,7 @@
5615
5667
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5616
5668
  }
5617
5669
 
5618
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5670
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5619
5671
  /*
5620
5672
  * Copyright (c) Microsoft Corporation. All rights reserved.
5621
5673
  * Licensed under the MIT License.
@@ -5642,7 +5694,7 @@
5642
5694
  }
5643
5695
  }
5644
5696
 
5645
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5697
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5646
5698
 
5647
5699
  /*
5648
5700
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5663,7 +5715,7 @@
5663
5715
  return new JoseHeaderError(code, correlationId);
5664
5716
  }
5665
5717
 
5666
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5718
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5667
5719
  /*
5668
5720
  * Copyright (c) Microsoft Corporation. All rights reserved.
5669
5721
  * Licensed under the MIT License.
@@ -5688,7 +5740,7 @@
5688
5740
  return Object.getPrototypeOf(value) === proto;
5689
5741
  }
5690
5742
 
5691
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5743
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5692
5744
  /*
5693
5745
  * Copyright (c) Microsoft Corporation. All rights reserved.
5694
5746
  * Licensed under the MIT License.
@@ -5698,7 +5750,7 @@
5698
5750
  const missingJwkError = "missing_jwk_error";
5699
5751
  const invalidJwkError = "invalid_jwk_error";
5700
5752
 
5701
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5753
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5702
5754
 
5703
5755
  /*
5704
5756
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5764,7 +5816,7 @@
5764
5816
  }
5765
5817
  }
5766
5818
 
5767
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5819
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5768
5820
 
5769
5821
  /*
5770
5822
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5865,7 +5917,7 @@
5865
5917
  }
5866
5918
  }
5867
5919
 
5868
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5920
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5869
5921
 
5870
5922
  /*
5871
5923
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6020,7 +6072,7 @@
6020
6072
  }
6021
6073
  }
6022
6074
 
6023
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6075
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6024
6076
  /*
6025
6077
  * Copyright (c) Microsoft Corporation. All rights reserved.
6026
6078
  * Licensed under the MIT License.
@@ -6071,7 +6123,7 @@
6071
6123
  */
6072
6124
  const interruptedUser = "interrupted_user";
6073
6125
 
6074
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6126
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6075
6127
 
6076
6128
  /*
6077
6129
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6138,7 +6190,7 @@
6138
6190
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6139
6191
  }
6140
6192
 
6141
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6193
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6142
6194
 
6143
6195
  /*
6144
6196
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6157,7 +6209,7 @@
6157
6209
  }
6158
6210
  }
6159
6211
 
6160
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6212
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6161
6213
 
6162
6214
  /*
6163
6215
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6228,7 +6280,7 @@
6228
6280
  }
6229
6281
  }
6230
6282
 
6231
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6283
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6232
6284
 
6233
6285
  /*
6234
6286
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6656,7 +6708,7 @@
6656
6708
  return baseAccount;
6657
6709
  }
6658
6710
 
6659
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6711
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6660
6712
  /*
6661
6713
  * Copyright (c) Microsoft Corporation. All rights reserved.
6662
6714
  * Licensed under the MIT License.
@@ -6666,7 +6718,7 @@
6666
6718
  UPN: "UPN",
6667
6719
  };
6668
6720
 
6669
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6721
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6670
6722
  /*
6671
6723
  * Copyright (c) Microsoft Corporation. All rights reserved.
6672
6724
  * Licensed under the MIT License.
@@ -6685,7 +6737,7 @@
6685
6737
  }
6686
6738
  }
6687
6739
 
6688
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6740
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6689
6741
 
6690
6742
  /*
6691
6743
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6709,7 +6761,7 @@
6709
6761
  };
6710
6762
  }
6711
6763
 
6712
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6764
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6713
6765
 
6714
6766
  /*
6715
6767
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6799,7 +6851,7 @@
6799
6851
  return undefined;
6800
6852
  }
6801
6853
 
6802
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6854
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6803
6855
 
6804
6856
  /*
6805
6857
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6830,7 +6882,7 @@
6830
6882
  return new NetworkError(error, httpStatus, responseHeaders);
6831
6883
  }
6832
6884
 
6833
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6885
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6834
6886
 
6835
6887
  /*
6836
6888
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6964,7 +7016,7 @@
6964
7016
  return response;
6965
7017
  }
6966
7018
 
6967
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7019
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6968
7020
 
6969
7021
  /*
6970
7022
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7007,7 +7059,8 @@
7007
7059
  throw createClientAuthError(requestCannotBeMade, request.correlationId);
7008
7060
  }
7009
7061
  // Check for new cloud instance
7010
- if (authCodePayload && authCodePayload.cloud_instance_host_name) {
7062
+ if (this.config.authOptions.instanceAware === true &&
7063
+ authCodePayload?.cloud_instance_host_name) {
7011
7064
  await invokeAsync(this.updateTokenEndpointAuthority.bind(this), UpdateTokenEndpointAuthority, this.logger, this.performanceClient, request.correlationId)(authCodePayload.cloud_instance_host_name, request.correlationId);
7012
7065
  }
7013
7066
  const reqTimestamp = nowSeconds();
@@ -7231,7 +7284,7 @@
7231
7284
  }
7232
7285
  }
7233
7286
 
7234
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7287
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7235
7288
 
7236
7289
  /*
7237
7290
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7416,13 +7469,13 @@
7416
7469
  decodedServerResponseState = decodeURIComponent(serverResponse.state);
7417
7470
  }
7418
7471
  catch (e) {
7419
- throw createClientAuthError(invalidState, correlationId, serverResponse.state);
7472
+ throw createClientAuthError(invalidState, correlationId);
7420
7473
  }
7421
7474
  try {
7422
7475
  decodedRequestState = decodeURIComponent(requestState);
7423
7476
  }
7424
7477
  catch (e) {
7425
- throw createClientAuthError(invalidState, correlationId, serverResponse.state);
7478
+ throw createClientAuthError(invalidState, correlationId);
7426
7479
  }
7427
7480
  if (decodedServerResponseState !== decodedRequestState) {
7428
7481
  throw createClientAuthError(stateMismatch, correlationId);
@@ -7461,7 +7514,7 @@
7461
7514
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7462
7515
  }
7463
7516
 
7464
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7517
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7465
7518
 
7466
7519
  /*
7467
7520
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7696,7 +7749,7 @@
7696
7749
  }
7697
7750
  }
7698
7751
 
7699
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7752
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7700
7753
 
7701
7754
  /*
7702
7755
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7989,7 +8042,7 @@
7989
8042
  clearNativeBrokerErrorCode() { }
7990
8043
  }
7991
8044
 
7992
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8045
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7993
8046
 
7994
8047
  /*
7995
8048
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8116,7 +8169,7 @@
8116
8169
  }
8117
8170
  }
8118
8171
 
8119
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8172
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
8120
8173
 
8121
8174
  /*
8122
8175
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8132,7 +8185,7 @@
8132
8185
  },
8133
8186
  };
8134
8187
 
8135
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8188
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
8136
8189
 
8137
8190
  /*
8138
8191
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8584,7 +8637,7 @@
8584
8637
 
8585
8638
  /* eslint-disable header/header */
8586
8639
  const name = "@azure/msal-browser";
8587
- const version = "5.29.0";
8640
+ const version = "5.30.0";
8588
8641
 
8589
8642
  /*
8590
8643
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9228,6 +9281,13 @@
9228
9281
  const Encrypt = "encrypt";
9229
9282
  const Decrypt = "decrypt";
9230
9283
  const GenerateEarKey = "generateEarKey";
9284
+ const GenerateAsymmetricEarKey = "generateAsymmetricEarKey";
9285
+ const ImportAsymmetricEarKey = "importAsymmetricEarKey";
9286
+ const ImportAsymmetricEarPublicKey = "importAsymmetricEarPublicKey";
9287
+ const DeriveAsymmetricEarSecret = "deriveAsymmetricEarSecret";
9288
+ const AsymmetricEarConcatKdf = "asymmetricEarConcatKdf";
9289
+ const ImportAsymmetricEarContentKey = "importAsymmetricEarContentKey";
9290
+ const DecryptAsymmetricEarResponse = "decryptAsymmetricEarResponse";
9231
9291
  const DecryptEarResponse = "decryptEarResponse";
9232
9292
  /**
9233
9293
  * Background telemetry measurement that tracks whether a late bridge response
@@ -9288,6 +9348,7 @@
9288
9348
  const failedToBuildHeaders = "failed_to_build_headers";
9289
9349
  const failedToParseHeaders = "failed_to_parse_headers";
9290
9350
  const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
9351
+ const asymmetricEarKeyError = "asymmetric_ear_key_error";
9291
9352
  const timedOut = "timed_out";
9292
9353
  const emptyResponse = "empty_response";
9293
9354
 
@@ -9596,6 +9657,10 @@
9596
9657
  const S256_HASH_ALG = "SHA-256";
9597
9658
  // JWK values used by browser-internal WebCrypto helpers.
9598
9659
  const JSON_WEB_KEY_CURVE_P256 = "P-256";
9660
+ const ECDH_P384_ALGORITHM = {
9661
+ name: "ECDH",
9662
+ namedCurve: "P-384",
9663
+ };
9599
9664
  const JSON_WEB_KEY_TYPE_EC = "EC";
9600
9665
  const JSON_WEB_KEY_TYPE_RSA = "RSA";
9601
9666
  const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
@@ -9733,6 +9798,16 @@
9733
9798
  async function exportJwk(key) {
9734
9799
  return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
9735
9800
  }
9801
+ /**
9802
+ * Imports key as Json Web Key (JWK), can set extractable and usages.
9803
+ * @param key
9804
+ * @param extractable
9805
+ * @param usages
9806
+ * @param algorithm
9807
+ */
9808
+ async function importJwk(key, extractable, usages, algorithm) {
9809
+ return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, algorithm, extractable, usages);
9810
+ }
9736
9811
  /**
9737
9812
  * Signs given data with given key.
9738
9813
  * @param key
@@ -9755,6 +9830,172 @@
9755
9830
  };
9756
9831
  return base64Encode(JSON.stringify(jwk));
9757
9832
  }
9833
+ /**
9834
+ * Generates P-384 ECDH keys for request-scoped private sessionStorage and public wire metadata.
9835
+ * @internal
9836
+ */
9837
+ async function generateAsymmetricEarKey() {
9838
+ const keyPair = await generateKeyPair(true, ["deriveBits"], ECDH_P384_ALGORITHM);
9839
+ const publicJwk = await exportJwk(keyPair.publicKey);
9840
+ const privateJwk = await exportJwk(keyPair.privateKey);
9841
+ return {
9842
+ privateJwk,
9843
+ publicJwk,
9844
+ };
9845
+ }
9846
+ /**
9847
+ * Restores a private EAR key as non-exportable. The serialized sessionStorage copy remains exportable.
9848
+ * @internal
9849
+ */
9850
+ async function importAsymmetricEarKey(privateJwk, correlationId = "") {
9851
+ if (privateJwk?.kty !== "EC" ||
9852
+ privateJwk.crv !== "P-384" ||
9853
+ !privateJwk.d) {
9854
+ throw createBrowserAuthError(asymmetricEarKeyError, correlationId, "invalid_private_key" /* AsymmetricEarSubErrors.InvalidPrivateKey */);
9855
+ }
9856
+ try {
9857
+ return await importJwk(privateJwk, false, ["deriveBits"], ECDH_P384_ALGORITHM);
9858
+ }
9859
+ catch {
9860
+ throw createBrowserAuthError(asymmetricEarKeyError, correlationId, "private_key_import_failed" /* AsymmetricEarSubErrors.PrivateKeyImportFailed */);
9861
+ }
9862
+ }
9863
+ /**
9864
+ * Encodes the EAR client party information with a fresh 192-bit nonce.
9865
+ * @internal
9866
+ */
9867
+ function generateAsymmetricEarApv(publicJwk) {
9868
+ const point = new Uint8Array(concatEarBytes(new Uint8Array([4]), decodeEarBase64Url(publicJwk.x || ""), decodeEarBase64Url(publicJwk.y || "")));
9869
+ if (point.length !== 97) {
9870
+ throw createBrowserAuthError(asymmetricEarKeyError, "", "invalid_public_key_coordinates" /* AsymmetricEarSubErrors.InvalidPublicKeyCoordinates */);
9871
+ }
9872
+ const nonce = new Uint8Array(24);
9873
+ window.crypto.getRandomValues(nonce);
9874
+ return urlEncodeArr(new Uint8Array(concatEarBytes(lengthPrefixEarBytes(new TextEncoder().encode("EarClient")), lengthPrefixEarBytes(point), lengthPrefixEarBytes(nonce))));
9875
+ }
9876
+ /**
9877
+ * Authenticates and decrypts direct ECDH-ES/P-384/A256GCM using JOSE Concat KDF.
9878
+ * Party information is used byte-for-byte; the service need not echo the request APV.
9879
+ * @internal
9880
+ */
9881
+ async function decryptAsymmetricEarResponse(privateJwk, apv, earJwe, requestApv = apv, telemetry) {
9882
+ const correlationId = telemetry?.correlationId || "";
9883
+ const measure = (eventName, operation) => telemetry
9884
+ ? invokeAsync(operation, eventName, telemetry.logger, telemetry.performanceClient, correlationId)()
9885
+ : operation();
9886
+ if (apv !== requestApv) {
9887
+ throw createBrowserAuthError(asymmetricEarKeyError, correlationId, "request_apv_mismatch" /* AsymmetricEarSubErrors.RequestApvMismatch */);
9888
+ }
9889
+ const parts = earJwe.split(".");
9890
+ if (parts.length !== 5 || parts[1] !== "") {
9891
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9892
+ }
9893
+ let header;
9894
+ try {
9895
+ header = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(decodeEarBase64Url(parts[0], correlationId)));
9896
+ }
9897
+ catch {
9898
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9899
+ }
9900
+ if (!header ||
9901
+ header.alg !== "ECDH-ES" ||
9902
+ header.enc !== "A256GCM" ||
9903
+ header.crit !== undefined ||
9904
+ header.zip !== undefined ||
9905
+ header.epk?.kty !== "EC" ||
9906
+ header.epk.crv !== "P-384" ||
9907
+ header.epk.d !== undefined ||
9908
+ (header.apv !== undefined && header.apv !== apv)) {
9909
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9910
+ }
9911
+ const x = decodeEarBase64Url(header.epk.x, correlationId);
9912
+ const y = decodeEarBase64Url(header.epk.y, correlationId);
9913
+ const apuBytes = decodeEarBase64Url(header.apu, correlationId);
9914
+ const apvBytes = decodeEarBase64Url(apv, correlationId);
9915
+ const iv = decodeEarBase64Url(parts[2], correlationId);
9916
+ const ciphertext = decodeEarBase64Url(parts[3], correlationId);
9917
+ const tag = decodeEarBase64Url(parts[4], correlationId);
9918
+ if (x.length !== 48 ||
9919
+ y.length !== 48 ||
9920
+ iv.length !== 12 ||
9921
+ tag.length !== 16) {
9922
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9923
+ }
9924
+ let key;
9925
+ try {
9926
+ const privateKey = await measure(ImportAsymmetricEarKey, () => importAsymmetricEarKey(privateJwk, correlationId));
9927
+ const publicKey = await measure(ImportAsymmetricEarPublicKey, () => importJwk({
9928
+ kty: "EC",
9929
+ crv: "P-384",
9930
+ x: header.epk.x,
9931
+ y: header.epk.y,
9932
+ }, false, [], ECDH_P384_ALGORITHM));
9933
+ const secret = new Uint8Array(await measure(DeriveAsymmetricEarSecret, () => window.crypto.subtle.deriveBits({ name: "ECDH", public: publicKey }, privateKey, 384)));
9934
+ // RFC 7518 section 4.6.2: one SHA-256 round produces the 256-bit content key.
9935
+ const input = new Uint8Array(concatEarBytes(earUint32(1), secret, lengthPrefixEarBytes(new TextEncoder().encode("A256GCM")), lengthPrefixEarBytes(apuBytes), lengthPrefixEarBytes(apvBytes), earUint32(256)));
9936
+ let derivedKey;
9937
+ try {
9938
+ derivedKey = await measure(AsymmetricEarConcatKdf, () => window.crypto.subtle.digest(S256_HASH_ALG, input));
9939
+ }
9940
+ finally {
9941
+ secret.fill(0);
9942
+ input.fill(0);
9943
+ }
9944
+ try {
9945
+ key = await measure(ImportAsymmetricEarContentKey, () => window.crypto.subtle.importKey(RAW, derivedKey, AES_GCM, false, [DECRYPT]));
9946
+ }
9947
+ finally {
9948
+ new Uint8Array(derivedKey).fill(0);
9949
+ }
9950
+ }
9951
+ catch (error) {
9952
+ if (error instanceof AuthError) {
9953
+ throw error;
9954
+ }
9955
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "content_encryption_key_derivation_failed" /* AsymmetricEarSubErrors.ContentEncryptionKeyDerivationFailed */);
9956
+ }
9957
+ try {
9958
+ const plaintext = await measure(DecryptAsymmetricEarResponse, () => window.crypto.subtle.decrypt({
9959
+ name: AES_GCM,
9960
+ iv,
9961
+ tagLength: 128,
9962
+ additionalData: new TextEncoder().encode(parts[0]),
9963
+ }, key, concatEarBytes(ciphertext, tag)));
9964
+ return new TextDecoder("utf-8", { fatal: true }).decode(plaintext);
9965
+ }
9966
+ catch {
9967
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "jwe_decryption_failed" /* AsymmetricEarSubErrors.JweDecryptionFailed */);
9968
+ }
9969
+ }
9970
+ /** Decodes canonical, unpadded JOSE base64url for asymmetric EAR only. */
9971
+ function decodeEarBase64Url(value, correlationId = "") {
9972
+ // Match the unpadded base64url alphabet only: letters, digits, '-' and '_'.
9973
+ if (typeof value !== "string" || !/^[A-Za-z0-9_-]+$/.test(value)) {
9974
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9975
+ }
9976
+ const bytes = new Uint8Array(base64DecToArr(value));
9977
+ if (urlEncodeArr(bytes) !== value) {
9978
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9979
+ }
9980
+ return bytes;
9981
+ }
9982
+ function earUint32(value) {
9983
+ const bytes = new Uint8Array(4);
9984
+ new DataView(bytes.buffer).setUint32(0, value);
9985
+ return bytes;
9986
+ }
9987
+ function concatEarBytes(...parts) {
9988
+ const bytes = new Uint8Array(parts.reduce((length, part) => length + part.length, 0));
9989
+ let offset = 0;
9990
+ for (const part of parts) {
9991
+ bytes.set(part, offset);
9992
+ offset += part.length;
9993
+ }
9994
+ return bytes.buffer;
9995
+ }
9996
+ function lengthPrefixEarBytes(bytes) {
9997
+ return new Uint8Array(concatEarBytes(earUint32(bytes.length), bytes));
9998
+ }
9758
9999
  /**
9759
10000
  * Parses earJwk for encryption key and returns CryptoKey object
9760
10001
  * @param earJwk
@@ -11508,6 +11749,10 @@
11508
11749
  clientId: this.config.auth.clientId,
11509
11750
  authority: discoveredAuthority,
11510
11751
  clientCapabilities: this.config.auth.clientCapabilities,
11752
+ instanceAware: requestExtraQueryParameters?.instance_aware
11753
+ ?.length
11754
+ ? requestExtraQueryParameters.instance_aware === "true"
11755
+ : this.config.auth.instanceAware,
11511
11756
  redirectUri: this.config.auth.redirectUri,
11512
11757
  isMcp: this.config.auth.isMcp,
11513
11758
  },
@@ -20695,8 +20940,7 @@
20695
20940
  }
20696
20941
  }
20697
20942
  catch (e) {
20698
- this.logger.errorPii(`Attempted to parse: '${encodedTokenRequest}'`, correlationId);
20699
- this.logger.error(`Parsing cached token request threw with error: '${e}'`, correlationId);
20943
+ this.logger.error("Unable to parse cached token request", correlationId);
20700
20944
  throw createBrowserAuthError(unableToParseTokenRequestCacheError, "");
20701
20945
  }
20702
20946
  return [parsedRequest, verifier];
@@ -21171,30 +21415,42 @@
21171
21415
  * page (see `runPopupRelay`) back to the embedded frame that opened it. See
21172
21416
  * {@link BrowserAuthOptions.popupRelayUri}.
21173
21417
  *
21174
- * Kept dependency-free so both the relay-page entry (`./index.js`) and the
21175
- * client-side helpers (`./relayClient.js`) can import it without either bundle
21176
- * pulling in the other's dependencies.
21418
+ * Shared by the relay-page entry and client helpers without importing either
21419
+ * implementation into the other bundle.
21177
21420
  *
21178
21421
  * @internal
21179
21422
  */
21180
- const POPUP_RELAY_RESPONSE_TYPE = "msal:popup-relay-response:v1";
21423
+ const POPUP_RELAY_RESPONSE_TYPE = "msal:popup-relay-response:v1";
21424
+ /** @internal Response bound to an authenticated v2 relay document. */
21425
+ const POPUP_RELAY_V2_RESPONSE_TYPE = "msal:popup-relay-response:v2";
21426
+ /** @internal Ready signal for the authenticated popup-relay request handoff. */
21427
+ const POPUP_RELAY_READY_TYPE = "msal:popup-relay-ready:v2";
21428
+ /** @internal Request delivered only to the same-origin relay window. */
21429
+ const POPUP_RELAY_REQUEST_TYPE = "msal:popup-relay-request:v2";
21430
+ /** @internal Resolve the compatibility default without downgrading invalid versions. */
21431
+ function getPopupRelayProtocolVersion(version, correlationId = "") {
21432
+ if (version === undefined) {
21433
+ return 1;
21434
+ }
21435
+ if (version !== 1 && version !== 2) {
21436
+ throw createBrowserAuthError(popupRelayUnsupportedFlow, correlationId, "popup_relay_invalid_protocol");
21437
+ }
21438
+ return version;
21439
+ }
21181
21440
 
21182
21441
  /*
21183
21442
  * Copyright (c) Microsoft Corporation. All rights reserved.
21184
21443
  * Licensed under the MIT License.
21185
21444
  */
21186
21445
  /**
21187
- * Builds the URL of the popup-relay page to open. The action the relay page
21188
- * must perform (GET navigation or POST form) is carried in the page's hash
21189
- * (client-side only, never sent to a server), keyed by the per-request
21190
- * library-state `id` so the relay page can listen on the right BroadcastChannel
21191
- * and echo the id back. The relay URI is resolved against the app origin, so it
21192
- * must be same-origin as the embedded frame. See `runPopupRelay`.
21446
+ * Builds the same-origin relay URL. V1 preserves the fragment descriptor;
21447
+ * explicitly selected v2 carries only the id and retains the navigation for
21448
+ * the authenticated handoff.
21193
21449
  *
21194
21450
  * @internal
21195
21451
  */
21196
- function buildPopupRelayUrl(popupRelayUri, id, action, correlationId) {
21197
- const req = { id, ...action };
21452
+ function buildPopupRelayUrl(popupRelayUri, id, action, correlationId, protocolVersion) {
21453
+ const version = getPopupRelayProtocolVersion(protocolVersion, correlationId);
21198
21454
  const target = new URL(popupRelayUri, window.location.origin);
21199
21455
  /*
21200
21456
  * The relay page must be same-origin as the embedded frame: the response is
@@ -21207,7 +21463,12 @@
21207
21463
  throw createBrowserAuthError(popupRelayUnsupportedFlow, correlationId, "popup_relay_cross_origin");
21208
21464
  }
21209
21465
  const hashParams = new URLSearchParams();
21210
- hashParams.set("req", JSON.stringify(req));
21466
+ if (version === 1) {
21467
+ hashParams.set("req", JSON.stringify({ id, ...action }));
21468
+ }
21469
+ else {
21470
+ hashParams.set("id", id);
21471
+ }
21211
21472
  target.hash = hashParams.toString();
21212
21473
  return target.toString();
21213
21474
  }
@@ -21218,21 +21479,30 @@
21218
21479
  * partitioning blocks the BroadcastChannel the redirect bridge uses from
21219
21480
  * reaching the embedded frame.
21220
21481
  *
21221
- * The response is accepted only from the popup window we opened, on our own
21222
- * origin (the relay page is same-origin as the embedded frame), and only when
21223
- * it carries the matching per-request library-state id.
21482
+ * In v2, the retained navigation is sent once, after a ready signal from the popup
21483
+ * window we opened on our own origin with the matching library-state id.
21484
+ * Successful responses must also carry that handoff's relay-document nonce.
21485
+ * Setup failures can reject the request before the handoff completes.
21224
21486
  *
21225
21487
  * @internal
21226
21488
  */
21227
- async function waitForPopupRelayResponse(timeoutMs, logger, request, popupWindow, performanceClient) {
21489
+ async function waitForPopupRelayResponse(timeoutMs, logger, request, popupWindow, performanceClient, action, protocolVersion) {
21490
+ const version = getPopupRelayProtocolVersion(protocolVersion, request.correlationId);
21491
+ if (version === 2 && !action) {
21492
+ throw createBrowserAuthError(popupRelayUnsupportedFlow, request.correlationId, "popup_relay_bad_request");
21493
+ }
21228
21494
  return new Promise((resolve, reject) => {
21229
21495
  const correlationId = request.correlationId;
21230
21496
  logger.verbose("PopupRelay.waitForPopupRelayResponse - started", correlationId);
21231
- performanceClient.addFields({ redirectBridgeTimeoutMs: timeoutMs }, correlationId);
21497
+ performanceClient.addFields({
21498
+ redirectBridgeTimeoutMs: timeoutMs,
21499
+ popupRelayProtocolVersion: version,
21500
+ }, correlationId);
21232
21501
  const { libraryState } = parseRequestState(base64Decode, request.state || "", correlationId);
21233
21502
  const expectedId = libraryState.id;
21234
21503
  const expectedOrigin = window.location.origin;
21235
21504
  let settled = false;
21505
+ let handoffNonce = "";
21236
21506
  const cleanup = () => {
21237
21507
  window.removeEventListener("message", onMessage);
21238
21508
  clearTimeout(timeoutId);
@@ -21244,20 +21514,52 @@
21244
21514
  return;
21245
21515
  }
21246
21516
  const data = event.data;
21247
- if (!data ||
21248
- data.type !== POPUP_RELAY_RESPONSE_TYPE ||
21249
- data.id !== expectedId) {
21517
+ if (!data || data.id !== expectedId) {
21250
21518
  return;
21251
21519
  }
21252
21520
  if (settled) {
21253
21521
  return;
21254
21522
  }
21523
+ if (version === 2 && data.type === POPUP_RELAY_READY_TYPE) {
21524
+ if (handoffNonce ||
21525
+ typeof data.nonce !== "string" ||
21526
+ !data.nonce) {
21527
+ return;
21528
+ }
21529
+ handoffNonce = data.nonce;
21530
+ try {
21531
+ popupWindow.postMessage({
21532
+ type: POPUP_RELAY_REQUEST_TYPE,
21533
+ id: expectedId,
21534
+ nonce: handoffNonce,
21535
+ request: { id: expectedId, ...action },
21536
+ }, expectedOrigin);
21537
+ performanceClient.addFields({ "ext.popupRelayRequestSent": true }, correlationId);
21538
+ }
21539
+ catch {
21540
+ settled = true;
21541
+ cleanup();
21542
+ logger.error("PopupRelay.waitForPopupRelayResponse - request handoff failed", correlationId);
21543
+ reject(createBrowserAuthError(popupWindowError, correlationId, "popup_relay_handoff_failed"));
21544
+ }
21545
+ return;
21546
+ }
21547
+ const hasError = typeof data.error === "string" && data.error.length > 0;
21548
+ const responseType = version === 1
21549
+ ? POPUP_RELAY_RESPONSE_TYPE
21550
+ : POPUP_RELAY_V2_RESPONSE_TYPE;
21551
+ if (data.type !== responseType ||
21552
+ (version === 2 &&
21553
+ ((!handoffNonce && !hasError) ||
21554
+ (handoffNonce && data.nonce !== handoffNonce)))) {
21555
+ return;
21556
+ }
21255
21557
  settled = true;
21256
21558
  cleanup();
21257
- if (data.error) {
21258
- reject(createBrowserAuthError(data.error, correlationId));
21559
+ if (hasError) {
21560
+ reject(createBrowserAuthError(data.error, correlationId, data.subError));
21259
21561
  }
21260
- else if (data.payload) {
21562
+ else if (typeof data.payload === "string" && data.payload) {
21261
21563
  resolve(data.payload);
21262
21564
  }
21263
21565
  else {
@@ -22925,6 +23227,36 @@
22925
23227
  addCorrelationId(queryParams, request.correlationId);
22926
23228
  return getAuthorizeUrl(authority, queryParams);
22927
23229
  }
23230
+ /**
23231
+ * Prepares the selected EAR construction.
23232
+ * @internal
23233
+ */
23234
+ async function initializeEarRequest(config, request, logger, performanceClient) {
23235
+ if (!config.experimental.enableAsymmetricEar) {
23236
+ const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, logger, performanceClient, request.correlationId)();
23237
+ return {
23238
+ ...request,
23239
+ earJwk,
23240
+ asymmetricEar: undefined,
23241
+ };
23242
+ }
23243
+ try {
23244
+ const { privateJwk, publicJwk } = await invokeAsync(generateAsymmetricEarKey, GenerateAsymmetricEarKey, logger, performanceClient, request.correlationId)();
23245
+ const apv = generateAsymmetricEarApv(publicJwk);
23246
+ const earJwk = base64Encode(JSON.stringify(publicJwk));
23247
+ return {
23248
+ ...request,
23249
+ earJwk,
23250
+ asymmetricEar: { privateJwk, apv },
23251
+ };
23252
+ }
23253
+ catch (error) {
23254
+ if (error instanceof AuthError) {
23255
+ throw error;
23256
+ }
23257
+ throw createBrowserAuthError(asymmetricEarKeyError, request.correlationId, "request_initialization_failed" /* AsymmetricEarSubErrors.RequestInitializationFailed */);
23258
+ }
23259
+ }
22928
23260
  /**
22929
23261
  * Builds the action URL + POST-body fields for the EAR /authorize form.
22930
23262
  */
@@ -22934,7 +23266,18 @@
22934
23266
  }
22935
23267
  const parameters = await getStandardParameters(config, authority, request, logger, performanceClient);
22936
23268
  addResponseType(parameters, OAuthResponseType.IDTOKEN_TOKEN_REFRESHTOKEN);
22937
- addEARParameters(parameters, request.earJwk);
23269
+ try {
23270
+ addEARParameters(parameters, request.earJwk, request.asymmetricEar
23271
+ ? base64Encode(JSON.stringify({
23272
+ alg: "ECDH-ES",
23273
+ enc: "A256GCM",
23274
+ apv: request.asymmetricEar.apv,
23275
+ }))
23276
+ : undefined);
23277
+ }
23278
+ catch {
23279
+ throw createBrowserAuthError(asymmetricEarKeyError, request.correlationId, "request_encoding_failed" /* AsymmetricEarSubErrors.RequestEncodingFailed */);
23280
+ }
22938
23281
  // Also add codeChallenge as backup in case EAR is not supported
22939
23282
  addCodeChallengeParams(parameters, request.codeChallenge, S256_CODE_CHALLENGE_METHOD);
22940
23283
  addExtraParameters(parameters, {
@@ -23018,12 +23361,14 @@
23018
23361
  const browserCrypto = new CryptoOps(logger, performanceClient);
23019
23362
  const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
23020
23363
  const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
23364
+ const brokerRequest = {
23365
+ ...request,
23366
+ state: userRequestState,
23367
+ prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
23368
+ };
23369
+ delete brokerRequest.asymmetricEar;
23021
23370
  try {
23022
- return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
23023
- ...request,
23024
- state: userRequestState,
23025
- prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
23026
- });
23371
+ return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)(brokerRequest);
23027
23372
  }
23028
23373
  catch (e) {
23029
23374
  await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
@@ -23088,7 +23433,20 @@
23088
23433
  if (!request.earJwk) {
23089
23434
  throw createBrowserAuthError(earJwkEmpty, request.correlationId);
23090
23435
  }
23091
- const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
23436
+ let plaintext;
23437
+ if (request.asymmetricEar) {
23438
+ plaintext = await invokeAsync(decryptAsymmetricEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.asymmetricEar.privateJwk, request.asymmetricEar.apv, response.ear_jwe, request.asymmetricEar.apv, { logger, performanceClient, correlationId: request.correlationId });
23439
+ }
23440
+ else {
23441
+ plaintext = await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe);
23442
+ }
23443
+ let decryptedData;
23444
+ try {
23445
+ decryptedData = JSON.parse(plaintext);
23446
+ }
23447
+ catch {
23448
+ throw createBrowserAuthError(failedToDecryptEarResponse, request.correlationId, "invalid_decrypted_response_payload" /* AsymmetricEarSubErrors.InvalidDecryptedResponsePayload */);
23449
+ }
23092
23450
  if (decryptedData.accountId) {
23093
23451
  return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
23094
23452
  }
@@ -23379,6 +23737,7 @@
23379
23737
  : "",
23380
23738
  postLogoutRedirectUri: "",
23381
23739
  popupRelayUri: "",
23740
+ popupRelayProtocolVersion: 1,
23382
23741
  clientCapabilities: [],
23383
23742
  OIDCOptions: {
23384
23743
  responseMode: ResponseMode.FRAGMENT,
@@ -23445,6 +23804,7 @@
23445
23804
  client: new StubPerformanceClient(),
23446
23805
  };
23447
23806
  const DEFAULT_EXPERIMENTAL_OPTIONS = {
23807
+ enableAsymmetricEar: false,
23448
23808
  iframeTimeoutTelemetry: false,
23449
23809
  allowPlatformBrokerWithDOM: false,
23450
23810
  };
@@ -23498,9 +23858,16 @@
23498
23858
  experimental: {
23499
23859
  ...DEFAULT_EXPERIMENTAL_OPTIONS,
23500
23860
  ...userInputExperimental,
23861
+ enableAsymmetricEar: userInputExperimental?.enableAsymmetricEar ?? false,
23501
23862
  },
23502
23863
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry },
23503
23864
  };
23865
+ if (overlayedConfig.experimental.enableAsymmetricEar &&
23866
+ overlayedConfig.system.protocolMode !== ProtocolMode.EAR) {
23867
+ const logger = new Logger(providedSystemOptions.loggerOptions, name, version);
23868
+ logger.warning("experimental.enableAsymmetricEar is ignored because system.protocolMode is not ProtocolMode.EAR.", "");
23869
+ overlayedConfig.experimental.enableAsymmetricEar = false;
23870
+ }
23504
23871
  return overlayedConfig;
23505
23872
  }
23506
23873
 
@@ -24388,19 +24755,21 @@
24388
24755
  /*
24389
24756
  * When a popup-relay page is configured, open it top-level
24390
24757
  * (same first-party origin) instead of navigating the popup
24391
- * straight to the IdP, and carry the /authorize URL in its hash.
24758
+ * straight to the IdP. V1 carries the action in the hash; v2
24759
+ * retains it for the authenticated handoff.
24392
24760
  * The relay page opens the IdP child popup and relays the
24393
24761
  * response back via postMessage (see waitForPopupResponse).
24394
24762
  */
24395
24763
  const popupRelayUri = this.config.auth.popupRelayUri;
24764
+ popupParams.relayAction = { method: "GET", url: navigateUrl };
24396
24765
  const popupNavigateUrl = popupRelayUri
24397
- ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), { method: "GET", url: navigateUrl }, correlationId)
24766
+ ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), popupParams.relayAction, correlationId, this.config.auth.popupRelayProtocolVersion)
24398
24767
  : navigateUrl;
24399
24768
  // Show the UI once the url has been created. Get the window handle for the popup.
24400
24769
  const popupWindow = this.initiateAuthRequest(popupNavigateUrl, popupParams);
24401
24770
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, correlationId, InteractionType.Popup, { popupWindow }, null);
24402
24771
  // Wait for the redirect bridge response
24403
- const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
24772
+ const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent, popupParams.relayAction);
24404
24773
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
24405
24774
  return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, pkce.verifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
24406
24775
  }
@@ -24424,21 +24793,20 @@
24424
24793
  const { correlationId, authority, azureCloudOptions, extraQueryParameters, account, } = request;
24425
24794
  // Get the frame handle for the silent request
24426
24795
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
24427
- const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
24428
24796
  const pkce = pkceCodes ||
24429
24797
  (await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId));
24430
24798
  const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
24431
- const popupRequest = {
24799
+ let popupRequest = {
24432
24800
  ...request,
24433
- earJwk: earJwk,
24434
24801
  codeChallenge: pkce.challenge,
24435
24802
  ...tokenBindingParams,
24436
24803
  popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
24437
24804
  };
24438
24805
  try {
24806
+ popupRequest = await initializeEarRequest(this.config, popupRequest, this.logger, this.performanceClient);
24439
24807
  const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
24440
24808
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
24441
- const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
24809
+ const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent, popupParams.relayAction);
24442
24810
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
24443
24811
  if (!serverParams.ear_jwe && serverParams.code) {
24444
24812
  const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
@@ -24466,7 +24834,7 @@
24466
24834
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger);
24467
24835
  const popupWindow = await this.openPostFormPopup(request, discoveredAuthority, popupParams, correlationId, false);
24468
24836
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
24469
- const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
24837
+ const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent, popupParams.relayAction);
24470
24838
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
24471
24839
  return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(request, serverParams, pkceVerifier, ApiId.acquireTokenPopup, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
24472
24840
  }
@@ -24522,21 +24890,22 @@
24522
24890
  this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, validRequest.correlationId, InteractionType.Popup, validRequest);
24523
24891
  /*
24524
24892
  * When a popup-relay page is configured, open it top-level (same
24525
- * first-party origin) and carry the end-session URL in its hash,
24526
- * exactly like the login flow. The relay page opens the IdP child
24893
+ * first-party origin), using the configured wire protocol for the
24894
+ * end-session URL. The relay page opens the IdP child
24527
24895
  * popup and the post-logout redirect page (running the redirect
24528
24896
  * bridge) relays completion back via postMessage — so logout works
24529
24897
  * from an embedded, cross-origin iframe where a direct popup to the
24530
24898
  * IdP cannot. See runPopupRelay / waitForPopupResponse.
24531
24899
  */
24532
24900
  const popupRelayUri = this.config.auth.popupRelayUri;
24901
+ popupParams.relayAction = { method: "GET", url: logoutUri };
24533
24902
  const popupNavigateUrl = popupRelayUri
24534
- ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(validRequest.state || "", this.correlationId), { method: "GET", url: logoutUri }, this.correlationId)
24903
+ ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(validRequest.state || "", this.correlationId), popupParams.relayAction, this.correlationId, this.config.auth.popupRelayProtocolVersion)
24535
24904
  : logoutUri;
24536
24905
  // Open the popup window to requestUrl.
24537
24906
  const popupWindow = this.openPopup(popupNavigateUrl, popupParams);
24538
24907
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, validRequest.correlationId, InteractionType.Popup, { popupWindow }, null);
24539
- await this.waitForPopupResponse(validRequest, popupWindow, popupParams.popupWindowParent).catch(() => {
24908
+ await this.waitForPopupResponse(validRequest, popupWindow, popupParams.popupWindowParent, popupParams.relayAction).catch(() => {
24540
24909
  // Swallow any errors related to monitoring the window. Server logout is best effort
24541
24910
  });
24542
24911
  if (mainWindowRedirectUri) {
@@ -24748,11 +25117,12 @@
24748
25117
  ? getEARFormData
24749
25118
  : getCodeFormData;
24750
25119
  const formData = await getFormData(this.config, discoveredAuthority, request, this.logger, this.performanceClient);
24751
- const relayUrl = buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), {
25120
+ popupParams.relayAction = {
24752
25121
  method: "POST",
24753
25122
  action: formData.action,
24754
25123
  fields: formData.fields,
24755
- }, correlationId);
25124
+ };
25125
+ const relayUrl = buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), popupParams.relayAction, correlationId, this.config.auth.popupRelayProtocolVersion);
24756
25126
  return this.initiateAuthRequest(relayUrl, popupParams);
24757
25127
  }
24758
25128
  const popupWindow = popupParams.popup || this.openPopup("about:blank", popupParams);
@@ -24761,7 +25131,7 @@
24761
25131
  form.submit();
24762
25132
  return popupWindow;
24763
25133
  }
24764
- async waitForPopupResponse(request, popupWindow, popupWindowParent) {
25134
+ async waitForPopupResponse(request, popupWindow, popupWindowParent, relayAction) {
24765
25135
  /*
24766
25136
  * When a popup-relay page is configured the response is relayed back to
24767
25137
  * this frame by the relay page via postMessage, and the relay popup's
@@ -24771,7 +25141,11 @@
24771
25141
  * frame and which does not track the relay popup.
24772
25142
  */
24773
25143
  if (this.config.auth.popupRelayUri) {
24774
- return waitForPopupRelayResponse(this.config.system.popupBridgeTimeout, this.logger, request, popupWindow, this.performanceClient);
25144
+ if (this.config.auth.popupRelayProtocolVersion === 2 &&
25145
+ !relayAction) {
25146
+ throw createBrowserAuthError(popupRelayUnsupportedFlow, this.correlationId, "popup_relay_bad_request");
25147
+ }
25148
+ return waitForPopupRelayResponse(this.config.system.popupBridgeTimeout, this.logger, request, popupWindow, this.performanceClient, relayAction, this.config.auth.popupRelayProtocolVersion);
24775
25149
  }
24776
25150
  if (this.waitForPopupResponseHook) {
24777
25151
  return this.waitForPopupResponseHook(request, popupWindow, popupWindowParent);
@@ -24896,16 +25270,15 @@
24896
25270
  const { correlationId, authority, azureCloudOptions, extraQueryParameters, account, } = request;
24897
25271
  // Get the frame handle for the silent request
24898
25272
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
24899
- const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
24900
25273
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
24901
25274
  const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
24902
- const redirectRequest = {
25275
+ let redirectRequest = {
24903
25276
  ...request,
24904
- earJwk: earJwk,
24905
25277
  codeChallenge: pkceCodes.challenge,
24906
25278
  ...tokenBindingParams,
24907
25279
  };
24908
25280
  try {
25281
+ redirectRequest = await initializeEarRequest(this.config, redirectRequest, this.logger, this.performanceClient);
24909
25282
  if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
24910
25283
  throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
24911
25284
  }
@@ -24918,9 +25291,10 @@
24918
25291
  }, this.config.system.redirectNavigationTimeout);
24919
25292
  });
24920
25293
  }
24921
- catch (e) {
25294
+ catch (error) {
25295
+ this.browserStorage.resetRequestCache(correlationId);
24922
25296
  await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
24923
- throw e;
25297
+ throw error;
24924
25298
  }
24925
25299
  }
24926
25300
  /**
@@ -25099,13 +25473,16 @@
25099
25473
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, request.correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
25100
25474
  return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, request.correlationId)(request, serverParams, ApiId.acquireTokenRedirect, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
25101
25475
  }
25102
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
25476
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
25477
+ serverTelemetryManager,
25478
+ requestAuthority: request.authority,
25479
+ requestExtraQueryParameters: request.extraQueryParameters,
25480
+ });
25103
25481
  return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(request, serverParams, codeVerifier, ApiId.acquireTokenRedirect, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
25104
25482
  }
25105
25483
  /**
25106
25484
  * Redirects window to given URL.
25107
25485
  * @param urlNavigate
25108
- * @param onRedirectNavigateRequest - onRedirectNavigate callback provided on the request
25109
25486
  */
25110
25487
  async initiateAuthRequest(requestUrl) {
25111
25488
  this.logger.verbose("RedirectHandler.initiateAuthRequest called", this.correlationId);
@@ -25393,13 +25770,11 @@
25393
25770
  async executeEarFlow(request) {
25394
25771
  const { correlationId, authority, azureCloudOptions, extraQueryParameters, account, } = request;
25395
25772
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger, authority, azureCloudOptions, extraQueryParameters, account);
25396
- const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
25397
25773
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
25398
- const silentRequest = {
25774
+ const silentRequest = await initializeEarRequest(this.config, {
25399
25775
  ...request,
25400
- earJwk: earJwk,
25401
25776
  codeChallenge: pkceCodes.challenge,
25402
- };
25777
+ }, this.logger, this.performanceClient);
25403
25778
  // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
25404
25779
  const iframe = createHiddenIframe();
25405
25780
  const responseType = this.config.auth.OIDCOptions.responseMode;
@@ -25749,6 +26124,7 @@
25749
26124
  return {
25750
26125
  key: JSON.stringify({
25751
26126
  ...thumbprint,
26127
+ accountTenantId: account.tenantId,
25752
26128
  forceRefresh: !!request.forceRefresh,
25753
26129
  cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
25754
26130
  extraParameters: canonicalizeStringDict(request.extraParameters),