@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.msal = {}));
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.
@@ -305,7 +305,7 @@
305
305
  // Token renewal offset default in seconds
306
306
  const DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = 300;
307
307
 
308
- /*! @azure/msal-common v16.16.1 2026-11-06 */
308
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
309
309
  /*
310
310
  * Copyright (c) Microsoft Corporation. All rights reserved.
311
311
  * Licensed under the MIT License.
@@ -334,7 +334,7 @@
334
334
  return new AuthError(code, correlationId, additionalMessage || getDefaultErrorMessage$1(code));
335
335
  }
336
336
 
337
- /*! @azure/msal-common v16.16.1 2026-11-06 */
337
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
338
338
 
339
339
  /*
340
340
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -357,7 +357,7 @@
357
357
  return new ClientAuthError(errorCode, correlationId, additionalMessage);
358
358
  }
359
359
 
360
- /*! @azure/msal-common v16.16.1 2026-11-06 */
360
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
361
361
  /*
362
362
  * Copyright (c) Microsoft Corporation. All rights reserved.
363
363
  * Licensed under the MIT License.
@@ -443,7 +443,7 @@
443
443
  userCanceled: userCanceled
444
444
  });
445
445
 
446
- /*! @azure/msal-common v16.16.1 2026-11-06 */
446
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
447
447
 
448
448
  /*
449
449
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -481,7 +481,7 @@
481
481
  };
482
482
  }
483
483
 
484
- /*! @azure/msal-common v16.16.1 2026-11-06 */
484
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
485
485
 
486
486
  /*
487
487
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -547,7 +547,7 @@
547
547
  return matches[2];
548
548
  }
549
549
 
550
- /*! @azure/msal-common v16.16.1 2026-11-06 */
550
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
551
551
 
552
552
  /*
553
553
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -635,7 +635,7 @@
635
635
  return updatedAccountInfo;
636
636
  }
637
637
 
638
- /*! @azure/msal-common v16.16.1 2026-11-06 */
638
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
639
639
  /*
640
640
  * Copyright (c) Microsoft Corporation. All rights reserved.
641
641
  * Licensed under the MIT License.
@@ -649,7 +649,7 @@
649
649
  Ciam: 3,
650
650
  };
651
651
 
652
- /*! @azure/msal-common v16.16.1 2026-11-06 */
652
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
653
653
  /*
654
654
  * Copyright (c) Microsoft Corporation. All rights reserved.
655
655
  * Licensed under the MIT License.
@@ -671,7 +671,7 @@
671
671
  return null;
672
672
  }
673
673
 
674
- /*! @azure/msal-common v16.16.1 2026-11-06 */
674
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
675
675
  /*
676
676
  * Copyright (c) Microsoft Corporation. All rights reserved.
677
677
  * Licensed under the MIT License.
@@ -695,7 +695,7 @@
695
695
  EAR: "EAR",
696
696
  };
697
697
 
698
- /*! @azure/msal-common v16.16.1 2026-11-06 */
698
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
699
699
  /**
700
700
  * Returns the AccountInfo interface for this account.
701
701
  * @internal
@@ -884,7 +884,7 @@
884
884
  entity.hasOwnProperty("authorityType"));
885
885
  }
886
886
 
887
- /*! @azure/msal-common v16.16.1 2026-11-06 */
887
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
888
888
  /*
889
889
  * Copyright (c) Microsoft Corporation. All rights reserved.
890
890
  * Licensed under the MIT License.
@@ -901,7 +901,7 @@
901
901
  unexpectedError: unexpectedError
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
  /*
907
907
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -921,7 +921,7 @@
921
921
  return new ClientConfigurationError(errorCode, correlationId);
922
922
  }
923
923
 
924
- /*! @azure/msal-common v16.16.1 2026-11-06 */
924
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
925
925
  /*
926
926
  * Copyright (c) Microsoft Corporation. All rights reserved.
927
927
  * Licensed under the MIT License.
@@ -961,7 +961,7 @@
961
961
  return headerName === undefined ? undefined : headers[headerName];
962
962
  }
963
963
 
964
- /*! @azure/msal-common v16.16.1 2026-11-06 */
964
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
965
965
  /*
966
966
  * Copyright (c) Microsoft Corporation. All rights reserved.
967
967
  * Licensed under the MIT License.
@@ -1031,7 +1031,7 @@
1031
1031
  urlParseError: urlParseError
1032
1032
  });
1033
1033
 
1034
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1034
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1035
1035
 
1036
1036
  /*
1037
1037
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1090,7 +1090,7 @@
1090
1090
  }
1091
1091
  }
1092
1092
 
1093
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1093
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1094
1094
  /*
1095
1095
  * Copyright (c) Microsoft Corporation. All rights reserved.
1096
1096
  * Licensed under the MIT License.
@@ -1102,7 +1102,7 @@
1102
1102
  response.hasOwnProperty("jwks_uri"));
1103
1103
  }
1104
1104
 
1105
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1105
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1106
1106
  /*
1107
1107
  * Copyright (c) Microsoft Corporation. All rights reserved.
1108
1108
  * Licensed under the MIT License.
@@ -1182,12 +1182,18 @@
1182
1182
  }
1183
1183
  }
1184
1184
 
1185
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1185
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1186
1186
 
1187
1187
  /*
1188
1188
  * Copyright (c) Microsoft Corporation. All rights reserved.
1189
1189
  * Licensed under the MIT License.
1190
1190
  */
1191
+ // Matches ASCII controls, space, DEL, backslash, or the userinfo separator (@).
1192
+ const UNSAFE_AUTHORITY = /[\x00-\x20\x7f\\@]/;
1193
+ const DEFAULT_PORTS = {
1194
+ "https:": ":443",
1195
+ "http:": ":80",
1196
+ };
1191
1197
  /**
1192
1198
  * Url object class which can perform various transformations on url strings.
1193
1199
  */
@@ -1303,6 +1309,29 @@
1303
1309
  AbsolutePath: match[5],
1304
1310
  QueryString: match[7],
1305
1311
  };
1312
+ let parsedUrl;
1313
+ try {
1314
+ parsedUrl = new URL(this.urlString);
1315
+ }
1316
+ catch {
1317
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1318
+ }
1319
+ const host = urlComponents.HostNameAndPort?.toLowerCase();
1320
+ const schemeAndAuthority = `${urlComponents.Protocol}//${host}`;
1321
+ const defaultPort = DEFAULT_PORTS[parsedUrl.protocol] ?? "";
1322
+ /*
1323
+ * Cross-check the original host; reparsing parsedUrl would hide parser differences.
1324
+ * URL has validated IPv6 syntax, so only bracketed hosts need a normalization comparison.
1325
+ */
1326
+ const hostMatches = host === parsedUrl.host ||
1327
+ host === `${parsedUrl.host}${defaultPort}` ||
1328
+ (host?.startsWith("[") &&
1329
+ new URL(`${urlComponents.Protocol}//${host}`).host ===
1330
+ parsedUrl.host);
1331
+ // Check authority ambiguity without restricting resource paths, queries, or fragments.
1332
+ if (UNSAFE_AUTHORITY.test(schemeAndAuthority) || !hostMatches) {
1333
+ throw createClientConfigurationError(urlParseError, this.correlationId);
1334
+ }
1306
1335
  let pathSegments = urlComponents.AbsolutePath.split("/");
1307
1336
  pathSegments = pathSegments.filter((val) => val && val.length > 0); // remove empty elements
1308
1337
  urlComponents.PathSegments = pathSegments;
@@ -1340,7 +1369,7 @@
1340
1369
  }
1341
1370
  }
1342
1371
 
1343
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1372
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1344
1373
 
