@azure/msal-browser 5.27.0 → 5.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (434) 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 +9 -1
  5. package/dist/broker/nativeBroker/PlatformAuthDOMHandler.mjs.map +1 -1
  6. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +7 -6
  7. package/dist/broker/nativeBroker/PlatformAuthExtensionHandler.mjs.map +1 -1
  8. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs +4 -2
  9. package/dist/broker/nativeBroker/PlatformAuthProvider.mjs.map +1 -1
  10. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs +21 -7
  11. package/dist/broker/nativeBroker/PlatformAuthRequest.mjs.map +1 -1
  12. package/dist/cache/AccountManager.mjs +1 -1
  13. package/dist/cache/AsyncMemoryStorage.mjs +14 -1
  14. package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
  15. package/dist/cache/BrowserCacheManager.mjs +9 -2
  16. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  17. package/dist/cache/CacheHelpers.mjs +1 -1
  18. package/dist/cache/CacheKeys.mjs +1 -1
  19. package/dist/cache/CookieStorage.mjs +1 -1
  20. package/dist/cache/DatabaseStorage.mjs +1 -1
  21. package/dist/cache/EncryptedData.mjs +1 -1
  22. package/dist/cache/LocalStorage.mjs +1 -1
  23. package/dist/cache/MemoryStorage.mjs +1 -1
  24. package/dist/cache/SessionStorage.mjs +1 -1
  25. package/dist/cache/TokenCache.mjs +1 -1
  26. package/dist/config/Configuration.mjs +1 -1
  27. package/dist/controllers/NestedAppAuthController.mjs +1 -1
  28. package/dist/controllers/StandardController.mjs +65 -7
  29. package/dist/controllers/StandardController.mjs.map +1 -1
  30. package/dist/crypto/BrowserCrypto.mjs +1 -1
  31. package/dist/crypto/CryptoOps.mjs +1 -1
  32. package/dist/crypto/PkceGenerator.mjs +1 -1
  33. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  34. package/dist/crypto/TokenBindingKeyManager.mjs +14 -1
  35. package/dist/crypto/TokenBindingKeyManager.mjs.map +1 -1
  36. package/dist/custom_auth/CustomAuthConstants.mjs +1 -1
  37. package/dist/custom_auth/CustomAuthPublicClientApplication.mjs +1 -1
  38. package/dist/custom_auth/controller/CustomAuthStandardController.mjs +14 -2
  39. package/dist/custom_auth/controller/CustomAuthStandardController.mjs.map +1 -1
  40. package/dist/custom_auth/core/CustomAuthAuthority.mjs +1 -1
  41. package/dist/custom_auth/core/auth_flow/AuthFlowErrorBase.mjs +1 -1
  42. package/dist/custom_auth/core/auth_flow/AuthFlowResultBase.mjs +1 -1
  43. package/dist/custom_auth/core/auth_flow/AuthFlowState.mjs +1 -1
  44. package/dist/custom_auth/core/auth_flow/AuthFlowStateTypes.mjs +1 -1
  45. package/dist/custom_auth/core/auth_flow/jit/error_type/AuthMethodRegistrationError.mjs +1 -1
  46. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationChallengeMethodResult.mjs +1 -1
  47. package/dist/custom_auth/core/auth_flow/jit/result/AuthMethodRegistrationSubmitChallengeResult.mjs +1 -1
  48. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationCompletedState.mjs +1 -1
  49. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationFailedState.mjs +1 -1
  50. package/dist/custom_auth/core/auth_flow/jit/state/AuthMethodRegistrationState.mjs +1 -1
  51. package/dist/custom_auth/core/auth_flow/mfa/error_type/MfaError.mjs +1 -1
  52. package/dist/custom_auth/core/auth_flow/mfa/result/MfaRequestChallengeResult.mjs +1 -1
  53. package/dist/custom_auth/core/auth_flow/mfa/result/MfaSubmitChallengeResult.mjs +1 -1
  54. package/dist/custom_auth/core/auth_flow/mfa/state/MfaCompletedState.mjs +1 -1
  55. package/dist/custom_auth/core/auth_flow/mfa/state/MfaFailedState.mjs +1 -1
  56. package/dist/custom_auth/core/auth_flow/mfa/state/MfaState.mjs +1 -1
  57. package/dist/custom_auth/core/auth_flow/v2/CustomAuthFlowScenarioV2.mjs +1 -1
  58. package/dist/custom_auth/core/auth_flow/v2/CustomAuthResultV2.mjs +1 -1
  59. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorSubcodesV2.mjs +1 -1
  60. package/dist/custom_auth/core/auth_flow/v2/error/AuthFlowErrorV2.mjs +1 -1
  61. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs +68 -0
  62. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.mjs.map +1 -0
  63. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs +3 -2
  64. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.mjs.map +1 -1
  65. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs +87 -0
  66. package/dist/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.mjs.map +1 -0
  67. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs +5 -3
  68. package/dist/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.mjs.map +1 -1
  69. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs +14 -2
  70. package/dist/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.mjs.map +1 -1
  71. package/dist/custom_auth/core/auth_flow/v2/state/CompletedStateV2.mjs +1 -1
  72. package/dist/custom_auth/core/auth_flow/v2/state/FailedStateV2.mjs +1 -1
  73. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs +4 -3
  74. package/dist/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.mjs.map +1 -1
  75. package/dist/custom_auth/core/error/CustomAuthApiError.mjs +1 -1
  76. package/dist/custom_auth/core/error/CustomAuthError.mjs +1 -1
  77. package/dist/custom_auth/core/error/HttpError.mjs +1 -1
  78. package/dist/custom_auth/core/error/HttpErrorCodes.mjs +1 -1
  79. package/dist/custom_auth/core/error/InvalidArgumentError.mjs +1 -1
  80. package/dist/custom_auth/core/error/InvalidConfigurationError.mjs +1 -1
  81. package/dist/custom_auth/core/error/InvalidConfigurationErrorCodes.mjs +1 -1
  82. package/dist/custom_auth/core/error/MethodNotImplementedError.mjs +1 -1
  83. package/dist/custom_auth/core/error/MsalCustomAuthError.mjs +1 -1
  84. package/dist/custom_auth/core/error/NoCachedAccountFoundError.mjs +1 -1
  85. package/dist/custom_auth/core/error/ParsedUrlError.mjs +1 -1
  86. package/dist/custom_auth/core/error/ParsedUrlErrorCodes.mjs +1 -1
  87. package/dist/custom_auth/core/error/UnexpectedError.mjs +1 -1
  88. package/dist/custom_auth/core/error/UnsupportedEnvironmentError.mjs +1 -1
  89. package/dist/custom_auth/core/error/UserAccountAttributeError.mjs +1 -1
  90. package/dist/custom_auth/core/error/UserAlreadySignedInError.mjs +1 -1
  91. package/dist/custom_auth/core/interaction_client/CustomAuthInteractionClientBase.mjs +1 -1
  92. package/dist/custom_auth/core/interaction_client/CustomAuthInterationClientFactory.mjs +1 -1
  93. package/dist/custom_auth/core/interaction_client/jit/JitClient.mjs +1 -1
  94. package/dist/custom_auth/core/interaction_client/jit/result/JitActionResult.mjs +1 -1
  95. package/dist/custom_auth/core/interaction_client/mfa/MfaClient.mjs +1 -1
  96. package/dist/custom_auth/core/interaction_client/mfa/result/MfaActionResult.mjs +1 -1
  97. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs +246 -73
  98. package/dist/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.mjs.map +1 -1
  99. package/dist/custom_auth/core/interaction_client/v2/InteractionClientBaseV2.mjs +1 -1
  100. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs +10 -2
  101. package/dist/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.mjs.map +1 -1
  102. package/dist/custom_auth/core/network_client/custom_auth_api/BaseApiClient.mjs +1 -1
  103. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiClient.mjs +1 -1
  104. package/dist/custom_auth/core/network_client/custom_auth_api/CustomAuthApiEndpoint.mjs +1 -1
  105. package/dist/custom_auth/core/network_client/custom_auth_api/RegisterApiClient.mjs +1 -1
  106. package/dist/custom_auth/core/network_client/custom_auth_api/ResetPasswordApiClient.mjs +1 -1
  107. package/dist/custom_auth/core/network_client/custom_auth_api/SignInApiClient.mjs +1 -1
  108. package/dist/custom_auth/core/network_client/custom_auth_api/SignupApiClient.mjs +1 -1
  109. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiErrorCodes.mjs +1 -1
  110. package/dist/custom_auth/core/network_client/custom_auth_api/types/ApiSuberrors.mjs +1 -1
  111. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs +10 -2
  112. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.mjs.map +1 -1
  113. package/dist/custom_auth/core/network_client/custom_auth_api/v2/BaseApiClientV2.mjs +1 -1
  114. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs +118 -25
  115. package/dist/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.mjs.map +1 -1
  116. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ErrorCodesV2.mjs +1 -1
  117. package/dist/custom_auth/core/network_client/custom_auth_api/v2/HrefResolverV2.mjs +1 -1
  118. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs +2 -2
  119. package/dist/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.mjs.map +1 -1
  120. package/dist/custom_auth/core/network_client/custom_auth_api/v2/response/ErrorNormalizerV2.mjs +1 -1
  121. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs +2 -12
  122. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.mjs.map +1 -1
  123. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs +2 -1
  124. package/dist/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.mjs.map +1 -1
  125. package/dist/custom_auth/core/network_client/http_client/FetchHttpClient.mjs +1 -1
  126. package/dist/custom_auth/core/network_client/http_client/IHttpClient.mjs +1 -1
  127. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs +17 -3
  128. package/dist/custom_auth/core/telemetry/FlowApiIdHelperV2.mjs.map +1 -1
  129. package/dist/custom_auth/core/telemetry/PublicApiId.mjs +9 -3
  130. package/dist/custom_auth/core/telemetry/PublicApiId.mjs.map +1 -1
  131. package/dist/custom_auth/core/utils/ArgumentValidator.mjs +1 -1
  132. package/dist/custom_auth/core/utils/CustomHeaderUtils.mjs +1 -1
  133. package/dist/custom_auth/core/utils/UrlUtils.mjs +1 -1
  134. package/dist/custom_auth/get_account/auth_flow/CustomAuthAccountData.mjs +1 -1
  135. package/dist/custom_auth/get_account/auth_flow/error_type/GetAccountError.mjs +1 -1
  136. package/dist/custom_auth/get_account/auth_flow/result/GetAccessTokenResult.mjs +1 -1
  137. package/dist/custom_auth/get_account/auth_flow/result/GetAccountResult.mjs +1 -1
  138. package/dist/custom_auth/get_account/auth_flow/result/SignOutResult.mjs +1 -1
  139. package/dist/custom_auth/get_account/auth_flow/state/GetAccessTokenState.mjs +1 -1
  140. package/dist/custom_auth/get_account/auth_flow/state/GetAccountState.mjs +1 -1
  141. package/dist/custom_auth/get_account/auth_flow/state/SignOutState.mjs +1 -1
  142. package/dist/custom_auth/get_account/interaction_client/CustomAuthSilentCacheClient.mjs +1 -1
  143. package/dist/custom_auth/index.mjs +3 -1
  144. package/dist/custom_auth/index.mjs.map +1 -1
  145. package/dist/custom_auth/operating_context/CustomAuthOperatingContext.mjs +1 -1
  146. package/dist/custom_auth/reset_password/auth_flow/error_type/ResetPasswordError.mjs +1 -1
  147. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordResendCodeResult.mjs +1 -1
  148. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordStartResult.mjs +1 -1
  149. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitCodeResult.mjs +1 -1
  150. package/dist/custom_auth/reset_password/auth_flow/result/ResetPasswordSubmitPasswordResult.mjs +1 -1
  151. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCodeRequiredState.mjs +1 -1
  152. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordCompletedState.mjs +1 -1
  153. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordFailedState.mjs +1 -1
  154. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordPasswordRequiredState.mjs +1 -1
  155. package/dist/custom_auth/reset_password/auth_flow/state/ResetPasswordState.mjs +1 -1
  156. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs +32 -13
  157. package/dist/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.mjs.map +1 -1
  158. package/dist/custom_auth/reset_password/interaction_client/ResetPasswordClient.mjs +1 -1
  159. package/dist/custom_auth/sign_in/auth_flow/SignInScenario.mjs +1 -1
  160. package/dist/custom_auth/sign_in/auth_flow/error_type/SignInError.mjs +1 -1
  161. package/dist/custom_auth/sign_in/auth_flow/result/SignInResendCodeResult.mjs +1 -1
  162. package/dist/custom_auth/sign_in/auth_flow/result/SignInResult.mjs +1 -1
  163. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitCodeResult.mjs +1 -1
  164. package/dist/custom_auth/sign_in/auth_flow/result/SignInSubmitPasswordResult.mjs +1 -1
  165. package/dist/custom_auth/sign_in/auth_flow/state/SignInCodeRequiredState.mjs +1 -1
  166. package/dist/custom_auth/sign_in/auth_flow/state/SignInCompletedState.mjs +1 -1
  167. package/dist/custom_auth/sign_in/auth_flow/state/SignInContinuationState.mjs +1 -1
  168. package/dist/custom_auth/sign_in/auth_flow/state/SignInFailedState.mjs +1 -1
  169. package/dist/custom_auth/sign_in/auth_flow/state/SignInPasswordRequiredState.mjs +1 -1
  170. package/dist/custom_auth/sign_in/auth_flow/state/SignInState.mjs +1 -1
  171. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs +14 -2
  172. package/dist/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.mjs.map +1 -1
  173. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInContinuationStateV2.mjs +1 -1
  174. package/dist/custom_auth/sign_in/auth_flow/v2/state/SignInStateTransitionHandlerV2.mjs +1 -1
  175. package/dist/custom_auth/sign_in/interaction_client/SignInClient.mjs +1 -1
  176. package/dist/custom_auth/sign_in/interaction_client/result/SignInActionResult.mjs +1 -1
  177. package/dist/custom_auth/sign_up/auth_flow/error_type/SignUpError.mjs +1 -1
  178. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResendCodeResult.mjs +1 -1
  179. package/dist/custom_auth/sign_up/auth_flow/result/SignUpResult.mjs +1 -1
  180. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitAttributesResult.mjs +1 -1
  181. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitCodeResult.mjs +1 -1
  182. package/dist/custom_auth/sign_up/auth_flow/result/SignUpSubmitPasswordResult.mjs +1 -1
  183. package/dist/custom_auth/sign_up/auth_flow/state/SignUpAttributesRequiredState.mjs +1 -1
  184. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCodeRequiredState.mjs +1 -1
  185. package/dist/custom_auth/sign_up/auth_flow/state/SignUpCompletedState.mjs +1 -1
  186. package/dist/custom_auth/sign_up/auth_flow/state/SignUpFailedState.mjs +1 -1
  187. package/dist/custom_auth/sign_up/auth_flow/state/SignUpPasswordRequiredState.mjs +1 -1
  188. package/dist/custom_auth/sign_up/auth_flow/state/SignUpState.mjs +1 -1
  189. package/dist/custom_auth/sign_up/auth_flow/v2/state/AttributesRequiredStateV2.mjs +1 -1
  190. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpAttributesRequiredStateBaseV2.mjs +1 -1
  191. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpPasswordRequiredStateV2.mjs +1 -1
  192. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs +9 -2
  193. package/dist/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.mjs.map +1 -1
  194. package/dist/custom_auth/sign_up/interaction_client/SignUpClient.mjs +1 -1
  195. package/dist/custom_auth/sign_up/interaction_client/result/SignUpActionResult.mjs +1 -1
  196. package/dist/encode/Base64Decode.mjs +1 -1
  197. package/dist/encode/Base64Encode.mjs +1 -1
  198. package/dist/error/BrowserAuthError.mjs +1 -1
  199. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  200. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  201. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  202. package/dist/error/NativeAuthError.mjs +1 -1
  203. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  204. package/dist/error/NestedAppAuthError.mjs +1 -1
  205. package/dist/event/EventHandler.mjs +1 -1
  206. package/dist/event/EventMessage.mjs +1 -1
  207. package/dist/event/EventType.mjs +1 -1
  208. package/dist/index.mjs +1 -1
  209. package/dist/interaction_client/BaseInteractionClient.mjs +1 -1
  210. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  211. package/dist/interaction_client/PlatformAuthInteractionClient.mjs +504 -75
  212. package/dist/interaction_client/PlatformAuthInteractionClient.mjs.map +1 -1
  213. package/dist/interaction_client/PopupClient.mjs +27 -20
  214. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  215. package/dist/interaction_client/RedirectClient.mjs +29 -14
  216. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  217. package/dist/interaction_client/SilentAuthCodeClient.mjs +1 -1
  218. package/dist/interaction_client/SilentCacheClient.mjs +1 -1
  219. package/dist/interaction_client/SilentIframeClient.mjs +44 -32
  220. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  221. package/dist/interaction_client/SilentRefreshClient.mjs +1 -1
  222. package/dist/interaction_client/StandardInteractionClient.mjs +1 -1
  223. package/dist/interaction_handler/InteractionHandler.mjs +1 -1
  224. package/dist/interaction_handler/SilentHandler.mjs +1 -1
  225. package/dist/log-strings-mapping.json +59 -19
  226. package/dist/naa/BridgeError.mjs +1 -1
  227. package/dist/naa/BridgeProxy.mjs +1 -1
  228. package/dist/naa/BridgeStatusCode.mjs +1 -1
  229. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +1 -1
  230. package/dist/navigation/NavigationClient.mjs +1 -1
  231. package/dist/network/FetchClient.mjs +1 -1
  232. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  233. package/dist/operatingcontext/NestedAppOperatingContext.mjs +1 -1
  234. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  235. package/dist/packageMetadata.mjs +2 -2
  236. package/dist/popup_relay/constants.mjs +1 -1
  237. package/dist/popup_relay/index.mjs +1 -1
  238. package/dist/popup_relay/relayClient.mjs +1 -1
  239. package/dist/protocol/Authorize.mjs +21 -13
  240. package/dist/protocol/Authorize.mjs.map +1 -1
  241. package/dist/redirect_bridge/index.mjs +1 -1
  242. package/dist/request/RequestHelpers.mjs +35 -11
  243. package/dist/request/RequestHelpers.mjs.map +1 -1
  244. package/dist/request/SilentRequestHelpers.mjs +6 -6
  245. package/dist/request/SilentRequestHelpers.mjs.map +1 -1
  246. package/dist/response/ResponseHandler.mjs +1 -1
  247. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  248. package/dist/telemetry/BrowserPerformanceEvents.mjs +3 -2
  249. package/dist/telemetry/BrowserPerformanceEvents.mjs.map +1 -1
  250. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  251. package/dist/telemetry/BrowserRootPerformanceEvents.mjs +1 -1
  252. package/dist/utils/BrowserConstants.mjs +1 -1
  253. package/dist/utils/BrowserDetection.mjs +1 -1
  254. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  255. package/dist/utils/BrowserUtils.mjs +1 -1
  256. package/dist/utils/Helpers.mjs +1 -1
  257. package/dist/utils/IframeMonitor.mjs +1 -1
  258. package/dist/utils/MsalFrameStatsUtils.mjs +1 -1
  259. package/dist/utils/PopupMonitor.mjs +1 -1
  260. package/dist/utils/PopupOriginCheck.mjs +1 -1
  261. package/dist/webBrokerBridge/PendingRequestRegistry.mjs +1 -1
  262. package/dist/webBrokerBridge/PerfEventNames.mjs +1 -1
  263. package/dist/webBrokerBridge/WebBrokerBridgeError.mjs +1 -1
  264. package/dist/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +1 -1
  265. package/dist/webBrokerBridge/adapter/CrossVersionRequestAdapter.mjs +1 -1
  266. package/dist/webBrokerBridge/index.mjs +1 -1
  267. package/lib/custom-auth-path/log-strings-mapping.json +51 -11
  268. package/lib/custom-auth-path/msal-custom-auth.cjs +1563 -424
  269. package/lib/custom-auth-path/msal-custom-auth.cjs.map +1 -1
  270. package/lib/custom-auth-path/msal-custom-auth.js +1563 -424
  271. package/lib/custom-auth-path/msal-custom-auth.js.map +1 -1
  272. package/lib/log-strings-mapping.json +19 -11
  273. package/lib/msal-browser.cjs +914 -259
  274. package/lib/msal-browser.cjs.map +1 -1
  275. package/lib/msal-browser.js +914 -259
  276. package/lib/msal-browser.js.map +1 -1
  277. package/lib/msal-browser.min.js +2 -2
  278. package/lib/popup-relay/msal-popup-relay.cjs +2 -2
  279. package/lib/popup-relay/msal-popup-relay.cjs.map +1 -1
  280. package/lib/popup-relay/msal-popup-relay.js +2 -2
  281. package/lib/popup-relay/msal-popup-relay.js.map +1 -1
  282. package/lib/popup-relay/msal-popup-relay.min.js +1 -1
  283. package/lib/redirect-bridge/msal-redirect-bridge.cjs +10 -10
  284. package/lib/redirect-bridge/msal-redirect-bridge.cjs.map +1 -1
  285. package/lib/redirect-bridge/msal-redirect-bridge.js +10 -10
  286. package/lib/redirect-bridge/msal-redirect-bridge.js.map +1 -1
  287. package/lib/redirect-bridge/msal-redirect-bridge.min.js +1 -1
  288. package/lib/web-broker-bridge/msal-web-broker-bridge.cjs +1 -1
  289. package/package.json +2 -2
  290. package/src/broker/nativeBroker/PlatformAuthDOMHandler.ts +15 -0
  291. package/src/broker/nativeBroker/PlatformAuthExtensionHandler.ts +6 -21
  292. package/src/broker/nativeBroker/PlatformAuthProvider.ts +3 -1
  293. package/src/broker/nativeBroker/PlatformAuthRequest.ts +12 -8
  294. package/src/broker/nativeBroker/PlatformAuthResponse.ts +31 -0
  295. package/src/cache/AsyncMemoryStorage.ts +16 -0
  296. package/src/cache/BrowserCacheManager.ts +19 -1
  297. package/src/controllers/StandardController.ts +107 -11
  298. package/src/crypto/TokenBindingKeyManager.ts +21 -0
  299. package/src/custom_auth/controller/CustomAuthStandardController.ts +18 -0
  300. package/src/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.ts +15 -0
  301. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.ts +23 -0
  302. package/src/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.ts +26 -0
  303. package/src/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.ts +1 -1
  304. package/src/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.ts +2 -0
  305. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.ts +94 -0
  306. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.ts +7 -2
  307. package/src/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.ts +132 -0
  308. package/src/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.ts +8 -2
  309. package/src/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.ts +18 -0
  310. package/src/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.ts +13 -0
  311. package/src/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.ts +8 -2
  312. package/src/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.ts +1 -0
  313. package/src/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.ts +445 -91
  314. package/src/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.ts +25 -0
  315. package/src/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.ts +34 -0
  316. package/src/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.ts +9 -0
  317. package/src/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.ts +262 -43
  318. package/src/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.ts +4 -7
  319. package/src/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.ts +21 -0
  320. package/src/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.ts +41 -2
  321. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.ts +44 -19
  322. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.ts +4 -6
  323. package/src/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.ts +6 -1
  324. package/src/custom_auth/core/telemetry/FlowApiIdHelperV2.ts +25 -1
  325. package/src/custom_auth/core/telemetry/PublicApiId.ts +6 -0
  326. package/src/custom_auth/index.ts +11 -0
  327. package/src/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.ts +6 -7
  328. package/src/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.ts +47 -15
  329. package/src/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.ts +2 -0
  330. package/src/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.ts +2 -0
  331. package/src/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.ts +18 -0
  332. package/src/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.ts +2 -0
  333. package/src/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.ts +13 -0
  334. package/src/interaction_client/PlatformAuthInteractionClient.ts +851 -128
  335. package/src/interaction_client/PopupClient.ts +104 -83
  336. package/src/interaction_client/RedirectClient.ts +88 -34
  337. package/src/interaction_client/SilentIframeClient.ts +121 -95
  338. package/src/packageMetadata.ts +1 -1
  339. package/src/protocol/Authorize.ts +46 -18
  340. package/src/request/RequestHelpers.ts +64 -11
  341. package/src/request/SilentRequestHelpers.ts +8 -9
  342. package/src/telemetry/BrowserPerformanceEvents.ts +1 -0
  343. package/types/broker/nativeBroker/PlatformAuthDOMHandler.d.ts.map +1 -1
  344. package/types/broker/nativeBroker/PlatformAuthExtensionHandler.d.ts.map +1 -1
  345. package/types/broker/nativeBroker/PlatformAuthProvider.d.ts.map +1 -1
  346. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts +6 -1
  347. package/types/broker/nativeBroker/PlatformAuthRequest.d.ts.map +1 -1
  348. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts +21 -0
  349. package/types/broker/nativeBroker/PlatformAuthResponse.d.ts.map +1 -1
  350. package/types/cache/AsyncMemoryStorage.d.ts +5 -0
  351. package/types/cache/AsyncMemoryStorage.d.ts.map +1 -1
  352. package/types/cache/BrowserCacheManager.d.ts +4 -0
  353. package/types/cache/BrowserCacheManager.d.ts.map +1 -1
  354. package/types/controllers/StandardController.d.ts +5 -0
  355. package/types/controllers/StandardController.d.ts.map +1 -1
  356. package/types/crypto/TokenBindingKeyManager.d.ts +9 -0
  357. package/types/crypto/TokenBindingKeyManager.d.ts.map +1 -1
  358. package/types/custom_auth/CustomAuthConstants.d.ts +1 -1
  359. package/types/custom_auth/controller/CustomAuthStandardController.d.ts.map +1 -1
  360. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts +11 -0
  361. package/types/custom_auth/core/auth_flow/v2/AuthenticationMethodRegistrationV2.d.ts.map +1 -0
  362. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts +14 -0
  363. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodRegistrationChallengeResultV2.d.ts.map +1 -0
  364. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts +15 -0
  365. package/types/custom_auth/core/auth_flow/v2/result/AuthMethodVerificationSubmitChallengeResultV2.d.ts.map +1 -0
  366. package/types/custom_auth/core/auth_flow/v2/result/RequestChallengeResultV2.d.ts +1 -1
  367. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts +2 -1
  368. package/types/custom_auth/core/auth_flow/v2/result/VerifyChallengeResultV2.d.ts.map +1 -1
  369. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts +22 -0
  370. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodRegistrationRequiredStateV2.d.ts.map +1 -0
  371. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodSelectionRequiredStateV2.d.ts.map +1 -1
  372. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts +28 -0
  373. package/types/custom_auth/core/auth_flow/v2/state/AuthMethodVerificationRequiredStateV2.d.ts.map +1 -0
  374. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts +3 -2
  375. package/types/custom_auth/core/auth_flow/v2/state/ChallengeVerificationStateBaseV2.d.ts.map +1 -1
  376. package/types/custom_auth/core/auth_flow/v2/state/CodeRequiredStateV2.d.ts.map +1 -1
  377. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts +9 -0
  378. package/types/custom_auth/core/auth_flow/v2/state/CustomAuthStateParametersV2.d.ts.map +1 -1
  379. package/types/custom_auth/core/auth_flow/v2/state/MFAVerificationRequiredStateV2.d.ts.map +1 -1
  380. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts +1 -0
  381. package/types/custom_auth/core/interaction_client/v2/FlowContinuationStateV2.d.ts.map +1 -1
  382. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts +12 -5
  383. package/types/custom_auth/core/interaction_client/v2/FlowInteractionClientV2.d.ts.map +1 -1
  384. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts +17 -0
  385. package/types/custom_auth/core/interaction_client/v2/parameter/FlowParamsV2.d.ts.map +1 -1
  386. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts +18 -2
  387. package/types/custom_auth/core/interaction_client/v2/result/FlowActionResultV2.d.ts.map +1 -1
  388. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts +8 -0
  389. package/types/custom_auth/core/network_client/custom_auth_api/v2/ApiClientConstantsV2.d.ts.map +1 -1
  390. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts +8 -2
  391. package/types/custom_auth/core/network_client/custom_auth_api/v2/CustomAuthApiClientV2.d.ts.map +1 -1
  392. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts +3 -3
  393. package/types/custom_auth/core/network_client/custom_auth_api/v2/ResponseHandlerV2.d.ts.map +1 -1
  394. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts +12 -0
  395. package/types/custom_auth/core/network_client/custom_auth_api/v2/request/RequestsV2.d.ts.map +1 -1
  396. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts +29 -2
  397. package/types/custom_auth/core/network_client/custom_auth_api/v2/response/ResponsesV2.d.ts.map +1 -1
  398. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts +30 -17
  399. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/BaseResultsV2.d.ts.map +1 -1
  400. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts +3 -1
  401. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/ResetPasswordResultsV2.d.ts.map +1 -1
  402. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts +3 -2
  403. package/types/custom_auth/core/network_client/custom_auth_api/v2/result/SignUpResultsV2.d.ts.map +1 -1
  404. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts +6 -1
  405. package/types/custom_auth/core/telemetry/FlowApiIdHelperV2.d.ts.map +1 -1
  406. package/types/custom_auth/core/telemetry/PublicApiId.d.ts +6 -0
  407. package/types/custom_auth/core/telemetry/PublicApiId.d.ts.map +1 -1
  408. package/types/custom_auth/index.d.ts +5 -0
  409. package/types/custom_auth/index.d.ts.map +1 -1
  410. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts +6 -8
  411. package/types/custom_auth/reset_password/auth_flow/v2/result/SubmitNewPasswordResultV2.d.ts.map +1 -1
  412. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts +4 -4
  413. package/types/custom_auth/reset_password/auth_flow/v2/state/NewPasswordRequiredStateV2.d.ts.map +1 -1
  414. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts +2 -1
  415. package/types/custom_auth/sign_in/auth_flow/v2/result/SignInStartResultV2.d.ts.map +1 -1
  416. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts +2 -1
  417. package/types/custom_auth/sign_in/auth_flow/v2/result/SubmitPasswordResultV2.d.ts.map +1 -1
  418. package/types/custom_auth/sign_in/auth_flow/v2/state/PasswordRequiredStateV2.d.ts.map +1 -1
  419. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts +2 -1
  420. package/types/custom_auth/sign_up/auth_flow/v2/result/SubmitAttributesResultV2.d.ts.map +1 -1
  421. package/types/custom_auth/sign_up/auth_flow/v2/state/SignUpStateTransitionHandlerV2.d.ts.map +1 -1
  422. package/types/interaction_client/PlatformAuthInteractionClient.d.ts +106 -5
  423. package/types/interaction_client/PlatformAuthInteractionClient.d.ts.map +1 -1
  424. package/types/interaction_client/PopupClient.d.ts.map +1 -1
  425. package/types/interaction_client/RedirectClient.d.ts.map +1 -1
  426. package/types/interaction_client/SilentIframeClient.d.ts.map +1 -1
  427. package/types/packageMetadata.d.ts +1 -1
  428. package/types/protocol/Authorize.d.ts +4 -4
  429. package/types/protocol/Authorize.d.ts.map +1 -1
  430. package/types/request/RequestHelpers.d.ts +21 -3
  431. package/types/request/RequestHelpers.d.ts.map +1 -1
  432. package/types/request/SilentRequestHelpers.d.ts.map +1 -1
  433. package/types/telemetry/BrowserPerformanceEvents.d.ts +1 -0
  434. package/types/telemetry/BrowserPerformanceEvents.d.ts.map +1 -1
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v5.27.0 2026-10-27 */
1
+ /*! @azure/msal-browser v5.28.0 2026-11-05 */
2
2
  'use strict';
