@azure/msal-browser 3.0.2 → 3.2.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 (280) hide show
  1. package/dist/app/IPublicClientApplication.d.ts +2 -0
  2. package/dist/app/IPublicClientApplication.d.ts.map +1 -1
  3. package/dist/app/IPublicClientApplication.mjs +22 -18
  4. package/dist/app/IPublicClientApplication.mjs.map +1 -1
  5. package/dist/app/PublicClientApplication.d.ts +20 -6
  6. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  7. package/dist/app/PublicClientApplication.mjs +24 -7
  8. package/dist/app/PublicClientApplication.mjs.map +1 -1
  9. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +3 -4
  10. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
  11. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +17 -16
  12. package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
  13. package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +8 -0
  14. package/dist/broker/nativeBroker/NativeStatusCodes.d.ts.map +1 -0
  15. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +16 -0
  16. package/dist/broker/nativeBroker/NativeStatusCodes.mjs.map +1 -0
  17. package/dist/cache/AsyncMemoryStorage.mjs +4 -3
  18. package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
  19. package/dist/cache/BrowserCacheManager.d.ts +10 -3
  20. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  21. package/dist/cache/BrowserCacheManager.mjs +58 -29
  22. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  23. package/dist/cache/BrowserStorage.d.ts.map +1 -1
  24. package/dist/cache/BrowserStorage.mjs +7 -9
  25. package/dist/cache/BrowserStorage.mjs.map +1 -1
  26. package/dist/cache/CryptoKeyStore.mjs +1 -1
  27. package/dist/cache/CryptoKeyStore.mjs.map +1 -1
  28. package/dist/cache/DatabaseStorage.d.ts.map +1 -1
  29. package/dist/cache/DatabaseStorage.mjs +9 -8
  30. package/dist/cache/DatabaseStorage.mjs.map +1 -1
  31. package/dist/cache/MemoryStorage.mjs +1 -1
  32. package/dist/cache/MemoryStorage.mjs.map +1 -1
  33. package/dist/cache/TokenCache.d.ts.map +1 -1
  34. package/dist/cache/TokenCache.mjs +30 -30
  35. package/dist/cache/TokenCache.mjs.map +1 -1
  36. package/dist/config/Configuration.d.ts +1 -0
  37. package/dist/config/Configuration.d.ts.map +1 -1
  38. package/dist/config/Configuration.mjs +12 -16
  39. package/dist/config/Configuration.mjs.map +1 -1
  40. package/dist/controllers/ControllerFactory.mjs +1 -1
  41. package/dist/controllers/ControllerFactory.mjs.map +1 -1
  42. package/dist/controllers/IController.d.ts +5 -28
  43. package/dist/controllers/IController.d.ts.map +1 -1
  44. package/dist/controllers/StandardController.d.ts +17 -31
  45. package/dist/controllers/StandardController.d.ts.map +1 -1
  46. package/dist/controllers/StandardController.mjs +78 -83
  47. package/dist/controllers/StandardController.mjs.map +1 -1
  48. package/dist/crypto/BrowserCrypto.d.ts +44 -49
  49. package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
  50. package/dist/crypto/BrowserCrypto.mjs +78 -77
  51. package/dist/crypto/BrowserCrypto.mjs.map +1 -1
  52. package/dist/crypto/CryptoOps.d.ts +1 -10
  53. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  54. package/dist/crypto/CryptoOps.mjs +23 -34
  55. package/dist/crypto/CryptoOps.mjs.map +1 -1
  56. package/dist/crypto/PkceGenerator.d.ts +6 -22
  57. package/dist/crypto/PkceGenerator.d.ts.map +1 -1
  58. package/dist/crypto/PkceGenerator.mjs +48 -49
  59. package/dist/crypto/PkceGenerator.mjs.map +1 -1
  60. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  61. package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
  62. package/dist/encode/Base64Decode.d.ts +6 -19
  63. package/dist/encode/Base64Decode.d.ts.map +1 -1
  64. package/dist/encode/Base64Decode.mjs +31 -68
  65. package/dist/encode/Base64Decode.mjs.map +1 -1
  66. package/dist/encode/Base64Encode.d.ts +15 -27
  67. package/dist/encode/Base64Encode.d.ts.map +1 -1
  68. package/dist/encode/Base64Encode.mjs +36 -75
  69. package/dist/encode/Base64Encode.mjs.map +1 -1
  70. package/dist/error/BrowserAuthError.d.ts +63 -195
  71. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  72. package/dist/error/BrowserAuthError.mjs +159 -381
  73. package/dist/error/BrowserAuthError.mjs.map +1 -1
  74. package/dist/error/BrowserAuthErrorCodes.d.ts +46 -0
  75. package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -0
  76. package/dist/error/BrowserAuthErrorCodes.mjs +54 -0
  77. package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -0
  78. package/dist/error/BrowserConfigurationAuthError.d.ts +9 -46
  79. package/dist/error/BrowserConfigurationAuthError.d.ts.map +1 -1
  80. package/dist/error/BrowserConfigurationAuthError.mjs +20 -73
  81. package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
  82. package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +4 -0
  83. package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts.map +1 -0
  84. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +12 -0
  85. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs.map +1 -0
  86. package/dist/error/NativeAuthError.d.ts +17 -45
  87. package/dist/error/NativeAuthError.d.ts.map +1 -1
  88. package/dist/error/NativeAuthError.mjs +49 -79
  89. package/dist/error/NativeAuthError.mjs.map +1 -1
  90. package/dist/error/NativeAuthErrorCodes.d.ts +3 -0
  91. package/dist/error/NativeAuthErrorCodes.d.ts.map +1 -0
  92. package/dist/error/NativeAuthErrorCodes.mjs +11 -0
  93. package/dist/error/NativeAuthErrorCodes.mjs.map +1 -0
  94. package/dist/event/EventHandler.d.ts.map +1 -1
  95. package/dist/event/EventHandler.mjs +3 -2
  96. package/dist/event/EventHandler.mjs.map +1 -1
  97. package/dist/event/EventMessage.mjs +1 -1
  98. package/dist/event/EventMessage.mjs.map +1 -1
  99. package/dist/event/EventType.mjs +1 -1
  100. package/dist/event/EventType.mjs.map +1 -1
  101. package/dist/index.d.ts +6 -6
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.mjs +8 -4
  104. package/dist/index.mjs.map +1 -1
  105. package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
  106. package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
  107. package/dist/interaction_client/BaseInteractionClient.mjs +7 -8
  108. package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
  109. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  110. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs.map +1 -1
  111. package/dist/interaction_client/NativeInteractionClient.d.ts +4 -10
  112. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  113. package/dist/interaction_client/NativeInteractionClient.mjs +32 -38
  114. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  115. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  116. package/dist/interaction_client/PopupClient.mjs +16 -15
  117. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  118. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  119. package/dist/interaction_client/RedirectClient.mjs +7 -6
  120. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  121. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  122. package/dist/interaction_client/SilentAuthCodeClient.mjs +9 -11
  123. package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
  124. package/dist/interaction_client/SilentCacheClient.d.ts +4 -2
  125. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  126. package/dist/interaction_client/SilentCacheClient.mjs +19 -25
  127. package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
  128. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  129. package/dist/interaction_client/SilentIframeClient.mjs +20 -47
  130. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  131. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  132. package/dist/interaction_client/SilentRefreshClient.mjs +11 -20
  133. package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
  134. package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
  135. package/dist/interaction_client/StandardInteractionClient.mjs +18 -38
  136. package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
  137. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  138. package/dist/interaction_handler/InteractionHandler.mjs +13 -16
  139. package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
  140. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  141. package/dist/interaction_handler/RedirectHandler.mjs +12 -11
  142. package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
  143. package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
  144. package/dist/interaction_handler/SilentHandler.mjs +11 -11
  145. package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
  146. package/dist/navigation/NavigationClient.mjs +1 -1
  147. package/dist/navigation/NavigationClient.mjs.map +1 -1
  148. package/dist/network/FetchClient.d.ts.map +1 -1
  149. package/dist/network/FetchClient.mjs +9 -8
  150. package/dist/network/FetchClient.mjs.map +1 -1
  151. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  152. package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -1
  153. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  154. package/dist/operatingcontext/StandardOperatingContext.mjs.map +1 -1
  155. package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
  156. package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
  157. package/dist/packageMetadata.d.ts +1 -1
  158. package/dist/packageMetadata.mjs +2 -2
  159. package/dist/packageMetadata.mjs.map +1 -1
  160. package/dist/request/ClearCacheRequest.d.ts +11 -0
  161. package/dist/request/ClearCacheRequest.d.ts.map +1 -0
  162. package/dist/telemetry/BrowserPerformanceClient.d.ts +2 -4
  163. package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
  164. package/dist/telemetry/BrowserPerformanceClient.mjs +2 -6
  165. package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
  166. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  167. package/dist/telemetry/BrowserPerformanceMeasurement.mjs.map +1 -1
  168. package/dist/utils/BrowserConstants.mjs +1 -1
  169. package/dist/utils/BrowserConstants.mjs.map +1 -1
  170. package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
  171. package/dist/utils/BrowserProtocolUtils.mjs +4 -4
  172. package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
  173. package/dist/utils/BrowserStringUtils.mjs +1 -1
  174. package/dist/utils/BrowserStringUtils.mjs.map +1 -1
  175. package/dist/utils/BrowserUtils.d.ts +0 -9
  176. package/dist/utils/BrowserUtils.d.ts.map +1 -1
  177. package/dist/utils/BrowserUtils.mjs +8 -33
  178. package/dist/utils/BrowserUtils.mjs.map +1 -1
  179. package/lib/msal-browser.cjs +8729 -9566
  180. package/lib/msal-browser.cjs.map +1 -1
  181. package/lib/msal-browser.js +8729 -9566
  182. package/lib/msal-browser.js.map +1 -1
  183. package/lib/msal-browser.min.js +68 -62
  184. package/package.json +7 -5
  185. package/src/app/IPublicClientApplication.ts +236 -0
  186. package/src/app/PublicClientApplication.ts +417 -0
  187. package/src/broker/nativeBroker/NativeMessageHandler.ts +416 -0
  188. package/src/broker/nativeBroker/NativeRequest.ts +52 -0
  189. package/src/broker/nativeBroker/NativeResponse.ts +56 -0
  190. package/src/broker/nativeBroker/NativeStatusCodes.ts +13 -0
  191. package/src/cache/AsyncMemoryStorage.ts +158 -0
  192. package/src/cache/BrowserCacheManager.ts +2009 -0
  193. package/src/cache/BrowserStorage.ts +52 -0
  194. package/src/cache/CryptoKeyStore.ts +63 -0
  195. package/src/cache/DatabaseStorage.ts +287 -0
  196. package/src/cache/IAsyncMemoryStorage.ts +36 -0
  197. package/src/cache/ITokenCache.ts +21 -0
  198. package/src/cache/IWindowStorage.ts +36 -0
  199. package/src/cache/MemoryStorage.ts +42 -0
  200. package/src/cache/TokenCache.ts +484 -0
  201. package/src/config/Configuration.ts +383 -0
  202. package/src/controllers/ControllerFactory.ts +55 -0
  203. package/src/controllers/IController.ts +134 -0
  204. package/src/controllers/StandardController.ts +2170 -0
  205. package/src/crypto/BrowserCrypto.ts +151 -0
  206. package/src/crypto/CryptoOps.ts +235 -0
  207. package/src/crypto/PkceGenerator.ts +115 -0
  208. package/src/crypto/SignedHttpRequest.ts +76 -0
  209. package/src/encode/Base64Decode.ts +46 -0
  210. package/src/encode/Base64Encode.ts +52 -0
  211. package/src/error/BrowserAuthError.ts +352 -0
  212. package/src/error/BrowserAuthErrorCodes.ts +57 -0
  213. package/src/error/BrowserConfigurationAuthError.ts +64 -0
  214. package/src/error/BrowserConfigurationAuthErrorCodes.ts +9 -0
  215. package/src/error/NativeAuthError.ts +113 -0
  216. package/src/error/NativeAuthErrorCodes.ts +7 -0
  217. package/src/event/EventHandler.ts +177 -0
  218. package/src/event/EventMessage.ts +125 -0
  219. package/src/event/EventType.ts +33 -0
  220. package/src/index.ts +157 -0
  221. package/src/interaction_client/BaseInteractionClient.ts +307 -0
  222. package/src/interaction_client/HybridSpaAuthorizationCodeClient.ts +16 -0
  223. package/src/interaction_client/NativeInteractionClient.ts +925 -0
  224. package/src/interaction_client/PopupClient.ts +926 -0
  225. package/src/interaction_client/RedirectClient.ts +616 -0
  226. package/src/interaction_client/SilentAuthCodeClient.ts +165 -0
  227. package/src/interaction_client/SilentCacheClient.ts +125 -0
  228. package/src/interaction_client/SilentIframeClient.ts +301 -0
  229. package/src/interaction_client/SilentRefreshClient.ts +118 -0
  230. package/src/interaction_client/StandardInteractionClient.ts +450 -0
  231. package/src/interaction_handler/InteractionHandler.ts +251 -0
  232. package/src/interaction_handler/RedirectHandler.ts +229 -0
  233. package/src/interaction_handler/SilentHandler.ts +269 -0
  234. package/src/navigation/INavigationClient.ts +23 -0
  235. package/src/navigation/NavigationClient.ts +55 -0
  236. package/src/navigation/NavigationOptions.ts +18 -0
  237. package/src/network/FetchClient.ts +130 -0
  238. package/src/operatingcontext/BaseOperatingContext.ts +82 -0
  239. package/src/operatingcontext/StandardOperatingContext.ts +49 -0
  240. package/src/operatingcontext/TeamsAppOperatingContext.ts +48 -0
  241. package/src/packageMetadata.ts +3 -0
  242. package/src/request/AuthorizationCodeRequest.ts +19 -0
  243. package/src/request/AuthorizationUrlRequest.ts +17 -0
  244. package/src/request/ClearCacheRequest.ts +16 -0
  245. package/src/request/EndSessionPopupRequest.ts +26 -0
  246. package/src/request/EndSessionRequest.ts +23 -0
  247. package/src/request/PopupRequest.ts +51 -0
  248. package/src/request/PopupWindowAttributes.ts +22 -0
  249. package/src/request/RedirectRequest.ts +51 -0
  250. package/src/request/SilentRequest.ts +49 -0
  251. package/src/request/SsoSilentRequest.ts +44 -0
  252. package/src/response/AuthenticationResult.ts +13 -0
  253. package/src/telemetry/BrowserPerformanceClient.ts +226 -0
  254. package/src/telemetry/BrowserPerformanceMeasurement.ts +144 -0
  255. package/src/utils/BrowserConstants.ts +241 -0
  256. package/src/utils/BrowserProtocolUtils.ts +58 -0
  257. package/src/utils/BrowserStringUtils.ts +143 -0
  258. package/src/utils/BrowserUtils.ts +156 -0
  259. package/dist/crypto/GuidGenerator.d.ts +0 -13
  260. package/dist/crypto/GuidGenerator.d.ts.map +0 -1
  261. package/dist/crypto/GuidGenerator.mjs +0 -104
  262. package/dist/crypto/GuidGenerator.mjs.map +0 -1
  263. package/dist/crypto/ISubtleCrypto.d.ts +0 -10
  264. package/dist/crypto/ISubtleCrypto.d.ts.map +0 -1
  265. package/dist/crypto/ModernBrowserCrypto.d.ts +0 -10
  266. package/dist/crypto/ModernBrowserCrypto.d.ts.map +0 -1
  267. package/dist/crypto/ModernBrowserCrypto.mjs +0 -31
  268. package/dist/crypto/ModernBrowserCrypto.mjs.map +0 -1
  269. package/dist/internals.d.ts +0 -23
  270. package/dist/internals.d.ts.map +0 -1
  271. package/dist/internals.mjs +0 -28
  272. package/dist/internals.mjs.map +0 -1
  273. package/dist/network/XhrClient.d.ts +0 -41
  274. package/dist/network/XhrClient.d.ts.map +0 -1
  275. package/dist/network/XhrClient.mjs +0 -125
  276. package/dist/network/XhrClient.mjs.map +0 -1
  277. package/dist/utils/MathUtils.d.ts +0 -12
  278. package/dist/utils/MathUtils.d.ts.map +0 -1
  279. package/dist/utils/MathUtils.mjs +0 -26
  280. package/dist/utils/MathUtils.mjs.map +0 -1