1345
1374
  /*
1346
1375
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1494,7 +1523,7 @@
1494
1523
  return null;
1495
1524
  }
1496
1525
 
1497
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1526
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1498
1527
  /*
1499
1528
  * Copyright (c) Microsoft Corporation. All rights reserved.
1500
1529
  * Licensed under the MIT License.
@@ -1512,7 +1541,7 @@
1512
1541
  AzureUsGovernment: "https://login.microsoftonline.us",
1513
1542
  };
1514
1543
 
1515
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1544
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1516
1545
  /*
1517
1546
  * Copyright (c) Microsoft Corporation. All rights reserved.
1518
1547
  * Licensed under the MIT License.
@@ -1522,7 +1551,7 @@
1522
1551
  response.hasOwnProperty("metadata"));
1523
1552
  }
1524
1553
 
1525
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1554
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1526
1555
  /*
1527
1556
  * Copyright (c) Microsoft Corporation. All rights reserved.
1528
1557
  * Licensed under the MIT License.
@@ -1532,7 +1561,7 @@
1532
1561
  response.hasOwnProperty("error_description"));
1533
1562
  }
1534
1563
 
1535
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1564
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1536
1565
  /*
1537
1566
  * Copyright (c) Microsoft Corporation. All rights reserved.
1538
1567
  * Licensed under the MIT License.
@@ -1603,7 +1632,7 @@
1603
1632
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1604
1633
  const SetUserData = "setUserData";
1605
1634
 
1606
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1635
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1607
1636
  /*
1608
1637
  * Copyright (c) Microsoft Corporation. All rights reserved.
1609
1638
  * Licensed under the MIT License.
@@ -1639,7 +1668,8 @@
1639
1668
  catch (e) {
1640
1669
  logger.trace(`0cfd8i ${eventName}`, correlationId);
1641
1670
  try {
1642
- logger.trace(JSON.stringify(e), correlationId);
1671
+ // Prevent numeric error details from being treated as minified log hashes.
1672
+ logger.tracePii(`028ef8 ${JSON.stringify(e)}`, correlationId);
1643
1673
  }
1644
1674
  catch (e) {
1645
1675
  logger.trace("00dty7", correlationId);
@@ -1683,7 +1713,7 @@
1683
1713
  .catch((e) => {
1684
1714
  logger.trace(`0cfd8i ${eventName}`, correlationId);
1685
1715
  try {
1686
- logger.trace(JSON.stringify(e), correlationId);
1716
+ logger.tracePii(`028ef8 ${JSON.stringify(e)}`, correlationId);
1687
1717
  }
1688
1718
  catch (e) {
1689
1719
  logger.trace("00dty7", correlationId);
@@ -1696,12 +1726,26 @@
1696
1726
  };
1697
1727
  };
1698
1728
 
1699
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1729
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1700
1730
 
1701
1731
  /*
1702
1732
  * Copyright (c) Microsoft Corporation. All rights reserved.
1703
1733
  * Licensed under the MIT License.
1704
1734
  */
1735
+ // Starts with an ASCII letter; remaining characters are ASCII letters, digits, or hyphens.
1736
+ const REGION_NAME_PATTERN = /^[a-z][a-z0-9-]*$/i;
1737
+ // A region becomes a DNS label, limited to 63 octets by RFC 1035 section 2.3.4.
1738
+ const MAX_REGION_NAME_LENGTH = 63;
1739
+ /**
1740
+ * Whether a region can safely be used as a single DNS label.
1741
+ */
1742
+ function isValidRegion(region) {
1743
+ return (typeof region === "string" &&
1744
+ region.length <= MAX_REGION_NAME_LENGTH &&
1745
+ REGION_NAME_PATTERN.test(region) &&
1746
+ // Keep the trailing-hyphen rule explicit rather than complicating the pattern.
1747
+ !region.endsWith("-"));
1748
+ }
1705
1749
  class RegionDiscovery {
1706
1750
  constructor(networkInterface, logger, performanceClient, correlationId) {
1707
1751
  this.networkInterface = networkInterface;
@@ -1761,12 +1805,16 @@
1761
1805
  regionDiscoveryMetadata.region_source =
1762
1806
  RegionDiscoverySources.ENVIRONMENT_VARIABLE;
1763
1807
  }
1764
- // If no region was auto detected from the environment or from the IMDS endpoint, mark the attempt as a FAILED_AUTO_DETECTION
1765
- if (!autodetectedRegionName) {
1808
+ // Untrusted discovery values must be a single DNS label before becoming a host prefix.
1809
+ if (!autodetectedRegionName || !isValidRegion(autodetectedRegionName)) {
1810
+ if (autodetectedRegionName) {
1811
+ this.logger.warning("0n83q0", this.correlationId);
1812
+ }
1766
1813
  regionDiscoveryMetadata.region_source =
1767
1814
  RegionDiscoverySources.FAILED_AUTO_DETECTION;
1815
+ return null;
1768
1816
  }
1769
- return autodetectedRegionName || null;
1817
+ return autodetectedRegionName;
1770
1818
  }
1771
1819
  /**
1772
1820
  * Make the call to the IMDS endpoint
@@ -1807,7 +1855,7 @@
1807
1855
  },
1808
1856
  };
1809
1857
 
1810
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1858
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1811
1859
  /*
1812
1860
  * Copyright (c) Microsoft Corporation. All rights reserved.
1813
1861
  * Licensed under the MIT License.
@@ -1872,7 +1920,7 @@
1872
1920
  return cachedAtSec > nowSeconds();
1873
1921
  }
1874
1922
 
1875
- /*! @azure/msal-common v16.16.1 2026-11-06 */
1923
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
1876
1924
 
1877
1925
  /*
1878
1926
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2159,7 +2207,7 @@
2159
2207
  return [...attributeTokens].sort().join(" ");
2160
2208
  }
2161
2209
 
2162
- /*! @azure/msal-common v16.16.1 2026-11-06 */
2210
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
2163
2211
 
2164
2212
  /*
2165
2213
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3012,6 +3060,9 @@
3012
3060
  * @param region string
3013
3061
  */
3014
3062
  static buildRegionalAuthorityString(host, region, correlationId, queryString) {
3063
+ if (!isValidRegion(region)) {
3064
+ throw createClientConfigurationError(urlParseError, correlationId);
3065
+ }
3015
3066
  // Create and validate a Url string object with the initial authority string
3016
3067
  const authorityUrlInstance = new UrlString(host, correlationId);
3017
3068
  authorityUrlInstance.validateAsUri();
@@ -3022,7 +3073,7 @@
3022
3073
  }
3023
3074
  // Include the query string portion of the url
3024
3075
  const url = UrlString.constructAuthorityUriFromObject({
3025
- ...authorityUrlInstance.getUrlComponents(),
3076
+ ...authorityUrlParts,
3026
3077
  HostNameAndPort: hostNameAndPort,
3027
3078
  }, correlationId).urlString;
3028
3079
  // Add the query string if a query string was provided
@@ -3127,7 +3178,7 @@
3127
3178
  };
3128
3179
  }
3129
3180
 
3130
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3181
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3131
3182
 
3132
3183
  /*
3133
3184
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3161,7 +3212,7 @@
3161
3212
  }
3162
3213
  }
3163
3214
 
3164
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3215
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3165
3216
 
3166
3217
  /*
3167
3218
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3357,7 +3408,7 @@
3357
3408
  }
3358
3409
  }
3359
3410
 
3360
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3411
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3361
3412
 
3362
3413
  /*
3363
3414
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3825,12 +3876,13 @@
3825
3876
  * Add EAR (Encrypted Authorize Response) request parameters
3826
3877
  * @param parameters
3827
3878
  * @param jwk
3879
+ * @param jweCrypto - Base64-encoded encryption metadata; defaults to symmetric EAR.
3828
3880
  */