3
3
  (function (global, factory) {
4
4
  typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
@@ -6,7 +6,7 @@
6
6
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.msal = {}));
7
7
  })(this, (function (exports) { 'use strict';
8
8
 
9
- /*! @azure/msal-common v16.15.0 2026-10-27 */
9
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
10
10
  /*
11
11
  * Copyright (c) Microsoft Corporation. All rights reserved.
12
12
  * Licensed under the MIT License.
@@ -66,7 +66,7 @@
66
66
  */
67
67
  const POPUP_ORIGIN_CHECK_DONE = "pocd";
68
68
 
69
- /*! @azure/msal-common v16.15.0 2026-10-27 */
69
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
70
70
  /*
71
71
  * Copyright (c) Microsoft Corporation. All rights reserved.
72
72
  * Licensed under the MIT License.
@@ -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.15.0 2026-10-27 */
308
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
337
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
360
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
446
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
484
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
550
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
638
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
652
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
674
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
698
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
887
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
904
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
924
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
964
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
1034
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
1093
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
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.15.0 2026-10-27 */
1105
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1106
1106
  /*
1107
1107
  * Copyright (c) Microsoft Corporation. All rights reserved.
1108
1108
  * Licensed under the MIT License.
@@ -1182,7 +1182,7 @@
1182
1182
  }
1183
1183
  }
1184
1184
 
1185
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1185
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1186
1186
 
1187
1187
  /*
1188
1188
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1340,7 +1340,7 @@
1340
1340
  }
1341
1341
  }
1342
1342
 
1343
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1343
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1344
1344
 
1345
1345
  /*
1346
1346
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1494,7 +1494,7 @@
1494
1494
  return null;
1495
1495
  }
1496
1496
 
1497
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1497
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1498
1498
  /*
1499
1499
  * Copyright (c) Microsoft Corporation. All rights reserved.
1500
1500
  * Licensed under the MIT License.
@@ -1512,7 +1512,7 @@
1512
1512
  AzureUsGovernment: "https://login.microsoftonline.us",
1513
1513
  };
1514
1514
 
1515
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1515
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1516
1516
  /*
1517
1517
  * Copyright (c) Microsoft Corporation. All rights reserved.
1518
1518
  * Licensed under the MIT License.
@@ -1522,7 +1522,7 @@
1522
1522
  response.hasOwnProperty("metadata"));
1523
1523
  }
1524
1524
 
1525
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1525
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1526
1526
  /*
1527
1527
  * Copyright (c) Microsoft Corporation. All rights reserved.
1528
1528
  * Licensed under the MIT License.
@@ -1532,7 +1532,7 @@
1532
1532
  response.hasOwnProperty("error_description"));
1533
1533
  }
1534
1534
 
1535
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1535
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1536
1536
  /*
1537
1537
  * Copyright (c) Microsoft Corporation. All rights reserved.
1538
1538
  * Licensed under the MIT License.
@@ -1603,7 +1603,7 @@
1603
1603
  const CacheManagerGetRefreshToken = "cacheManagerGetRefreshToken";
1604
1604
  const SetUserData = "setUserData";
1605
1605
 
1606
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1606
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1607
1607
  /*
1608
1608
  * Copyright (c) Microsoft Corporation. All rights reserved.
1609
1609
  * Licensed under the MIT License.
@@ -1696,7 +1696,7 @@
1696
1696
  };
1697
1697
  };
1698
1698
 
1699
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1699
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1700
1700
 
1701
1701
  /*
1702
1702
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -1807,7 +1807,7 @@
1807
1807
  },
1808
1808
  };
1809
1809
 
1810
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1810
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1811
1811
  /*
1812
1812
  * Copyright (c) Microsoft Corporation. All rights reserved.
1813
1813
  * Licensed under the MIT License.
@@ -1872,7 +1872,7 @@
1872
1872
  return cachedAtSec > nowSeconds();
1873
1873
  }
1874
1874
 
1875
- /*! @azure/msal-common v16.15.0 2026-10-27 */
1875
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
1876
1876
 
1877
1877
  /*
1878
1878
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -2159,7 +2159,7 @@
2159
2159
  return [...attributeTokens].sort().join(" ");
2160
2160
  }
2161
2161
 
2162
- /*! @azure/msal-common v16.15.0 2026-10-27 */
2162
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
2163
2163
 
2164
2164
  /*
2165
2165
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3127,7 +3127,7 @@
3127
3127
  };
3128
3128
  }
3129
3129
 
3130
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3130
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3131
3131
 
3132
3132
  /*
3133
3133
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3161,7 +3161,7 @@
3161
3161
  }
3162
3162
  }
3163
3163
 
3164
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3164
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3165
3165
 
3166
3166
  /*
3167
3167
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3357,7 +3357,7 @@
3357
3357
  }
3358
3358
  }
3359
3359
 
3360
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3360
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3361
3361
 
3362
3362
  /*
3363
3363
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3857,7 +3857,7 @@
3857
3857
  }
3858
3858
  }
3859
3859
 
3860
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3860
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3861
3861
 
3862
3862
  /*
3863
3863
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -3988,7 +3988,7 @@
3988
3988
  }
3989
3989
  }
3990
3990
 
3991
- /*! @azure/msal-common v16.15.0 2026-10-27 */
3991
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
3992
3992
 
3993
3993
  /*
3994
3994
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4036,7 +4036,7 @@
4036
4036
  },
4037
4037
  };
4038
4038
 
4039
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4039
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4040
4040
 
4041
4041
  /*
4042
4042
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4059,7 +4059,7 @@
4059
4059
  },
4060
4060
  };
4061
4061
 
4062
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4062
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4063
4063
  /*
4064
4064
  * Copyright (c) Microsoft Corporation. All rights reserved.
4065
4065
  * Licensed under the MIT License.
@@ -4348,12 +4348,12 @@
4348
4348
  }
4349
4349
  }
4350
4350
 
4351
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4351
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4352
4352
  /* eslint-disable header/header */
4353
4353
  const name$1 = "@azure/msal-common";
4354
- const version$1 = "16.15.0";
4354
+ const version$1 = "16.16.0";
4355
4355
 
4356
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4356
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4357
4357
  /*
4358
4358
  * Copyright (c) Microsoft Corporation. All rights reserved.
4359
4359
  * Licensed under the MIT License.
@@ -4361,7 +4361,7 @@
4361
4361
  const cacheQuotaExceeded = "cache_quota_exceeded";
4362
4362
  const cacheErrorUnknown = "cache_error_unknown";
4363
4363
 
4364
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4364
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4365
4365
 
4366
4366
  /*
4367
4367
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4399,7 +4399,7 @@
4399
4399
  }
4400
4400
  }
4401
4401
 
4402
- /*! @azure/msal-common v16.15.0 2026-10-27 */
4402
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
4403
4403
 
4404
4404
  /*
4405
4405
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -4648,6 +4648,7 @@
4648
4648
  };
4649
4649
  const tokenKeys = this.getTokenKeys();
4650
4650
  const currentScopes = ScopeSet.fromString(credential.target, correlationId);
4651
+ const accessTokenKeysToRemove = [];
4651
4652
  tokenKeys.accessToken.forEach((key) => {
4652
4653
  if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
4653
4654
  return;
@@ -4657,10 +4658,13 @@
4657
4658
  this.credentialMatchesFilter(tokenEntity, accessTokenFilter, correlationId)) {
4658
4659
  const tokenScopeSet = ScopeSet.fromString(tokenEntity.target, correlationId);
4659
4660
  if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
4660
- this.removeAccessToken(key, correlationId);
4661
+ accessTokenKeysToRemove.push(key);
4661
4662
  }
4662
4663
  }
4663
4664
  });
4665
+ for (const key of accessTokenKeysToRemove) {
4666
+ await this.removeAccessTokenAndTokenBindingKey(key, correlationId, credential.keyId);
4667
+ }
4664
4668
  await this.setAccessTokenCredential(credential, correlationId, kmsi, additionalCacheKeyHash);
4665
4669
  }
4666
4670
  /**
@@ -4896,12 +4900,32 @@
4896
4900
  * @param correlationId
4897
4901
  */
4898
4902
  removeAccessToken(key, correlationId) {
4903
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4904
+ if (credential) {
4905
+ void this.removeTokenBindingKeyForCredential(credential, correlationId);
4906
+ }
4907
+ }
4908
+ /**
4909
+ * Removes an access token and waits for any unreferenced token-binding key
4910
+ * cleanup. Internal callers that require deterministic cleanup should use
4911
+ * this method instead of the synchronous public cache contract.
4912
+ */
4913
+ async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId) {
4914
+ const credential = this.removeAccessTokenCredential(key, correlationId);
4915
+ if (credential) {
4916
+ await this.removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId);
4917
+ }
4918
+ }
4919
+ removeAccessTokenCredential(key, correlationId) {
4899
4920
  const credential = this.getAccessTokenCredential(key, correlationId);
4900
4921
  if (!credential) {
4901
- return;
4922
+ return null;
4902
4923
  }
4903
4924
  this.removeItem(key, correlationId);
4904
4925
  this.performanceClient.incrementFields({ accessTokensRemoved: 1 }, correlationId);
4926
+ return credential;
4927
+ }
4928
+ async removeTokenBindingKeyForCredential(credential, correlationId, preservedKeyId) {
4905
4929
  // Remove Token Binding Key from key store for token-bound access token credentials
4906
4930
  if (credential.credentialType.toLowerCase() ===
4907
4931
  CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {
@@ -4911,19 +4935,28 @@
4911
4935
  case AuthenticationScheme$1.DPOP.toLowerCase(): {
4912
4936
  const accessTokenWithAuthSchemeEntity = credential;
4913
4937
  const kid = accessTokenWithAuthSchemeEntity.keyId;
4914
- if (kid) {
4915
- void this.tokenBindingKeyManager
4916
- .removeTokenBindingKey(kid, correlationId)
4917
- .catch(() => {
4938
+ if (kid &&
4939
+ kid !== preservedKeyId &&
4940
+ !this.isTokenBindingKeyReferenced(kid, correlationId)) {
4941
+ try {
4942
+ await this.tokenBindingKeyManager.removeTokenBindingKey(kid, correlationId);
4943
+ }
4944
+ catch {
4918
4945
  this.commonLogger.error("0id34f", correlationId);
4919
4946
  this.performanceClient?.incrementFields({ removeTokenBindingKeyFailure: 1 }, correlationId);
4920
- });
4947
+ }
4921
4948
  }
4922
4949
  break;
4923
4950
  }
4924
4951
  }
4925
4952
  }
4926
4953
  }
4954
+ isTokenBindingKeyReferenced(keyId, correlationId) {
4955
+ return this.getTokenKeys().accessToken.some((accessTokenKey) => {
4956
+ const accessToken = this.getAccessTokenCredential(accessTokenKey, correlationId);
4957
+ return accessToken?.keyId === keyId;
4958
+ });
4959
+ }
4927
4960
  /**
4928
4961
  * Removes all app metadata objects from cache.
4929
4962
  */
@@ -5062,6 +5095,7 @@
5062
5095
  const scopes = ScopeSet.createSearchScopes(request.scopes, correlationId);
5063
5096
  const authScheme = request.authenticationScheme ||
5064
5097
  AuthenticationScheme$1.BEARER;
5098
+ const normalizedAuthScheme = authScheme.toLowerCase();
5065
5099
  /*
5066
5100
  * Distinguish between Bearer and PoP/SSH token cache types
5067
5101
  * Cast to lowercase to handle "bearer" from ADFS
@@ -5087,7 +5121,10 @@
5087
5121
  tokenType: authScheme,
5088
5122
  keyId: authScheme === AuthenticationScheme$1.SSH
5089
5123
  ? request.sshKid
5090
- : undefined,
5124
+ : normalizedAuthScheme ===
5125
+ AuthenticationScheme$1.DPOP.toLowerCase()
5126
+ ? request.popKid || request.dpopJkt
5127
+ : undefined,
5091
5128
  additionalCacheKeyComponents: additionalCacheKeyComponents,
5092
5129
  };
5093
5130
  const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||
@@ -5587,7 +5624,7 @@
5587
5624
  }
5588
5625
  }
5589
5626
 
5590
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5627
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5591
5628
  /*
5592
5629
  * Copyright (c) Microsoft Corporation. All rights reserved.
5593
5630
  * Licensed under the MIT License.
@@ -5652,7 +5689,7 @@
5652
5689
  "fetchRetryCount",
5653
5690
  ]);
5654
5691
 
5655
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5692
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5656
5693
 
5657
5694
  /*
5658
5695
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5710,7 +5747,7 @@
5710
5747
  }
5711
5748
  }
5712
5749
 
5713
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5750
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5714
5751
 
5715
5752
  /*
5716
5753
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5808,7 +5845,7 @@
5808
5845
  return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);
5809
5846
  }
5810
5847
 
5811
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5848
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5812
5849
  /*
5813
5850
  * Copyright (c) Microsoft Corporation. All rights reserved.
5814
5851
  * Licensed under the MIT License.
@@ -5835,7 +5872,7 @@
5835
5872
  }
5836
5873
  }
5837
5874
 
5838
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5875
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5839
5876
 
5840
5877
  /*
5841
5878
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5856,7 +5893,7 @@
5856
5893
  return new JoseHeaderError(code, correlationId);
5857
5894
  }
5858
5895
 
5859
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5896
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5860
5897
  /*
5861
5898
  * Copyright (c) Microsoft Corporation. All rights reserved.
5862
5899
  * Licensed under the MIT License.
@@ -5881,7 +5918,7 @@
5881
5918
  return Object.getPrototypeOf(value) === proto;
5882
5919
  }
5883
5920
 
5884
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5921
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5885
5922
  /*
5886
5923
  * Copyright (c) Microsoft Corporation. All rights reserved.
5887
5924
  * Licensed under the MIT License.
@@ -5891,7 +5928,7 @@
5891
5928
  const missingJwkError = "missing_jwk_error";
5892
5929
  const invalidJwkError = "invalid_jwk_error";
5893
5930
 
5894
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5931
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5895
5932
 
5896
5933
  /*
5897
5934
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -5957,7 +5994,7 @@
5957
5994
  }
5958
5995
  }
5959
5996
 
5960
- /*! @azure/msal-common v16.15.0 2026-10-27 */
5997
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
5961
5998
 
5962
5999
  /*
5963
6000
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6058,7 +6095,7 @@
6058
6095
  }
6059
6096
  }
6060
6097
 
6061
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6098
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6062
6099
 
6063
6100
  /*
6064
6101
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6108,13 +6145,22 @@
6108
6145
  throw createClientConfigurationError(invalidDpopNonce, correlationId);
6109
6146
  }
6110
6147
  }
6148
+ /**
6149
+ * Validates and normalizes the HTTP resource context for a DPoP-bound request.
6150
+ * @internal
6151
+ */
6152
+ function normalizeDpopResourceRequestContext(context, correlationId = "") {
6153
+ return {
6154
+ htm: normalizeHtm(context.htm, correlationId),
6155
+ htu: normalizeHtu(context.htu, correlationId),
6156
+ };
6157
+ }
6111
6158
  /**
6112
6159
  * Builds RFC 9449 DPoP proof JWT payloads for token-endpoint and
6113
6160
  * resource-endpoint proof bindings.
6114
6161
  *
6115
- * Not exported from any public package entry point.
6116
- * This helper is internal-only until DPoP is wired into acquisition flows
6117
- * in a subsequent work item.
6162
+ * Exported from package entry points for use by MSAL Browser.
6163
+ * This helper remains an unsupported internal API for direct consumers.
6118
6164
  *
6119
6165
  * DPoP proofs do not contain SHR fields (at, ts, m, u, p, q).
6120
6166
  * @internal
@@ -6169,10 +6215,11 @@
6169
6215
  */
6170
6216
  buildResourceProofClaims(params, correlationId = "") {
6171
6217
  validateDpopNonce(params.nonce, correlationId);
6218
+ const resourceContext = normalizeDpopResourceRequestContext(params, correlationId);
6172
6219
  const claims = {
6173
6220
  jti: this.cryptoUtils.createNewGuid(),
6174
- htm: normalizeHtm(params.htm, correlationId),
6175
- htu: normalizeHtu(params.htu, correlationId),
6221
+ htm: resourceContext.htm,
6222
+ htu: resourceContext.htu,
6176
6223
  ath: params.ath,
6177
6224
  iat: nowSeconds(),
6178
6225
  };
@@ -6203,7 +6250,7 @@
6203
6250
  }
6204
6251
  }
6205
6252
 
6206
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6253
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6207
6254
  /*
6208
6255
  * Copyright (c) Microsoft Corporation. All rights reserved.
6209
6256
  * Licensed under the MIT License.
@@ -6267,7 +6314,7 @@
6267
6314
  uiNotAllowed: uiNotAllowed
6268
6315
  });
6269
6316
 
6270
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6317
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6271
6318
 
6272
6319
  /*
6273
6320
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6334,7 +6381,7 @@
6334
6381
  return new InteractionRequiredAuthError(errorCode, correlationId, errorMessage);
6335
6382
  }
6336
6383
 
6337
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6384
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6338
6385
 
6339
6386
  /*
6340
6387
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6353,7 +6400,7 @@
6353
6400
  }
6354
6401
  }
6355
6402
 
6356
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6403
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6357
6404
 
6358
6405
  /*
6359
6406
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6424,7 +6471,7 @@
6424
6471
  }
6425
6472
  }
6426
6473
 
6427
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6474
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6428
6475
 
6429
6476
  /*
6430
6477
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6852,7 +6899,7 @@
6852
6899
  return baseAccount;
6853
6900
  }
6854
6901
 
6855
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6902
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6856
6903
  /*
6857
6904
  * Copyright (c) Microsoft Corporation. All rights reserved.
6858
6905
  * Licensed under the MIT License.
@@ -6862,7 +6909,7 @@
6862
6909
  UPN: "UPN",
6863
6910
  };
6864
6911
 
6865
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6912
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6866
6913
  /*
6867
6914
  * Copyright (c) Microsoft Corporation. All rights reserved.
6868
6915
  * Licensed under the MIT License.
@@ -6881,7 +6928,7 @@
6881
6928
  }
6882
6929
  }
6883
6930
 
6884
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6931
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6885
6932
 
6886
6933
  /*
6887
6934
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6905,7 +6952,7 @@
6905
6952
  };
6906
6953
  }
6907
6954
 
6908
- /*! @azure/msal-common v16.15.0 2026-10-27 */
6955
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6909
6956
 
6910
6957
  /*
6911
6958
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -6995,7 +7042,7 @@
6995
7042
  return undefined;
6996
7043
  }
6997
7044
 
6998
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7045
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
6999
7046
 
7000
7047
  /*
7001
7048
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7026,7 +7073,7 @@
7026
7073
  return new NetworkError(error, httpStatus, responseHeaders);
7027
7074
  }
7028
7075
 
7029
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7076
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7030
7077
 
7031
7078
  /*
7032
7079
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7160,7 +7207,7 @@
7160
7207
  return response;
7161
7208
  }
7162
7209
 
7163
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7210
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7164
7211
 
7165
7212
  /*
7166
7213
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7427,7 +7474,7 @@
7427
7474
  }
7428
7475
  }
7429
7476
 
7430
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7477
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7431
7478
 
7432
7479
  /*
7433
7480
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -7657,7 +7704,7 @@
7657
7704
  return account.loginHint || account.idTokenClaims?.login_hint || null;
7658
7705
  }
7659
7706
 
7660
- /*! @azure/msal-common v16.15.0 2026-10-27 */
7707
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
7661
7708
 
7662
7709
  /*
7663
7710
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8206,7 +8253,7 @@
8206
8253
  }
8207
8254
  }
8208
8255
 
8209
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8256
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8210
8257
 
8211
8258
  /*
8212
8259
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8441,7 +8488,7 @@
8441
8488
  }
8442
8489
  }
8443
8490
 
8444
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8491
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8445
8492
 
8446
8493
  /*
8447
8494
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8734,7 +8781,7 @@
8734
8781
  clearNativeBrokerErrorCode() { }
8735
8782
  }
8736
8783
 
8737
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8784
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8738
8785
 
8739
8786
  /*
8740
8787
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8861,7 +8908,7 @@
8861
8908
  }
8862
8909
  }
8863
8910
 
8864
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8911
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8865
8912
 
8866
8913
  /*
8867
8914
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -8877,7 +8924,7 @@
8877
8924
  },
8878
8925
  };
8879
8926
 
8880
- /*! @azure/msal-common v16.15.0 2026-10-27 */
8927
+ /*! @azure/msal-common v16.16.0 2026-11-05 */
8881
8928
 
8882
8929
  /*
8883
8930
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -9026,6 +9073,7 @@
9026
9073
  const PlatformAuthHandleNativeResponse = "platformAuthHandleNativeResponse";
9027
9074
  const PlatformAuthCacheAccount = "platformAuthCacheAccount";
9028
9075
  const PlatformAuthCacheNativeTokens = "platformAuthCacheNativeTokens";
9076
+ const PlatformAuthDpopKeyCleanup = "platformAuthDpopKeyCleanup";
9029
9077
  const RemoveHiddenIframe = "removeHiddenIframe";
9030
9078
  const ImportExistingCache = "importExistingCache";
9031
9079
  /**
@@ -10586,6 +10634,19 @@
10586
10634
  return cacheKeys;
10587
10635
  }
10588
10636
  }
10637
+ /**
10638
+ * Returns whether a key is available in persistent storage. Unlike
10639
+ * containsKey, this does not consult the in-memory fallback.
10640
+ */
10641
+ async containsKeyInPersistentStorage(key, correlationId) {
10642
+ try {
10643
+ return await this.indexedDBCache.containsKey(key);
10644
+ }
10645
+ catch (e) {
10646
+ this.handleDatabaseAccessError(e, correlationId);
10647
+ return false;
10648
+ }
10649
+ }
10589
10650
  /**
10590
10651
  * Returns true or false if the given key is present in the cache.
10591
10652
  * @param key
@@ -10691,6 +10752,12 @@
10691
10752
  throw createClientAuthError(bindingKeyNotRemoved, correlationId);
10692
10753
  }
10693
10754
  }
10755
+ /**
10756
+ * Returns whether a browser token-binding key is available.
10757
+ */
10758
+ async hasTokenBindingKey(keyId, correlationId) {
10759
+ return this.cache.containsKey(keyId, correlationId);
10760
+ }
10694
10761
  /**
10695
10762
  * Clears browser token-binding keys from memory and persistent storage.
10696
10763
  * @param correlationId - Request correlation identifier.
@@ -10752,6 +10819,13 @@
10752
10819
  }
10753
10820
  return cachedKeyPair;
10754
10821
  }
10822
+ /**
10823
+ * Returns whether a browser token-binding key survived in persistent
10824
+ * storage and can be restored after a redirect navigation.
10825
+ */
10826
+ async isTokenBindingKeyPersisted(keyId, correlationId) {
10827
+ return this.cache.containsKeyInPersistentStorage(keyId, correlationId);
10828
+ }
10755
10829
  /** @internal */
10756
10830
  getTokenBindingKeyTelemetry(cachedKeyPair, fallbackAlgorithm) {
10757
10831
  return {
@@ -11585,7 +11659,7 @@
11585
11659
 
11586
11660
  /* eslint-disable header/header */
11587
11661
  const name = "@azure/msal-browser";
11588
- const version = "5.27.0";
11662
+ const version = "5.28.0";
11589
11663
 
11590
11664
  /*
11591
11665
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -12217,7 +12291,7 @@
12217
12291
  throw cacheError;
12218
12292
  }
12219
12293
  // When cache quota is exceeded, start removing access tokens until we can successfully set the item
12220
- this.removeAccessToken(accessTokenKeys[i], correlationId, false // Don't save token keys yet, do it at the end
12294
+ await this.removeAccessTokenAndTokenBindingKey(accessTokenKeys[i], correlationId, undefined, false // Don't save token keys yet, do it at the end
12221
12295
  );
12222
12296
  }
12223
12297
  else {
@@ -12359,6 +12433,13 @@
12359
12433
  super.removeAccessToken(key, correlationId);
12360
12434
  updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
12361
12435
  }
12436
+ /**
12437
+ * Removes an access token and awaits token-binding key cleanup.
12438
+ */
12439
+ async removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId, updateTokenKeys = true) {
12440
+ await super.removeAccessTokenAndTokenBindingKey(key, correlationId, preservedKeyId);
12441
+ updateTokenKeys && this.removeAccessTokenKeys([key], correlationId);
12442
+ }
12362
12443
  /**
12363
12444
  * Remove access token key from the key map
12364
12445
  * @param key
@@ -13472,19 +13553,13 @@
13472
13553
  }
13473
13554
  /**
13474
13555
  * Resolves the token-binding parameters needed before building authorize or token requests.
13475
- * Public PCA DPoP requests use a dpopJkt thumbprint, while platform broker PoP requests use
13476
- * a reqCnf confirmation claim. Requests that do not require request-time token binding return
13477
- * no additional parameters.
13556
+ * DPoP requests provision a browser key for token endpoint redemption. Platform broker
13557
+ * authorization requests retain the key for auth-code fallback but suppress dpop_jkt on
13558
+ * /authorize. Platform broker PoP requests use a reqCnf confirmation claim.
13478
13559
  */
13479
13560
  async function getTokenBindingRequestParams(request, tokenBindingKeyManager, logger, performanceClient) {
13480
13561
  switch (request.authenticationScheme) {
13481
13562
  case AuthenticationScheme$1.DPOP:
13482
- if (request.platformBroker) {
13483
- return {};
13484
- }
13485
- if (request.dpopJkt) {
13486
- return { dpopJkt: request.dpopJkt };
13487
- }
13488
13563
  return {
13489
13564
  dpopJkt: await tokenBindingKeyManager.provisionTokenBindingKey({
13490
13565
  tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
@@ -13507,6 +13582,36 @@
13507
13582
  return {};
13508
13583
  }
13509
13584
  }
13585
+ /**
13586
+ * Removes a DPoP key that was provisioned for an authorization attempt which
13587
+ * did not complete. Cleanup failures are recorded without replacing the
13588
+ * original authorization error.
13589
+ */
13590
+ async function removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient) {
13591
+ if (request.authenticationScheme !== AuthenticationScheme$1.DPOP ||
13592
+ !request.dpopJkt) {
13593
+ return;
13594
+ }
13595
+ try {
13596
+ await tokenBindingKeyManager.removeTokenBindingKey(request.dpopJkt, request.correlationId);
13597
+ }
13598
+ catch {
13599
+ logger.error("1su7ne", request.correlationId);
13600
+ performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, request.correlationId);
13601
+ }
13602
+ }
13603
+ /**
13604
+ * Returns whether an MSAL-owned DPoP key is available in persistent storage
13605
+ * before a redirect navigation. Custom managers without a persistence probe
13606
+ * retain their existing behavior.
13607
+ */
13608
+ async function isTokenBindingKeyPersistedForRedirect(request, tokenBindingKeyManager) {
13609
+ const keyId = request.dpopJkt ?? request.keyId;
13610
+ if (!keyId || !tokenBindingKeyManager.isTokenBindingKeyPersisted) {
13611
+ return true;
13612
+ }
13613
+ return tokenBindingKeyManager.isTokenBindingKeyPersisted(keyId, request.correlationId);
13614
+ }
13510
13615
  /**
13511
13616
  * Initializer function for all request APIs
13512
13617
  * @param request
@@ -14194,12 +14299,26 @@
14194
14299
  * Copyright (c) Microsoft Corporation. All rights reserved.
14195
14300
  * Licensed under the MIT License.
14196
14301
  */
14302
+ /**
14303
+ * Key storage enclaves supported by the platform broker.
14304
+ */
14305
+ const PlatformAuthEnclave = {
14306
+ /**
14307
+ * Persisted software key using MS_KEY_STORAGE_PROVIDER.
14308
+ */
14309
+ SOFTWARE: "sw"};
14197
14310
  /**
14198
14311
  * Token types supported by the platform broker request contract.
14199
14312
  */
14200
14313
  const PlatformAuthTokenType = {
14201
14314
  DPOP_WITH_PROOF: "dpop+proof",
14202
14315
  };
14316
+ /**
14317
+ * Token binding preferences supported by the platform broker.
14318
+ */
14319
+ const PlatformAuthBindingPreference = {
14320
+ ATTESTED: "attested",
14321
+ };
14203
14322
  const PROOF_OF_POSSESSION_TOKEN_TYPES = [
14204
14323
  AuthenticationScheme$1.POP,
14205
14324
  AuthenticationScheme$1.DPOP,
@@ -14215,19 +14334,19 @@
14215
14334
  /**
14216
14335
  * Adds canonical proof request fields to the broker no-cache property bag.
14217
14336
  */
14218
- function createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionRequest, resourceRequestMethod, resourceRequestUri, dpopNonce) {
14219
- if (!isProofOfPossessionRequest) {
14220
- return extraParametersNoCache;
14337
+ function createPlatformAuthExtraParametersNoCache(tokenType, resourceRequestMethod, resourceRequestUri, dpopNonce) {
14338
+ if (!isProofOfPossessionTokenType(tokenType)) {
14339
+ return undefined;
14221
14340
  }
14222
14341
  return {
14223
- ...extraParametersNoCache,
14224
14342
  ...(resourceRequestMethod && {
14225
14343
  pop_method: resourceRequestMethod,
14226
14344
  }),
14227
14345
  ...(resourceRequestUri && {
14228
14346
  pop_url: resourceRequestUri,
14229
14347
  }),
14230
- ...(dpopNonce && {
14348
+ ...(tokenType === PlatformAuthTokenType.DPOP_WITH_PROOF &&
14349
+ dpopNonce && {
14231
14350
  pop_nonce: dpopNonce,
14232
14351
  }),
14233
14352
  };
@@ -14375,6 +14494,7 @@
14375
14494
  * Copyright (c) Microsoft Corporation. All rights reserved.
14376
14495
  * Licensed under the MIT License.
14377
14496
  */
14497
+ const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
14378
14498
  class PlatformAuthInteractionClient extends BaseInteractionClient {
14379
14499
  constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
14380
14500
  super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
@@ -14433,17 +14553,9 @@
14433
14553
  throw e;
14434
14554
  }
14435
14555
  // check if the tokens can be retrieved from internal cache
14556
+ let cachedResult;
14436
14557
  try {
14437
- const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);
14438
- // Served from the native internal cache; token did not come directly from the broker
14439
- nativeATMeasurement.add({
14440
- isNativeBroker: false,
14441
- });
14442
- nativeATMeasurement.end({
14443
- success: true,
14444
- fromCache: true,
14445
- });
14446
- return result;
14558
+ cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
14447
14559
  }
14448
14560
  catch (e) {
14449
14561
  if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
@@ -14454,13 +14566,28 @@
14454
14566
  nativeATMeasurement.end({
14455
14567
  success: false,
14456
14568
  });
14569
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14457
14570
  throw e;
14458
14571
  }
14459
14572
  // continue with a native call for any and all errors
14460
14573
  this.logger.info("0957j1", this.correlationId);
14461
14574
  }
14575
+ if (cachedResult) {
14576
+ // Served from the native internal cache; token did not come directly from the broker
14577
+ nativeATMeasurement.add({
14578
+ isNativeBroker: false,
14579
+ });
14580
+ nativeATMeasurement.end({
14581
+ success: true,
14582
+ fromCache: true,
14583
+ });
14584
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
14585
+ return cachedResult;
14586
+ }
14462
14587
  // dispatch the request to the broker
14463
14588
  try {
14589
+ await this.prepareDpopBrokerRequest(nativeRequest);
14590
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
14464
14591
  const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
14465
14592
  const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
14466
14593
  nativeATMeasurement.end({
@@ -14478,6 +14605,7 @@
14478
14605
  success: false,
14479
14606
  }, e);
14480
14607
  this.setBrokerErrorTelemetry(e);
14608
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14481
14609
  throw e;
14482
14610
  }
14483
14611
  }
@@ -14512,6 +14640,7 @@
14512
14640
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
14513
14641
  account: cachedAccount,
14514
14642
  forceRefresh: false,
14643
+ ...this.createSilentCacheTokenBindingParameters(request),
14515
14644
  resource: request.extraParameters?.resource,
14516
14645
  };
14517
14646
  // Preserve FMI partition semantics for silent cache filtering.
@@ -14520,6 +14649,29 @@
14520
14649
  }
14521
14650
  return silentRequest;
14522
14651
  }
14652
+ /**
14653
+ * Maps platform-broker token-binding state to silent-cache request fields.
14654
+ * @param request
14655
+ */
14656
+ createSilentCacheTokenBindingParameters(request) {
14657
+ const authenticationScheme = this.isDpopBrokerRequest(request)
14658
+ ? AuthenticationScheme$1.DPOP
14659
+ : request.tokenType;
14660
+ if (authenticationScheme !== AuthenticationScheme$1.DPOP &&
14661
+ authenticationScheme !== AuthenticationScheme$1.POP) {
14662
+ return { authenticationScheme };
14663
+ }
14664
+ return {
14665
+ authenticationScheme,
14666
+ ...(authenticationScheme === AuthenticationScheme$1.DPOP &&
14667
+ request.keyId && { dpopJkt: request.keyId }),
14668
+ ...(authenticationScheme === AuthenticationScheme$1.POP &&
14669
+ request.signPopToken === false &&
14670
+ request.keyId && { popKid: request.keyId }),
14671
+ resourceRequestMethod: request.resourceRequestMethod,
14672
+ resourceRequestUri: request.resourceRequestUri,
14673
+ };
14674
+ }
14523
14675
  /**
14524
14676
  * Fetches the tokens from the cache if un-expired
14525
14677
  * @param nativeAccountId
@@ -14568,10 +14720,22 @@
14568
14720
  const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
14569
14721
  const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
14570
14722
  try {
14571
- await this.platformAuthProvider.sendMessage(nativeRequest);
14723
+ await this.prepareDpopBrokerRequest(nativeRequest);
14724
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
14725
+ const response = await this.platformAuthProvider.sendMessage(nativeRequest);
14726
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
14727
+ if (dpopBrokerOutcome === "L3") {
14728
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
14729
+ }
14572
14730
  }
14573
14731
  catch (e) {
14574
- // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
14732
+ /*
14733
+ * Raw persistent/transient broker errors are retrieved again in
14734
+ * phase two. Availability errors are thrown for controller-managed
14735
+ * web fallback, while translated cancellation, network, and
14736
+ * interaction-required errors are surfaced without being swallowed.
14737
+ */
14738
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14575
14739
  if (e instanceof NativeAuthError) {
14576
14740
  const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
14577
14741
  serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
@@ -14586,6 +14750,16 @@
14586
14750
  throw e;
14587
14751
  }
14588
14752
  }
14753
+ else if (this.isDpopBrokerRequest(nativeRequest)) {
14754
+ throw e;
14755
+ }
14756
+ }
14757
+ try {
14758
+ await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
14759
+ }
14760
+ catch (e) {
14761
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14762
+ throw e;
14589
14763
  }