@@ -0,0 +1,19 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { CommonAuthorizationCodeRequest } from "@azure/msal-common";
7
+
8
+ export type AuthorizationCodeRequest = Partial<
9
+ Omit<
10
+ CommonAuthorizationCodeRequest,
11
+ "code" | "enableSpaAuthorizationCode" | "requestedClaimsHash"
12
+ >
13
+ > & {
14
+ code?: string;
15
+ nativeAccountId?: string;
16
+ cloudGraphHostName?: string;
17
+ msGraphHost?: string;
18
+ cloudInstanceHostName?: string;
19
+ };
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { CommonAuthorizationUrlRequest } from "@azure/msal-common";
7
+
8
+ /**
9
+ * This type is deprecated and will be removed on the next major version update
10
+ */
11
+ export type AuthorizationUrlRequest = Omit<
12
+ CommonAuthorizationUrlRequest,
13
+ "state" | "nonce" | "requestedClaimsHash" | "nativeBroker"
14
+ > & {
15
+ state: string;
16
+ nonce: string;
17
+ };
@@ -0,0 +1,16 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { AccountInfo } from "@azure/msal-common";
7
+
8
+ /**
9
+ * ClearCacheRequest
10
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
11
+ * - account - Account object that will be logged out of. All tokens tied to this account will be cleared.
12
+ */
13
+ export type ClearCacheRequest = {
14
+ correlationId?: string;
15
+ account?: AccountInfo | null;
16
+ };
@@ -0,0 +1,26 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { CommonEndSessionRequest } from "@azure/msal-common";
7
+ import { PopupWindowAttributes } from "./PopupWindowAttributes";
8
+
9
+ /**
10
+ * EndSessionPopupRequest
11
+ * - account - Account object that will be logged out of. All tokens tied to this account will be cleared.
12
+ * - postLogoutRedirectUri - URI to navigate to after logout page inside the popup. Required to ensure popup can be closed.
13
+ * - authority - Authority to send logout request to.
14
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
15
+ * - idTokenHint - ID Token used by B2C to validate logout if required by the policy
16
+ * - mainWindowRedirectUri - URI to navigate the main window to after logout is complete
17
+ * - popupWindowAttributes - Optional popup window attributes. popupSize with height and width, and popupPosition with top and left can be set.
18
+ * - logoutHint - A string that specifies the account that is being logged out in order to skip the server account picker on logout
19
+ */
20
+ export type EndSessionPopupRequest = Partial<
21
+ Omit<CommonEndSessionRequest, "tokenQueryParameters">
22
+ > & {
23
+ authority?: string;
24
+ mainWindowRedirectUri?: string;
25
+ popupWindowAttributes?: PopupWindowAttributes;
26
+ };
@@ -0,0 +1,23 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { CommonEndSessionRequest } from "@azure/msal-common";
7
+
8
+ /**
9
+ * EndSessionRequest
10
+ * - account - Account object that will be logged out of. All tokens tied to this account will be cleared.
11
+ * - postLogoutRedirectUri - URI to navigate to after logout page.
12
+ * - authority - Authority to send logout request to.
13
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
14
+ * - idTokenHint - ID Token used by B2C to validate logout if required by the policy
15
+ * - onRedirectNavigate - Callback that will be passed the url that MSAL will navigate to. Returning false in the callback will stop navigation.
16
+ * - logoutHint - A string that specifies the account that is being logged out in order to skip the server account picker on logout
17
+ */
18
+ export type EndSessionRequest = Partial<
19
+ Omit<CommonEndSessionRequest, "tokenQueryParameters">
20
+ > & {
21
+ authority?: string;
22
+ onRedirectNavigate?: (url: string) => boolean | void;
23
+ };
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { CommonAuthorizationUrlRequest, StringDict } from "@azure/msal-common";
7
+ import { PopupWindowAttributes } from "./PopupWindowAttributes";
8
+
9
+ /**
10
+ * PopupRequest: Request object passed by user to retrieve a Code from the
11
+ * server (first leg of authorization code grant flow) with a popup window.
12
+ *
13
+ * - scopes - Array of scopes the application is requesting access to.
14
+ * - authority - Url of the authority which the application acquires tokens from.
15
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
16
+ * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.
17
+ * - extraScopesToConsent - Scopes for a different resource when the user needs consent upfront.
18
+ * - state - A value included in the request that is also returned in the token response. A randomly generated unique value is typically used for preventing cross site request forgery attacks. The state is also used to encode information about the user's state in the app before the authentication request occurred.
19
+ * - prompt - Indicates the type of user interaction that is required.
20
+ * login: will force the user to enter their credentials on that request, negating single-sign on
21
+ * none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via single-sign on, the endpoint will return an interaction_required error
22
+ * consent: will the trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app
23
+ * select_account: will interrupt single sign-=on providing account selection experience listing all the accounts in session or any remembered accounts or an option to choose to use a different account
24
+ * create: will direct the user to the account creation experience instead of the log in experience
25
+ * no_session: will not read existing session token when authenticating the user. Upon user being successfully authenticated, EVO won’t create a new session for the user. FOR INTERNAL USE ONLY.
26
+ * - loginHint - Can be used to pre-fill the username/email address field of the sign-in page for the user, if you know the username/email address ahead of time. Often apps use this parameter during re-authentication, having already extracted the username from a previous sign-in using the login_hint or preferred_username claim.
27
+ * - sid - Session ID, unique identifier for the session. Available as an optional claim on ID tokens.
28
+ * - domainHint - Provides a hint about the tenant or domain that the user should use to sign in. The value of the domain hint is a registered domain for the tenant.
29
+ * - extraQueryParameters - String to string map of custom query parameters added to the /authorize call
30
+ * - tokenBodyParameters - String to string map of custom token request body parameters added to the /token call. Only used when renewing access tokens.
31
+ * - tokenQueryParameters - String to string map of custom query parameters added to the /token call
32
+ * - claims - In cases where Azure AD tenant admin has enabled conditional access policies, and the policy has not been met, exceptions will contain claims that need to be consented to.
33
+ * - nonce - A value included in the request that is returned in the id token. A randomly generated unique value is typically used to mitigate replay attacks.
34
+ * - popupWindowAttributes - Optional popup window attributes. popupSize with height and width, and popupPosition with top and left can be set.
35
+ */
36
+
37
+ export type PopupRequest = Partial<
38
+ Omit<
39
+ CommonAuthorizationUrlRequest,
40
+ | "responseMode"
41
+ | "scopes"
42
+ | "codeChallenge"
43
+ | "codeChallengeMethod"
44
+ | "requestedClaimsHash"
45
+ | "nativeBroker"
46
+ >
47
+ > & {
48
+ scopes: Array<string>;
49
+ popupWindowAttributes?: PopupWindowAttributes;
50
+ tokenBodyParameters?: StringDict;
51
+ };
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ /**
7
+ * Popup configurations for setting dimensions and position of popup window
8
+ */
9
+ export type PopupWindowAttributes = {
10
+ popupSize?: PopupSize;
11
+ popupPosition?: PopupPosition;
12
+ };
13
+
14
+ export type PopupSize = {
15
+ height: number;
16
+ width: number;
17
+ };
18
+
19
+ export type PopupPosition = {
20
+ top: number;
21
+ left: number;
22
+ };
@@ -0,0 +1,51 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { CommonAuthorizationUrlRequest, StringDict } from "@azure/msal-common";
7
+
8
+ /**
9
+ * RedirectRequest: Request object passed by user to retrieve a Code from the
10
+ * server (first leg of authorization code grant flow) with a full page redirect.
11
+ *
12
+ * - scopes - Array of scopes the application is requesting access to.
13
+ * - authority - Url of the authority which the application acquires tokens from.
14
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
15
+ * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.
16
+ * - extraScopesToConsent - Scopes for a different resource when the user needs consent upfront.
17
+ * - state - A value included in the request that is also returned in the token response. A randomly generated unique value is typically used for preventing cross site request forgery attacks. The state is also used to encode information about the user's state in the app before the authentication request occurred.
18
+ * - prompt - Indicates the type of user interaction that is required.
19
+ * login: will force the user to enter their credentials on that request, negating single-sign on
20
+ * none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via single-sign on, the endpoint will return an interaction_required error
21
+ * consent: will the trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app
22
+ * select_account: will interrupt single sign-=on providing account selection experience listing all the accounts in session or any remembered accounts or an option to choose to use a different account
23
+ * create: will direct the user to the account creation experience instead of the log in experience
24
+ * no_session: will not read existing session token when authenticating the user. Upon user being successfully authenticated, EVO won’t create a new session for the user. FOR INTERNAL USE ONLY.
25
+ * - loginHint - Can be used to pre-fill the username/email address field of the sign-in page for the user, if you know the username/email address ahead of time. Often apps use this parameter during re-authentication, having already extracted the username from a previous sign-in using the login_hint or preferred_username claim.
26
+ * - sid - Session ID, unique identifier for the session. Available as an optional claim on ID tokens.
27
+ * - domainHint - Provides a hint about the tenant or domain that the user should use to sign in. The value of the domain hint is a registered domain for the tenant.
28
+ * - extraQueryParameters - String to string map of custom query parameters added to the /authorize call
29
+ * - tokenBodyParameters - String to string map of custom token request body parameters added to the /token call. Only used when renewing access tokens.
30
+ * - tokenQueryParameters - String to string map of custom query parameters added to the /token call
31
+ * - claims - In cases where Azure AD tenant admin has enabled conditional access policies, and the policy has not been met, exceptions will contain claims that need to be consented to.
32
+ * - nonce - A value included in the request that is returned in the id token. A randomly generated unique value is typically used to mitigate replay attacks.
33
+ * - redirectStartPage - The page that should be returned to after loginRedirect or acquireTokenRedirect. This should only be used if this is different from the redirectUri and will default to the page that initiates the request. When the navigateToLoginRequestUrl config option is set to false this parameter will be ignored.
34
+ * - onRedirectNavigate - Callback that will be passed the url that MSAL will navigate to. Returning false in the callback will stop navigation.
35
+ */
36
+ export type RedirectRequest = Partial<
37
+ Omit<
38
+ CommonAuthorizationUrlRequest,
39
+ | "responseMode"
40
+ | "scopes"
41
+ | "codeChallenge"
42
+ | "codeChallengeMethod"
43
+ | "requestedClaimsHash"
44
+ | "nativeBroker"
45
+ >
46
+ > & {
47
+ scopes: Array<string>;
48
+ redirectStartPage?: string;
49
+ onRedirectNavigate?: (url: string) => boolean | void;
50
+ tokenBodyParameters?: StringDict;
51
+ };
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ AccountInfo,
8
+ CommonSilentFlowRequest,
9
+ StringDict,
10
+ } from "@azure/msal-common";
11
+ import { CacheLookupPolicy } from "../utils/BrowserConstants";
12
+
13
+ /**
14
+ * SilentRequest: Request object passed by user to retrieve tokens from the
15
+ * cache, renew an expired token with a refresh token, or retrieve a code (first leg of authorization code grant flow)
16
+ * in a hidden iframe.
17
+ *
18
+ * - scopes - Array of scopes the application is requesting access to.
19
+ * - authority - Url of the authority which the application acquires tokens from.
20
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
21
+ * - account - Account entity to lookup the credentials.
22
+ * - forceRefresh - Forces silent requests to make network calls if true.
23
+ * - extraQueryParameters - String to string map of custom query parameters added to the /authorize call. Only used when renewing the refresh token.
24
+ * - tokenBodyParameters - String to string map of custom token request body parameters added to the /token call. Only used when renewing access tokens.
25
+ * - tokenQueryParameters - String to string map of custom query parameters added to the /token call. Only used when renewing access tokens.
26
+ * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal. Only used for cases where refresh token is expired.
27
+ * - cacheLookupPolicy - Enum of different ways the silent token can be retrieved.
28
+ * - prompt - Indicates the type of user interaction that is required.
29
+ * none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via single-sign on, the endpoint will return an interaction_required error
30
+ * no_session: will not read existing session token when authenticating the user. Upon user being successfully authenticated, EVO won’t create a new session for the user. FOR INTERNAL USE ONLY.
31
+ */
32
+ export type SilentRequest = Omit<
33
+ CommonSilentFlowRequest,
34
+ | "authority"
35
+ | "correlationId"
36
+ | "forceRefresh"
37
+ | "account"
38
+ | "requestedClaimsHash"
39
+ > & {
40
+ redirectUri?: string;
41
+ extraQueryParameters?: StringDict;
42
+ authority?: string;
43
+ account?: AccountInfo;
44
+ correlationId?: string;
45
+ forceRefresh?: boolean;
46
+ cacheLookupPolicy?: CacheLookupPolicy;
47
+ prompt?: string;
48
+ tokenBodyParameters?: StringDict;
49
+ };
@@ -0,0 +1,44 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { CommonAuthorizationUrlRequest, StringDict } from "@azure/msal-common";
7
+
8
+ /**
9
+ * Request object passed by user to ssoSilent to retrieve a Code from the server (first leg of authorization code grant flow)
10
+ *
11
+ * - scopes - Array of scopes the application is requesting access to (optional for ssoSilent calls)
12
+ * - claims - A stringified claims request which will be added to all /authorize and /token calls
13
+ * - authority - Url of the authority which the application acquires tokens from.
14
+ * - correlationId - Unique GUID set per request to trace a request end-to-end for telemetry purposes.
15
+ * - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.
16
+ * - extraScopesToConsent - Scopes for a different resource when the user needs consent upfront.
17
+ * - state - A value included in the request that is also returned in the token response. A randomly generated unique value is typically used for preventing cross site request forgery attacks. The state is also used to encode information about the user's state in the app before the authentication request occurred.
18
+ * - prompt - Indicates the type of user interaction that is required.
19
+ * login: will force the user to enter their credentials on that request, negating single-sign on
20
+ * none: will ensure that the user isn't presented with any interactive prompt. if request can't be completed via single-sign on, the endpoint will return an interaction_required error
21
+ * consent: will trigger the OAuth consent dialog after the user signs in, asking the user to grant permissions to the app
22
+ * select_account: will interrupt single sign-=on providing account selection experience listing all the accounts in session or any remembered accounts or an option to choose to use a different account
23
+ * create: will direct the user to the account creation experience instead of the log in experience
24
+ * no_session: will not read existing session token when authenticating the user. Upon user being successfully authenticated, EVO won’t create a new session for the user. FOR INTERNAL USE ONLY.
25
+ * - loginHint - Can be used to pre-fill the username/email address field of the sign-in page for the user, if you know the username/email address ahead of time. Often apps use this parameter during re-authentication, having already extracted the username from a previous sign-in using the login_hint or preferred_username claim.
26
+ * - sid - Session ID, unique identifier for the session. Available as an optional claim on ID tokens.
27
+ * - domainHint - Provides a hint about the tenant or domain that the user should use to sign in. The value of the domain hint is a registered domain for the tenant.
28
+ * - extraQueryParameters - String to string map of custom query parameters added to the /authorize call
29
+ * - tokenBodyParameters - String to string map of custom token request body parameters added to the /token call. Only used when renewing access tokens.
30
+ * - tokenQueryParameters - String to string map of custom query parameters added to the /token call
31
+ * - nonce - A value included in the request that is returned in the id token. A randomly generated unique value is typically used to mitigate replay attacks.
32
+ */
33
+ export type SsoSilentRequest = Partial<
34
+ Omit<
35
+ CommonAuthorizationUrlRequest,
36
+ | "responseMode"
37
+ | "codeChallenge"
38
+ | "codeChallengeMethod"
39
+ | "requestedClaimsHash"
40
+ | "nativeBroker"
41
+ >
42
+ > & {
43
+ tokenBodyParameters?: StringDict;
44
+ };
@@ -0,0 +1,13 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ AccountInfo,
8
+ AuthenticationResult as CommonAuthenticationResult,
9
+ } from "@azure/msal-common";
10
+
11
+ export type AuthenticationResult = CommonAuthenticationResult & {
12
+ account: AccountInfo;
13
+ };
@@ -0,0 +1,226 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import {
7
+ Logger,
8
+ PerformanceEvent,
9
+ PerformanceEvents,
10
+ IPerformanceClient,
11
+ PerformanceClient,
12
+ IPerformanceMeasurement,
13
+ InProgressPerformanceEvent,
14
+ SubMeasurement,
15
+ PreQueueEvent,
16
+ Constants,
17
+ } from "@azure/msal-common";
18
+ import { BrowserPerformanceMeasurement } from "./BrowserPerformanceMeasurement";
19
+ import { Configuration } from "../config/Configuration";
20
+ import { name, version } from "../packageMetadata";
21
+
22
+ export class BrowserPerformanceClient
23
+ extends PerformanceClient
24
+ implements IPerformanceClient
25
+ {
26
+ constructor(configuration: Configuration, intFields?: Set<string>) {
27
+ super(
28
+ configuration.auth.clientId,
29
+ configuration.auth.authority || `${Constants.DEFAULT_AUTHORITY}`,
30
+ new Logger(
31
+ configuration.system?.loggerOptions || {},
32
+ name,
33
+ version
34
+ ),
35
+ name,
36
+ version,
37
+ configuration.telemetry?.application || {
38
+ appName: "",
39
+ appVersion: "",
40
+ },
41
+ intFields
42
+ );
43
+ }
44
+
45
+ startPerformanceMeasurement(
46
+ measureName: string,
47
+ correlationId: string
48
+ ): IPerformanceMeasurement {
49
+ return new BrowserPerformanceMeasurement(measureName, correlationId);
50
+ }
51
+
52
+ generateId(): string {
53
+ return window.crypto.randomUUID();
54
+ }
55
+
56
+ private getPageVisibility(): string | null {
57
+ return document.visibilityState?.toString() || null;
58
+ }
59
+
60
+ private deleteIncompleteSubMeasurements(
61
+ inProgressEvent: InProgressPerformanceEvent
62
+ ): void {
63
+ const rootEvent = this.eventsByCorrelationId.get(
64
+ inProgressEvent.event.correlationId
65
+ );
66
+ const isRootEvent =
67
+ rootEvent && rootEvent.eventId === inProgressEvent.event.eventId;
68
+ const incompleteMeasurements: SubMeasurement[] = [];
69
+ if (isRootEvent && rootEvent?.incompleteSubMeasurements) {
70
+ rootEvent.incompleteSubMeasurements.forEach((subMeasurement) => {
71
+ incompleteMeasurements.push({ ...subMeasurement });
72
+ });
73
+ }
74
+ // Clean up remaining marks for incomplete sub-measurements
75
+ if (incompleteMeasurements.length > 0) {
76
+ BrowserPerformanceMeasurement.flushMeasurements(
77
+ inProgressEvent.event.correlationId,
78
+ incompleteMeasurements
79
+ );
80
+ }
81
+ }
82
+
83
+ supportsBrowserPerformanceNow(): boolean {
84
+ return (
85
+ typeof window !== "undefined" &&
86
+ typeof window.performance !== "undefined" &&
87
+ typeof window.performance.now === "function"
88
+ );
89
+ }
90
+
91
+ /**
92
+ * Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
93
+ * Also captures browser page visibilityState.
94
+ *
95
+ * @param {PerformanceEvents} measureName
96
+ * @param {?string} [correlationId]
97
+ * @returns {((event?: Partial<PerformanceEvent>) => PerformanceEvent| null)}
98
+ */
99
+ startMeasurement(
100
+ measureName: string,
101
+ correlationId?: string
102
+ ): InProgressPerformanceEvent {
103
+ // Capture page visibilityState and then invoke start/end measurement
104
+ const startPageVisibility = this.getPageVisibility();
105
+
106
+ const inProgressEvent = super.startMeasurement(
107
+ measureName,
108
+ correlationId
109
+ );
110
+
111
+ return {
112
+ ...inProgressEvent,
113
+ end: (
114
+ event?: Partial<PerformanceEvent>
115
+ ): PerformanceEvent | null => {
116
+ const res = inProgressEvent.end({
117
+ startPageVisibility,
118
+ endPageVisibility: this.getPageVisibility(),
119
+ ...event,
120
+ });
121
+ this.deleteIncompleteSubMeasurements(inProgressEvent);
122
+
123
+ return res;
124
+ },
125
+ discard: () => {
126
+ inProgressEvent.discard();
127
+ this.deleteIncompleteSubMeasurements(inProgressEvent);
128
+ inProgressEvent.measurement.flushMeasurement();
129
+ },
130
+ };
131
+ }
132
+
133
+ /**
134
+ * Adds pre-queue time to preQueueTimeByCorrelationId map.
135
+ * @param {PerformanceEvents} eventName
136
+ * @param {?string} correlationId
137
+ * @returns
138
+ */
139
+ setPreQueueTime(
140
+ eventName: PerformanceEvents,
141
+ correlationId?: string
142
+ ): void {
143
+ if (!this.supportsBrowserPerformanceNow()) {
144
+ this.logger.trace(
145
+ `BrowserPerformanceClient: window performance API not available, unable to set telemetry queue time for ${eventName}`
146
+ );
147
+ return;
148
+ }
149
+
150
+ if (!correlationId) {
151
+ this.logger.trace(
152
+ `BrowserPerformanceClient: correlationId for ${eventName} not provided, unable to set telemetry queue time`
153
+ );
154
+ return;
155
+ }
156
+
157
+ const preQueueEvent: PreQueueEvent | undefined =
158
+ this.preQueueTimeByCorrelationId.get(correlationId);
159
+ /**
160
+ * Manually complete queue measurement if there is an incomplete pre-queue event.
161
+ * Incomplete pre-queue events are instrumentation bugs that should be fixed.
162
+ */
163
+ if (preQueueEvent) {
164
+ this.logger.trace(
165
+ `BrowserPerformanceClient: Incomplete pre-queue ${preQueueEvent.name} found`,
166
+ correlationId
167
+ );
168
+ this.addQueueMeasurement(
169
+ preQueueEvent.name,
170
+ correlationId,
171
+ undefined,
172
+ true
173
+ );
174
+ }
175
+ this.preQueueTimeByCorrelationId.set(correlationId, {
176
+ name: eventName,
177
+ time: window.performance.now(),
178
+ });
179
+ }
180
+
181
+ /**
182
+ * Calculates and adds queue time measurement for given performance event.
183
+ *
184
+ * @param {PerformanceEvents} eventName
185
+ * @param {?string} correlationId
186
+ * @param {?number} queueTime
187
+ * @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements
188
+ * @returns
189
+ */
190
+ addQueueMeasurement(
191
+ eventName: string,
192
+ correlationId?: string,
193
+ queueTime?: number,
194
+ manuallyCompleted?: boolean
195
+ ): void {
196
+ if (!this.supportsBrowserPerformanceNow()) {
197
+ this.logger.trace(
198
+ `BrowserPerformanceClient: window performance API not available, unable to add queue measurement for ${eventName}`
199
+ );
200
+ return;
201
+ }
202
+
203
+ if (!correlationId) {
204
+ this.logger.trace(
205
+ `BrowserPerformanceClient: correlationId for ${eventName} not provided, unable to add queue measurement`
206
+ );
207
+ return;
208
+ }
209
+
210
+ const preQueueTime = super.getPreQueueTime(eventName, correlationId);
211
+ if (!preQueueTime) {
212
+ return;
213
+ }
214
+
215
+ const currentTime = window.performance.now();
216
+ const resQueueTime =
217
+ queueTime || super.calculateQueuedTime(preQueueTime, currentTime);
218
+
219
+ return super.addQueueMeasurement(
220
+ eventName,
221
+ correlationId,
222
+ resQueueTime,
223
+ manuallyCompleted
224
+ );
225
+ }
226
+ }