3829
- function addEARParameters(parameters, jwk) {
3881
+ function addEARParameters(parameters, jwk, jweCrypto) {
3830
3882
  parameters.set(EAR_JWK, encodeURIComponent(jwk));
3831
- // ear_jwe_crypto will always have value: {"alg":"dir","enc":"A256GCM"} so we can hardcode this
3883
+ // Default symmetric EAR metadata; asymmetric requests supply their APV.
3832
3884
  const jweCryptoB64Encoded = "eyJhbGciOiJkaXIiLCJlbmMiOiJBMjU2R0NNIn0";
3833
- parameters.set(EAR_JWE_CRYPTO, jweCryptoB64Encoded);
3885
+ parameters.set(EAR_JWE_CRYPTO, jweCrypto ?? jweCryptoB64Encoded);
3834
3886
  }
3835
3887
  function addResource(parameters, resource) {
3836
3888
  if (resource) {
@@ -3857,7 +3909,7 @@
3857
3909
  }
3858
3910
  }
3859
3911
 
3860
- /*! @azure/msal-common v16.16.1 2026-11-06 */
3912
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3861
3913
 
3862
3914
  /*
3863
3915
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3988,7 +4040,7 @@
3988
4040
  }
3989
4041
  }
3990
4042
 
3991
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4043
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
3992
4044
 
3993
4045
  /*
3994
4046
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4036,7 +4088,7 @@
4036
4088
  },
4037
4089
  };
4038
4090
 
4039
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4091
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4040
4092
 
4041
4093
  /*
4042
4094
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4059,7 +4111,7 @@
4059
4111
  },
4060
4112
  };
4061
4113
 
4062
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4114
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4063
4115
  /*
4064
4116
  * Copyright (c) Microsoft Corporation. All rights reserved.
4065
4117
  * Licensed under the MIT License.
@@ -4348,12 +4400,12 @@
4348
4400
  }
4349
4401
  }
4350
4402
 
4351
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4403
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4352
4404
  /* eslint-disable header/header */
4353
4405
  const name$1 = "@azure/msal-common";
4354
- const version$1 = "16.16.1";
4406
+ const version$1 = "16.17.0";
4355
4407
 
4356
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4408
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4357
4409
  /*
4358
4410
  * Copyright (c) Microsoft Corporation. All rights reserved.
4359
4411
  * Licensed under the MIT License.
@@ -4361,7 +4413,7 @@
4361
4413
  const cacheQuotaExceeded = "cache_quota_exceeded";
4362
4414
  const cacheErrorUnknown = "cache_error_unknown";
4363
4415
 
4364
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4416
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4365
4417
 
4366
4418
  /*
4367
4419
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4399,7 +4451,7 @@
4399
4451
  }
4400
4452
  }
4401
4453
 
4402
- /*! @azure/msal-common v16.16.1 2026-11-06 */
4454
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
4403
4455
 
4404
4456
  /*
4405
4457
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5627,7 +5679,7 @@
5627
5679
  }
5628
5680
  }
5629
5681
 
5630
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5682
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5631
5683
  /*
5632
5684
  * Copyright (c) Microsoft Corporation. All rights reserved.
5633
5685
  * Licensed under the MIT License.
@@ -5689,10 +5741,11 @@
5689
5741
  "networkRtt",
5690
5742
  "redirectBridgeTimeoutMs",
5691
5743
  "redirectBridgeMessageVersion",
5744
+ "popupRelayProtocolVersion",
5692
5745
  "fetchRetryCount",
5693
5746
  ]);
5694
5747
 
5695
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5748
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5696
5749
 
5697
5750
  /*
5698
5751
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5750,7 +5803,7 @@
5750
5803
  }
5751
5804
  }
5752
5805
 
5753
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5806
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5754
5807
 
5755
5808
  /*
5756
5809
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5848,7 +5901,7 @@
5848
5901
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5849
5902
  }
5850
5903
 
5851
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5904
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5852
5905
  /*
5853
5906
  * Copyright (c) Microsoft Corporation. All rights reserved.
5854
5907
  * Licensed under the MIT License.
@@ -5875,7 +5928,7 @@
5875
5928
  }
5876
5929
  }
5877
5930
 
5878
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5931
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5879
5932
 
5880
5933
  /*
5881
5934
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5896,7 +5949,7 @@
5896
5949
  return new JoseHeaderError(code, correlationId);
5897
5950
  }
5898
5951
 
5899
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5952
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5900
5953
  /*
5901
5954
  * Copyright (c) Microsoft Corporation. All rights reserved.
5902
5955
  * Licensed under the MIT License.
@@ -5921,7 +5974,7 @@
5921
5974
  return Object.getPrototypeOf(value) === proto;
5922
5975
  }
5923
5976
 
5924
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5977
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5925
5978
  /*
5926
5979
  * Copyright (c) Microsoft Corporation. All rights reserved.
5927
5980
  * Licensed under the MIT License.
@@ -5931,7 +5984,7 @@
5931
5984
  const missingJwkError = "missing_jwk_error";
5932
5985
  const invalidJwkError = "invalid_jwk_error";
5933
5986
 
5934
- /*! @azure/msal-common v16.16.1 2026-11-06 */
5987
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
5935
5988
 
5936
5989
  /*
5937
5990
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5997,7 +6050,7 @@
5997
6050
  }
5998
6051
  }
5999
6052
 
6000
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6053
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6001
6054
 
6002
6055
  /*
6003
6056
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6098,7 +6151,7 @@
6098
6151
  }
6099
6152
  }
6100
6153
 
6101
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6154
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6102
6155
 
6103
6156
  /*
6104
6157
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6253,7 +6306,7 @@
6253
6306
  }
6254
6307
  }
6255
6308
 
6256
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6309
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6257
6310
  /*
6258
6311
  * Copyright (c) Microsoft Corporation. All rights reserved.
6259
6312
  * Licensed under the MIT License.
@@ -6317,7 +6370,7 @@
6317
6370
  uiNotAllowed: uiNotAllowed
6318
6371
  });
6319
6372
 
6320
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6373
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6321
6374
 
6322
6375
  /*
6323
6376
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6384,7 +6437,7 @@
6384
6437
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6385
6438
  }
6386
6439
 
6387
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6440
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6388
6441
 
6389
6442
  /*
6390
6443
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6403,7 +6456,7 @@
6403
6456
  }
6404
6457
  }
6405
6458
 
6406
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6459
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6407
6460
 
6408
6461
  /*
6409
6462
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6474,7 +6527,7 @@
6474
6527
  }
6475
6528
  }
6476
6529
 
6477
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6530
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6478
6531
 
6479
6532
  /*
6480
6533
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6902,7 +6955,7 @@
6902
6955
  return baseAccount;
6903
6956
  }
6904
6957
 
6905
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6958
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6906
6959
  /*
6907
6960
  * Copyright (c) Microsoft Corporation. All rights reserved.
6908
6961
  * Licensed under the MIT License.
@@ -6912,7 +6965,7 @@
6912
6965
  UPN: "UPN",
6913
6966
  };
6914
6967
 
6915
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6968
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6916
6969
  /*
6917
6970
  * Copyright (c) Microsoft Corporation. All rights reserved.
6918
6971
  * Licensed under the MIT License.
@@ -6931,7 +6984,7 @@
6931
6984
  }
6932
6985
  }
6933
6986
 
6934
- /*! @azure/msal-common v16.16.1 2026-11-06 */
6987
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6935
6988
 
6936
6989
  /*
6937
6990
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6955,7 +7008,7 @@
6955
7008
  };
6956
7009
  }
6957
7010
 
6958
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7011
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
6959
7012
 
6960
7013
  /*
6961
7014
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7045,7 +7098,7 @@
7045
7098
  return undefined;
7046
7099
  }
7047
7100
 
7048
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7101
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7049
7102
 
7050
7103
  /*
7051
7104
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7076,7 +7129,7 @@
7076
7129
  return new NetworkError(error, httpStatus, responseHeaders);
7077
7130
  }
7078
7131
 
7079
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7132
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7080
7133
 
7081
7134
  /*
7082
7135
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7210,7 +7263,7 @@
7210
7263
  return response;
7211
7264
  }
7212
7265
 
7213
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7266
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7214
7267
 
7215
7268
  /*
7216
7269
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7253,7 +7306,8 @@
7253
7306
  throw createClientAuthError(requestCannotBeMade, request.correlationId);
7254
7307
  }
7255
7308
  // Check for new cloud instance
7256
- if (authCodePayload && authCodePayload.cloud_instance_host_name) {
7309
+ if (this.config.authOptions.instanceAware === true &&
7310
+ authCodePayload?.cloud_instance_host_name) {
7257
7311
  await invokeAsync(this.updateTokenEndpointAuthority.bind(this), UpdateTokenEndpointAuthority, this.logger, this.performanceClient, request.correlationId)(authCodePayload.cloud_instance_host_name, request.correlationId);
7258
7312
  }
7259
7313
  const reqTimestamp = nowSeconds();
@@ -7477,7 +7531,7 @@
7477
7531
  }
7478
7532
  }
7479
7533
 
7480
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7534
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7481
7535
 
7482
7536
  /*
7483
7537
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7662,13 +7716,13 @@
7662
7716
  decodedServerResponseState = decodeURIComponent(serverResponse.state);
7663
7717
  }
7664
7718
  catch (e) {
7665
- throw createClientAuthError(invalidState, correlationId, serverResponse.state);
7719
+ throw createClientAuthError(invalidState, correlationId);
7666
7720
  }
7667
7721
  try {
7668
7722
  decodedRequestState = decodeURIComponent(requestState);
7669
7723
  }
7670
7724
  catch (e) {
7671
- throw createClientAuthError(invalidState, correlationId, serverResponse.state);
7725
+ throw createClientAuthError(invalidState, correlationId);
7672
7726
  }
7673
7727
  if (decodedServerResponseState !== decodedRequestState) {
7674
7728
  throw createClientAuthError(stateMismatch, correlationId);
@@ -7707,7 +7761,7 @@
7707
7761
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7708
7762
  }
7709
7763
 
7710
- /*! @azure/msal-common v16.16.1 2026-11-06 */
7764
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
7711
7765
 
7712
7766
  /*
7713
7767
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8256,7 +8310,7 @@
8256
8310
  }
8257
8311
  }
8258
8312
 
8259
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8313
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
8260
8314
 
8261
8315
  /*
8262
8316
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8491,7 +8545,7 @@
8491
8545
  }
8492
8546
  }
8493
8547
 
8494
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8548
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
8495
8549
 
8496
8550
  /*
8497
8551
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8784,7 +8838,7 @@
8784
8838
  clearNativeBrokerErrorCode() { }
8785
8839
  }
8786
8840
 
8787
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8841
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
8788
8842
 
8789
8843
  /*
8790
8844
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8911,7 +8965,7 @@
8911
8965
  }
8912
8966
  }
8913
8967
 
8914
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8968
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
8915
8969
 
8916
8970
  /*
8917
8971
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8927,7 +8981,7 @@
8927
8981
  },
8928
8982
  };
8929
8983
 
8930
- /*! @azure/msal-common v16.16.1 2026-11-06 */
8984
+ /*! @azure/msal-common v16.17.0 2026-11-18 */
8931
8985
 
8932
8986
  /*
8933
8987
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9094,6 +9148,13 @@
9094
9148
  const Encrypt = "encrypt";
9095
9149
  const Decrypt = "decrypt";
9096
9150
  const GenerateEarKey = "generateEarKey";
9151
+ const GenerateAsymmetricEarKey = "generateAsymmetricEarKey";
9152
+ const ImportAsymmetricEarKey = "importAsymmetricEarKey";
9153
+ const ImportAsymmetricEarPublicKey = "importAsymmetricEarPublicKey";
9154
+ const DeriveAsymmetricEarSecret = "deriveAsymmetricEarSecret";
9155
+ const AsymmetricEarConcatKdf = "asymmetricEarConcatKdf";
9156
+ const ImportAsymmetricEarContentKey = "importAsymmetricEarContentKey";
9157
+ const DecryptAsymmetricEarResponse = "decryptAsymmetricEarResponse";
9097
9158
  const DecryptEarResponse = "decryptEarResponse";
9098
9159
  const LoadAccount = "loadAccount";
9099
9160
  const LoadIdToken = "loadIdToken";
@@ -9164,11 +9225,13 @@
9164
9225
  const failedToBuildHeaders = "failed_to_build_headers";
9165
9226
  const failedToParseHeaders = "failed_to_parse_headers";
9166
9227
  const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
9228
+ const asymmetricEarKeyError = "asymmetric_ear_key_error";
9167
9229
  const timedOut = "timed_out";
9168
9230
  const emptyResponse = "empty_response";
9169
9231
 
9170
9232
  var BrowserAuthErrorCodes = /*#__PURE__*/Object.freeze({
9171
9233
  __proto__: null,
9234
+ asymmetricEarKeyError: asymmetricEarKeyError,
9172
9235
  authCodeOrNativeAccountIdRequired: authCodeOrNativeAccountIdRequired,
9173
9236
  authCodeRequired: authCodeRequired,
9174
9237
  authRequestNotSetError: authRequestNotSetError,
@@ -9564,6 +9627,10 @@
9564
9627
  const S256_HASH_ALG = "SHA-256";
9565
9628
  // JWK values used by browser-internal WebCrypto helpers.
9566
9629
  const JSON_WEB_KEY_CURVE_P256 = "P-256";
9630
+ const ECDH_P384_ALGORITHM = {
9631
+ name: "ECDH",
9632
+ namedCurve: "P-384",
9633
+ };
9567
9634
  const JSON_WEB_KEY_TYPE_EC = "EC";
9568
9635
  const JSON_WEB_KEY_TYPE_RSA = "RSA";
9569
9636
  const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
@@ -9701,6 +9768,16 @@
9701
9768
  async function exportJwk(key) {
9702
9769
  return window.crypto.subtle.exportKey(KEY_FORMAT_JWK, key);
9703
9770
  }
9771
+ /**
9772
+ * Imports key as Json Web Key (JWK), can set extractable and usages.
9773
+ * @param key
9774
+ * @param extractable
9775
+ * @param usages
9776
+ * @param algorithm
9777
+ */
9778
+ async function importJwk(key, extractable, usages, algorithm) {
9779
+ return window.crypto.subtle.importKey(KEY_FORMAT_JWK, key, algorithm, extractable, usages);
9780
+ }
9704
9781
  /**
9705
9782
  * Signs given data with given key.
9706
9783
  * @param key
@@ -9723,6 +9800,172 @@
9723
9800
  };
9724
9801
  return base64Encode(JSON.stringify(jwk));
9725
9802
  }
9803
+ /**
9804
+ * Generates P-384 ECDH keys for request-scoped private sessionStorage and public wire metadata.
9805
+ * @internal
9806
+ */
9807
+ async function generateAsymmetricEarKey() {
9808
+ const keyPair = await generateKeyPair(true, ["deriveBits"], ECDH_P384_ALGORITHM);
9809
+ const publicJwk = await exportJwk(keyPair.publicKey);
9810
+ const privateJwk = await exportJwk(keyPair.privateKey);
9811
+ return {
9812
+ privateJwk,
9813
+ publicJwk,
9814
+ };
9815
+ }
9816
+ /**
9817
+ * Restores a private EAR key as non-exportable. The serialized sessionStorage copy remains exportable.
9818
+ * @internal
9819
+ */
9820
+ async function importAsymmetricEarKey(privateJwk, correlationId = "") {
9821
+ if (privateJwk?.kty !== "EC" ||
9822
+ privateJwk.crv !== "P-384" ||
9823
+ !privateJwk.d) {
9824
+ throw createBrowserAuthError(asymmetricEarKeyError, correlationId, "invalid_private_key" /* AsymmetricEarSubErrors.InvalidPrivateKey */);
9825
+ }
9826
+ try {
9827
+ return await importJwk(privateJwk, false, ["deriveBits"], ECDH_P384_ALGORITHM);
9828
+ }
9829
+ catch {
9830
+ throw createBrowserAuthError(asymmetricEarKeyError, correlationId, "private_key_import_failed" /* AsymmetricEarSubErrors.PrivateKeyImportFailed */);
9831
+ }
9832
+ }
9833
+ /**
9834
+ * Encodes the EAR client party information with a fresh 192-bit nonce.
9835
+ * @internal
9836
+ */
9837
+ function generateAsymmetricEarApv(publicJwk) {
9838
+ const point = new Uint8Array(concatEarBytes(new Uint8Array([4]), decodeEarBase64Url(publicJwk.x || ""), decodeEarBase64Url(publicJwk.y || "")));
9839
+ if (point.length !== 97) {
9840
+ throw createBrowserAuthError(asymmetricEarKeyError, "", "invalid_public_key_coordinates" /* AsymmetricEarSubErrors.InvalidPublicKeyCoordinates */);
9841
+ }
9842
+ const nonce = new Uint8Array(24);
9843
+ window.crypto.getRandomValues(nonce);
9844
+ return urlEncodeArr(new Uint8Array(concatEarBytes(lengthPrefixEarBytes(new TextEncoder().encode("EarClient")), lengthPrefixEarBytes(point), lengthPrefixEarBytes(nonce))));
9845
+ }
9846
+ /**
9847
+ * Authenticates and decrypts direct ECDH-ES/P-384/A256GCM using JOSE Concat KDF.
9848
+ * Party information is used byte-for-byte; the service need not echo the request APV.
9849
+ * @internal
9850
+ */
9851
+ async function decryptAsymmetricEarResponse(privateJwk, apv, earJwe, requestApv = apv, telemetry) {
9852
+ const correlationId = telemetry?.correlationId || "";
9853
+ const measure = (eventName, operation) => telemetry
9854
+ ? invokeAsync(operation, eventName, telemetry.logger, telemetry.performanceClient, correlationId)()
9855
+ : operation();
9856
+ if (apv !== requestApv) {
9857
+ throw createBrowserAuthError(asymmetricEarKeyError, correlationId, "request_apv_mismatch" /* AsymmetricEarSubErrors.RequestApvMismatch */);
9858
+ }
9859
+ const parts = earJwe.split(".");
9860
+ if (parts.length !== 5 || parts[1] !== "") {
9861
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9862
+ }
9863
+ let header;
9864
+ try {
9865
+ header = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(decodeEarBase64Url(parts[0], correlationId)));
9866
+ }
9867
+ catch {
9868
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9869
+ }
9870
+ if (!header ||
9871
+ header.alg !== "ECDH-ES" ||
9872
+ header.enc !== "A256GCM" ||
9873
+ header.crit !== undefined ||
9874
+ header.zip !== undefined ||
9875
+ header.epk?.kty !== "EC" ||
9876
+ header.epk.crv !== "P-384" ||
9877
+ header.epk.d !== undefined ||
9878
+ (header.apv !== undefined && header.apv !== apv)) {
9879
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9880
+ }
9881
+ const x = decodeEarBase64Url(header.epk.x, correlationId);
9882
+ const y = decodeEarBase64Url(header.epk.y, correlationId);
9883
+ const apuBytes = decodeEarBase64Url(header.apu, correlationId);
9884
+ const apvBytes = decodeEarBase64Url(apv, correlationId);
9885
+ const iv = decodeEarBase64Url(parts[2], correlationId);
9886
+ const ciphertext = decodeEarBase64Url(parts[3], correlationId);
9887
+ const tag = decodeEarBase64Url(parts[4], correlationId);
9888
+ if (x.length !== 48 ||
9889
+ y.length !== 48 ||
9890
+ iv.length !== 12 ||
9891
+ tag.length !== 16) {
9892
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9893
+ }
9894
+ let key;
9895
+ try {
9896
+ const privateKey = await measure(ImportAsymmetricEarKey, () => importAsymmetricEarKey(privateJwk, correlationId));
9897
+ const publicKey = await measure(ImportAsymmetricEarPublicKey, () => importJwk({
9898
+ kty: "EC",
9899
+ crv: "P-384",
9900
+ x: header.epk.x,
9901
+ y: header.epk.y,
9902
+ }, false, [], ECDH_P384_ALGORITHM));
9903
+ const secret = new Uint8Array(await measure(DeriveAsymmetricEarSecret, () => window.crypto.subtle.deriveBits({ name: "ECDH", public: publicKey }, privateKey, 384)));
9904
+ // RFC 7518 section 4.6.2: one SHA-256 round produces the 256-bit content key.
9905
+ const input = new Uint8Array(concatEarBytes(earUint32(1), secret, lengthPrefixEarBytes(new TextEncoder().encode("A256GCM")), lengthPrefixEarBytes(apuBytes), lengthPrefixEarBytes(apvBytes), earUint32(256)));
9906
+ let derivedKey;
9907
+ try {
9908
+ derivedKey = await measure(AsymmetricEarConcatKdf, () => window.crypto.subtle.digest(S256_HASH_ALG, input));
9909
+ }
9910
+ finally {
9911
+ secret.fill(0);
9912
+ input.fill(0);
9913
+ }
9914
+ try {
9915
+ key = await measure(ImportAsymmetricEarContentKey, () => window.crypto.subtle.importKey(RAW, derivedKey, AES_GCM, false, [DECRYPT]));
9916
+ }
9917
+ finally {
9918
+ new Uint8Array(derivedKey).fill(0);
9919
+ }
9920
+ }
9921
+ catch (error) {
9922
+ if (error instanceof AuthError) {
9923
+ throw error;
9924
+ }
9925
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "content_encryption_key_derivation_failed" /* AsymmetricEarSubErrors.ContentEncryptionKeyDerivationFailed */);
9926
+ }
9927
+ try {
9928
+ const plaintext = await measure(DecryptAsymmetricEarResponse, () => window.crypto.subtle.decrypt({
9929
+ name: AES_GCM,
9930
+ iv,
9931
+ tagLength: 128,
9932
+ additionalData: new TextEncoder().encode(parts[0]),
9933
+ }, key, concatEarBytes(ciphertext, tag)));
9934
+ return new TextDecoder("utf-8", { fatal: true }).decode(plaintext);
9935
+ }
9936
+ catch {
9937
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "jwe_decryption_failed" /* AsymmetricEarSubErrors.JweDecryptionFailed */);
9938
+ }
9939
+ }
9940
+ /** Decodes canonical, unpadded JOSE base64url for asymmetric EAR only. */
9941
+ function decodeEarBase64Url(value, correlationId = "") {
9942
+ // Match the unpadded base64url alphabet only: letters, digits, '-' and '_'.
9943
+ if (typeof value !== "string" || !/^[A-Za-z0-9_-]+$/.test(value)) {
9944
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9945
+ }
9946
+ const bytes = new Uint8Array(base64DecToArr(value));
9947
+ if (urlEncodeArr(bytes) !== value) {
9948
+ throw createBrowserAuthError(failedToDecryptEarResponse, correlationId, "invalid_jwe_format_or_header" /* AsymmetricEarSubErrors.InvalidJweFormatOrHeader */);
9949
+ }
9950
+ return bytes;
9951
+ }
9952
+ function earUint32(value) {
9953
+ const bytes = new Uint8Array(4);
9954
+ new DataView(bytes.buffer).setUint32(0, value);
9955
+ return bytes;
9956
+ }
9957
+ function concatEarBytes(...parts) {
9958
+ const bytes = new Uint8Array(parts.reduce((length, part) => length + part.length, 0));
9959
+ let offset = 0;
9960
+ for (const part of parts) {
9961
+ bytes.set(part, offset);
9962
+ offset += part.length;
9963
+ }
9964
+ return bytes.buffer;
9965
+ }
9966
+ function lengthPrefixEarBytes(bytes) {
9967
+ return new Uint8Array(concatEarBytes(earUint32(bytes.length), bytes));
9968
+ }
9726
9969
  /**
9727
9970
  * Parses earJwk for encryption key and returns CryptoKey object
9728
9971
  * @param earJwk
@@ -11662,7 +11905,7 @@
11662
11905
 
11663
11906
  /* eslint-disable header/header */
