@azure/msal-browser 5.29.1 → 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 (319) 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 +8 -10
  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 +1 -1
  200. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  201. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  202. package/dist/log-strings-mapping.json +701 -697
  203. package/dist/naa/BridgeError.mjs +1 -1
  204. package/dist/naa/BridgeProxy.mjs +1 -1
  205. package/dist/naa/BridgeStatusCode.mjs +1 -1
  206. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  207. package/dist/navigation/NavigationClient.mjs +1 -1
  208. package/dist/network/FetchClient.mjs +1 -1
  209. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  210. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  211. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  212. package/dist/packageMetadata.mjs +2 -2
  213. package/dist/popup_relay/constants.mjs +24 -6
  214. package/dist/popup_relay/constants.mjs.map +1 -1
  215. package/dist/popup_relay/index.mjs +142 -44
  216. package/dist/popup_relay/index.mjs.map +1 -1
  217. package/dist/popup_relay/relayClient.mjs +66 -23
  218. package/dist/popup_relay/relayClient.mjs.map +1 -1
  219. package/dist/protocol/Authorize.mjs +70 -13
  220. package/dist/protocol/Authorize.mjs.map +1 -1
  221. package/dist/redirect_bridge/index.mjs +1 -1
  222. package/dist/request/RequestHelpers.mjs +1 -1
  223. package/dist/request/SilentRequestHelpers.mjs +2 -1
  224. package/dist/request/SilentRequestHelpers.mjs.map +1 -1
  225. package/dist/response/ResponseHandler.mjs +1 -1
  226. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  227. package/dist/telemetry/BrowserPerformanceEvents.mjs +9 -2
  228. package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
  229. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  230. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  231. package/dist/utils/BrowserConstants.mjs +1 -1
  232. package/dist/utils/BrowserDetection.mjs +1 -1
  233. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  234. package/dist/utils/BrowserUtils.mjs +1 -1
  235. package/dist/utils/Helpers.mjs +1 -1
  236. package/dist/utils/IframeMonitor.mjs +1 -1
  237. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  238. package/dist/utils/PopupMonitor.mjs +1 -1
  239. package/dist/utils/PopupOriginCheck.mjs +1 -1
  240. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  241. package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
  242. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  243. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  244. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  245. package/dist/webBrokerBridge/index.mjs +1 -1
  246. package/lib/custom-auth-path/log-strings-mapping.json +13 -9
  247. package/lib/custom-auth-path/msal-custom-auth.cjs +449 -133
  248. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  249. package/lib/custom-auth-path/msal-custom-auth.js +449 -133
  250. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  251. package/lib/log-strings-mapping.json +13 -9
  252. package/lib/msal-browser.cjs +453 -135
  253. package/lib/msal-browser.cjs.map +1 -1
  254. package/lib/msal-browser.js +453 -135
  255. package/lib/msal-browser.js.map +1 -1
  256. package/lib/msal-browser.min.js +2 -2
  257. package/lib/popup-relay/msal-popup-relay.cjs +231 -60
  258. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  259. package/lib/popup-relay/msal-popup-relay.js +231 -60
  260. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  261. package/lib/popup-relay/msal-popup-relay.min.js +2 -2
  262. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  263. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  264. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  265. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  266. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  267. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
  268. package/package.json +2 -2
  269. package/src/cache/BrowserCacheManager.ts +1 -5
  270. package/src/config/Configuration.ts +35 -0
  271. package/src/crypto/BrowserCrypto.ts +363 -0
  272. package/src/error/AsymmetricEarSubErrors.ts +18 -0
  273. package/src/error/BrowserAuthErrorCodes.ts +1 -0
  274. package/src/interaction_client/PopupClient.ts +59 -29
  275. package/src/interaction_client/RedirectClient.ts +10 -13
  276. package/src/interaction_client/SilentIframeClient.ts +9 -13
  277. package/src/packageMetadata.ts +1 -1
  278. package/src/popup_relay/constants.ts +34 -3
  279. package/src/popup_relay/index.ts +200 -45
  280. package/src/popup_relay/relayClient.ts +108 -24
  281. package/src/protocol/Authorize.ts +118 -11
  282. package/src/request/PopupRequest.ts +1 -0
  283. package/src/request/RedirectRequest.ts +1 -0
  284. package/src/request/SilentRequestHelpers.ts +1 -0
  285. package/src/request/SsoSilentRequest.ts +1 -0
  286. package/src/telemetry/BrowserPerformanceEvents.ts +7 -0
  287. package/types/cache/BrowserCacheManager.d.ts.map +1 -1
  288. package/types/config/Configuration.d.ts +14 -0
  289. package/types/config/Configuration.d.ts.map +1 -1
  290. package/types/crypto/BrowserCrypto.d.ts +34 -0
  291. package/types/crypto/BrowserCrypto.d.ts.map +1 -1
  292. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  293. package/types/error/AsymmetricEarSubErrors.d.ts +14 -0
  294. package/types/error/AsymmetricEarSubErrors.d.ts.map +1 -0
  295. package/types/error/BrowserAuthErrorCodes.d.ts +1 -0
  296. package/types/error/BrowserAuthErrorCodes.d.ts.map +1 -1
  297. package/types/interaction_client/PopupClient.d.ts +3 -1
  298. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  299. package/types/interaction_client/RedirectClient.d.ts +0 -1
  300. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  301. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  302. package/types/packageMetadata.d.ts +1 -1
  303. package/types/popup_relay/constants.d.ts +10 -3
  304. package/types/popup_relay/constants.d.ts.map +1 -1
  305. package/types/popup_relay/index.d.ts +27 -11
  306. package/types/popup_relay/index.d.ts.map +1 -1
  307. package/types/popup_relay/relayClient.d.ts +9 -11
  308. package/types/popup_relay/relayClient.d.ts.map +1 -1
  309. package/types/protocol/Authorize.d.ts +5 -0
  310. package/types/protocol/Authorize.d.ts.map +1 -1
  311. package/types/request/PopupRequest.d.ts +1 -1
  312. package/types/request/PopupRequest.d.ts.map +1 -1
  313. package/types/request/RedirectRequest.d.ts +1 -1
  314. package/types/request/RedirectRequest.d.ts.map +1 -1
  315. package/types/request/SilentRequestHelpers.d.ts.map +1 -1
  316. package/types/request/SsoSilentRequest.d.ts +1 -1
  317. package/types/request/SsoSilentRequest.d.ts.map +1 -1
  318. package/types/telemetry/BrowserPerformanceEvents.d.ts +7 -0
  319. package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
