@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,23 +1,25 @@
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
- import { ServerTelemetryManager, AADServerParamKeys, TimeUtils, invokeAsync, AuthError, ScopeSet, createClientAuthError, ClientAuthErrorCodes, AuthToken, updateAccountTenantProfileData, UrlString, buildAccountToCache, AccountEntityUtils, AuthorityType, Constants, PopTokenGenerator, CacheHelpers, RequestParameterBuilder, PerformanceEvents } from '@azure/msal-common/browser';
4
- import { createPlatformAuthExtraParametersNoCache, isProofOfPossessionTokenType } from '../broker/nativeBroker/PlatformAuthRequest.mjs';
3
+ import { ServerTelemetryManager, AADServerParamKeys, TimeUtils, invokeAsync, AuthError, ScopeSet, Constants, createClientAuthError, ClientAuthErrorCodes, AuthToken, updateAccountTenantProfileData, UrlString, buildAccountToCache, AccountEntityUtils, AuthorityType, PopTokenGenerator, CacheHelpers, RequestParameterBuilder, PerformanceEvents, createClientConfigurationError, ClientConfigurationErrorCodes, normalizeDpopResourceRequestContext, createAuthError, AuthErrorCodes, JsonWebTokenAlgorithms, DpopProofGenerator } from '@azure/msal-common/browser';
4
+ import { createPlatformAuthExtraParametersNoCache, PlatformAuthBindingPreference, PlatformAuthTokenType, PlatformAuthEnclave } from '../broker/nativeBroker/PlatformAuthRequest.mjs';
5
5
  import { base64Decode } from '../encode/Base64Decode.mjs';
6
6
  import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
7
7
  import { NativeAuthError, isFatalNativeAuthError, createNativeAuthError } from '../error/NativeAuthError.mjs';
8
8
  import { version } from '../packageMetadata.mjs';
9
- import { NativeInteractionClientAcquireToken, PlatformAuthInteractionClientInitializeRequest, PlatformAuthHandleNativeResponse, NativeGenerateAuthResult, PlatformAuthCacheAccount, PlatformAuthCacheNativeTokens } from '../telemetry/BrowserPerformanceEvents.mjs';
9
+ import { isTokenBindingKeyPersistedForRedirect } from '../request/RequestHelpers.mjs';
10
+ import { NativeInteractionClientAcquireToken, PlatformAuthInteractionClientInitializeRequest, PlatformAuthHandleNativeResponse, NativeGenerateAuthResult, PlatformAuthCacheAccount, PlatformAuthCacheNativeTokens, PlatformAuthDpopKeyCleanup } from '../telemetry/BrowserPerformanceEvents.mjs';
10
11
  import { BrowserConstants, CacheLookupPolicy, TemporaryCacheKeys, ApiId, PlatformAuthConstants } from '../utils/BrowserConstants.mjs';
11
12
  import { getCurrentUri } from '../utils/BrowserUtils.mjs';
12
13
  import { BaseInteractionClient, initializeServerTelemetryManager, getRedirectUri, getDiscoveredAuthority } from './BaseInteractionClient.mjs';
13
14
  import { SilentCacheClient } from './SilentCacheClient.mjs';
14
- import { invalidPopTokenRequest, nativePromptNotSupported } from '../error/BrowserAuthErrorCodes.mjs';
15
+ import { nativePromptNotSupported } from '../error/BrowserAuthErrorCodes.mjs';
15
16
  import { userSwitch } from '../error/NativeAuthErrorCodes.mjs';
16
17
 
17
18
  /*
18
19
  * Copyright (c) Microsoft Corporation. All rights reserved.
19
20
  * Licensed under the MIT License.
20
21
  */
22
+ const DPOP_POP_KID_NOT_SUPPORTED = "dpop_pop_kid_not_supported";
21
23
  class PlatformAuthInteractionClient extends BaseInteractionClient {
22
24
  constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId, tokenBindingKeyManager) {
23
25
  super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId, provider, tokenBindingKeyManager);
@@ -76,17 +78,9 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
76
78
  throw e;
77
79
  }
78
80
  // check if the tokens can be retrieved from internal cache
81
+ let cachedResult;
79
82
  try {
80
- const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);
81
- // Served from the native internal cache; token did not come directly from the broker
82
- nativeATMeasurement.add({
83
- isNativeBroker: false,
84
- });
85
- nativeATMeasurement.end({
86
- success: true,
87
- fromCache: true,
88
- });
89
- return result;
83
+ cachedResult = await this.acquireTokensFromCache(this.accountId, nativeRequest);
90
84
  }
91
85
  catch (e) {
92
86
  if (cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
@@ -97,13 +91,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
97
91
  nativeATMeasurement.end({
98
92
  success: false,
99
93
  });
94
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
100
95
  throw e;
101
96
  }
102
97
  // continue with a native call for any and all errors
103
98
  this.logger.info("0957j1", this.correlationId);
104
99
  }
100
+ if (cachedResult) {
101
+ // Served from the native internal cache; token did not come directly from the broker
102
+ nativeATMeasurement.add({
103
+ isNativeBroker: false,
104
+ });
105
+ nativeATMeasurement.end({
106
+ success: true,
107
+ fromCache: true,
108
+ });
109
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
110
+ return cachedResult;
111
+ }
105
112
  // dispatch the request to the broker