11664
11907
  const name = "@azure/msal-browser";
11665
- const version = "5.29.0";
11908
+ const version = "5.30.0";
11666
11909
 
11667
11910
  /*
11668
11911
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12969,8 +13212,7 @@
12969
13212
  }
12970
13213
  }
12971
13214
  catch (e) {
12972
- this.logger.errorPii(`0ewsey ${encodedTokenRequest}`, correlationId);
12973
- this.logger.error(`0tvdic ${e}`, correlationId);
13215
+ this.logger.error("023ixj", correlationId);
12974
13216
  throw createBrowserAuthError(unableToParseTokenRequestCacheError, "");
12975
13217
  }
12976
13218
  return [parsedRequest, verifier];
@@ -13908,6 +14150,10 @@
13908
14150
  clientId: this.config.auth.clientId,
13909
14151
  authority: discoveredAuthority,
13910
14152
  clientCapabilities: this.config.auth.clientCapabilities,
14153
+ instanceAware: requestExtraQueryParameters?.instance_aware
14154
+ ?.length
14155
+ ? requestExtraQueryParameters.instance_aware === "true"
14156
+ : this.config.auth.instanceAware,
13911
14157
  redirectUri: this.config.auth.redirectUri,
13912
14158
  isMcp: this.config.auth.isMcp,
13913
14159
  },
@@ -14040,30 +14286,42 @@
14040
14286
  * page (see `runPopupRelay`) back to the embedded frame that opened it. See
14041
14287
  * {@link BrowserAuthOptions.popupRelayUri}.
14042
14288
  *
14043
- * Kept dependency-free so both the relay-page entry (`./index.js`) and the
14044
- * client-side helpers (`./relayClient.js`) can import it without either bundle
14045
- * pulling in the other's dependencies.
14289
+ * Shared by the relay-page entry and client helpers without importing either
14290
+ * implementation into the other bundle.
14046
14291
  *
14047
14292
  * @internal
14048
14293
  */