14590
14764
  this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
14591
14765
  ...nativeRequest,
@@ -14600,7 +14774,14 @@
14600
14774
  ? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
14601
14775
  : getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
14602
14776
  rootMeasurement.end({ success: true });
14603
- await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
14777
+ try {
14778
+ await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
14779
+ }
14780
+ catch (e) {
14781
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
14782
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
14783
+ throw e;
14784
+ }
14604
14785
  }
14605
14786
  /**
14606
14787
  * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
@@ -14633,6 +14814,8 @@
14633
14814
  this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
14634
14815
  const reqTimestamp = nowSeconds();
14635
14816
  try {
14817
+ await this.prepareDpopBrokerRequest(request, true);
14818
+ this.addDpopBrokerAttemptTelemetry(request);
14636
14819
  this.logger.verbose("003x5a", this.correlationId);
14637
14820
  const response = await this.platformAuthProvider.sendMessage(request);
14638
14821
  const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
@@ -14641,7 +14824,12 @@
14641
14824
  return authResult;
14642
14825
  }
14643
14826
  catch (e) {
14827
+ if (e instanceof NativeAuthError) {
14828
+ const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
14829
+ serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
14830
+ }
14644
14831
  this.setBrokerErrorTelemetry(e);
14832
+ await this.resetGeneratedDpopRequestKeyBestEffort(request);
14645
14833
  throw e;
14646
14834
  }
14647
14835
  }
@@ -14661,6 +14849,7 @@
14661
14849
  */