106
113
  try {
114
+ await this.prepareDpopBrokerRequest(nativeRequest);
115
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
107
116
  const validatedResponse = await this.platformAuthProvider.sendMessage(nativeRequest);
108
117
  const result = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(validatedResponse, nativeRequest, reqTimestamp, request.storeInCache);
109
118
  nativeATMeasurement.end({
@@ -121,6 +130,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
121
130
  success: false,
122
131
  }, e);
123
132
  this.setBrokerErrorTelemetry(e);
133
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
124
134
  throw e;
125
135
  }
126
136
  }
@@ -155,6 +165,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
155
165
  scopes: ScopeSet.fromString(request.scope, this.correlationId).asArray(),
156
166
  account: cachedAccount,
157
167
  forceRefresh: false,
168
+ ...this.createSilentCacheTokenBindingParameters(request),
158
169
  resource: request.extraParameters?.resource,
159
170
  };
160
171
  // Preserve FMI partition semantics for silent cache filtering.
@@ -163,6 +174,29 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
163
174
  }
164
175
  return silentRequest;
165
176
  }
177
+ /**
178
+ * Maps platform-broker token-binding state to silent-cache request fields.
179
+ * @param request
180
+ */
181
+ createSilentCacheTokenBindingParameters(request) {
182
+ const authenticationScheme = this.isDpopBrokerRequest(request)
183
+ ? Constants.AuthenticationScheme.DPOP
184
+ : request.tokenType;
185
+ if (authenticationScheme !== Constants.AuthenticationScheme.DPOP &&
186
+ authenticationScheme !== Constants.AuthenticationScheme.POP) {
187
+ return { authenticationScheme };
188
+ }
189
+ return {
190
+ authenticationScheme,
191
+ ...(authenticationScheme === Constants.AuthenticationScheme.DPOP &&
192
+ request.keyId && { dpopJkt: request.keyId }),
193
+ ...(authenticationScheme === Constants.AuthenticationScheme.POP &&
194
+ request.signPopToken === false &&
195
+ request.keyId && { popKid: request.keyId }),
196
+ resourceRequestMethod: request.resourceRequestMethod,
197
+ resourceRequestUri: request.resourceRequestUri,
198
+ };
199
+ }
166
200
  /**
167
201
  * Fetches the tokens from the cache if un-expired
168
202
  * @param nativeAccountId
@@ -211,10 +245,22 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
211
245
  const nativeRequest = await invokeAsync(this.initializePlatformRequest.bind(this), PlatformAuthInteractionClientInitializeRequest, this.logger, this.performanceClient, this.correlationId)(request);
212
246
  const navigateToLoginRequestUrl = options?.navigateToLoginRequestUrl ?? true;
213
247
  try {
214
- await this.platformAuthProvider.sendMessage(nativeRequest);
248
+ await this.prepareDpopBrokerRequest(nativeRequest);
249
+ this.addDpopBrokerAttemptTelemetry(nativeRequest);
250
+ const response = await this.platformAuthProvider.sendMessage(nativeRequest);
251
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, nativeRequest);
252
+ if (dpopBrokerOutcome === "L3") {
253
+ await this.resetGeneratedDpopRequestKey(nativeRequest);
254
+ }
215
255
  }
216
256
  catch (e) {
217
- // Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
257
+ /*
258
+ * Raw persistent/transient broker errors are retrieved again in
259
+ * phase two. Availability errors are thrown for controller-managed
260
+ * web fallback, while translated cancellation, network, and
261
+ * interaction-required errors are surfaced without being swallowed.
262
+ */
263
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
218
264
  if (e instanceof NativeAuthError) {
219
265
  const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
220
266
  serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
@@ -229,6 +275,16 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
229
275
  throw e;
230
276
  }
231
277
  }
278
+ else if (this.isDpopBrokerRequest(nativeRequest)) {
279
+ throw e;
280
+ }
281
+ }
282
+ try {
283
+ await this.ensureRedirectDpopKeyIsPersisted(nativeRequest);
284
+ }
285
+ catch (e) {
286
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
287
+ throw e;
232
288
  }