14049
- const POPUP_RELAY_RESPONSE_TYPE = "msal:popup-relay-response:v1";
14294
+ const POPUP_RELAY_RESPONSE_TYPE = "msal:popup-relay-response:v1";
14295
+ /** @internal Response bound to an authenticated v2 relay document. */
14296
+ const POPUP_RELAY_V2_RESPONSE_TYPE = "msal:popup-relay-response:v2";
14297
+ /** @internal Ready signal for the authenticated popup-relay request handoff. */
14298
+ const POPUP_RELAY_READY_TYPE = "msal:popup-relay-ready:v2";
14299
+ /** @internal Request delivered only to the same-origin relay window. */
14300
+ const POPUP_RELAY_REQUEST_TYPE = "msal:popup-relay-request:v2";
14301
+ /** @internal Resolve the compatibility default without downgrading invalid versions. */
14302
+ function getPopupRelayProtocolVersion(version, correlationId = "") {
14303
+ if (version === undefined) {
14304
+ return 1;
14305
+ }
14306
+ if (version !== 1 && version !== 2) {
14307
+ throw createBrowserAuthError(popupRelayUnsupportedFlow, correlationId, "popup_relay_invalid_protocol");
14308
+ }
14309
+ return version;
14310
+ }
14050
14311
 
14051
14312
  /*
14052
14313
  * Copyright (c) Microsoft Corporation. All rights reserved.
14053
14314
  * Licensed under the MIT License.
14054
14315
  */