14662
14850
  async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
14663
14851
  this.logger.trace("1bojln", this.correlationId);
14852
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
14664
14853
  // generate identifiers
14665
14854
  const idTokenClaims = extractTokenClaims(response.id_token, base64Decode, this.correlationId);
14666
14855
  const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
@@ -14686,10 +14875,17 @@
14686
14875
  response.expires_in = Number(response.expires_in);
14687
14876
  // generate authenticationResult
14688
14877
  const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
14878
+ const isL3DpopResponse = dpopBrokerOutcome === "L3";
14689
14879
  // cache accounts and tokens in the appropriate storage
14690
- await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims));
14880
+ const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
14881
+ (this.isDpopBrokerRequest(request) &&
14882
+ storeInCache?.accessToken === false);
14883
+ if (shouldRemoveGeneratedDpopKey) {
14884
+ await this.resetGeneratedDpopRequestKey(request);
14885
+ }
14886
+ await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, isKmsi(idTokenClaims), !isL3DpopResponse);
14691
14887
  await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
14692
- storeInCache);
14888
+ storeInCache, dpopBrokerOutcome);
14693
14889
  return result;
14694
14890
  }
14695
14891
  /**
@@ -14765,7 +14961,7 @@
14765
14961
  */
14766
14962
  async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