233
289
  this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify({
234
290
  ...nativeRequest,
@@ -243,7 +299,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
243
299
  ? UrlString.getAbsoluteUrl(request.redirectStartPage || window.location.href, getCurrentUri(), this.correlationId)
244
300
  : getRedirectUri(request.redirectUri, this.config.auth.redirectUri, this.logger, this.correlationId);
245
301
  rootMeasurement.end({ success: true });
246
- await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
302
+ try {
303
+ await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
304
+ }
305
+ catch (e) {
306
+ this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
307
+ await this.resetGeneratedDpopRequestKeyBestEffort(nativeRequest);
308
+ throw e;
309
+ }
247
310
  }
248
311
  /**
249
312
  * If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
@@ -276,6 +339,8 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
276
339
  this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
277
340
  const reqTimestamp = TimeUtils.nowSeconds();
278
341
  try {
342
+ await this.prepareDpopBrokerRequest(request, true);
343
+ this.addDpopBrokerAttemptTelemetry(request);
279
344
  this.logger.verbose("003x5a", this.correlationId);
280
345
  const response = await this.platformAuthProvider.sendMessage(request);
281
346
  const authResult = await invokeAsync(this.handleNativeResponse.bind(this), PlatformAuthHandleNativeResponse, this.logger, this.performanceClient, this.correlationId)(response, request, reqTimestamp, storeInCache);
@@ -284,7 +349,12 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
284
349
  return authResult;
285
350
  }
286
351
  catch (e) {
352
+ if (e instanceof NativeAuthError) {
353
+ const serverTelemetryManager = initializeServerTelemetryManager(this.apiId, this.config.auth.clientId, this.correlationId, this.browserStorage, this.logger, undefined, this.config.system.serverTelemetryEnabled);
354
+ serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
355
+ }
287
356
  this.setBrokerErrorTelemetry(e);
357
+ await this.resetGeneratedDpopRequestKeyBestEffort(request);
288
358
  throw e;
289
359
  }
290
360
  }
@@ -304,6 +374,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
304
374
  */
305
375
  async handleNativeResponse(response, request, reqTimestamp, storeInCache) {
306
376
  this.logger.trace("1bojln", this.correlationId);
377
+ const dpopBrokerOutcome = this.validateDpopBrokerOutcome(response, request);
307
378
  // generate identifiers
308
379
  const idTokenClaims = AuthToken.extractTokenClaims(response.id_token, base64Decode, this.correlationId);
309
380
  const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
@@ -329,10 +400,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
329
400
  response.expires_in = Number(response.expires_in);
330
401
  // generate authenticationResult
331
402
  const result = await invokeAsync(this.generateAuthenticationResult.bind(this), NativeGenerateAuthResult, this.logger, this.performanceClient, this.correlationId)(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
403
+ const isL3DpopResponse = dpopBrokerOutcome === "L3";
332
404
  // cache accounts and tokens in the appropriate storage
333
- await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, AuthToken.isKmsi(idTokenClaims));
405
+ const shouldRemoveGeneratedDpopKey = isL3DpopResponse ||
406
+ (this.isDpopBrokerRequest(request) &&
407
+ storeInCache?.accessToken === false);
408
+ if (shouldRemoveGeneratedDpopKey) {
409
+ await this.resetGeneratedDpopRequestKey(request);
410
+ }
411
+ await invokeAsync(this.cacheAccount.bind(this), PlatformAuthCacheAccount, this.logger, this.performanceClient, this.correlationId)(baseAccount, AuthToken.isKmsi(idTokenClaims), !isL3DpopResponse);
334
412
  await invokeAsync(this.cacheNativeTokens.bind(this), PlatformAuthCacheNativeTokens, this.logger, this.performanceClient, this.correlationId)(response, request, homeAccountIdentifier, idTokenClaims, result.tenantId, reqTimestamp, authority.getPreferredCache(), // environment
335
- storeInCache);
413
+ storeInCache, dpopBrokerOutcome);
336
414
  return result;
337
415
  }
338
416
  /**
@@ -408,7 +486,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
408
486
  */
409
487
  async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
410
488
  // Add Native Broker fields to Telemetry
411
- const mats = this.addTelemetryFromNativeResponse(response.properties.MATS);
489
+ const mats = this.addTelemetryFromNativeResponse(response.properties?.MATS);
412
490
  // If scopes not returned in server response, use request scopes
413
491
  const responseScopes = this.generateScopes(request.scope, response.scope);
414
492
  const accountProperties = response.account.properties || {};
@@ -434,9 +512,17 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
434
512
  }
435
513
  // generate PoP token as needed
436
514
  const responseAccessToken = await this.generatePopAccessToken(response, request);
437
- const tokenType = request.tokenType === Constants.AuthenticationScheme.POP
438
- ? Constants.AuthenticationScheme.POP
439
- : Constants.AuthenticationScheme.BEARER;
515
+ const isDpopRequest = this.isDpopBrokerRequest(request);
516
+ let tokenType = Constants.AuthenticationScheme.BEARER;
517
+ if (isDpopRequest) {
518
+ tokenType = Constants.AuthenticationScheme.DPOP;
519
+ }
520
+ else if (request.tokenType === Constants.AuthenticationScheme.POP) {
521
+ tokenType = Constants.AuthenticationScheme.POP;
522
+ }
523
+ const dpopProof = isDpopRequest
524
+ ? await this.generateDpopProof(response, request)
525
+ : undefined;
440
526
  const result = {
441
527
  authority: authority,
442
528
  uniqueId: uid,
@@ -450,6 +536,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
450
536
  // Request timestamp and NativeResponse expires_in are in seconds, converting to Date for AuthenticationResult
451
537
  expiresOn: TimeUtils.toDateFromSeconds(reqTimestamp + response.expires_in),
452
538
  tokenType: tokenType,
539
+ dpopProof,
453
540
  correlationId: this.correlationId,
454
541
  state: response.state,
455
542
  fromPlatformBroker: true,
@@ -463,11 +550,13 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
463
550
  * cache the account entity in browser storage
464
551
  * @param accountEntity
465
552
  */
466
- async cacheAccount(accountEntity, kmsi) {
553
+ async cacheAccount(accountEntity, kmsi, clearExistingTokens = true) {
467
554
  // Store the account info and hence `nativeAccountId` in browser cache
468
555
  await this.browserStorage.setAccount(accountEntity, this.correlationId, kmsi, this.apiId);
469
556
  // Remove any existing cached tokens for this account in browser storage
470
- this.browserStorage.removeAccountContext(AccountEntityUtils.getAccountInfo(accountEntity), this.correlationId);
557
+ if (clearExistingTokens) {
558
+ this.browserStorage.removeAccountContext(AccountEntityUtils.getAccountInfo(accountEntity), this.correlationId);
559
+ }
471
560
  }
472
561
  /**
473
562
  * Stores the access_token and id_token in inmemory storage
@@ -479,8 +568,18 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
479
568
  * @param tenantId
480
569
  * @param reqTimestamp
481
570
  */
482
- async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache) {
571
+ async cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, tenantId, reqTimestamp, environment, storeInCache, dpopBrokerOutcome = "none") {
483
572
  const cachedIdToken = CacheHelpers.createIdTokenEntity(homeAccountIdentifier, environment, response.id_token || "", request.clientId, idTokenClaims.tid || "");
573
+ // save idtoken credential in configured browser storage
574
+ if (!!cachedIdToken && storeInCache?.idToken !== false) {
575
+ await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, AuthToken.isKmsi(idTokenClaims));
576
+ }
577
+ if (dpopBrokerOutcome === "L3") {
578
+ return;
579
+ }
580
+ if (storeInCache?.accessToken === false) {
581
+ return;
582
+ }
484
583
  // cache accessToken in inmemory storage
485
584
  const expiresIn = request.tokenType === Constants.AuthenticationScheme.POP
486
585
  ? Constants.SHR_NONCE_VALIDITY
@@ -490,18 +589,14 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
490
589
  const tokenExpirationSeconds = reqTimestamp + expiresIn;
491
590
  const responseScopes = this.generateScopes(response.scope, request.scope);
492
591
  const additionalCacheKeyComponents = request.attributeTokens
493
- ? {
494
- attribute_tokens: request.attributeTokens,
495
- }
592
+ ? { attribute_tokens: request.attributeTokens }
496
593
  : undefined;
497
- const cachedAccessToken = CacheHelpers.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);
594
+ const cachedAccessToken = CacheHelpers.createAccessTokenEntity(homeAccountIdentifier, environment, response.access_token, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, request.correlationId, undefined, this.isDpopBrokerRequest(request)
595
+ ? Constants.AuthenticationScheme.DPOP
596
+ : request.tokenType, undefined, request.keyId, additionalCacheKeyComponents);
498
597
  if (request.extraParameters?.resource) {
499
598
  cachedAccessToken.resource = request.extraParameters.resource;
500
599
  }