14055
14316
  /**
14056
- * Builds the URL of the popup-relay page to open. The action the relay page
14057
- * must perform (GET navigation or POST form) is carried in the page's hash
14058
- * (client-side only, never sent to a server), keyed by the per-request
14059
- * library-state `id` so the relay page can listen on the right BroadcastChannel
14060
- * and echo the id back. The relay URI is resolved against the app origin, so it
14061
- * must be same-origin as the embedded frame. See `runPopupRelay`.
14317
+ * Builds the same-origin relay URL. V1 preserves the fragment descriptor;
14318
+ * explicitly selected v2 carries only the id and retains the navigation for
14319
+ * the authenticated handoff.
14062
14320
  *
14063
14321
  * @internal
14064
14322
  */
14065
- function buildPopupRelayUrl(popupRelayUri, id, action, correlationId) {
14066
- const req = { id, ...action };
14323
+ function buildPopupRelayUrl(popupRelayUri, id, action, correlationId, protocolVersion) {
14324
+ const version = getPopupRelayProtocolVersion(protocolVersion, correlationId);
14067
14325
  const target = new URL(popupRelayUri, window.location.origin);
14068
14326
  /*
14069
14327
  * The relay page must be same-origin as the embedded frame: the response is
@@ -14076,7 +14334,12 @@
14076
14334
  throw createBrowserAuthError(popupRelayUnsupportedFlow, correlationId, "popup_relay_cross_origin");
14077
14335
  }
14078
14336
  const hashParams = new URLSearchParams();
14079
- hashParams.set("req", JSON.stringify(req));
14337
+ if (version === 1) {
14338
+ hashParams.set("req", JSON.stringify({ id, ...action }));
14339
+ }
14340
+ else {
14341
+ hashParams.set("id", id);
14342
+ }
14080
14343
  target.hash = hashParams.toString();
14081
14344
  return target.toString();
14082
14345
  }
@@ -14087,21 +14350,30 @@
14087
14350
  * partitioning blocks the BroadcastChannel the redirect bridge uses from
14088
14351
  * reaching the embedded frame.
14089
14352
  *
14090
- * The response is accepted only from the popup window we opened, on our own
14091
- * origin (the relay page is same-origin as the embedded frame), and only when
14092
- * it carries the matching per-request library-state id.
14353
+ * In v2, the retained navigation is sent once, after a ready signal from the popup
14354
+ * window we opened on our own origin with the matching library-state id.
14355
+ * Successful responses must also carry that handoff's relay-document nonce.
14356
+ * Setup failures can reject the request before the handoff completes.
14093
14357
  *
14094
14358
  * @internal
14095
14359
  */
14096
- async function waitForPopupRelayResponse(timeoutMs, logger, request, popupWindow, performanceClient) {
14360
+ async function waitForPopupRelayResponse(timeoutMs, logger, request, popupWindow, performanceClient, action, protocolVersion) {
14361
+ const version = getPopupRelayProtocolVersion(protocolVersion, request.correlationId);
14362
+ if (version === 2 && !action) {
14363
+ throw createBrowserAuthError(popupRelayUnsupportedFlow, request.correlationId, "popup_relay_bad_request");
14364
+ }
14097
14365
  return new Promise((resolve, reject) => {
14098
14366
  const correlationId = request.correlationId;
14099
14367
  logger.verbose("1d05g9", correlationId);
14100
- performanceClient.addFields({ redirectBridgeTimeoutMs: timeoutMs }, correlationId);
14368
+ performanceClient.addFields({
14369
+ redirectBridgeTimeoutMs: timeoutMs,
14370
+ popupRelayProtocolVersion: version,
14371
+ }, correlationId);
14101
14372
  const { libraryState } = parseRequestState(base64Decode, request.state || "", correlationId);
14102
14373
  const expectedId = libraryState.id;
14103
14374
  const expectedOrigin = window.location.origin;
14104
14375
  let settled = false;
14376
+ let handoffNonce = "";
14105
14377
  const cleanup = () => {
14106
14378
  window.removeEventListener("message", onMessage);
14107
14379
  clearTimeout(timeoutId);
@@ -14113,20 +14385,52 @@
14113
14385
  return;
14114
14386
  }
14115
14387
  const data = event.data;
14116
- if (!data ||
14117
- data.type !== POPUP_RELAY_RESPONSE_TYPE ||
14118
- data.id !== expectedId) {
14388
+ if (!data || data.id !== expectedId) {
14119
14389
  return;
14120
14390
  }
14121
14391
  if (settled) {
14122
14392
  return;
14123
14393
  }
14394
+ if (version === 2 && data.type === POPUP_RELAY_READY_TYPE) {
14395
+ if (handoffNonce ||
14396
+ typeof data.nonce !== "string" ||
14397
+ !data.nonce) {
14398
+ return;
14399
+ }
14400
+ handoffNonce = data.nonce;
14401
+ try {
14402
+ popupWindow.postMessage({
14403
+ type: POPUP_RELAY_REQUEST_TYPE,
14404
+ id: expectedId,
14405
+ nonce: handoffNonce,
14406
+ request: { id: expectedId, ...action },
14407
+ }, expectedOrigin);
14408
+ performanceClient.addFields({ "ext.popupRelayRequestSent": true }, correlationId);
14409
+ }
14410
+ catch {
14411
+ settled = true;
14412
+ cleanup();
14413
+ logger.error("0sx3jz", correlationId);
14414
+ reject(createBrowserAuthError(popupWindowError, correlationId, "popup_relay_handoff_failed"));
14415
+ }
14416
+ return;
14417
+ }
14418
+ const hasError = typeof data.error === "string" && data.error.length > 0;
14419
+ const responseType = version === 1
14420
+ ? POPUP_RELAY_RESPONSE_TYPE
14421
+ : POPUP_RELAY_V2_RESPONSE_TYPE;
14422
+ if (data.type !== responseType ||
14423
+ (version === 2 &&
14424
+ ((!handoffNonce && !hasError) ||
14425
+ (handoffNonce && data.nonce !== handoffNonce)))) {
14426
+ return;
14427
+ }
14124
14428
  settled = true;
14125
14429
  cleanup();
14126
- if (data.error) {
14127
- reject(createBrowserAuthError(data.error, correlationId));
14430
+ if (hasError) {
14431
+ reject(createBrowserAuthError(data.error, correlationId, data.subError));
14128
14432
  }
14129
- else if (data.payload) {
14433
+ else if (typeof data.payload === "string" && data.payload) {
14130
14434
  resolve(data.payload);
14131
14435
  }
14132
14436
  else {
@@ -15795,6 +16099,36 @@
15795
16099
  addCorrelationId(queryParams, request.correlationId);
15796
16100
  return getAuthorizeUrl(authority, queryParams);
15797
16101
  }
16102
+ /**
16103
+ * Prepares the selected EAR construction.
16104
+ * @internal
16105
+ */
16106
+ async function initializeEarRequest(config, request, logger, performanceClient) {
16107
+ if (!config.experimental.enableAsymmetricEar) {
16108
+ const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, logger, performanceClient, request.correlationId)();
16109
+ return {
16110
+ ...request,
16111
+ earJwk,
16112
+ asymmetricEar: undefined,
16113
+ };
16114
+ }
16115
+ try {
16116
+ const { privateJwk, publicJwk } = await invokeAsync(generateAsymmetricEarKey, GenerateAsymmetricEarKey, logger, performanceClient, request.correlationId)();
16117
+ const apv = generateAsymmetricEarApv(publicJwk);
16118
+ const earJwk = base64Encode(JSON.stringify(publicJwk));
16119
+ return {
16120
+ ...request,
16121
+ earJwk,
16122
+ asymmetricEar: { privateJwk, apv },
16123
+ };
16124
+ }
16125
+ catch (error) {
16126
+ if (error instanceof AuthError) {
16127
+ throw error;
16128
+ }
16129
+ throw createBrowserAuthError(asymmetricEarKeyError, request.correlationId, "request_initialization_failed" /* AsymmetricEarSubErrors.RequestInitializationFailed */);
16130
+ }
16131
+ }
15798
16132
  /**
15799
16133
  * Builds the action URL + POST-body fields for the EAR /authorize form.
15800
16134
  */
@@ -15804,7 +16138,18 @@
15804
16138
  }
15805
16139
  const parameters = await getStandardParameters(config, authority, request, logger, performanceClient);
15806
16140
  addResponseType(parameters, OAuthResponseType.IDTOKEN_TOKEN_REFRESHTOKEN);
15807
- addEARParameters(parameters, request.earJwk);
16141
+ try {
16142
+ addEARParameters(parameters, request.earJwk, request.asymmetricEar
16143
+ ? base64Encode(JSON.stringify({
16144
+ alg: "ECDH-ES",
16145
+ enc: "A256GCM",
16146
+ apv: request.asymmetricEar.apv,
16147
+ }))
16148
+ : undefined);
16149
+ }
16150
+ catch {
16151
+ throw createBrowserAuthError(asymmetricEarKeyError, request.correlationId, "request_encoding_failed" /* AsymmetricEarSubErrors.RequestEncodingFailed */);
16152
+ }
15808
16153
  // Also add codeChallenge as backup in case EAR is not supported
15809
16154
  addCodeChallengeParams(parameters, request.codeChallenge, S256_CODE_CHALLENGE_METHOD);
15810
16155
  addExtraParameters(parameters, {
@@ -15888,12 +16233,14 @@
15888
16233
  const browserCrypto = new CryptoOps(logger, performanceClient);
15889
16234
  const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
15890
16235
  const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
16236
+ const brokerRequest = {
16237
+ ...request,
16238
+ state: userRequestState,
16239
+ prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
16240
+ };
16241
+ delete brokerRequest.asymmetricEar;
15891
16242
  try {
15892
- return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
15893
- ...request,
15894
- state: userRequestState,
15895
- prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
15896
- });
16243
+ return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)(brokerRequest);
15897
16244
  }
15898
16245
  catch (e) {
15899
16246
  await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
@@ -15958,7 +16305,20 @@
15958
16305
  if (!request.earJwk) {
15959
16306
  throw createBrowserAuthError(earJwkEmpty, request.correlationId);
15960
16307
  }
15961
- const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
16308
+ let plaintext;
16309
+ if (request.asymmetricEar) {
16310
+ 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 });
16311
+ }
16312
+ else {
16313
+ plaintext = await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe);
16314
+ }
16315
+ let decryptedData;
16316
+ try {
16317
+ decryptedData = JSON.parse(plaintext);
16318
+ }
16319
+ catch {
16320
+ throw createBrowserAuthError(failedToDecryptEarResponse, request.correlationId, "invalid_decrypted_response_payload" /* AsymmetricEarSubErrors.InvalidDecryptedResponsePayload */);
16321
+ }
15962
16322
  if (decryptedData.accountId) {
15963
16323
  return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
15964
16324
  }
@@ -16249,6 +16609,7 @@
16249
16609
  : "",
16250
16610
  postLogoutRedirectUri: "",
16251
16611
  popupRelayUri: "",
16612
+ popupRelayProtocolVersion: 1,
16252
16613
  clientCapabilities: [],
16253
16614
  OIDCOptions: {
16254
16615
  responseMode: ResponseMode$1.FRAGMENT,
@@ -16315,6 +16676,7 @@
16315
16676
  client: new StubPerformanceClient(),
16316
16677
  };
16317
16678
  const DEFAULT_EXPERIMENTAL_OPTIONS = {
16679
+ enableAsymmetricEar: false,
16318
16680
  iframeTimeoutTelemetry: false,
16319
16681
  allowPlatformBrokerWithDOM: false,
16320
16682
  };
@@ -16368,9 +16730,16 @@
16368
16730
  experimental: {
16369
16731
  ...DEFAULT_EXPERIMENTAL_OPTIONS,
16370
16732
  ...userInputExperimental,
16733
+ enableAsymmetricEar: userInputExperimental?.enableAsymmetricEar ?? false,
16371
16734
  },
16372
16735
  telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry },
16373
16736
  };
16737
+ if (overlayedConfig.experimental.enableAsymmetricEar &&
16738
+ overlayedConfig.system.protocolMode !== ProtocolMode.EAR) {
16739
+ const logger = new Logger(providedSystemOptions.loggerOptions, name, version);
16740
+ logger.warning("07xxx7", "");
16741
+ overlayedConfig.experimental.enableAsymmetricEar = false;
16742
+ }
16374
16743
  return overlayedConfig;
16375
16744
  }
16376
16745
 
@@ -17275,19 +17644,21 @@
17275
17644
  /*
17276
17645
  * When a popup-relay page is configured, open it top-level
17277
17646
  * (same first-party origin) instead of navigating the popup
17278
- * straight to the IdP, and carry the /authorize URL in its hash.
17647
+ * straight to the IdP. V1 carries the action in the hash; v2
17648
+ * retains it for the authenticated handoff.
17279
17649
  * The relay page opens the IdP child popup and relays the
17280
17650
  * response back via postMessage (see waitForPopupResponse).
17281
17651
  */
17282
17652
  const popupRelayUri = this.config.auth.popupRelayUri;
17653
+ popupParams.relayAction = { method: "GET", url: navigateUrl };
17283
17654
  const popupNavigateUrl = popupRelayUri
17284
- ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), { method: "GET", url: navigateUrl }, correlationId)
17655
+ ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), popupParams.relayAction, correlationId, this.config.auth.popupRelayProtocolVersion)
17285
17656
  : navigateUrl;