14767
14963
  // Add Native Broker fields to Telemetry
14768
- const mats = this.addTelemetryFromNativeResponse(response.properties.MATS);
14964
+ const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
14769
14965
  // If scopes not returned in server response, use request scopes
14770
14966
  const responseScopes = this.generateScopes(request.scope, response.scope);
14771
14967
  const accountProperties = response.account.properties || {};
@@ -14791,9 +14987,17 @@
14791
14987
  }
14792
14988
  // generate PoP token as needed
14793
14989
  const responseAccessToken = await this.generatePopAccessToken(response, request);
14794
- const tokenType = request.tokenType === AuthenticationScheme$1.POP
14795
- ? AuthenticationScheme$1.POP
14796
- : AuthenticationScheme$1.BEARER;
14990
+ const isDpopRequest = this.isDpopBrokerRequest(request);
14991
+ let tokenType = AuthenticationScheme$1.BEARER;
14992
+ if (isDpopRequest) {
14993
+ tokenType = AuthenticationScheme$1.DPOP;
14994
+ }
14995
+ else if (request.tokenType === AuthenticationScheme$1.POP) {
14996
+ tokenType = AuthenticationScheme$1.POP;
14997
+ }
14998
+ const dpopProof = isDpopRequest
14999
+ ? await this.generateDpopProof(response, request)
15000
+ : undefined;
14797
15001
  const result = {
14798
15002
  authority: authority,
14799
15003
  uniqueId: uid,
@@ -14807,6 +15011,7 @@
14807
15011
  // Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
14808
15012
  expiresOn: toDateFromSeconds(reqTimestamp + response.expires_in),
14809
15013
  tokenType: tokenType,
15014
+ dpopProof,
14810
15015
  correlationId: this.correlationId,
14811
15016
  state: response.state,
14812
15017
  fromPlatformBroker: true,
@@ -14820,11 +15025,13 @@
14820
15025
  * cache the account entity in browser storage
14821
15026
  * @param accountEntity
14822
15027
  */
14823
- async cacheAccount(accountEntity, kmsi) {
15028
+ async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
14824
15029
  // Store the account info and hence `nativeAccountId` in browser cache
14825
15030
  await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
14826
15031
  // Remove any existing cached tokens for this account in browser storage
14827
- this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
15032
+ if (clearExistingTokens) {
15033
+ this.browserStorage.removeAccountContext(getAccountInfo(accountEntity), this.correlationId);
15034
+ }
14828
15035
  }
14829
15036
  /**
14830
15037
  * Stores the access_token and id_token in inmemory storage
@@ -14836,8 +15043,18 @@
14836
15043
  * @param tenantId
14837
15044
  * @param reqTimestamp
14838
15045
  */
14839
- async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
15046
+ async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
14840
15047
  const cachedIdToken = createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
15048
+ // save idtoken credential in configured browser storage
15049
+ if (!!cachedIdToken && storeInCache?.idToken !== false) {
15050
+ await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
15051
+ }
15052
+ if (dpopBrokerOutcome === "L3") {
15053
+ return;
15054
+ }
15055
+ if (storeInCache?.accessToken === false) {
15056
+ return;
15057
+ }
14841
15058
  // cache accessToken in inmemory storage
14842
15059
  const expiresIn = request.tokenType === AuthenticationScheme$1.POP
14843
15060
  ? SHR_NONCE_VALIDITY
@@ -14847,18 +15064,14 @@
14847
15064
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
14848
15065
  const responseScopes = this.generateScopes(response.scope, request.scope);
14849
15066
  const additionalCacheKeyComponents = request.attributeTokens
14850
- ? {
14851
- attribute_tokens: request.attributeTokens,
14852
- }
15067
+ ? { attribute_tokens: request.attributeTokens }
14853
15068
  : undefined;
14854
- const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
15069
+ const cachedAccessToken = createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
15070
+ ? AuthenticationScheme$1.DPOP
15071
+ : request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
14855
15072
  if (request.extraParameters?.resource) {
14856
15073
  cachedAccessToken.resource = request.extraParameters.resource;
14857
15074
  }
14858
- // save idtoken credential in configured browser storage
14859
- if (!!cachedIdToken && storeInCache?.idToken !== false) {
14860
- await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, isKmsi(idTokenClaims));
14861
- }
14862
15075
  // save access token credential in memory storage
14863
15076
  const nativeCacheRecord = {
14864
15077
  accessToken: cachedAccessToken,
@@ -14935,11 +15148,7 @@
14935
15148
  const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
14936
15149
  ? undefined
14937
15150
  : this.config.auth.clientCapabilities;
14938
- /*
14939
- * scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
14940
- * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
14941
- */
14942
- const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
15151
+ const { scopes, claims, dpopNonce } = request;
14943
15152
  const scopeSet = new ScopeSet([...(scopes || []), ...OIDC_DEFAULT_SCOPES$1], this.correlationId);
14944
15153
  const mergedClaims = buildMergedClaims$1(claims, configClaims?.length ? configClaims : undefined);
14945
15154
  const hasAttributeTokens = !!request.attributeTokens?.length;
@@ -14963,57 +15172,391 @@
14963
15172
  loginHint: request.loginHint,
14964
15173
  extraParameters: {
14965
15174
  ...request.extraParameters,
14966
- ...(request.resource && { resource: request.resource }), // resource is set for MCP scenarios
15175
+ // Native broker resource is set for MCP scenarios.
15176
+ ...(request.resource && { resource: request.resource }),
14967
15177
  },
14968
15178
  extendedExpiryToken: false,
14969
15179
  keyId: request.popKid,
14970
- resourceRequestMethod: request.resourceRequestMethod,
14971
- resourceRequestUri: request.resourceRequestUri,
14972
- shrClaims: request.shrClaims,
14973
- shrNonce: request.shrNonce,
14974
- extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
14975
15180
  };
14976
15181
  if (hasAttributeTokens) {
14977
15182
  validatedRequest.attributeTokens =
14978
15183
  serializeAttributeTokens(request.attributeTokens);
14979
15184
  }
14980
- // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
14981
- if (validatedRequest.signPopToken && !!request.popKid) {
14982
- throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
14983
- }
14984
15185
  this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
14985
15186
  validatedRequest.extraParameters =
14986
15187
  validatedRequest.extraParameters || {};
14987
15188
  validatedRequest.extraParameters.telemetry =
14988
15189
  PlatformAuthConstants.MATS_TELEMETRY;
14989
15190
  if (request.authenticationScheme === AuthenticationScheme$1.POP) {
14990
- // add POP request type
14991
15191
  const shrParameters = {
14992
- resourceRequestUri: request.resourceRequestUri,
14993
15192
  resourceRequestMethod: request.resourceRequestMethod,
15193
+ resourceRequestUri: request.resourceRequestUri,
14994
15194
  shrClaims: request.shrClaims,
14995
15195
  shrNonce: request.shrNonce,
14996
15196
  correlationId: this.correlationId,
14997
15197
  };
14998
15198
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
14999
- // generate reqCnf if not provided in the request
15000
- let reqCnfData;
15001
15199
  if (!validatedRequest.keyId) {
15002
15200
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
15003
- reqCnfData = generatedReqCnfData.reqCnfString;
15201
+ validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
15004
15202
  validatedRequest.keyId = generatedReqCnfData.kid;
15005
15203
  validatedRequest.signPopToken = true;
15006
15204
  }
15007
15205
  else {
15008
- reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
15206
+ validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
15009
15207
  validatedRequest.signPopToken = false;
15010
15208
  }
15011
- // SPAs require whole string to be passed to broker
15012
- validatedRequest.reqCnf = reqCnfData;
15209
+ validatedRequest.resourceRequestMethod =
15210
+ request.resourceRequestMethod;
15211
+ validatedRequest.resourceRequestUri = request.resourceRequestUri;
15212
+ validatedRequest.shrClaims = request.shrClaims;
15213
+ validatedRequest.shrNonce = request.shrNonce;
15214
+ }
15215
+ else if (request.authenticationScheme === AuthenticationScheme$1.DPOP) {
15216
+ Object.assign(validatedRequest, this.createDpopRequestParameters(request));
15013
15217
  }