501
- // save idtoken credential in configured browser storage
502
- if (!!cachedIdToken && storeInCache?.idToken !== false) {
503
- await this.browserStorage.setIdTokenCredential(cachedIdToken, this.correlationId, AuthToken.isKmsi(idTokenClaims));
504
- }
505
600
  // save access token credential in memory storage
506
601
  const nativeCacheRecord = {
507
602
  accessToken: cachedAccessToken,
@@ -578,11 +673,7 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
578
673
  const configClaims = request.skipBrokerClaims && !!request.embeddedClientId
579
674
  ? undefined
580
675
  : this.config.auth.clientCapabilities;
581
- /*
582
- * 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.
583
- * attributeTokens is destructured out because PlatformAuthRequest represents it as a pre-serialized string, not the caller-provided Array<string>.
584
- */
585
- const { scopes, claims, extraParametersNoCache, dpopNonce } = request;
676
+ const { scopes, claims, dpopNonce } = request;
586
677
  const scopeSet = new ScopeSet([...(scopes || []), ...Constants.OIDC_DEFAULT_SCOPES], this.correlationId);
587
678
  const mergedClaims = RequestParameterBuilder.buildMergedClaims(claims, configClaims?.length ? configClaims : undefined);
588
679
  const hasAttributeTokens = !!request.attributeTokens?.length;
@@ -606,57 +697,391 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
606
697
  loginHint: request.loginHint,
607
698
  extraParameters: {
608
699
  ...request.extraParameters,
609
- ...(request.resource && { resource: request.resource }), // resource is set for MCP scenarios
700
+ // Native broker resource is set for MCP scenarios.
701
+ ...(request.resource && { resource: request.resource }),
610
702
  },
611
703
  extendedExpiryToken: false,
612
704
  keyId: request.popKid,
613
- resourceRequestMethod: request.resourceRequestMethod,
614
- resourceRequestUri: request.resourceRequestUri,
615
- shrClaims: request.shrClaims,
616
- shrNonce: request.shrNonce,
617
- extraParametersNoCache: createPlatformAuthExtraParametersNoCache(extraParametersNoCache, isProofOfPossessionTokenType(request.authenticationScheme), request.resourceRequestMethod, request.resourceRequestUri, dpopNonce),
618
705
  };
619
706
  if (hasAttributeTokens) {
620
707
  validatedRequest.attributeTokens =
621
708
  CacheHelpers.serializeAttributeTokens(request.attributeTokens);
622
709
  }
623
- // Check for PoP token requests: signPopToken should only be set to true if popKid is not set
624
- if (validatedRequest.signPopToken && !!request.popKid) {
625
- throw createBrowserAuthError(invalidPopTokenRequest, this.correlationId);
626
- }
627
710
  this.handleExtraBrokerParams(validatedRequest, request.embeddedClientId);
628
711
  validatedRequest.extraParameters =
629
712
  validatedRequest.extraParameters || {};
630
713
  validatedRequest.extraParameters.telemetry =
631
714
  PlatformAuthConstants.MATS_TELEMETRY;