@@ -10,6 +10,14 @@ import {
10
10
  import { KEY_FORMAT_JWK } from "../utils/BrowserConstants.js";
11
11
  import { base64Encode, urlEncodeArr } from "../encode/Base64Encode.js";
12
12
  import { base64Decode, base64DecToArr } from "../encode/Base64Decode.js";
13
+ import {
14
+ AuthError,
15
+ invokeAsync,
16
+ IPerformanceClient,
17
+ Logger,
18
+ } from "@azure/msal-common/browser";
19
+ import { AsymmetricEarSubErrors } from "../error/AsymmetricEarSubErrors.js";
20
+ import * as BrowserPerformanceEvents from "../telemetry/BrowserPerformanceEvents.js";
13
21
 
14
22
  /**
15
23
  * This file defines functions used by the browser library to perform cryptography operations such as
@@ -27,6 +35,10 @@ const HKDF = "HKDF";
27
35
  const S256_HASH_ALG = "SHA-256";
28
36
  // JWK values used by browser-internal WebCrypto helpers.
29
37
  const JSON_WEB_KEY_CURVE_P256 = "P-256";
38
+ const ECDH_P384_ALGORITHM: EcKeyGenParams = {
39
+ name: "ECDH",
40
+ namedCurve: "P-384",
41
+ };
30
42
  const JSON_WEB_KEY_TYPE_EC = "EC";
31
43
  const JSON_WEB_KEY_TYPE_RSA = "RSA";
32
44
  const MISSING_JWK_KTY_SUBERROR = "missing_jwk_kty";
@@ -263,6 +275,357 @@ export async function generateEarKey(): Promise<string> {
263
275
  return base64Encode(JSON.stringify(jwk));
264
276
  }
265
277
 
278
+ /**
279
+ * Local asymmetric EAR key material, separate from serializable request metadata.
280
+ * @internal
281
+ */
282
+ export type AsymmetricEarKey = {
283
+ privateJwk: JsonWebKey;
284
+ publicJwk: JsonWebKey;
285
+ };
286
+
287
+ /**
288
+ * Generates P-384 ECDH keys for request-scoped private sessionStorage and public wire metadata.
289
+ * @internal
290
+ */
291
+ export async function generateAsymmetricEarKey(): Promise<AsymmetricEarKey> {
292
+ const keyPair = await generateKeyPair(
293
+ true,
294
+ ["deriveBits"],
295
+ ECDH_P384_ALGORITHM
296
+ );
297
+ const publicJwk = await exportJwk(keyPair.publicKey);
298
+ const privateJwk = await exportJwk(keyPair.privateKey);
299
+
300
+ return {
301
+ privateJwk,
302
+ publicJwk,
303
+ };
304
+ }
305
+
306
+ /**
307
+ * Restores a private EAR key as non-exportable. The serialized sessionStorage copy remains exportable.
308
+ * @internal
309
+ */
310
+ export async function importAsymmetricEarKey(
311
+ privateJwk: JsonWebKey,
312
+ correlationId = ""
313
+ ): Promise<CryptoKey> {
314
+ if (
315
+ privateJwk?.kty !== "EC" ||
316
+ privateJwk.crv !== "P-384" ||
317
+ !privateJwk.d
318
+ ) {
319
+ throw createBrowserAuthError(
320
+ BrowserAuthErrorCodes.asymmetricEarKeyError,
321
+ correlationId,
322
+ AsymmetricEarSubErrors.InvalidPrivateKey
323
+ );
324
+ }
325
+ try {
326
+ return await importJwk(
327
+ privateJwk,
328
+ false,
329
+ ["deriveBits"],
330
+ ECDH_P384_ALGORITHM
331
+ );
332
+ } catch {
333
+ throw createBrowserAuthError(
334
+ BrowserAuthErrorCodes.asymmetricEarKeyError,
335
+ correlationId,
336
+ AsymmetricEarSubErrors.PrivateKeyImportFailed
337
+ );
338
+ }
339
+ }
340
+
341
+ /**
342
+ * Encodes the EAR client party information with a fresh 192-bit nonce.
343
+ * @internal
344
+ */
345
+ export function generateAsymmetricEarApv(publicJwk: JsonWebKey): string {
346
+ const point = new Uint8Array(
347
+ concatEarBytes(
348
+ new Uint8Array([4]),
349
+ decodeEarBase64Url(publicJwk.x || ""),
350
+ decodeEarBase64Url(publicJwk.y || "")
351
+ )
352
+ );
353
+ if (point.length !== 97) {
354
+ throw createBrowserAuthError(
355
+ BrowserAuthErrorCodes.asymmetricEarKeyError,
356
+ "",
357
+ AsymmetricEarSubErrors.InvalidPublicKeyCoordinates
358
+ );
359
+ }
360
+ const nonce = new Uint8Array(24);
361
+ window.crypto.getRandomValues(nonce);
362
+ return urlEncodeArr(
363
+ new Uint8Array(
364
+ concatEarBytes(
365
+ lengthPrefixEarBytes(new TextEncoder().encode("EarClient")),
366
+ lengthPrefixEarBytes(point),
367
+ lengthPrefixEarBytes(nonce)
368
+ )
369
+ )
370
+ );
371
+ }
372
+
373
+ /**
374
+ * Authenticates and decrypts direct ECDH-ES/P-384/A256GCM using JOSE Concat KDF.
375
+ * Party information is used byte-for-byte; the service need not echo the request APV.
376
+ * @internal
377
+ */
378
+ export async function decryptAsymmetricEarResponse(
379
+ privateJwk: JsonWebKey,
380
+ apv: string,
381
+ earJwe: string,
382
+ requestApv = apv,
383
+ telemetry?: {
384
+ logger: Logger;
385
+ performanceClient: IPerformanceClient;
386
+ correlationId: string;
387
+ }
388
+ ): Promise<string> {
389
+ const correlationId = telemetry?.correlationId || "";
390
+ const measure = <T>(
391
+ eventName: string,
392
+ operation: () => Promise<T>
393
+ ): Promise<T> =>
394
+ telemetry
395
+ ? invokeAsync(
396
+ operation,
397
+ eventName,
398
+ telemetry.logger,
399
+ telemetry.performanceClient,
400
+ correlationId
401
+ )()
402
+ : operation();
403
+ if (apv !== requestApv) {
404
+ throw createBrowserAuthError(
405
+ BrowserAuthErrorCodes.asymmetricEarKeyError,
406
+ correlationId,
407
+ AsymmetricEarSubErrors.RequestApvMismatch
408
+ );
409
+ }
410
+ const parts = earJwe.split(".");
411
+ if (parts.length !== 5 || parts[1] !== "") {
412
+ throw createBrowserAuthError(
413
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
414
+ correlationId,
415
+ AsymmetricEarSubErrors.InvalidJweFormatOrHeader
416
+ );
417
+ }
418
+ let header: {
419
+ alg: string;
420
+ enc: string;
421
+ crit?: unknown;
422
+ zip?: unknown;
423
+ apv?: string;
424
+ apu: string;
425
+ epk: {
426
+ kty: string;
427
+ crv: string;
428
+ x: string;
429
+ y: string;
430
+ d?: string;
431
+ };
432
+ };
433
+ try {
434
+ header = JSON.parse(
435
+ new TextDecoder("utf-8", { fatal: true }).decode(
436
+ decodeEarBase64Url(parts[0], correlationId)
437
+ )
438
+ );
439
+ } catch {
440
+ throw createBrowserAuthError(
441
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
442
+ correlationId,
443
+ AsymmetricEarSubErrors.InvalidJweFormatOrHeader
444
+ );
445
+ }
446
+ if (
447
+ !header ||
448
+ header.alg !== "ECDH-ES" ||
449
+ header.enc !== "A256GCM" ||
450
+ header.crit !== undefined ||
451
+ header.zip !== undefined ||
452
+ header.epk?.kty !== "EC" ||
453
+ header.epk.crv !== "P-384" ||
454
+ header.epk.d !== undefined ||
455
+ (header.apv !== undefined && header.apv !== apv)
456
+ ) {
457
+ throw createBrowserAuthError(
458
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
459
+ correlationId,
460
+ AsymmetricEarSubErrors.InvalidJweFormatOrHeader
461
+ );
462
+ }
463
+ const x = decodeEarBase64Url(header.epk.x, correlationId);
464
+ const y = decodeEarBase64Url(header.epk.y, correlationId);
465
+ const apuBytes = decodeEarBase64Url(header.apu, correlationId);
466
+ const apvBytes = decodeEarBase64Url(apv, correlationId);
467
+ const iv = decodeEarBase64Url(parts[2], correlationId);
468
+ const ciphertext = decodeEarBase64Url(parts[3], correlationId);
469
+ const tag = decodeEarBase64Url(parts[4], correlationId);
470
+ if (
471
+ x.length !== 48 ||
472
+ y.length !== 48 ||
473
+ iv.length !== 12 ||
474
+ tag.length !== 16
475
+ ) {
476
+ throw createBrowserAuthError(
477
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
478
+ correlationId,
479
+ AsymmetricEarSubErrors.InvalidJweFormatOrHeader
480
+ );
481
+ }
482
+
483
+ let key: CryptoKey;
484
+ try {
485
+ const privateKey = await measure(
486
+ BrowserPerformanceEvents.ImportAsymmetricEarKey,
487
+ () => importAsymmetricEarKey(privateJwk, correlationId)
488
+ );
489
+ const publicKey = await measure(
490
+ BrowserPerformanceEvents.ImportAsymmetricEarPublicKey,
491
+ () =>
492
+ importJwk(
493
+ {
494
+ kty: "EC",
495
+ crv: "P-384",
496
+ x: header.epk.x,
497
+ y: header.epk.y,
498
+ },
499
+ false,
500
+ [],
501
+ ECDH_P384_ALGORITHM
502
+ )
503
+ );
504
+ const secret = new Uint8Array(
505
+ await measure(
506
+ BrowserPerformanceEvents.DeriveAsymmetricEarSecret,
507
+ () =>
508
+ window.crypto.subtle.deriveBits(
509
+ { name: "ECDH", public: publicKey },
510
+ privateKey,
511
+ 384
512
+ )
513
+ )
514
+ );
515
+ // RFC 7518 section 4.6.2: one SHA-256 round produces the 256-bit content key.
516
+ const input = new Uint8Array(
517
+ concatEarBytes(
518
+ earUint32(1),
519
+ secret,
520
+ lengthPrefixEarBytes(new TextEncoder().encode("A256GCM")),
521
+ lengthPrefixEarBytes(apuBytes),
522
+ lengthPrefixEarBytes(apvBytes),
523
+ earUint32(256)
524
+ )
525
+ );
526
+ let derivedKey: ArrayBuffer;
527
+ try {
528
+ derivedKey = await measure(
529
+ BrowserPerformanceEvents.AsymmetricEarConcatKdf,
530
+ () => window.crypto.subtle.digest(S256_HASH_ALG, input)
531
+ );
532
+ } finally {
533
+ secret.fill(0);
534
+ input.fill(0);
535
+ }
536
+ try {
537
+ key = await measure(
538
+ BrowserPerformanceEvents.ImportAsymmetricEarContentKey,
539
+ () =>
540
+ window.crypto.subtle.importKey(
541
+ RAW,
542
+ derivedKey,
543
+ AES_GCM,
544
+ false,
545
+ [DECRYPT]
546
+ )
547
+ );
548
+ } finally {
549
+ new Uint8Array(derivedKey).fill(0);
550
+ }
551
+ } catch (error) {
552
+ if (error instanceof AuthError) {
553
+ throw error;
554
+ }
555
+ throw createBrowserAuthError(
556
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
557
+ correlationId,
558
+ AsymmetricEarSubErrors.ContentEncryptionKeyDerivationFailed
559
+ );
560
+ }
561
+ try {
562
+ const plaintext = await measure(
563
+ BrowserPerformanceEvents.DecryptAsymmetricEarResponse,
564
+ () =>
565
+ window.crypto.subtle.decrypt(
566
+ {
567
+ name: AES_GCM,
568
+ iv,
569
+ tagLength: 128,
570
+ additionalData: new TextEncoder().encode(parts[0]),
571
+ },
572
+ key,
573
+ concatEarBytes(ciphertext, tag)
574
+ )
575
+ );
576
+ return new TextDecoder("utf-8", { fatal: true }).decode(plaintext);
577
+ } catch {
578
+ throw createBrowserAuthError(
579
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
580
+ correlationId,
581
+ AsymmetricEarSubErrors.JweDecryptionFailed
582
+ );
583
+ }
584
+ }
585
+
586
+ /** Decodes canonical, unpadded JOSE base64url for asymmetric EAR only. */
587
+ function decodeEarBase64Url(value: string, correlationId = ""): Uint8Array {
588
+ // Match the unpadded base64url alphabet only: letters, digits, '-' and '_'.
589
+ if (typeof value !== "string" || !/^[A-Za-z0-9_-]+$/.test(value)) {
590
+ throw createBrowserAuthError(
591
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
592
+ correlationId,
593
+ AsymmetricEarSubErrors.InvalidJweFormatOrHeader
594
+ );
595
+ }
596
+ const bytes = new Uint8Array(base64DecToArr(value));
597
+ if (urlEncodeArr(bytes) !== value) {
598
+ throw createBrowserAuthError(
599
+ BrowserAuthErrorCodes.failedToDecryptEarResponse,
600
+ correlationId,
601
+ AsymmetricEarSubErrors.InvalidJweFormatOrHeader
602
+ );
603
+ }
604
+ return bytes;
605
+ }
606
+
607
+ function earUint32(value: number): Uint8Array {
608
+ const bytes = new Uint8Array(4);
609
+ new DataView(bytes.buffer).setUint32(0, value);
610
+ return bytes;
611
+ }
612
+
613
+ function concatEarBytes(...parts: Uint8Array[]): ArrayBuffer {
614
+ const bytes = new Uint8Array(
615
+ parts.reduce((length, part) => length + part.length, 0)
616
+ );
617
+ let offset = 0;
618
+ for (const part of parts) {
619
+ bytes.set(part, offset);
620
+ offset += part.length;
621
+ }
622
+ return bytes.buffer;
623
+ }
624
+
625
+ function lengthPrefixEarBytes(bytes: Uint8Array): Uint8Array {
626
+ return new Uint8Array(concatEarBytes(earUint32(bytes.length), bytes));
627
+ }
628
+
266
629
  /**
267
630
  * Parses earJwk for encryption key and returns CryptoKey object
268
631
  * @param earJwk
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /** Diagnostics for asymmetric EAR crypto, request encoding, and response validation. */
7
+ export const enum AsymmetricEarSubErrors {
8
+ RequestInitializationFailed = "request_initialization_failed",
9
+ RequestEncodingFailed = "request_encoding_failed",
10
+ InvalidPrivateKey = "invalid_private_key",
11
+ PrivateKeyImportFailed = "private_key_import_failed",
12
+ InvalidPublicKeyCoordinates = "invalid_public_key_coordinates",
13
+ InvalidJweFormatOrHeader = "invalid_jwe_format_or_header",
14
+ ContentEncryptionKeyDerivationFailed = "content_encryption_key_derivation_failed",
15
+ JweDecryptionFailed = "jwe_decryption_failed",
16
+ RequestApvMismatch = "request_apv_mismatch",
17
+ InvalidDecryptedResponsePayload = "invalid_decrypted_response_payload",
18
+ }
@@ -69,5 +69,6 @@ export const tokenBindingKeyJwkThumbprintMismatch =
69
69
  export const failedToBuildHeaders = "failed_to_build_headers";
70
70
  export const failedToParseHeaders = "failed_to_parse_headers";
71
71
  export const failedToDecryptEarResponse = "failed_to_decrypt_ear_response";
72
+ export const asymmetricEarKeyError = "asymmetric_ear_key_error";
72
73
  export const timedOut = "timed_out";
73
74
  export const emptyResponse = "empty_response";
@@ -61,7 +61,6 @@ import * as ResponseHandler from "../response/ResponseHandler.js";
61
61
  import * as Authorize from "../protocol/Authorize.js";
62
62
  import { generatePkceCodes } from "../crypto/PkceGenerator.js";
63
63
  import { isPlatformAuthAllowed } from "../broker/nativeBroker/PlatformAuthProvider.js";
64
- import { generateEarKey } from "../crypto/BrowserCrypto.js";
65
64
  import { IPlatformAuthHandler } from "../broker/nativeBroker/IPlatformAuthHandler.js";
66
65
  import {
67
66
  clearCacheOnLogout,
@@ -87,6 +86,7 @@ export type PopupParams = {
87
86
  popupName: string;
88
87
  popupWindowAttributes: PopupWindowAttributes;
89
88
  popupWindowParent: Window;
89
+ relayAction?: PopupRelay.PopupRelayAction;
90
90
  };
91
91
 
92
92
  export class PopupClient extends StandardInteractionClient {
@@ -410,17 +410,20 @@ export class PopupClient extends StandardInteractionClient {
410
410
  /*
411
411
  * When a popup-relay page is configured, open it top-level
412
412
  * (same first-party origin) instead of navigating the popup
413
- * straight to the IdP, and carry the /authorize URL in its hash.
413
+ * straight to the IdP. V1 carries the action in the hash; v2
414
+ * retains it for the authenticated handoff.
414
415
  * The relay page opens the IdP child popup and relays the
415
416
  * response back via postMessage (see waitForPopupResponse).
416
417
  */
417
418
  const popupRelayUri = this.config.auth.popupRelayUri;
419
+ popupParams.relayAction = { method: "GET", url: navigateUrl };
418
420
  const popupNavigateUrl = popupRelayUri
419
421
  ? PopupRelay.buildPopupRelayUrl(
420
422
  popupRelayUri,
421
423
  this.getRelayStateId(request.state, correlationId),
422
- { method: "GET", url: navigateUrl },
423
- correlationId
424
+ popupParams.relayAction,
425
+ correlationId,
426
+ this.config.auth.popupRelayProtocolVersion
424
427
  )
425
428
  : navigateUrl;
426
429
 
@@ -441,7 +444,8 @@ export class PopupClient extends StandardInteractionClient {
441
444
  const responseString = await this.waitForPopupResponse(
442
445
  request,
443
446
  popupWindow,
444
- popupParams.popupWindowParent
447
+ popupParams.popupWindowParent,
448
+ popupParams.relayAction
445
449
  );
446
450
 
447
451
  const serverParams = invoke(
@@ -532,13 +536,6 @@ export class PopupClient extends StandardInteractionClient {
532
536
  account
533
537
  );
534
538
 
535
- const earJwk = await invokeAsync(
536
- generateEarKey,
537
- BrowserPerformanceEvents.GenerateEarKey,
538
- this.logger,
539
- this.performanceClient,
540
- correlationId
541
- )();
542
539
  const pkce =
543
540
  pkceCodes ||
544
541
  (await invokeAsync(
@@ -554,9 +551,8 @@ export class PopupClient extends StandardInteractionClient {
554
551
  this.logger,
555
552
  this.performanceClient
556
553
  );
557
- const popupRequest = {
554
+ let popupRequest: CommonAuthorizationUrlRequest = {
558
555
  ...request,
559
- earJwk: earJwk,
560
556
  codeChallenge: pkce.challenge,
561
557
  ...tokenBindingParams,
562
558
  popupOriginCheckDone: this.getPopupOriginCheckDone(
@@ -564,6 +560,12 @@ export class PopupClient extends StandardInteractionClient {
564
560
  ),
565
561
  };
566
562
  try {
563
+ popupRequest = await Authorize.initializeEarRequest(
564
+ this.config,
565
+ popupRequest,
566
+ this.logger,
567
+ this.performanceClient
568
+ );
567
569
  const popupWindow = await this.openPostFormPopup(
568
570
  popupRequest,
569
571
  discoveredAuthority,
@@ -579,7 +581,12 @@ export class PopupClient extends StandardInteractionClient {
579
581
  this.logger,
580
582
  this.performanceClient,
581
583
  correlationId
582
- )(popupRequest, popupWindow, popupParams.popupWindowParent);
584
+ )(
585
+ popupRequest,
586
+ popupWindow,
587
+ popupParams.popupWindowParent,
588
+ popupParams.relayAction
589
+ );
583
590
 
584
591
  const serverParams = invoke(
585
592
  ResponseHandler.deserializeResponse,
@@ -709,7 +716,12 @@ export class PopupClient extends StandardInteractionClient {
709
716
  this.logger,
710
717
  this.performanceClient,
711
718
  correlationId
712
- )(request, popupWindow, popupParams.popupWindowParent);
719
+ )(
720
+ request,
721
+ popupWindow,
722
+ popupParams.popupWindowParent,
723
+ popupParams.relayAction
724
+ );
713
725
 
714
726
  const serverParams = invoke(
715
727
  ResponseHandler.deserializeResponse,
@@ -864,14 +876,15 @@ export class PopupClient extends StandardInteractionClient {
864
876
 
865
877
  /*
866
878
  * When a popup-relay page is configured, open it top-level (same
867
- * first-party origin) and carry the end-session URL in its hash,
868
- * exactly like the login flow. The relay page opens the IdP child
879
+ * first-party origin), using the configured wire protocol for the
880
+ * end-session URL. The relay page opens the IdP child
869
881
  * popup and the post-logout redirect page (running the redirect
870
882
  * bridge) relays completion back via postMessage — so logout works
871
883
  * from an embedded, cross-origin iframe where a direct popup to the
872
884
  * IdP cannot. See runPopupRelay / waitForPopupResponse.
873
885
  */
874
886
  const popupRelayUri = this.config.auth.popupRelayUri;
887
+ popupParams.relayAction = { method: "GET", url: logoutUri };
875
888
  const popupNavigateUrl = popupRelayUri
876
889
  ? PopupRelay.buildPopupRelayUrl(
877
890
  popupRelayUri,
@@ -879,8 +892,9 @@ export class PopupClient extends StandardInteractionClient {
879
892
  validRequest.state || "",
880
893
  this.correlationId
881
894
  ),
882
- { method: "GET", url: logoutUri },
883
- this.correlationId
895
+ popupParams.relayAction,
896
+ this.correlationId,
897
+ this.config.auth.popupRelayProtocolVersion
884
898
  )
885
899
  : logoutUri;
886
900
 
@@ -897,7 +911,8 @@ export class PopupClient extends StandardInteractionClient {
897
911
  await this.waitForPopupResponse(
898
912
  validRequest,
899
913
  popupWindow,
900
- popupParams.popupWindowParent
914
+ popupParams.popupWindowParent,
915
+ popupParams.relayAction
901
916
  ).catch(() => {
902
917
  // Swallow any errors related to monitoring the window. Server logout is best effort
903
918
  });
@@ -1228,15 +1243,17 @@ export class PopupClient extends StandardInteractionClient {
1228
1243
  this.logger,
1229
1244
  this.performanceClient
1230
1245
  );
1246
+ popupParams.relayAction = {
1247
+ method: "POST",
1248
+ action: formData.action,
1249
+ fields: formData.fields,
1250
+ };
1231
1251
  const relayUrl = PopupRelay.buildPopupRelayUrl(
1232
1252
  popupRelayUri,
1233
1253
  this.getRelayStateId(request.state, correlationId),
1234
- {
1235
- method: "POST",
1236
- action: formData.action,
1237
- fields: formData.fields,
1238
- },
1239
- correlationId
1254
+ popupParams.relayAction,
1255
+ correlationId,
1256
+ this.config.auth.popupRelayProtocolVersion
1240
1257
  );
1241
1258
  return this.initiateAuthRequest(relayUrl, popupParams);
1242
1259
  }
@@ -1259,7 +1276,8 @@ export class PopupClient extends StandardInteractionClient {
1259
1276
  protected async waitForPopupResponse(
1260
1277
  request: CommonAuthorizationUrlRequest | CommonEndSessionRequest,
1261
1278
  popupWindow: Window,
1262
- popupWindowParent: Window
1279
+ popupWindowParent: Window,
1280
+ relayAction?: PopupRelay.PopupRelayAction
1263
1281
  ): Promise<string> {
1264
1282
  /*
1265
1283
  * When a popup-relay page is configured the response is relayed back to
@@ -1270,12 +1288,24 @@ export class PopupClient extends StandardInteractionClient {
1270
1288
  * frame and which does not track the relay popup.
1271
1289
  */
1272
1290
  if (this.config.auth.popupRelayUri) {
1291
+ if (
1292
+ this.config.auth.popupRelayProtocolVersion === 2 &&
1293
+ !relayAction
1294
+ ) {
1295
+ throw createBrowserAuthError(
1296
+ BrowserAuthErrorCodes.popupRelayUnsupportedFlow,
1297
+ this.correlationId,
1298
+ "popup_relay_bad_request"
1299
+ );
1300
+ }
1273
1301
  return PopupRelay.waitForPopupRelayResponse(
1274
1302
  this.config.system.popupBridgeTimeout,
1275
1303
  this.logger,
1276
1304
  request,
1277
1305
  popupWindow,
1278
- this.performanceClient
1306
+ this.performanceClient,
1307
+ relayAction,
1308
+ this.config.auth.popupRelayProtocolVersion
1279
1309
  );
1280
1310
  }
1281
1311
  if (this.waitForPopupResponseHook) {
@@ -58,7 +58,6 @@ import * as ResponseHandler from "../response/ResponseHandler.js";
58
58
  import * as Authorize from "../protocol/Authorize.js";
59
59
  import { generatePkceCodes } from "../crypto/PkceGenerator.js";
60
60
  import { isPlatformAuthAllowed } from "../broker/nativeBroker/PlatformAuthProvider.js";
61
- import { generateEarKey } from "../crypto/BrowserCrypto.js";
62
61
  import { IPlatformAuthHandler } from "../broker/nativeBroker/IPlatformAuthHandler.js";
63
62
  import {
64
63
  clearCacheOnLogout,
@@ -346,13 +345,6 @@ export class RedirectClient extends StandardInteractionClient {
346
345
  account
347
346
  );
348
347
 
349
- const earJwk = await invokeAsync(
350
- generateEarKey,
351
- BrowserPerformanceEvents.GenerateEarKey,
352
- this.logger,
353
- this.performanceClient,
354
- correlationId
355
- )();
356
348
  const pkceCodes = await invokeAsync(
357
349
  generatePkceCodes,
358
350
  BrowserPerformanceEvents.GeneratePkceCodes,
@@ -367,14 +359,19 @@ export class RedirectClient extends StandardInteractionClient {
367
359
  this.logger,
368
360
  this.performanceClient
369
361
  );
370
- const redirectRequest = {
362
+ let redirectRequest: CommonAuthorizationUrlRequest = {
371
363
  ...request,
372
- earJwk: earJwk,
373
364
  codeChallenge: pkceCodes.challenge,
374
365
  ...tokenBindingParams,
375
366
  };
376
367
 
377
368
  try {
369
+ redirectRequest = await Authorize.initializeEarRequest(
370
+ this.config,
371
+ redirectRequest,
372
+ this.logger,
373
+ this.performanceClient
374
+ );
378
375
  if (
379
376
  !(await isTokenBindingKeyPersistedForRedirect(
380
377
  redirectRequest,
@@ -411,14 +408,15 @@ export class RedirectClient extends StandardInteractionClient {
411
408
  );
412
409
  }, this.config.system.redirectNavigationTimeout);
413
410
  });
414
- } catch (e) {
411
+ } catch (error) {
412
+ this.browserStorage.resetRequestCache(correlationId);
415
413
  await removeTokenBindingKeyOnFailure(
416
414
  redirectRequest,
417
415
  this.tokenBindingKeyManager,
418
416
  this.logger,
419
417
  this.performanceClient
420
418
  );
421
- throw e;
419
+ throw error;
422
420
  }
423
421
  }
424
422
 
@@ -844,7 +842,6 @@ export class RedirectClient extends StandardInteractionClient {
844
842
  /**
845
843
  * Redirects window to given URL.
846
844
  * @param urlNavigate
847
- * @param onRedirectNavigateRequest - onRedirectNavigate callback provided on the request
848
845
  */
849
846
  async initiateAuthRequest(requestUrl: string): Promise<void> {
850
847
  this.logger.verbose(