15218
+ validatedRequest.extraParametersNoCache =
15219
+ createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
15014
15220
  this.addRequestSKUs(validatedRequest);
15015
15221
  return validatedRequest;
15016
15222
  }
15223
+ /**
15224
+ * Creates and validates the broker-specific parameters for a DPoP request.
15225
+ * @param request - Developer-provided token request.
15226
+ * @returns Broker parameters for a DPoP token and resource proof.
15227
+ */
15228
+ createDpopRequestParameters(request) {
15229
+ if (request.popKid) {
15230
+ throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
15231
+ }
15232
+ if (!request.resourceRequestMethod?.trim() ||
15233
+ !request.resourceRequestUri?.trim()) {
15234
+ throw createClientConfigurationError(dpopMissingResourceContext, this.correlationId);
15235
+ }
15236
+ const resourceContext = normalizeDpopResourceRequestContext({
15237
+ htm: request.resourceRequestMethod,
15238
+ htu: request.resourceRequestUri,
15239
+ }, this.correlationId);
15240
+ return {
15241
+ tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
15242
+ preferBinding: PlatformAuthBindingPreference.ATTESTED,
15243
+ keyId: request.dpopJkt,
15244
+ resourceRequestMethod: resourceContext.htm,
15245
+ resourceRequestUri: resourceContext.htu,
15246
+ };
15247
+ }
15248
+ /**
15249
+ * Provisions the local key and confirmation data for a DPoP broker request.
15250
+ * @param request - Broker request to prepare.
15251
+ * @param reuseExistingKey - Whether a complete existing key binding may be reused.
15252
+ */
15253
+ async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
15254
+ if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
15255
+ return;
15256
+ }
15257
+ /*
15258
+ * Phase one clears both fields after an L3 response or non-fatal broker
15259
+ * error. In that case phase two must provision a replacement. If either
15260
+ * field remains, treat it as a retained binding and validate it fully.
15261
+ */
15262
+ if (reuseExistingKey && (request.keyId || request.reqCnf)) {
15263
+ if (!request.keyId || !request.reqCnf) {
15264
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
15265
+ }
15266
+ const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
15267
+ if (request.reqCnf !== expectedReqCnf) {
15268
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
15269
+ }
15270
+ const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
15271
+ ? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
15272
+ : await this.tokenBindingKeyManager
15273
+ .getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
15274
+ .then(() => true, () => false);
15275
+ if (!hasKey) {
15276
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
15277
+ }
15278
+ return;
15279
+ }
15280
+ if (request.reqCnf) {
15281
+ throw createAuthError(unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
15282
+ }
15283
+ if (!request.keyId) {
15284
+ request.keyId =
15285
+ await this.tokenBindingKeyManager.provisionTokenBindingKey({
15286
+ tokenBindingKeyType: AuthenticationScheme$1.DPOP.toLowerCase(),
15287
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
15288
+ correlationId: this.correlationId,
15289
+ });
15290
+ }
15291
+ request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
15292
+ }
15293
+ /**
15294
+ * Creates the confirmation claim for an MSAL-owned broker DPoP key.
15295
+ * @param keyId - Browser-managed DPoP key identifier.
15296
+ * @returns Encoded broker confirmation claim.
15297
+ */
15298
+ createDpopBrokerReqCnf(keyId) {
15299
+ return this.browserCrypto.base64UrlEncode(JSON.stringify({
15300
+ kid: keyId,
15301
+ xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
15302
+ }));
15303
+ }
15304
+ /**
15305
+ * Ensures an owned DPoP key can survive redirect navigation before the
15306
+ * request metadata is persisted for phase two.
15307
+ */
15308
+ async ensureRedirectDpopKeyIsPersisted(request) {
15309
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
15310
+ return;
15311
+ }
15312
+ if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
15313
+ throw createAuthError(unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
15314
+ }
15315
+ }
15316
+ /**
15317
+ * Validates and normalizes the DPoP binding outcome returned by the broker.
15318
+ * @param response - Broker response to validate.
15319
+ * @param request - Broker request associated with the response.
15320
+ * @returns The validated DPoP binding level, or `none` for non-DPoP requests.
15321
+ */
15322
+ validateDpopBrokerOutcome(response, request) {
15323
+ const isDpopRequest = this.isDpopBrokerRequest(request);
15324
+ const normalizedResponse = this.normalizeDpopBrokerResponse(response);
15325
+ const normalizedRequestTokenType = request.tokenType
15326
+ ?.trim()
15327
+ .toLowerCase();
15328
+ const bindingPreferenceSent = request.bindingPreferenceSent ??
15329
+ request.preferBinding !== undefined;
15330
+ const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
15331
+ normalizedResponse.proof !== undefined ||
15332
+ normalizedResponse.hasBindingAttested;
15333
+ if (!isDpopRequest) {
15334
+ if (hasDpopResponse) {
15335
+ this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
15336
+ }
15337
+ return "none";
15338
+ }
15339
+ if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
15340
+ this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
15341
+ }
15342
+ this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
15343
+ if (normalizedResponse.tokenType ===
15344
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
15345
+ return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
15346
+ }
15347
+ return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
15348
+ }
15349
+ /**
15350
+ * Normalizes the canonical DPoP fields returned under response properties.
15351
+ */
15352
+ normalizeDpopBrokerResponse(response) {
15353
+ const responseProperties = response.properties;
15354
+ const rawTokenType = responseProperties?.token_type;
15355
+ const tokenType = typeof rawTokenType === "string"
15356
+ ? rawTokenType.trim().toLowerCase()
15357
+ : undefined;
15358
+ const rawBindingAttested = responseProperties?.binding_attested;
15359
+ let bindingAttested;
15360
+ if (typeof rawBindingAttested === "string") {
15361
+ const normalizedBindingAttested = rawBindingAttested
15362
+ .trim()
15363
+ .toLowerCase();
15364
+ if (normalizedBindingAttested === "true") {
15365
+ bindingAttested = true;
15366
+ }
15367
+ else if (normalizedBindingAttested === "false") {
15368
+ bindingAttested = false;
15369
+ }
15370
+ }
15371
+ return {
15372
+ tokenType,
15373
+ proof: responseProperties?.DPoP,
15374
+ bindingAttested,
15375
+ hasBindingAttested: rawBindingAttested !== undefined,
15376
+ hasMalformedBindingAttested: rawBindingAttested !== undefined &&
15377
+ bindingAttested === undefined,
15378
+ };
15379
+ }
15380
+ /**
15381
+ * Validates normalized fields shared by L1 and L3 broker DPoP responses.
15382
+ */
15383
+ validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
15384
+ if (normalizedResponse.hasMalformedBindingAttested) {
15385
+ this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
15386
+ }
15387
+ if (bindingPreferenceSent &&
15388
+ normalizedResponse.bindingAttested === undefined) {
15389
+ this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
15390
+ }
15391
+ }
15392
+ /**
15393
+ * Validates a broker-returned L3 DPoP proof outcome.
15394
+ */
15395
+ validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
15396
+ const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
15397
+ if (typeof normalizedResponse.proof !== "string" ||
15398
+ normalizedResponse.proof.trim().length === 0) {
15399
+ this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
15400
+ }
15401
+ if (normalizedResponse.bindingAttested !== true) {
15402
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
15403
+ }
15404
+ if (normalizedRequestTokenType !== dpopWithProofTokenType ||
15405
+ normalizedResponse.tokenType !== dpopWithProofTokenType) {
15406
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
15407
+ }
15408
+ this.performanceClient.addFields({
15409
+ "ext.brokerDpopOutcome": "l3",
15410
+ "ext.brokerDpopBindingLevel": "L3",
15411
+ }, this.correlationId);
15412
+ return "L3";
15413
+ }
15414
+ /**
15415
+ * Validates an L1 DPoP outcome that MSAL will sign with its local key.
15416
+ */
15417
+ validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
15418
+ if (normalizedResponse.proof !== undefined) {
15419
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
15420
+ }
15421
+ if (normalizedRequestTokenType !==
15422
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
15423
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
15424
+ }
15425
+ if (normalizedResponse.bindingAttested !== false &&
15426
+ !(!bindingPreferenceSent &&
15427
+ normalizedResponse.bindingAttested === undefined)) {
15428
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
15429
+ }
15430
+ if (!request.reqCnf || !request.keyId) {
15431
+ this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
15432
+ }
15433
+ this.performanceClient.addFields({
15434
+ "ext.brokerDpopOutcome": "l1",
15435
+ "ext.brokerDpopBindingLevel": "L1",
15436
+ }, this.correlationId);
15437
+ return "L1";
15438
+ }
15439
+ /**
15440
+ * Emits bounded failure telemetry and rejects an invalid DPoP response.
15441
+ */
15442
+ throwInvalidDpopResponse(failureReason, message) {
15443
+ this.performanceClient.addFields({
15444
+ "ext.brokerDpopOutcome": "invalid_response",
15445
+ "ext.brokerDpopFailureReason": failureReason,
15446
+ }, this.correlationId);
15447
+ throw createAuthError(unexpectedError, this.correlationId, message);
15448
+ }
15449
+ /**
15450
+ * Returns the broker proof or signs an L1 resource proof with the local key.
15451
+ * @param response - Broker response containing the access token and optional proof.
15452
+ * @param request - Broker request containing the proof context and local key.
15453
+ * @returns The resource proof for the broker access token.
15454
+ */
15455
+ async generateDpopProof(response, request) {
15456
+ const brokerProof = response.properties?.DPoP;
15457
+ if (brokerProof !== undefined) {
15458
+ return brokerProof;
15459
+ }
15460
+ const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
15461
+ return dpopProofGenerator.generateResourceProof({
15462
+ htu: request.resourceRequestUri,
15463
+ htm: request.resourceRequestMethod,
15464
+ accessToken: response.access_token,
15465
+ nonce: request.extraParametersNoCache?.pop_nonce,
15466
+ }, request.keyId, this.correlationId);
15467
+ }
15468
+ /**
15469
+ * Removes a generated DPoP request key and clears its request metadata.
15470
+ * @param request - Broker request whose generated key should be removed.
15471
+ */
15472
+ async resetGeneratedDpopRequestKey(request) {
15473
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
15474
+ return;
15475
+ }
15476
+ const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
15477
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
15478
+ try {
15479
+ if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
15480
+ throw createAuthError(unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
15481
+ }
15482
+ this.performanceClient.addFields({
15483
+ "ext.brokerDpopKeyCleanupOutcome": "succeeded",
15484
+ }, this.correlationId);
15485
+ cleanupMeasurement.end({ success: true });
15486
+ request.keyId = undefined;
15487
+ request.reqCnf = undefined;
15488
+ }
15489
+ catch (error) {
15490
+ this.performanceClient.addFields({
15491
+ "ext.brokerDpopKeyCleanupOutcome": "failed",
15492
+ }, this.correlationId);
15493
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
15494
+ cleanupMeasurement.end({ success: false }, error);
15495
+ throw error;
15496
+ }
15497
+ }
15498
+ /**
15499
+ * Attempts to remove a generated DPoP request key without replacing an
15500
+ * existing operation error with a cleanup failure.
15501
+ * @param request - Broker request whose generated key should be removed.
15502
+ */
15503
+ async resetGeneratedDpopRequestKeyBestEffort(request) {
15504
+ try {
15505
+ await this.resetGeneratedDpopRequestKey(request);
15506
+ }
15507
+ catch {
15508
+ this.logger.error("1kxxak", this.correlationId);
15509
+ this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
15510
+ request.keyId = undefined;
15511
+ request.reqCnf = undefined;
15512
+ }
15513
+ }
15514
+ /**
15515
+ * Records that a DPoP request is about to be dispatched to the platform broker.
15516
+ * @param request - Broker request about to cross the provider boundary.
15517
+ */
15518
+ addDpopBrokerAttemptTelemetry(request) {
15519
+ if (!this.isDpopBrokerRequest(request)) {
15520
+ return;
15521
+ }
15522
+ this.performanceClient.addFields({
15523
+ "ext.brokerDpopAttempted": 1,
15524
+ }, this.correlationId);
15525
+ }
15526
+ /**
15527
+ * Determines whether a request uses the DPoP broker protocol.
15528
+ * @param request - Broker request to inspect.
15529
+ * @returns Whether the request uses a DPoP token type.
15530
+ */
15531
+ isDpopBrokerRequest(request) {
15532
+ return this.isDpopBrokerTokenType(request.tokenType);
15533
+ }
15534
+ /**
15535
+ * Determines whether a token type represents a DPoP broker request.
15536
+ * @param tokenType - Token type to inspect.
15537
+ * @returns Whether the token type is a supported DPoP broker token type.
15538
+ */
15539
+ isDpopBrokerTokenType(tokenType) {
15540
+ const normalizedTokenType = tokenType?.trim().toLowerCase();
15541
+ return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
15542
+ normalizedTokenType ===
15543
+ AuthenticationScheme$1.DPOP.toLowerCase());
15544
+ }
15545
+ /**
15546
+ * Removes a DPoP key while reporting cleanup failures.
15547
+ * @param keyId - Identifier of the DPoP key to remove.
15548
+ * @returns Whether the key was removed successfully.
15549
+ */
15550
+ async removeDpopKey(keyId) {
15551
+ try {
15552
+ await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
15553
+ return true;
15554
+ }
15555
+ catch {
15556
+ this.logger.error("1w60e4", this.correlationId);
15557
+ return false;
15558
+ }
15559
+ }
15017
15560
  async getCanonicalAuthority(request) {
15018
15561
  const requestAuthority = request.authority || this.config.auth.authority;
15019
15562
  const { azureCloudOptions, account } = request;
@@ -15052,29 +15595,28 @@
15052
15595
  }
15053
15596
  }
15054
15597
  /**
15055
- * Handles extra broker request parameters
15056
- * @param request {PlatformAuthRequest}
15057
- * @private
15598
+ * Handles extra broker request parameters.
15599
+ * @param request - Platform broker request.
15600
+ * @param embeddedClientId - Embedded application client identifier.
15058
15601
  */