632
715
  if (request.authenticationScheme === Constants.AuthenticationScheme.POP) {
633
- // add POP request type
634
716
  const shrParameters = {
635
- resourceRequestUri: request.resourceRequestUri,
636
717
  resourceRequestMethod: request.resourceRequestMethod,
718
+ resourceRequestUri: request.resourceRequestUri,
637
719
  shrClaims: request.shrClaims,
638
720
  shrNonce: request.shrNonce,
639
721
  correlationId: this.correlationId,
640
722
  };
641
723
  const popTokenGenerator = new PopTokenGenerator(this.browserCrypto, this.tokenBindingKeyManager, this.performanceClient);
642
- // generate reqCnf if not provided in the request
643
- let reqCnfData;
644
724
  if (!validatedRequest.keyId) {
645
725
  const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, this.correlationId)(shrParameters, this.logger);
646
- reqCnfData = generatedReqCnfData.reqCnfString;
726
+ validatedRequest.reqCnf = generatedReqCnfData.reqCnfString;
647
727
  validatedRequest.keyId = generatedReqCnfData.kid;
648
728
  validatedRequest.signPopToken = true;
649
729
  }
650
730
  else {
651
- reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
731
+ validatedRequest.reqCnf = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
652
732
  validatedRequest.signPopToken = false;
653
733
  }
654
- // SPAs require whole string to be passed to broker
655
- validatedRequest.reqCnf = reqCnfData;
734
+ validatedRequest.resourceRequestMethod =
735
+ request.resourceRequestMethod;
736
+ validatedRequest.resourceRequestUri = request.resourceRequestUri;
737
+ validatedRequest.shrClaims = request.shrClaims;
738
+ validatedRequest.shrNonce = request.shrNonce;
739
+ }
740
+ else if (request.authenticationScheme === Constants.AuthenticationScheme.DPOP) {
741
+ Object.assign(validatedRequest, this.createDpopRequestParameters(request));
656
742
  }
743
+ validatedRequest.extraParametersNoCache =
744
+ createPlatformAuthExtraParametersNoCache(validatedRequest.tokenType, validatedRequest.resourceRequestMethod, validatedRequest.resourceRequestUri, dpopNonce);
657
745
  this.addRequestSKUs(validatedRequest);
658
746
  return validatedRequest;
659
747
  }