17286
17657
  // Show the UI once the url has been created. Get the window handle for the popup.
17287
17658
  const popupWindow = this.initiateAuthRequest(popupNavigateUrl, popupParams);
17288
17659
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, correlationId, exports.InteractionType.Popup, { popupWindow }, null);
17289
17660
  // Wait for the redirect bridge response
17290
- const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
17661
+ const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent, popupParams.relayAction);
17291
17662
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
17292
17663
  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);
17293
17664
  }
@@ -17311,21 +17682,20 @@
17311
17682
  const { correlationId, authority, azureCloudOptions, extraQueryParameters, account, } = request;
17312
17683
  // Get the frame handle for the silent request
17313
17684
  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);
17314
- const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
17315
17685
  const pkce = pkceCodes ||
17316
17686
  (await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId));
17317
17687
  const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17318
- const popupRequest = {
17688
+ let popupRequest = {
17319
17689
  ...request,
17320
- earJwk: earJwk,
17321
17690
  codeChallenge: pkce.challenge,
17322
17691
  ...tokenBindingParams,
17323
17692
  popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
17324
17693
  };
17325
17694
  try {
17695
+ popupRequest = await initializeEarRequest(this.config, popupRequest, this.logger, this.performanceClient);
17326
17696
  const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
17327
17697
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
17328
- const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
17698
+ const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent, popupParams.relayAction);
17329
17699
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
17330
17700
  if (!serverParams.ear_jwe && serverParams.code) {
17331
17701
  const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
@@ -17353,7 +17723,7 @@
17353
17723
  const discoveredAuthority = await invokeAsync(getDiscoveredAuthority, StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, correlationId)(this.config, this.correlationId, this.performanceClient, this.browserStorage, this.logger);
17354
17724
  const popupWindow = await this.openPostFormPopup(request, discoveredAuthority, popupParams, correlationId, false);
17355
17725
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
17356
- const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
17726
+ const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent, popupParams.relayAction);
17357
17727
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
17358
17728
  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);