15059
15602
  handleExtraBrokerParams(request, embeddedClientId) {
15060
- const hasExtraBrokerParams = request.extraParameters &&
15061
- request.extraParameters.hasOwnProperty(BROKER_CLIENT_ID) &&
15062
- request.extraParameters.hasOwnProperty(BROKER_REDIRECT_URI) &&
15063
- request.extraParameters.hasOwnProperty(CLIENT_ID);
15603
+ const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
15604
+ const hasExtraBrokerParams = hasOwnParameter(BROKER_CLIENT_ID) &&
15605
+ hasOwnParameter(BROKER_REDIRECT_URI) &&
15606
+ hasOwnParameter(CLIENT_ID);
15064
15607
  if (!embeddedClientId && !hasExtraBrokerParams) {
15065
15608
  return;
15066
15609
  }
15067
- let child_client_id = "";
15068
- const child_redirect_uri = request.redirectUri;
15610
+ const childRedirectUri = request.redirectUri;
15611
+ const childClientId = embeddedClientId ||
15612
+ request.extraParameters?.[CLIENT_ID] ||
15613
+ "";
15069
15614
  if (embeddedClientId) {
15070
15615
  request.redirectUri = this.config.auth.redirectUri;
15071
- child_client_id = embeddedClientId;
15072
15616
  }
15073
15617
  else if (request.extraParameters) {
15074
15618
  request.redirectUri =
15075
15619
  request.extraParameters[BROKER_REDIRECT_URI];
15076
- child_client_id =
15077
- request.extraParameters[CLIENT_ID];
15078
15620
  }
15079
15621
  const {
15080
15622
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -15085,15 +15627,20 @@
15085
15627
  [CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
15086
15628
  request.extraParameters = {
15087
15629
  ...remainingExtraParameters,
15088
- child_client_id,
15089
- child_redirect_uri,
15630
+ child_client_id: childClientId,
15631
+ child_redirect_uri: childRedirectUri,
15090
15632
  };
15091
15633
  this.performanceClient?.addFields({
15092
- embeddedClientId: child_client_id,
15093
- embeddedRedirectUri: child_redirect_uri,
15634
+ embeddedClientId: childClientId,
15635
+ embeddedRedirectUri: childRedirectUri,
15094
15636
  }, this.correlationId);
15095
15637
  }
15096
- }
15638
+ }
15639
+ /**
15640
+ * Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
15641
+ * This does not constrain the binding selected by the platform broker.
15642
+ */
15643
+ PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
15097
15644
 
15098
15645
  /*
15099
15646
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -15199,6 +15746,7 @@
15199
15746
  }
15200
15747
  }
15201
15748
  if (request.authenticationScheme === AuthenticationScheme$1.DPOP &&
15749
+ !request.platformBroker &&
15202
15750
  request.dpopJkt) {
15203
15751
  parameters.set(DPOP_JKT, request.dpopJkt);
15204
15752
  }
@@ -15322,19 +15870,25 @@
15322
15870
  * @param nativeMessageHandler
15323
15871
  * @returns
15324
15872
  */
15325
- async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
15873
+ async function handleResponsePlatformBroker(request, accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
15326
15874
  logger.verbose("11qcow", request.correlationId);
15327
15875
  if (!platformAuthProvider) {
15328
15876
  throw createBrowserAuthError(nativeConnectionNotEstablished, request.correlationId);
15329
15877
  }
15330
15878
  const browserCrypto = new CryptoOps(logger, performanceClient);
15331
- const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId);
15879
+ const nativeInteractionClient = new PlatformAuthInteractionClient(config, browserStorage, browserCrypto, logger, eventHandler, config.system.navigationClient, apiId, performanceClient, platformAuthProvider, accountId, nativeStorage, request.correlationId, tokenBindingKeyManager);
15332
15880
  const { userRequestState } = parseRequestState(browserCrypto.base64Decode, request.state, request.correlationId);
15333
- return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
15334
- ...request,
15335
- state: userRequestState,
15336
- prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
15337
- });
15881
+ try {
15882
+ return await invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), NativeInteractionClientAcquireToken, logger, performanceClient, request.correlationId)({
15883
+ ...request,
15884
+ state: userRequestState,
15885
+ prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
15886
+ });
15887
+ }
15888
+ catch (e) {
15889
+ await removeTokenBindingKeyOnFailure(request, tokenBindingKeyManager, logger, performanceClient);
15890
+ throw e;
15891
+ }
15338
15892
  }
15339
15893
  /**
15340
15894
  * Response handler when server returns code on the /authorize request
@@ -15347,13 +15901,13 @@
15347
15901
  * @param performanceClient
15348
15902
  * @returns
15349
15903
  */
15350
- async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
15904
+ async function handleResponseCode(request, response, codeVerifier, apiId, config, authClient, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
15351
15905
  // Remove throttle if it exists
15352
15906
  ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
15353
15907
  // Instrument clientdata telemetry fields from the authorize response
15354
15908
  instrumentClientData(response, request.correlationId, performanceClient);
15355
15909
  if (response.accountId) {
15356
- return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
15910
+ return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, response.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
15357
15911
  }
15358
15912
  const authCodeRequest = {
15359
15913
  ...request,
@@ -15381,7 +15935,7 @@
15381
15935
  * @param nativeMessageHandler
15382
15936
  * @returns
15383
15937
  */
15384
- async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider) {
15938
+ async function handleResponseEAR(request, response, apiId, config, authority, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager = new TokenBindingKeyManager(logger, performanceClient)) {
15385
15939
  // Remove throttle if it exists
15386
15940
  ThrottlingUtils.removeThrottle(browserStorage, config.auth.clientId, request);
15387
15941
  // Instrument clientdata telemetry fields from the authorize response
@@ -15396,9 +15950,9 @@
15396
15950
  }
15397
15951
  const decryptedData = JSON.parse(await invokeAsync(decryptEarResponse, DecryptEarResponse, logger, performanceClient, request.correlationId)(request.earJwk, response.ear_jwe));
15398
15952
  if (decryptedData.accountId) {
15399
- return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider);
15953
+ return invokeAsync(handleResponsePlatformBroker, HandleResponsePlatformBroker, logger, performanceClient, request.correlationId)(request, decryptedData.accountId, apiId, config, browserStorage, nativeStorage, eventHandler, logger, performanceClient, platformAuthProvider, tokenBindingKeyManager);
15400
15954
  }
15401
- const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, new TokenBindingKeyManager(logger, performanceClient));
15955
+ const responseHandler = new ResponseHandler(config.auth.clientId, browserStorage, new CryptoOps(logger, performanceClient), logger, performanceClient, null, null, tokenBindingKeyManager);
15402
15956
  // Validate response. This function throws a server error if an error is returned by the server.
15403
15957
  responseHandler.validateTokenResponse(decryptedData, request.correlationId);
15404
15958
  // Temporary until response handler is refactored to be more flow agnostic.
@@ -15845,6 +16399,7 @@
15845
16399
  const extensionRequest = { ...request };
15846
16400
  delete extensionRequest.resourceRequestMethod;
15847
16401
  delete extensionRequest.resourceRequestUri;
16402
+ delete extensionRequest.bindingPreferenceSent;
15848
16403
  const messageBody = {
15849
16404
  method: NativeExtensionMethod.GetToken,
15850
16405
  request: extensionRequest,
@@ -15856,8 +16411,9 @@
15856
16411
  body: messageBody,
15857
16412
  };
15858
16413
  this.logger.trace(`1qadfi ${this.platformAuthType}`, correlationId);
15859
- this.logger.tracePii(`1xm533 ${this.platformAuthType} ${JSON.stringify(req)}`, correlationId);
15860
16414
  this.messageChannel.port1.postMessage(req);