748
+ /**
749
+ * Creates and validates the broker-specific parameters for a DPoP request.
750
+ * @param request - Developer-provided token request.
751
+ * @returns Broker parameters for a DPoP token and resource proof.
752
+ */
753
+ createDpopRequestParameters(request) {
754
+ if (request.popKid) {
755
+ throw createBrowserAuthError(DPOP_POP_KID_NOT_SUPPORTED, this.correlationId);
756
+ }
757
+ if (!request.resourceRequestMethod?.trim() ||
758
+ !request.resourceRequestUri?.trim()) {
759
+ throw createClientConfigurationError(ClientConfigurationErrorCodes.dpopMissingResourceContext, this.correlationId);
760
+ }
761
+ const resourceContext = normalizeDpopResourceRequestContext({
762
+ htm: request.resourceRequestMethod,
763
+ htu: request.resourceRequestUri,
764
+ }, this.correlationId);
765
+ return {
766
+ tokenType: PlatformAuthTokenType.DPOP_WITH_PROOF,
767
+ preferBinding: PlatformAuthBindingPreference.ATTESTED,
768
+ keyId: request.dpopJkt,
769
+ resourceRequestMethod: resourceContext.htm,
770
+ resourceRequestUri: resourceContext.htu,
771
+ };
772
+ }
773
+ /**
774
+ * Provisions the local key and confirmation data for a DPoP broker request.
775
+ * @param request - Broker request to prepare.
776
+ * @param reuseExistingKey - Whether a complete existing key binding may be reused.
777
+ */
778
+ async prepareDpopBrokerRequest(request, reuseExistingKey = false) {
779
+ if (request.tokenType !== PlatformAuthTokenType.DPOP_WITH_PROOF) {
780
+ return;
781
+ }
782
+ /*
783
+ * Phase one clears both fields after an L3 response or non-fatal broker
784
+ * error. In that case phase two must provision a replacement. If either
785
+ * field remains, treat it as a retained binding and validate it fully.
786
+ */
787
+ if (reuseExistingKey && (request.keyId || request.reqCnf)) {
788
+ if (!request.keyId || !request.reqCnf) {
789
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key binding is incomplete after redirect.");
790
+ }
791
+ const expectedReqCnf = this.createDpopBrokerReqCnf(request.keyId);
792
+ if (request.reqCnf !== expectedReqCnf) {
793
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key binding is invalid after redirect.");
794
+ }
795
+ const hasKey = this.tokenBindingKeyManager.hasTokenBindingKey !== undefined
796
+ ? await this.tokenBindingKeyManager.hasTokenBindingKey(request.keyId, this.correlationId)
797
+ : await this.tokenBindingKeyManager
798
+ .getTokenBindingPublicKeyJwk(request.keyId, this.correlationId)
799
+ .then(() => true, () => false);
800
+ if (!hasKey) {
801
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key is unavailable after redirect.");
802
+ }
803
+ return;
804
+ }
805
+ if (request.reqCnf) {
806
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "Unexpected preexisting DPoP request key.");
807
+ }
808
+ if (!request.keyId) {
809
+ request.keyId =
810
+ await this.tokenBindingKeyManager.provisionTokenBindingKey({
811
+ tokenBindingKeyType: Constants.AuthenticationScheme.DPOP.toLowerCase(),
812
+ tokenBindingKeyAlgorithm: JsonWebTokenAlgorithms.ES256,
813
+ correlationId: this.correlationId,
814
+ });
815
+ }
816
+ request.reqCnf = this.createDpopBrokerReqCnf(request.keyId);
817
+ }
818
+ /**
819
+ * Creates the confirmation claim for an MSAL-owned broker DPoP key.
820
+ * @param keyId - Browser-managed DPoP key identifier.
821
+ * @returns Encoded broker confirmation claim.
822
+ */
823
+ createDpopBrokerReqCnf(keyId) {
824
+ return this.browserCrypto.base64UrlEncode(JSON.stringify({
825
+ kid: keyId,
826
+ xms_ksl: PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION,
827
+ }));
828
+ }
829
+ /**
830
+ * Ensures an owned DPoP key can survive redirect navigation before the
831
+ * request metadata is persisted for phase two.
832
+ */
833
+ async ensureRedirectDpopKeyIsPersisted(request) {
834
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
835
+ return;
836
+ }
837
+ if (!(await isTokenBindingKeyPersistedForRedirect(request, this.tokenBindingKeyManager))) {
838
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "DPoP request key could not be persisted for redirect.");
839
+ }
840
+ }
841
+ /**
842
+ * Validates and normalizes the DPoP binding outcome returned by the broker.
843
+ * @param response - Broker response to validate.
844
+ * @param request - Broker request associated with the response.
845
+ * @returns The validated DPoP binding level, or `none` for non-DPoP requests.
846
+ */
847
+ validateDpopBrokerOutcome(response, request) {
848
+ const isDpopRequest = this.isDpopBrokerRequest(request);
849
+ const normalizedResponse = this.normalizeDpopBrokerResponse(response);
850
+ const normalizedRequestTokenType = request.tokenType
851
+ ?.trim()
852
+ .toLowerCase();
853
+ const bindingPreferenceSent = request.bindingPreferenceSent ??
854
+ request.preferBinding !== undefined;
855
+ const hasDpopResponse = this.isDpopBrokerTokenType(normalizedResponse.tokenType) ||
856
+ normalizedResponse.proof !== undefined ||
857
+ normalizedResponse.hasBindingAttested;
858
+ if (!isDpopRequest) {
859
+ if (hasDpopResponse) {
860
+ this.throwInvalidDpopResponse("unexpected_response", "Unexpected DPoP broker response.");
861
+ }
862
+ return "none";
863
+ }
864
+ if (!this.isDpopBrokerTokenType(normalizedResponse.tokenType)) {
865
+ this.throwInvalidDpopResponse("unknown_token_type", "Unknown DPoP broker response.");
866
+ }
867
+ this.validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent);
868
+ if (normalizedResponse.tokenType ===
869
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
870
+ return this.validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse);
871
+ }
872
+ return this.validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent);
873
+ }
874
+ /**
875
+ * Normalizes the canonical DPoP fields returned under response properties.
876
+ */
877
+ normalizeDpopBrokerResponse(response) {
878
+ const responseProperties = response.properties;
879
+ const rawTokenType = responseProperties?.token_type;
880
+ const tokenType = typeof rawTokenType === "string"
881
+ ? rawTokenType.trim().toLowerCase()
882
+ : undefined;
883
+ const rawBindingAttested = responseProperties?.binding_attested;
884
+ let bindingAttested;
885
+ if (typeof rawBindingAttested === "string") {
886
+ const normalizedBindingAttested = rawBindingAttested
887
+ .trim()
888
+ .toLowerCase();
889
+ if (normalizedBindingAttested === "true") {
890
+ bindingAttested = true;
891
+ }
892
+ else if (normalizedBindingAttested === "false") {
893
+ bindingAttested = false;
894
+ }
895
+ }
896
+ return {
897
+ tokenType,
898
+ proof: responseProperties?.DPoP,
899
+ bindingAttested,
900
+ hasBindingAttested: rawBindingAttested !== undefined,
901
+ hasMalformedBindingAttested: rawBindingAttested !== undefined &&
902
+ bindingAttested === undefined,
903
+ };
904
+ }
905
+ /**
906
+ * Validates normalized fields shared by L1 and L3 broker DPoP responses.
907
+ */
908
+ validateNormalizedDpopBrokerResponse(normalizedResponse, bindingPreferenceSent) {
909
+ if (normalizedResponse.hasMalformedBindingAttested) {
910
+ this.throwInvalidDpopResponse("invalid_attestation", "Conflicting DPoP broker response.");
911
+ }
912
+ if (bindingPreferenceSent &&
913
+ normalizedResponse.bindingAttested === undefined) {
914
+ this.throwInvalidDpopResponse("missing_attestation", "Conflicting DPoP broker response.");
915
+ }
916
+ }
917
+ /**
918
+ * Validates a broker-returned L3 DPoP proof outcome.
919
+ */
920
+ validateDpopBrokerL3Outcome(normalizedRequestTokenType, normalizedResponse) {
921
+ const dpopWithProofTokenType = PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase();
922
+ if (typeof normalizedResponse.proof !== "string" ||
923
+ normalizedResponse.proof.trim().length === 0) {
924
+ this.throwInvalidDpopResponse("missing_proof", "Malformed DPoP broker response.");
925
+ }
926
+ if (normalizedResponse.bindingAttested !== true) {
927
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker response.");
928
+ }
929
+ if (normalizedRequestTokenType !== dpopWithProofTokenType ||
930
+ normalizedResponse.tokenType !== dpopWithProofTokenType) {
931
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker response.");
932
+ }
933
+ this.performanceClient.addFields({
934
+ "ext.brokerDpopOutcome": "l3",
935
+ "ext.brokerDpopBindingLevel": "L3",
936
+ }, this.correlationId);
937
+ return "L3";
938
+ }
939
+ /**
940
+ * Validates an L1 DPoP outcome that MSAL will sign with its local key.
941
+ */
942
+ validateDpopBrokerL1Outcome(request, normalizedRequestTokenType, normalizedResponse, bindingPreferenceSent) {
943
+ if (normalizedResponse.proof !== undefined) {
944
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
945
+ }
946
+ if (normalizedRequestTokenType !==
947
+ PlatformAuthTokenType.DPOP_WITH_PROOF.toLowerCase()) {
948
+ this.throwInvalidDpopResponse("conflicting_fields", "Malformed DPoP broker L1 response.");
949
+ }
950
+ if (normalizedResponse.bindingAttested !== false &&
951
+ !(!bindingPreferenceSent &&
952
+ normalizedResponse.bindingAttested === undefined)) {
953
+ this.throwInvalidDpopResponse("invalid_attestation", "Malformed DPoP broker L1 response.");
954
+ }
955
+ if (!request.reqCnf || !request.keyId) {
956
+ this.throwInvalidDpopResponse("missing_l1_binding", "Malformed DPoP broker L1 response.");
957
+ }
958
+ this.performanceClient.addFields({
959
+ "ext.brokerDpopOutcome": "l1",
960
+ "ext.brokerDpopBindingLevel": "L1",
961
+ }, this.correlationId);
962
+ return "L1";
963
+ }
964
+ /**
965
+ * Emits bounded failure telemetry and rejects an invalid DPoP response.
966
+ */
967
+ throwInvalidDpopResponse(failureReason, message) {
968
+ this.performanceClient.addFields({
969
+ "ext.brokerDpopOutcome": "invalid_response",
970
+ "ext.brokerDpopFailureReason": failureReason,
971
+ }, this.correlationId);
972
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, message);
973
+ }
974
+ /**
975
+ * Returns the broker proof or signs an L1 resource proof with the local key.
976
+ * @param response - Broker response containing the access token and optional proof.
977
+ * @param request - Broker request containing the proof context and local key.
978
+ * @returns The resource proof for the broker access token.
979
+ */
980
+ async generateDpopProof(response, request) {
981
+ const brokerProof = response.properties?.DPoP;
982
+ if (brokerProof !== undefined) {
983
+ return brokerProof;
984
+ }
985
+ const dpopProofGenerator = new DpopProofGenerator(this.browserCrypto, this.tokenBindingKeyManager);
986
+ return dpopProofGenerator.generateResourceProof({
987
+ htu: request.resourceRequestUri,
988
+ htm: request.resourceRequestMethod,
989
+ accessToken: response.access_token,
990
+ nonce: request.extraParametersNoCache?.pop_nonce,
991
+ }, request.keyId, this.correlationId);
992
+ }
993
+ /**
994
+ * Removes a generated DPoP request key and clears its request metadata.
995
+ * @param request - Broker request whose generated key should be removed.
996
+ */
997
+ async resetGeneratedDpopRequestKey(request) {
998
+ if (!this.isDpopBrokerRequest(request) || !request.keyId) {
999
+ return;
1000
+ }
1001
+ const cleanupMeasurement = this.performanceClient.startMeasurement(PlatformAuthDpopKeyCleanup, this.correlationId);
1002
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupAttemptCount": 1 }, this.correlationId);
1003
+ try {
1004
+ if (request.keyId && !(await this.removeDpopKey(request.keyId))) {
1005
+ throw createAuthError(AuthErrorCodes.unexpectedError, this.correlationId, "Failed to remove generated DPoP request key.");
1006
+ }
1007
+ this.performanceClient.addFields({
1008
+ "ext.brokerDpopKeyCleanupOutcome": "succeeded",
1009
+ }, this.correlationId);
1010
+ cleanupMeasurement.end({ success: true });
1011
+ request.keyId = undefined;
1012
+ request.reqCnf = undefined;
1013
+ }
1014
+ catch (error) {
1015
+ this.performanceClient.addFields({
1016
+ "ext.brokerDpopKeyCleanupOutcome": "failed",
1017
+ }, this.correlationId);
1018
+ this.performanceClient.incrementFields({ "ext.brokerDpopKeyCleanupFailureCount": 1 }, this.correlationId);
1019
+ cleanupMeasurement.end({ success: false }, error);
1020
+ throw error;
1021
+ }
1022
+ }
1023
+ /**
1024
+ * Attempts to remove a generated DPoP request key without replacing an
1025
+ * existing operation error with a cleanup failure.
1026
+ * @param request - Broker request whose generated key should be removed.
1027
+ */
1028
+ async resetGeneratedDpopRequestKeyBestEffort(request) {
1029
+ try {
1030
+ await this.resetGeneratedDpopRequestKey(request);
1031
+ }
1032
+ catch {
1033
+ this.logger.error("1kxxak", this.correlationId);
1034
+ this.performanceClient.incrementFields({ removeTokenBindingKeyFailure: 1 }, this.correlationId);
1035
+ request.keyId = undefined;
1036
+ request.reqCnf = undefined;
1037
+ }
1038
+ }
1039
+ /**
1040
+ * Records that a DPoP request is about to be dispatched to the platform broker.
1041
+ * @param request - Broker request about to cross the provider boundary.
1042
+ */
1043
+ addDpopBrokerAttemptTelemetry(request) {
1044
+ if (!this.isDpopBrokerRequest(request)) {
1045
+ return;
1046
+ }
1047
+ this.performanceClient.addFields({
1048
+ "ext.brokerDpopAttempted": 1,
1049
+ }, this.correlationId);
1050
+ }
1051
+ /**
1052
+ * Determines whether a request uses the DPoP broker protocol.
1053
+ * @param request - Broker request to inspect.
1054
+ * @returns Whether the request uses a DPoP token type.
1055
+ */
1056
+ isDpopBrokerRequest(request) {
1057
+ return this.isDpopBrokerTokenType(request.tokenType);
1058
+ }
1059
+ /**
1060
+ * Determines whether a token type represents a DPoP broker request.
1061
+ * @param tokenType - Token type to inspect.
1062
+ * @returns Whether the token type is a supported DPoP broker token type.
1063
+ */
1064
+ isDpopBrokerTokenType(tokenType) {
1065
+ const normalizedTokenType = tokenType?.trim().toLowerCase();
1066
+ return (normalizedTokenType === PlatformAuthTokenType.DPOP_WITH_PROOF ||
1067
+ normalizedTokenType ===
1068
+ Constants.AuthenticationScheme.DPOP.toLowerCase());
1069
+ }
1070
+ /**
1071
+ * Removes a DPoP key while reporting cleanup failures.
1072
+ * @param keyId - Identifier of the DPoP key to remove.
1073
+ * @returns Whether the key was removed successfully.
1074
+ */
1075
+ async removeDpopKey(keyId) {
1076
+ try {
1077
+ await this.tokenBindingKeyManager.removeTokenBindingKey(keyId, this.correlationId);
1078
+ return true;
1079
+ }
1080
+ catch {
1081
+ this.logger.error("1w60e4", this.correlationId);
1082
+ return false;
1083
+ }
1084
+ }
660
1085
  async getCanonicalAuthority(request) {
661
1086
  const requestAuthority = request.authority || this.config.auth.authority;
662
1087
  const { azureCloudOptions, account } = request;
@@ -695,29 +1120,28 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
695
1120
  }