17359
17729
  }
@@ -17409,21 +17779,22 @@
17409
17779
  this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, validRequest.correlationId, exports.InteractionType.Popup, validRequest);
17410
17780
  /*
17411
17781
  * When a popup-relay page is configured, open it top-level (same
17412
- * first-party origin) and carry the end-session URL in its hash,
17413
- * exactly like the login flow. The relay page opens the IdP child
17782
+ * first-party origin), using the configured wire protocol for the
17783
+ * end-session URL. The relay page opens the IdP child
17414
17784
  * popup and the post-logout redirect page (running the redirect
17415
17785
  * bridge) relays completion back via postMessage — so logout works
17416
17786
  * from an embedded, cross-origin iframe where a direct popup to the
17417
17787
  * IdP cannot. See runPopupRelay / waitForPopupResponse.
17418
17788
  */
17419
17789
  const popupRelayUri = this.config.auth.popupRelayUri;
17790
+ popupParams.relayAction = { method: "GET", url: logoutUri };
17420
17791
  const popupNavigateUrl = popupRelayUri
17421
- ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(validRequest.state || "", this.correlationId), { method: "GET", url: logoutUri }, this.correlationId)
17792
+ ? buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(validRequest.state || "", this.correlationId), popupParams.relayAction, this.correlationId, this.config.auth.popupRelayProtocolVersion)
17422
17793
  : logoutUri;
17423
17794
  // Open the popup window to requestUrl.
17424
17795
  const popupWindow = this.openPopup(popupNavigateUrl, popupParams);
17425
17796
  this.eventHandler.emitEvent(EventType.POPUP_OPENED, validRequest.correlationId, exports.InteractionType.Popup, { popupWindow }, null);
17426
- await this.waitForPopupResponse(validRequest, popupWindow, popupParams.popupWindowParent).catch(() => {
17797
+ await this.waitForPopupResponse(validRequest, popupWindow, popupParams.popupWindowParent, popupParams.relayAction).catch(() => {
17427
17798
  // Swallow any errors related to monitoring the window. Server logout is best effort
17428
17799
  });
17429
17800
  if (mainWindowRedirectUri) {
@@ -17635,11 +18006,12 @@
17635
18006
  ? getEARFormData
17636
18007
  : getCodeFormData;
17637
18008
  const formData = await getFormData(this.config, discoveredAuthority, request, this.logger, this.performanceClient);
17638
- const relayUrl = buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), {
18009
+ popupParams.relayAction = {
17639
18010
  method: "POST",
17640
18011
  action: formData.action,
17641
18012
  fields: formData.fields,
17642
- }, correlationId);
18013
+ };
18014
+ const relayUrl = buildPopupRelayUrl(popupRelayUri, this.getRelayStateId(request.state, correlationId), popupParams.relayAction, correlationId, this.config.auth.popupRelayProtocolVersion);
17643
18015
  return this.initiateAuthRequest(relayUrl, popupParams);
17644
18016
  }
17645
18017
  const popupWindow = popupParams.popup || this.openPopup("about:blank", popupParams);
@@ -17648,7 +18020,7 @@
17648
18020
  form.submit();
17649
18021
  return popupWindow;
17650
18022
  }
17651
- async waitForPopupResponse(request, popupWindow, popupWindowParent) {
18023
+ async waitForPopupResponse(request, popupWindow, popupWindowParent, relayAction) {
17652
18024
  /*
17653
18025
  * When a popup-relay page is configured the response is relayed back to
17654
18026
  * this frame by the relay page via postMessage, and the relay popup's
@@ -17658,7 +18030,11 @@
17658
18030
  * frame and which does not track the relay popup.
17659
18031
  */
17660
18032
  if (this.config.auth.popupRelayUri) {
17661
- return waitForPopupRelayResponse(this.config.system.popupBridgeTimeout, this.logger, request, popupWindow, this.performanceClient);
18033
+ if (this.config.auth.popupRelayProtocolVersion === 2 &&
18034
+ !relayAction) {
18035
+ throw createBrowserAuthError(popupRelayUnsupportedFlow, this.correlationId, "popup_relay_bad_request");
18036
+ }
18037
+ return waitForPopupRelayResponse(this.config.system.popupBridgeTimeout, this.logger, request, popupWindow, this.performanceClient, relayAction, this.config.auth.popupRelayProtocolVersion);
17662
18038
  }
17663
18039
  if (this.waitForPopupResponseHook) {
17664
18040
  return this.waitForPopupResponseHook(request, popupWindow, popupWindowParent);
@@ -17783,16 +18159,15 @@
17783
18159
  const { correlationId, authority, azureCloudOptions, extraQueryParameters, account, } = request;
17784
18160
  // Get the frame handle for the silent request
17785
18161
  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);
17786
- const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
17787
18162
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
17788
18163
  const tokenBindingParams = await getTokenBindingRequestParams(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17789
- const redirectRequest = {
18164
+ let redirectRequest = {
17790
18165
  ...request,
17791
- earJwk: earJwk,
17792
18166
  codeChallenge: pkceCodes.challenge,
17793
18167
  ...tokenBindingParams,
17794
18168
  };
17795
18169
  try {
18170
+ redirectRequest = await initializeEarRequest(this.config, redirectRequest, this.logger, this.performanceClient);
17796
18171
  if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
17797
18172
  throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
17798
18173
  }
@@ -17805,9 +18180,10 @@
17805
18180
  }, this.config.system.redirectNavigationTimeout);
17806
18181
  });
17807
18182
  }
17808
- catch (e) {
18183
+ catch (error) {
18184
+ this.browserStorage.resetRequestCache(correlationId);
17809
18185
  await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17810
- throw e;
18186
+ throw error;
17811
18187
  }
17812
18188
  }
17813
18189
  /**
@@ -17986,13 +18362,16 @@
17986
18362
  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);
17987
18363
  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);
17988
18364
  }
17989
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
18365
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
18366
+ serverTelemetryManager,
18367
+ requestAuthority: request.authority,
18368
+ requestExtraQueryParameters: request.extraQueryParameters,
18369
+ });
17990
18370
  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);
17991
18371
  }
17992
18372
  /**
17993
18373
  * Redirects window to given URL.
17994
18374
  * @param urlNavigate
17995
- * @param onRedirectNavigateRequest - onRedirectNavigate callback provided on the request
17996
18375
  */
17997
18376
  async initiateAuthRequest(requestUrl) {
17998
18377
  this.logger.verbose("0yaw2e", this.correlationId);
@@ -18280,13 +18659,11 @@
18280
18659
  async executeEarFlow(request) {
18281
18660
  const { correlationId, authority, azureCloudOptions, extraQueryParameters, account, } = request;
18282
18661
  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);
18283
- const earJwk = await invokeAsync(generateEarKey, GenerateEarKey, this.logger, this.performanceClient, correlationId)();
18284
18662
  const pkceCodes = await invokeAsync(generatePkceCodes, GeneratePkceCodes, this.logger, this.performanceClient, correlationId)(this.performanceClient, this.logger, correlationId);
18285
- const silentRequest = {
18663
+ const silentRequest = await initializeEarRequest(this.config, {
18286
18664
  ...request,
18287
- earJwk: earJwk,
18288
18665
  codeChallenge: pkceCodes.challenge,
18289
- };
18666
+ }, this.logger, this.performanceClient);
18290
18667
  // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
18291
18668
  const iframe = createHiddenIframe();
18292
18669
  const responseType = this.config.auth.OIDCOptions.responseMode;
@@ -18648,6 +19025,7 @@
18648
19025
  return {
18649
19026
  key: JSON.stringify({
18650
19027
  ...thumbprint,
19028
+ accountTenantId: account.tenantId,
18651
19029
  forceRefresh: !!request.forceRefresh,
18652
19030
  cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
18653
19031
  extraParameters: canonicalizeStringDict(request.extraParameters),