16415
+ request.bindingPreferenceSent =
16416
+ extensionRequest.preferBinding !== undefined;
15861
16417
  const response = await new Promise((resolve, reject) => {
15862
16418
  this.resolvers.set(req.responseId, {
15863
16419
  resolve,
@@ -16054,13 +16610,11 @@
16054
16610
  try {
16055
16611
  const response = request.body.response;
16056
16612
  this.logger.trace(`19hpgm ${this.platformAuthType}`, correlationId);
16057
- this.logger.tracePii(`179a24 ${this.platformAuthType} ${JSON.stringify(response)}`, correlationId);
16058
16613
  if (response.status !== "Success") {
16059
16614
  resolver.reject(createNativeAuthError(response.code, correlationId, response.description, response.ext));
16060
16615
  }
16061
16616
  else if (response.result) {
16062
- if (response.result["code"] &&
16063
- response.result["description"]) {
16617
+ if (response.result["code"]) {
16064
16618
  resolver.reject(createNativeAuthError(response.result["code"], correlationId, response.result["description"], response.result["ext"]));
16065
16619
  }
16066
16620
  else {
@@ -16141,11 +16695,12 @@
16141
16695
  Object.prototype.hasOwnProperty.call(response, "account") &&
16142
16696
  Object.prototype.hasOwnProperty.call(response, "scope") &&
16143
16697
  Object.prototype.hasOwnProperty.call(response, "expires_in")) {
16698
+ const validatedResponse = response;
16144
16699
  validationMeasurement.end({
16145
16700
  success: true,
16146
16701
  platformAuthProviderType: this.platformAuthType,
16147
16702
  });
16148
- return response;
16703
+ return validatedResponse;
16149
16704
  }
16150
16705
  else {
16151
16706
  const error = createAuthError(unexpectedError, responseCorrelationId, "Response missing expected properties.");
@@ -16187,6 +16742,7 @@
16187
16742
  * Copyright (c) Microsoft Corporation. All rights reserved.
16188
16743
  * Licensed under the MIT License.
16189
16744
  */
16745
+ const PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED = "platform_auth_dom_dpop_not_supported";
16190
16746
  class PlatformAuthDOMHandler {
16191
16747
  constructor(logger, performanceClient, correlationId) {
16192
16748
  this.logger = logger;
@@ -16266,6 +16822,10 @@
16266
16822
  });
16267
16823
  this.logger.trace(`02bcil ${this.platformAuthType}`, correlationId);
16268
16824
  try {
16825
+ if (request.tokenType?.trim().toLowerCase() ===
16826
+ PlatformAuthTokenType.DPOP_WITH_PROOF) {
16827
+ throw createBrowserAuthError(PLATFORM_AUTH_DOM_DPOP_NOT_SUPPORTED, correlationId);
16828
+ }
16269
16829
  const platformDOMRequest = invoke(this.initializePlatformDOMRequest.bind(this), PlatformAuthDOMInitializeRequest, this.logger, this.performanceClient, correlationId)(request);
16270
16830
  const response =
16271
16831
  // @ts-ignore
@@ -16292,6 +16852,7 @@
16292
16852
  this.logger.trace(`15d6yv ${this.platformAuthType}`, requestCorrelationId);
16293
16853
  delete remainingProperties.resourceRequestMethod;
16294
16854
  delete remainingProperties.resourceRequestUri;
16855
+ delete remainingProperties.bindingPreferenceSent;
16295
16856
  const validExtraParameters = this.getDOMExtraParams(remainingProperties, requestCorrelationId);
16296
16857
  const platformDOMRequest = {
16297
16858
  accountId: accountId,
@@ -16519,7 +17080,9 @@
16519
17080
  logger.trace("0uko3r", correlationId);
16520
17081
  const schemeSupported = !authenticationScheme ||
16521
17082
  authenticationScheme === AuthenticationScheme$1.BEARER ||
16522
- authenticationScheme === AuthenticationScheme$1.POP;
17083
+ authenticationScheme === AuthenticationScheme$1.POP ||
17084
+ (authenticationScheme === AuthenticationScheme$1.DPOP &&
17085
+ !(platformAuthProvider instanceof PlatformAuthDOMHandler));
16523
17086
  const fields = {
16524
17087
  allowPlatformBroker: config.system.allowPlatformBroker,
16525
17088
  ...(config.system.allowPlatformBroker && {
@@ -16716,12 +17279,13 @@
16716
17279
  // Wait for the redirect bridge response
16717
17280
  const responseString = await this.waitForPopupResponse(request, popupWindow, popupParams.popupWindowParent);
16718
17281
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
16719
- 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);
17282
+ 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);
16720
17283
  }
16721
17284
  }
16722
17285
  catch (e) {
16723
17286
  // Close the synchronous popup if an error is thrown before the window unload event is registered
16724
17287
  popupParams.popup?.close();
17288
+ await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
16725
17289
  if (e instanceof AuthError) {
16726
17290
  e.correlationId = this.correlationId;
16727
17291
  serverTelemetryManager.cacheFailedRequest(e);
@@ -16748,23 +17312,29 @@
16748
17312
  ...tokenBindingParams,
16749
17313
  popupOriginCheckDone: this.getPopupOriginCheckDone(popupParams.popupWindowParent),
16750
17314
  };
16751
- const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
16752
- // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
16753
- const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
16754
- const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
16755
- if (!serverParams.ear_jwe && serverParams.code) {
16756
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
16757
- serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
16758
- requestAuthority: request.authority,
16759
- requestAzureCloudOptions: request.azureCloudOptions,
16760
- requestExtraQueryParameters: request.extraQueryParameters,
16761
- account: request.account,
16762
- authority: discoveredAuthority,
16763
- });
16764
- return 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);
17315
+ try {
17316
+ const popupWindow = await this.openPostFormPopup(popupRequest, discoveredAuthority, popupParams, correlationId, true);
17317
+ // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
17318
+ const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(popupRequest, popupWindow, popupParams.popupWindowParent);
17319
+ const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
17320
+ if (!serverParams.ear_jwe && serverParams.code) {
17321
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, correlationId)({
17322
+ serverTelemetryManager: initializeServerTelemetryManager(ApiId.acquireTokenPopup, this.config.auth.clientId, correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled),
17323
+ requestAuthority: request.authority,
17324
+ requestAzureCloudOptions: request.azureCloudOptions,
17325
+ requestExtraQueryParameters: request.extraQueryParameters,
17326
+ account: request.account,
17327
+ authority: discoveredAuthority,
17328
+ });
17329
+ 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);
17330
+ }
17331
+ else {
17332
+ return await invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, ApiId.acquireTokenPopup, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17333
+ }
16765
17334
  }
16766
- else {
16767
- return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(popupRequest, serverParams, ApiId.acquireTokenPopup, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
17335
+ catch (e) {
17336
+ await removeTokenBindingKeyOnFailure(popupRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17337
+ throw e;
16768
17338
  }
16769
17339
  }
16770
17340
  async executeCodeFlowWithPost(request, popupParams, authClient, pkceVerifier) {
@@ -16775,7 +17345,7 @@
16775
17345
  // Monitor the popup for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
16776
17346
  const responseString = await invokeAsync(this.waitForPopupResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(request, popupWindow, popupParams.popupWindowParent);
16777
17347
  const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.responseMode, this.logger, this.correlationId);
16778
- 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);
17348
+ 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);
16779
17349
  }
16780
17350
  /**
16781
17351
  *
@@ -17163,8 +17733,11 @@
17163
17733
  codeChallenge: pkceCodes.challenge,
17164
17734
  ...tokenBindingParams,
17165
17735
  };
17166
- this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17167
17736
  try {
17737
+ if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
17738
+ throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
17739
+ }
17740
+ this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17168
17741
  if (redirectRequest.httpMethod === HttpMethod.POST) {
17169
17742
  return await this.executeCodeFlowWithPost(redirectRequest);
17170
17743
  }
@@ -17184,6 +17757,7 @@
17184
17757
  }
17185
17758
  }
17186
17759
  catch (e) {
17760
+ await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17187
17761
  if (e instanceof AuthError) {
17188
17762
  e.correlationId = this.correlationId;
17189
17763
  serverTelemetryManager.cacheFailedRequest(e);
@@ -17208,14 +17782,23 @@
17208
17782
  codeChallenge: pkceCodes.challenge,
17209
17783
  ...tokenBindingParams,
17210
17784
  };
17211
- this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17212
- const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
17213
- form.submit();
17214
- return new Promise((resolve, reject) => {
17215
- setTimeout(() => {
17216
- reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
17217
- }, this.config.system.redirectNavigationTimeout);
17218
- });
17785
+ try {
17786
+ if (!(await isTokenBindingKeyPersistedForRedirect(redirectRequest, this.tokenBindingKeyManager))) {
17787
+ throw createBrowserAuthError(cryptoKeyNotFound, this.correlationId);
17788
+ }
17789
+ this.browserStorage.cacheAuthorizeRequest(redirectRequest, this.correlationId, pkceCodes.verifier);
17790
+ const form = await getEARForm(document, this.config, discoveredAuthority, redirectRequest, this.logger, this.performanceClient);
17791
+ form.submit();
17792
+ return await new Promise((resolve, reject) => {
17793
+ setTimeout(() => {
17794
+ reject(createBrowserAuthError(timedOut, "", "failed_to_redirect"));
17795
+ }, this.config.system.redirectNavigationTimeout);
17796
+ });
17797
+ }
17798
+ catch (e) {
17799
+ await removeTokenBindingKeyOnFailure(redirectRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17800
+ throw e;
17801
+ }
17219
17802
  }
17220
17803
  /**
17221
17804
  * Executes classic Authorization Code flow with a POST request.
@@ -17254,6 +17837,7 @@
17254
17837
  if (!serverParams) {
17255
17838
  // Not a recognized server response hash or hash not associated with a redirect request
17256
17839
  this.logger.info("1qmv0q", this.correlationId);
17840
+ await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17257
17841
  this.browserStorage.resetRequestCache(this.correlationId);
17258
17842
  // Do not instrument "no_server_response" if user clicked back button
17259
17843
  if (getNavigationType() !== "back_forward") {
@@ -17323,6 +17907,7 @@
17323
17907
  return null;
17324
17908
  }
17325
17909
  catch (e) {
17910
+ await removeTokenBindingKeyOnFailure(request, this.tokenBindingKeyManager, this.logger, this.performanceClient);
17326
17911
  if (e instanceof AuthError) {
17327
17912
  e.correlationId = this.correlationId;
17328
17913
  serverTelemetryManager.cacheFailedRequest(e);
@@ -17389,10 +17974,10 @@
17389
17974
  const { authority, azureCloudOptions, extraQueryParameters, account } = request;
17390
17975
  if (serverParams.ear_jwe) {
17391
17976
  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);
17392
- 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);
17977
+ 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);
17393
17978
  }
17394
17979
  const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: request.authority });
17395
- 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);
17980
+ 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);
17396
17981
  }
17397
17982
  /**
17398
17983
  * Redirects window to given URL.
@@ -17723,10 +18308,10 @@
17723
18308
  account: request.account,
17724
18309
  authority: discoveredAuthority,
17725
18310
  });
17726
- return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
18311
+ return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17727
18312
  }
17728
18313
  else {
17729
- return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, this.apiId, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
18314
+ return invokeAsync(handleResponseEAR, HandleResponseEar, this.logger, this.performanceClient, correlationId)(silentRequest, serverParams, this.apiId, this.config, discoveredAuthority, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
17730
18315
  }
17731
18316
  }
17732
18317
  /**
@@ -17776,7 +18361,13 @@
17776
18361
  */
17777
18362
  async silentTokenHelper(authClient, request) {
17778
18363
  const { serverParams, pkceCodes, silentRequest } = await this.silentAuthorizeHelper(authClient, request);
17779
- return invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider);
18364
+ try {
18365
+ return await invokeAsync(handleResponseCode, HandleResponseCode, this.logger, this.performanceClient, request.correlationId)(silentRequest, serverParams, pkceCodes.verifier, this.apiId, this.config, authClient, this.browserStorage, this.nativeStorage, this.eventHandler, this.logger, this.performanceClient, this.platformAuthProvider, this.tokenBindingKeyManager);
18366
+ }
18367
+ catch (e) {
18368
+ await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
18369
+ throw e;
18370
+ }
17780
18371
  }
17781
18372
  /**
17782
18373
  * Shared helper that generates PKCE codes, builds the /authorize URL,
@@ -17793,38 +18384,44 @@
17793
18384
  codeChallenge: pkceCodes.challenge,
17794
18385
  ...tokenBindingParams,
17795
18386
  };
17796
- // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
17797
- const iframe = createHiddenIframe();
17798
- const responseType = this.config.auth.OIDCOptions.responseMode;
17799
- // Wait for response from the redirect bridge.
17800
- let responseString;
17801
18387
  try {
17802
- const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
17803
- responsePromise.catch(() => {
17804
- /*
17805
- * If URL creation or navigation below throws before
17806
- * responsePromise is awaited, the listener still rejects on
17807
- * timeout. Swallow it here so it does not surface as an
17808
- * unhandled rejection; the navigation error is propagated
17809
- * instead.
17810
- */
17811
- });
17812
- if (request.httpMethod === HttpMethod.POST) {
17813
- await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
18388
+ // Create the iframe, register the response listener, then navigate, so the listener is active before the iframe can respond.
18389
+ const iframe = createHiddenIframe();
18390
+ const responseType = this.config.auth.OIDCOptions.responseMode;
18391
+ // Wait for response from the redirect bridge.
18392
+ let responseString;
18393
+ try {
18394
+ const responsePromise = invokeAsync(this.waitForIframeResponse.bind(this), SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(iframe, request);
18395
+ responsePromise.catch(() => {
18396
+ /*
18397
+ * If URL creation or navigation below throws before
18398
+ * responsePromise is awaited, the listener still rejects on
18399
+ * timeout. Swallow it here so it does not surface as an
18400
+ * unhandled rejection; the navigation error is propagated
18401
+ * instead.
18402
+ */
18403
+ });
18404
+ if (request.httpMethod === HttpMethod.POST) {
18405
+ await invokeAsync(initiateCodeFlowWithPost, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
18406
+ }
18407
+ else {
18408
+ // Create authorize request url
18409
+ const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
18410
+ // Navigate the iframe to the authorize request url
18411
+ await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
18412
+ }
18413
+ responseString = await responsePromise;
17814
18414
  }
17815
- else {
17816
- // Create authorize request url
17817
- const navigateUrl = await invokeAsync(getAuthCodeRequestUrl, GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)(this.config, authClient.authority, silentRequest, this.logger, this.performanceClient);
17818
- // Navigate the iframe to the authorize request url
17819
- await invokeAsync(initiateCodeRequest, SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(iframe, navigateUrl, this.logger, correlationId);
18415
+ finally {
18416
+ invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
17820
18417
  }
17821
- responseString = await responsePromise;
18418
+ const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
18419
+ return { serverParams, pkceCodes, silentRequest };
17822
18420
  }
17823
- finally {
17824
- invoke(removeHiddenIframe, RemoveHiddenIframe, this.logger, this.performanceClient, correlationId)(iframe);
18421
+ catch (e) {
18422
+ await removeTokenBindingKeyOnFailure(silentRequest, this.tokenBindingKeyManager, this.logger, this.performanceClient);
18423
+ throw e;
17825
18424
  }
17826
- const serverParams = invoke(deserializeResponse, DeserializeResponse, this.logger, this.performanceClient, correlationId)(responseString, responseType, this.logger, this.correlationId);
17827
- return { serverParams, pkceCodes, silentRequest };
17828
18425
  }
17829
18426
  async waitForIframeResponse(iframe, request) {
17830
18427
  if (this.waitForIframeResponseHook) {
@@ -18097,7 +18694,6 @@
18097
18694
  : undefined,
18098
18695
  extraParameters: canonicalizeStringDict(request.extraParameters),
18099
18696
  extraQueryParameters: canonicalizeStringDict(request.extraQueryParameters),
18100
- extraParametersNoCache: canonicalizeStringDict(request.extraParametersNoCache),
18101
18697
  forceRefresh: !!request.forceRefresh,
18102
18698
  cacheLookupPolicy: request.cacheLookupPolicy ?? CacheLookupPolicy.Default,
18103
18699
  });
@@ -18106,8 +18702,12 @@
18106
18702
  * Copies caller-owned mutable inputs before asynchronous broker initialization.
18107
18703
  */
18108
18704
  function snapshotPlatformSilentRequest(request) {
18109
- return {
18705
+ const snapshot = {
18110
18706
  ...request,
18707
+ };
18708
+ delete snapshot.extraParametersNoCache;
18709
+ return {
18710
+ ...snapshot,
18111
18711
  scopes: [...(request.scopes || [])],
18112
18712
  account: { ...request.account },
18113
18713
  azureCloudOptions: request.azureCloudOptions
@@ -18119,9 +18719,6 @@
18119
18719
  extraQueryParameters: request.extraQueryParameters
18120
18720
  ? { ...request.extraQueryParameters }
18121
18721
  : undefined,
18122
- extraParametersNoCache: request.extraParametersNoCache
18123
- ? { ...request.extraParametersNoCache }
18124
- : undefined,
18125
18722
  attributeTokens: request.attributeTokens
18126
18723
  ? [...request.attributeTokens]
18127
18724
  : undefined,
@@ -18486,8 +19083,9 @@
18486
19083
  let result;
18487
19084
  const platformAuthProvider = this.platformAuthProvider;
18488
19085
  if (this.canUsePlatformBroker(request) && platformAuthProvider) {
19086
+ const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
18489
19087
  const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, platformAuthProvider, this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
18490
- result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(request, atrMeasurement).catch((e) => {
19088
+ result = invokeAsync(nativeClient.acquireTokenRedirect.bind(nativeClient), NativeInteractionClientAcquireTokenRedirect, this.logger, this.performanceClient, correlationId)(nativeRequest, atrMeasurement).catch((e) => {
18491
19089
  if (e instanceof NativeAuthError &&
18492
19090
  isFatalNativeAuthError(e)) {
18493
19091
  this.platformAuthProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt platform broker calls
@@ -19032,6 +19630,13 @@
19032
19630
  const correlationId = this.getRequestCorrelationId(logoutRequest);
19033
19631
  redirectPreflightCheck(this.initialized, this.config);
19034
19632
  this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
19633
+ try {
19634
+ await this.clearNativeCache(logoutRequest?.account, correlationId);
19635
+ }
19636
+ catch (error) {
19637
+ this.browserStorage.setInteractionInProgress(false);
19638
+ throw error;
19639
+ }
19035
19640
  const redirectClient = this.createRedirectClient(correlationId);
19036
19641
  return redirectClient.logout(logoutRequest);
19037
19642
  }
@@ -19045,7 +19650,11 @@
19045
19650
  preflightCheck$1(this.initialized);
19046
19651
  this.browserStorage.setInteractionInProgress(true, INTERACTION_TYPE.SIGNOUT);
19047
19652
  const popupClient = this.createPopupClient(correlationId);
19048
- return popupClient.logout(logoutRequest).finally(() => {
19653
+ const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
19654
+ const popupLogout = popupClient.logout(logoutRequest);
19655
+ return Promise.all([nativeCacheClear, popupLogout])
19656
+ .then(() => undefined)
19657
+ .finally(() => {
19049
19658
  this.browserStorage.setInteractionInProgress(false);
19050
19659
  });
19051
19660
  }
@@ -19064,7 +19673,30 @@
19064
19673
  }
19065
19674
  const correlationId = this.getRequestCorrelationId(logoutRequest);
19066
19675
  const cacheClient = this.createSilentCacheClient(correlationId);
19067
- return cacheClient.logout(logoutRequest);
19676
+ const nativeCacheClear = this.clearNativeCache(logoutRequest?.account, correlationId);
19677
+ const browserCacheClear = cacheClient.logout(logoutRequest);
19678
+ await Promise.all([nativeCacheClear, browserCacheClear]);
19679
+ }
19680
+ async clearNativeCache(account, correlationId) {
19681
+ const homeAccountId = account?.homeAccountId.toLowerCase();
19682
+ const environment = account?.environment.toLowerCase();
19683
+ const accessTokenKeys = this.nativeInternalStorage
19684
+ .getTokenKeys()
19685
+ .accessToken.filter((key) => {
19686
+ if (!account) {
19687
+ return true;
19688
+ }
19689
+ const accessToken = this.nativeInternalStorage.getAccessTokenCredential(key, correlationId);
19690
+ if (!accessToken) {
19691
+ return false;
19692
+ }
19693
+ return (accessToken.homeAccountId.toLowerCase() === homeAccountId &&
19694
+ accessToken.environment.toLowerCase() === environment);
19695
+ });
19696
+ await Promise.all(accessTokenKeys.map((key) => this.nativeInternalStorage.removeAccessTokenAndTokenBindingKey(key, correlationId)));
19697
+ if (!account) {
19698
+ this.nativeInternalStorage.clear(correlationId);
19699
+ }
19068
19700
  }
19069
19701
  // #endregion
19070
19702
  // #region Account APIs
@@ -19146,6 +19778,19 @@
19146
19778
  }
19147
19779
  }
19148
19780
  // #region Helpers
19781
+ /**
19782
+ * Removes internal DPoP key state from application-originated broker requests.
19783
+ */
19784
+ sanitizeNativeBrokerRequest(request, correlationId) {
19785
+ if (!request.dpopJkt) {
19786
+ return request;
19787
+ }
19788
+ this.logger.warning("0rh2us", correlationId);
19789
+ return {
19790
+ ...request,
19791
+ dpopJkt: undefined,
19792
+ };
19793
+ }
19149
19794
  /**
19150
19795
  * Acquire a token from native device (e.g. WAM)
19151
19796
  * @param request
@@ -19165,7 +19810,8 @@
19165
19810
  throw createBrowserAuthError(nativeConnectionNotEstablished, correlationId);
19166
19811
  }
19167
19812
  const nativeClient = new PlatformAuthInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.platformAuthProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, correlationId, this.tokenBindingKeyManager);
19168
- return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(request, cacheLookupPolicy);
19813
+ const nativeRequest = this.sanitizeNativeBrokerRequest(request, correlationId);
19814
+ return invokeAsync(nativeClient.acquireToken.bind(nativeClient), NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)(nativeRequest, cacheLookupPolicy);
19169
19815
  }
19170
19816
  /**
19171
19817
  * Returns boolean indicating if this request can use the platform broker
@@ -19445,14 +20091,23 @@
19445
20091
  correlationId,
19446
20092
  config: this.config,
19447
20093
  }, this.platformAuthProvider, this.logger, this.performanceClient);
19448
- const inProgressRequest = this.activeSilentTokenRequests.get(preparedRequest.key);
20094
+ const shouldDeduplicate = preparedRequest.request.authenticationScheme !==
20095
+ AuthenticationScheme$1.DPOP;
20096
+ const inProgressRequest = shouldDeduplicate
20097
+ ? this.activeSilentTokenRequests.get(preparedRequest.key)
20098
+ : undefined;
19449
20099
  if (typeof inProgressRequest === "undefined") {
19450
- this.logger.verbose("0fcjbk", correlationId);
20100
+ this.logger.verbose(shouldDeduplicate
20101
+ ? "0fcjbk"
20102
+ : "acquireTokenSilent called for DPoP request, starting an independent operation", correlationId);
19451
20103
  this.performanceClient.addFields({ deduped: false }, correlationId);
19452
20104
  const activeRequest = invokeAsync(this.acquireTokenSilentAsync.bind(this), AcquireTokenSilentAsync, this.logger, this.performanceClient, correlationId)({
19453
20105
  ...preparedRequest.request,
19454
20106
  correlationId,
19455
20107
  }, preparedRequest.account);
20108
+ if (!shouldDeduplicate) {
20109
+ return activeRequest;
20110
+ }
19456
20111
  this.activeSilentTokenRequests.set(preparedRequest.key, activeRequest);
19457
20112
  return activeRequest.finally(() => {
19458
20113
  this.activeSilentTokenRequests.delete(preparedRequest.key);