696
1121
  }
697
1122
  /**
698
- * Handles extra broker request parameters
699
- * @param request {PlatformAuthRequest}
700
- * @private
1123
+ * Handles extra broker request parameters.
1124
+ * @param request - Platform broker request.
1125
+ * @param embeddedClientId - Embedded application client identifier.
701
1126
  */
702
1127
  handleExtraBrokerParams(request, embeddedClientId) {
703
- const hasExtraBrokerParams = request.extraParameters &&
704
- request.extraParameters.hasOwnProperty(AADServerParamKeys.BROKER_CLIENT_ID) &&
705
- request.extraParameters.hasOwnProperty(AADServerParamKeys.BROKER_REDIRECT_URI) &&
706
- request.extraParameters.hasOwnProperty(AADServerParamKeys.CLIENT_ID);
1128
+ const hasOwnParameter = (parameter) => Object.prototype.hasOwnProperty.call(request.extraParameters, parameter);
1129
+ const hasExtraBrokerParams = hasOwnParameter(AADServerParamKeys.BROKER_CLIENT_ID) &&
1130
+ hasOwnParameter(AADServerParamKeys.BROKER_REDIRECT_URI) &&
1131
+ hasOwnParameter(AADServerParamKeys.CLIENT_ID);
707
1132
  if (!embeddedClientId && !hasExtraBrokerParams) {
708
1133
  return;
709
1134
  }
710
- let child_client_id = "";
711
- const child_redirect_uri = request.redirectUri;
1135
+ const childRedirectUri = request.redirectUri;
1136
+ const childClientId = embeddedClientId ||
1137
+ request.extraParameters?.[AADServerParamKeys.CLIENT_ID] ||
1138
+ "";
712
1139
  if (embeddedClientId) {
713
1140
  request.redirectUri = this.config.auth.redirectUri;
714
- child_client_id = embeddedClientId;
715
1141
  }
716
1142
  else if (request.extraParameters) {
717
1143
  request.redirectUri =
718
1144
  request.extraParameters[AADServerParamKeys.BROKER_REDIRECT_URI];
719
- child_client_id =
720
- request.extraParameters[AADServerParamKeys.CLIENT_ID];
721
1145
  }
722
1146
  const {
723
1147
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
@@ -728,15 +1152,20 @@ class PlatformAuthInteractionClient extends BaseInteractionClient {
728
1152
  [AADServerParamKeys.CLIENT_ID]: _clientId, ...remainingExtraParameters } = request.extraParameters || {};
729
1153
  request.extraParameters = {
730
1154
  ...remainingExtraParameters,
731
- child_client_id,
732
- child_redirect_uri,
1155
+ child_client_id: childClientId,
1156
+ child_redirect_uri: childRedirectUri,
733
1157
  };
734
1158
  this.performanceClient?.addFields({
735
- embeddedClientId: child_client_id,
736
- embeddedRedirectUri: child_redirect_uri,
1159
+ embeddedClientId: childClientId,
1160
+ embeddedRedirectUri: childRedirectUri,
737
1161
  }, this.correlationId);
738
1162
  }
739
- }
1163
+ }
1164
+ /**
1165
+ * Storage location reported for MSAL-owned browser DPoP keys in reqCnf.
1166
+ * This does not constrain the binding selected by the platform broker.
1167
+ */
1168
+ PlatformAuthInteractionClient.MSAL_DPOP_KEY_STORAGE_LOCATION = PlatformAuthEnclave.SOFTWARE;
740
1169
 
741
1170
  export { PlatformAuthInteractionClient };
742
1171
  //# sourceMappingURL=PlatformAuthInteractionClient.mjs.map