@azure/msal-browser 3.2.0 → 3.4.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 (224) hide show
  1. package/dist/app/IPublicClientApplication.mjs +1 -1
  2. package/dist/app/PublicClientApplication.d.ts.map +1 -1
  3. package/dist/app/PublicClientApplication.mjs +3 -4
  4. package/dist/app/PublicClientApplication.mjs.map +1 -1
  5. package/dist/app/PublicClientNext.d.ts +274 -0
  6. package/dist/app/PublicClientNext.d.ts.map +1 -0
  7. package/dist/app/PublicClientNext.mjs +360 -0
  8. package/dist/app/PublicClientNext.mjs.map +1 -0
  9. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
  10. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
  11. package/dist/cache/AsyncMemoryStorage.mjs +1 -1
  12. package/dist/cache/BrowserCacheManager.d.ts +2 -13
  13. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  14. package/dist/cache/BrowserCacheManager.mjs +26 -83
  15. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  16. package/dist/cache/BrowserStorage.mjs +1 -1
  17. package/dist/cache/CryptoKeyStore.mjs +1 -1
  18. package/dist/cache/DatabaseStorage.mjs +1 -1
  19. package/dist/cache/MemoryStorage.mjs +1 -1
  20. package/dist/cache/TokenCache.d.ts.map +1 -1
  21. package/dist/cache/TokenCache.mjs +5 -5
  22. package/dist/cache/TokenCache.mjs.map +1 -1
  23. package/dist/config/Configuration.d.ts +4 -0
  24. package/dist/config/Configuration.d.ts.map +1 -1
  25. package/dist/config/Configuration.mjs +2 -1
  26. package/dist/config/Configuration.mjs.map +1 -1
  27. package/dist/controllers/ControllerFactory.d.ts +2 -7
  28. package/dist/controllers/ControllerFactory.d.ts.map +1 -1
  29. package/dist/controllers/ControllerFactory.mjs +24 -34
  30. package/dist/controllers/ControllerFactory.mjs.map +1 -1
  31. package/dist/controllers/IController.d.ts +1 -2
  32. package/dist/controllers/IController.d.ts.map +1 -1
  33. package/dist/controllers/NestedAppAuthController.d.ts +96 -0
  34. package/dist/controllers/NestedAppAuthController.d.ts.map +1 -0
  35. package/dist/controllers/NestedAppAuthController.mjs +345 -0
  36. package/dist/controllers/NestedAppAuthController.mjs.map +1 -0
  37. package/dist/controllers/StandardController.d.ts +4 -4
  38. package/dist/controllers/StandardController.d.ts.map +1 -1
  39. package/dist/controllers/StandardController.mjs +43 -42
  40. package/dist/controllers/StandardController.mjs.map +1 -1
  41. package/dist/controllers/UnknownOperatingContextController.d.ts +88 -0
  42. package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -0
  43. package/dist/controllers/UnknownOperatingContextController.mjs +275 -0
  44. package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -0
  45. package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
  46. package/dist/crypto/BrowserCrypto.mjs +3 -3
  47. package/dist/crypto/BrowserCrypto.mjs.map +1 -1
  48. package/dist/crypto/CryptoOps.d.ts.map +1 -1
  49. package/dist/crypto/CryptoOps.mjs +8 -5
  50. package/dist/crypto/CryptoOps.mjs.map +1 -1
  51. package/dist/crypto/PkceGenerator.mjs +1 -1
  52. package/dist/crypto/SignedHttpRequest.mjs +1 -1
  53. package/dist/encode/Base64Decode.mjs +1 -1
  54. package/dist/encode/Base64Encode.mjs +1 -1
  55. package/dist/error/BrowserAuthError.mjs +1 -1
  56. package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
  57. package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
  58. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
  59. package/dist/error/NativeAuthError.mjs +1 -1
  60. package/dist/error/NativeAuthErrorCodes.mjs +1 -1
  61. package/dist/error/NestedAppAuthError.d.ts +15 -0
  62. package/dist/error/NestedAppAuthError.d.ts.map +1 -0
  63. package/dist/error/NestedAppAuthError.mjs +30 -0
  64. package/dist/error/NestedAppAuthError.mjs.map +1 -0
  65. package/dist/event/EventHandler.mjs +1 -1
  66. package/dist/event/EventMessage.mjs +1 -1
  67. package/dist/event/EventType.mjs +1 -1
  68. package/dist/index.d.ts +3 -5
  69. package/dist/index.d.ts.map +1 -1
  70. package/dist/index.mjs +4 -2
  71. package/dist/index.mjs.map +1 -1
  72. package/dist/interaction_client/BaseInteractionClient.mjs +4 -4
  73. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
  74. package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
  75. package/dist/interaction_client/NativeInteractionClient.mjs +18 -7
  76. package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
  77. package/dist/interaction_client/PopupClient.d.ts +1 -2
  78. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  79. package/dist/interaction_client/PopupClient.mjs +13 -25
  80. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  81. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  82. package/dist/interaction_client/RedirectClient.mjs +17 -25
  83. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  84. package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
  85. package/dist/interaction_client/SilentAuthCodeClient.mjs +6 -8
  86. package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
  87. package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
  88. package/dist/interaction_client/SilentCacheClient.mjs +4 -3
  89. package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
  90. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  91. package/dist/interaction_client/SilentIframeClient.mjs +28 -19
  92. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  93. package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
  94. package/dist/interaction_client/SilentRefreshClient.mjs +2 -12
  95. package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
  96. package/dist/interaction_client/StandardInteractionClient.mjs +5 -5
  97. package/dist/interaction_handler/InteractionHandler.d.ts +6 -13
  98. package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
  99. package/dist/interaction_handler/InteractionHandler.mjs +29 -56
  100. package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
  101. package/dist/interaction_handler/RedirectHandler.d.ts +14 -7
  102. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  103. package/dist/interaction_handler/RedirectHandler.mjs +28 -9
  104. package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
  105. package/dist/interaction_handler/SilentHandler.d.ts +13 -47
  106. package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
  107. package/dist/interaction_handler/SilentHandler.mjs +120 -155
  108. package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
  109. package/dist/naa/AccountInfo.d.ts +13 -0
  110. package/dist/naa/AccountInfo.d.ts.map +1 -0
  111. package/dist/naa/AccountRequests.d.ts +10 -0
  112. package/dist/naa/AccountRequests.d.ts.map +1 -0
  113. package/dist/naa/AuthBridge.d.ts +6 -0
  114. package/dist/naa/AuthBridge.d.ts.map +1 -0
  115. package/dist/naa/BridgeCapabilities.d.ts +4 -0
  116. package/dist/naa/BridgeCapabilities.d.ts.map +1 -0
  117. package/dist/naa/BridgeError.d.ts +10 -0
  118. package/dist/naa/BridgeError.d.ts.map +1 -0
  119. package/dist/naa/BridgeError.mjs +12 -0
  120. package/dist/naa/BridgeError.mjs.map +1 -0
  121. package/dist/naa/BridgeProxy.d.ts +72 -0
  122. package/dist/naa/BridgeProxy.d.ts.map +1 -0
  123. package/dist/naa/BridgeProxy.mjs +154 -0
  124. package/dist/naa/BridgeProxy.mjs.map +1 -0
  125. package/dist/naa/BridgeRequest.d.ts +7 -0
  126. package/dist/naa/BridgeRequest.d.ts.map +1 -0
  127. package/dist/naa/BridgeRequestEnvelope.d.ts +14 -0
  128. package/dist/naa/BridgeRequestEnvelope.d.ts.map +1 -0
  129. package/dist/naa/BridgeResponseEnvelope.d.ts +11 -0
  130. package/dist/naa/BridgeResponseEnvelope.d.ts.map +1 -0
  131. package/dist/naa/BridgeStatusCode.d.ts +11 -0
  132. package/dist/naa/BridgeStatusCode.d.ts.map +1 -0
  133. package/dist/naa/BridgeStatusCode.mjs +20 -0
  134. package/dist/naa/BridgeStatusCode.mjs.map +1 -0
  135. package/dist/naa/IBridgeProxy.d.ts +11 -0
  136. package/dist/naa/IBridgeProxy.d.ts.map +1 -0
  137. package/dist/naa/InitializeBridgeResponse.d.ts +7 -0
  138. package/dist/naa/InitializeBridgeResponse.d.ts.map +1 -0
  139. package/dist/naa/TokenRequest.d.ts +22 -0
  140. package/dist/naa/TokenRequest.d.ts.map +1 -0
  141. package/dist/naa/TokenResponse.d.ts +17 -0
  142. package/dist/naa/TokenResponse.d.ts.map +1 -0
  143. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +26 -0
  144. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -0
  145. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +178 -0
  146. package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -0
  147. package/dist/navigation/NavigationClient.mjs +1 -1
  148. package/dist/network/FetchClient.mjs +1 -1
  149. package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
  150. package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
  151. package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +7 -0
  152. package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
  153. package/dist/operatingcontext/TeamsAppOperatingContext.mjs +45 -4
  154. package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
  155. package/dist/operatingcontext/UnknownOperatingContext.d.ts +26 -0
  156. package/dist/operatingcontext/UnknownOperatingContext.d.ts.map +1 -0
  157. package/dist/operatingcontext/UnknownOperatingContext.mjs +49 -0
  158. package/dist/operatingcontext/UnknownOperatingContext.mjs.map +1 -0
  159. package/dist/packageMetadata.d.ts +1 -1
  160. package/dist/packageMetadata.mjs +2 -2
  161. package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
  162. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
  163. package/dist/utils/BrowserConstants.mjs +1 -1
  164. package/dist/utils/BrowserProtocolUtils.mjs +1 -1
  165. package/dist/utils/BrowserUtils.d.ts +54 -53
  166. package/dist/utils/BrowserUtils.d.ts.map +1 -1
  167. package/dist/utils/BrowserUtils.mjs +114 -102
  168. package/dist/utils/BrowserUtils.mjs.map +1 -1
  169. package/lib/msal-browser.cjs +13221 -12385
  170. package/lib/msal-browser.cjs.map +1 -1
  171. package/lib/msal-browser.js +13221 -12385
  172. package/lib/msal-browser.js.map +1 -1
  173. package/lib/msal-browser.min.js +67 -68
  174. package/package.json +2 -2
  175. package/src/app/PublicClientApplication.ts +4 -3
  176. package/src/app/PublicClientNext.ts +444 -0
  177. package/src/cache/BrowserCacheManager.ts +33 -140
  178. package/src/cache/TokenCache.ts +5 -4
  179. package/src/config/Configuration.ts +5 -0
  180. package/src/controllers/ControllerFactory.ts +35 -43
  181. package/src/controllers/IController.ts +0 -6
  182. package/src/controllers/NestedAppAuthController.ts +525 -0
  183. package/src/controllers/StandardController.ts +50 -52
  184. package/src/controllers/UnknownOperatingContextController.ts +383 -0
  185. package/src/crypto/BrowserCrypto.ts +2 -2
  186. package/src/crypto/CryptoOps.ts +8 -5
  187. package/src/error/NestedAppAuthError.ts +32 -0
  188. package/src/index.ts +3 -10
  189. package/src/interaction_client/BaseInteractionClient.ts +1 -1
  190. package/src/interaction_client/NativeInteractionClient.ts +23 -6
  191. package/src/interaction_client/PopupClient.ts +41 -61
  192. package/src/interaction_client/RedirectClient.ts +42 -47
  193. package/src/interaction_client/SilentAuthCodeClient.ts +6 -16
  194. package/src/interaction_client/SilentCacheClient.ts +11 -3
  195. package/src/interaction_client/SilentIframeClient.ts +54 -34
  196. package/src/interaction_client/SilentRefreshClient.ts +5 -19
  197. package/src/interaction_client/StandardInteractionClient.ts +1 -1
  198. package/src/interaction_handler/InteractionHandler.ts +34 -104
  199. package/src/interaction_handler/RedirectHandler.ts +48 -22
  200. package/src/interaction_handler/SilentHandler.ts +177 -233
  201. package/src/naa/AccountInfo.ts +17 -0
  202. package/src/naa/AccountRequests.ts +16 -0
  203. package/src/naa/AuthBridge.ts +16 -0
  204. package/src/naa/BridgeCapabilities.ts +8 -0
  205. package/src/naa/BridgeError.ts +18 -0
  206. package/src/naa/BridgeProxy.ts +230 -0
  207. package/src/naa/BridgeRequest.ts +12 -0
  208. package/src/naa/BridgeRequestEnvelope.ts +46 -0
  209. package/src/naa/BridgeResponseEnvelope.ts +21 -0
  210. package/src/naa/BridgeStatusCode.ts +15 -0
  211. package/src/naa/IBridgeProxy.ts +25 -0
  212. package/src/naa/InitializeBridgeResponse.ts +12 -0
  213. package/src/naa/TokenRequest.ts +26 -0
  214. package/src/naa/TokenResponse.ts +61 -0
  215. package/src/naa/mapping/NestedAppAuthAdapter.ts +252 -0
  216. package/src/operatingcontext/TeamsAppOperatingContext.ts +43 -3
  217. package/src/operatingcontext/UnknownOperatingContext.ts +48 -0
  218. package/src/packageMetadata.ts +1 -1
  219. package/src/utils/BrowserUtils.ts +133 -125
  220. package/dist/utils/BrowserStringUtils.d.ts +0 -22
  221. package/dist/utils/BrowserStringUtils.d.ts.map +0 -1
  222. package/dist/utils/BrowserStringUtils.mjs +0 -144
  223. package/dist/utils/BrowserStringUtils.mjs.map +0 -1
  224. package/src/utils/BrowserStringUtils.ts +0 -143
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "type": "git",
11
11
  "url": "https://github.com/AzureAD/microsoft-authentication-library-for-js.git"
12
12
  },
13
- "version": "3.2.0",
13
+ "version": "3.4.0",
14
14
  "description": "Microsoft Authentication Library for js",
15
15
  "keywords": [
16
16
  "implicit",
@@ -100,6 +100,6 @@
100
100
  "typescript": "^4.9.5"
101
101
  },
102
102
  "dependencies": {
103
- "@azure/msal-common": "14.1.0"
103
+ "@azure/msal-common": "14.3.0"
104
104
  }
105
105
  }
@@ -20,7 +20,7 @@ import {
20
20
  } from "@azure/msal-common";
21
21
  import { EndSessionRequest } from "../request/EndSessionRequest";
22
22
  import { SsoSilentRequest } from "../request/SsoSilentRequest";
23
- import { ControllerFactory } from "../controllers/ControllerFactory";
23
+ import * as ControllerFactory from "../controllers/ControllerFactory";
24
24
  import { StandardController } from "../controllers/StandardController";
25
25
  import { BrowserConfiguration, Configuration } from "../config/Configuration";
26
26
  import { StandardOperatingContext } from "../operatingcontext/StandardOperatingContext";
@@ -38,8 +38,9 @@ export class PublicClientApplication implements IPublicClientApplication {
38
38
  public static async createPublicClientApplication(
39
39
  configuration: Configuration
40
40
  ): Promise<IPublicClientApplication> {
41
- const factory = new ControllerFactory(configuration);
42
- const controller = await factory.createController();
41
+ const controller = await ControllerFactory.createV3Controller(
42
+ configuration
43
+ );
43
44
  const pca = new PublicClientApplication(configuration, controller);
44
45
 
45
46
  return pca;
@@ -0,0 +1,444 @@
1
+ /*
2
+ * Copyright (c) Microsoft Corporation. All rights reserved.
3
+ * Licensed under the MIT License.
4
+ */
5
+
6
+ import { ITokenCache } from "../cache/ITokenCache";
7
+ import { INavigationClient } from "../navigation/INavigationClient";
8
+ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
9
+ import { PopupRequest } from "../request/PopupRequest";
10
+ import { RedirectRequest } from "../request/RedirectRequest";
11
+ import { SilentRequest } from "../request/SilentRequest";
12
+ import { WrapperSKU } from "../utils/BrowserConstants";
13
+ import { IPublicClientApplication } from "./IPublicClientApplication";
14
+ import { IController } from "../controllers/IController";
15
+ import {
16
+ PerformanceCallbackFunction,
17
+ AccountInfo,
18
+ AccountFilter,
19
+ Logger,
20
+ } from "@azure/msal-common";
21
+ import { EndSessionRequest } from "../request/EndSessionRequest";
22
+ import { SsoSilentRequest } from "../request/SsoSilentRequest";
23
+ import * as ControllerFactory from "../controllers/ControllerFactory";
24
+ import { BrowserConfiguration, Configuration } from "../config/Configuration";
25
+ import { EventCallbackFunction } from "../event/EventMessage";
26
+ import { ClearCacheRequest } from "../request/ClearCacheRequest";
27
+ import { AuthenticationResult } from "../response/AuthenticationResult";
28
+ import { UnknownOperatingContextController } from "../controllers/UnknownOperatingContextController";
29
+ import { UnknownOperatingContext } from "../operatingcontext/UnknownOperatingContext";
30
+
31
+ /**
32
+ * PublicClientNext is an early look at the planned implementation of PublicClientApplication in the next major version of MSAL.js.
33
+ * It contains support for multiple API implementations based on the runtime environment that it is running in.
34
+ *
35
+ * The goals of these changes are to provide a clean separation of behavior between different operating contexts (Nested App Auth, Platform Brokers, Plain old Browser, etc.)
36
+ * while still providing a consistent API surface for developers.
37
+ *
38
+ */
39
+ export class PublicClientNext implements IPublicClientApplication {
40
+ /*
41
+ * Definite assignment assertion used below
42
+ * https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#definite-assignment-assertions
43
+ */
44
+ protected controller!: IController;
45
+ protected configuration: Configuration;
46
+
47
+ public static async createPublicClientApplication(
48
+ configuration: Configuration
49
+ ): Promise<IPublicClientApplication> {
50
+ const controller = await ControllerFactory.createController(
51
+ configuration
52
+ );
53
+ let pca;
54
+ if (controller !== null) {
55
+ pca = new PublicClientNext(configuration, controller);
56
+ } else {
57
+ pca = new PublicClientNext(configuration);
58
+ }
59
+ return pca;
60
+ }
61
+
62
+ /**
63
+ * @constructor
64
+ * Constructor for the PublicClientNext used to instantiate the PublicClientNext object
65
+ *
66
+ * Important attributes in the Configuration object for auth are:
67
+ * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview
68
+ * - authority: the authority URL for your application.
69
+ * - redirect_uri: the uri of your application registered in the portal.
70
+ *
71
+ * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.
72
+ * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}
73
+ * If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
74
+ * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
75
+ * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
76
+ * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
77
+ *
78
+ * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/
79
+ * Full B2C functionality will be available in this library in future versions.
80
+ *
81
+ * @param configuration Object for the MSAL PublicClientApplication instance
82
+ * @param IController Optional parameter to explictly set the controller. (Will be removed when we remove public constructor)
83
+ */
84
+ private constructor(
85
+ configuration: Configuration,
86
+ controller?: IController
87
+ ) {
88
+ this.configuration = configuration;
89
+ if (controller) {
90
+ this.controller = controller;
91
+ } else {
92
+ const operatingContext = new UnknownOperatingContext(configuration);
93
+ this.controller = new UnknownOperatingContextController(
94
+ operatingContext
95
+ );
96
+ }
97
+ }
98
+
99
+ /**
100
+ * Initializer function to perform async startup tasks such as connecting to WAM extension
101
+ */
102
+ async initialize(): Promise<void> {
103
+ if (this.controller instanceof UnknownOperatingContextController) {
104
+ const result = await ControllerFactory.createController(
105
+ this.configuration
106
+ );
107
+ if (result !== null) {
108
+ this.controller = result;
109
+ }
110
+ return this.controller.initialize();
111
+ }
112
+ return Promise.resolve();
113
+ }
114
+
115
+ /**
116
+ * Use when you want to obtain an access_token for your API via opening a popup window in the user's browser
117
+ *
118
+ * @param request
119
+ *
120
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
121
+ */
122
+ async acquireTokenPopup(
123
+ request: PopupRequest
124
+ ): Promise<AuthenticationResult> {
125
+ return this.controller.acquireTokenPopup(request);
126
+ }
127
+
128
+ /**
129
+ * Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects
130
+ * the page, so any code that follows this function will not execute.
131
+ *
132
+ * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current
133
+ * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
134
+ *
135
+ * @param request
136
+ */
137
+ acquireTokenRedirect(request: RedirectRequest): Promise<void> {
138
+ return this.controller.acquireTokenRedirect(request);
139
+ }
140
+
141
+ /**
142
+ * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.
143
+ *
144
+ * @param {@link (SilentRequest:type)}
145
+ * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthenticationResult} object
146
+ */
147
+ acquireTokenSilent(
148
+ silentRequest: SilentRequest
149
+ ): Promise<AuthenticationResult> {
150
+ return this.controller.acquireTokenSilent(silentRequest);
151
+ }
152
+
153
+ /**
154
+ * This function redeems an authorization code (passed as code) from the eSTS token endpoint.
155
+ * This authorization code should be acquired server-side using a confidential client to acquire a spa_code.
156
+ * This API is not indended for normal authorization code acquisition and redemption.
157
+ *
158
+ * Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.
159
+ *
160
+ * @param request {@link AuthorizationCodeRequest}
161
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
162
+ */
163
+ acquireTokenByCode(
164
+ request: AuthorizationCodeRequest
165
+ ): Promise<AuthenticationResult> {
166
+ return this.controller.acquireTokenByCode(request);
167
+ }
168
+
169
+ /**
170
+ * Adds event callbacks to array
171
+ * @param callback
172
+ */
173
+ addEventCallback(callback: EventCallbackFunction): string | null {
174
+ return this.controller.addEventCallback(callback);
175
+ }
176
+
177
+ /**
178
+ * Removes callback with provided id from callback array
179
+ * @param callbackId
180
+ */
181
+ removeEventCallback(callbackId: string): void {
182
+ return this.controller.removeEventCallback(callbackId);
183
+ }
184
+
185
+ /**
186
+ * Registers a callback to receive performance events.
187
+ *
188
+ * @param {PerformanceCallbackFunction} callback
189
+ * @returns {string}
190
+ */
191
+ addPerformanceCallback(callback: PerformanceCallbackFunction): string {
192
+ return this.controller.addPerformanceCallback(callback);
193
+ }
194
+
195
+ /**
196
+ * Removes a callback registered with addPerformanceCallback.
197
+ *
198
+ * @param {string} callbackId
199
+ * @returns {boolean}
200
+ */
201
+ removePerformanceCallback(callbackId: string): boolean {
202
+ return this.controller.removePerformanceCallback(callbackId);
203
+ }
204
+
205
+ /**
206
+ * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
207
+ */
208
+ enableAccountStorageEvents(): void {
209
+ this.controller.enableAccountStorageEvents();
210
+ }
211
+
212
+ /**
213
+ * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
214
+ */
215
+ disableAccountStorageEvents(): void {
216
+ this.controller.disableAccountStorageEvents();
217
+ }
218
+
219
+ /**
220
+ * Returns the first account found in the cache that matches the account filter passed in.
221
+ * @param accountFilter
222
+ * @returns The first account found in the cache matching the provided filter or null if no account could be found.
223
+ */
224
+ getAccount(accountFilter: AccountFilter): AccountInfo | null {
225
+ return this.controller.getAccount(accountFilter);
226
+ }
227
+
228
+ /**
229
+ * Returns the signed in account matching homeAccountId.
230
+ * (the account object is created at the time of successful login)
231
+ * or null when no matching account is found
232
+ * @param homeAccountId
233
+ * @returns The account object stored in MSAL
234
+ * @deprecated - Use getAccount instead
235
+ */
236
+ getAccountByHomeId(homeAccountId: string): AccountInfo | null {
237
+ return this.controller.getAccountByHomeId(homeAccountId);
238
+ }
239
+
240
+ /**
241
+ * Returns the signed in account matching localAccountId.
242
+ * (the account object is created at the time of successful login)
243
+ * or null when no matching account is found
244
+ * @param localAccountId
245
+ * @returns The account object stored in MSAL
246
+ * @deprecated - Use getAccount instead
247
+ */
248
+ getAccountByLocalId(localId: string): AccountInfo | null {
249
+ return this.controller.getAccountByLocalId(localId);
250
+ }
251
+
252
+ /**
253
+ * Returns the signed in account matching username.
254
+ * (the account object is created at the time of successful login)
255
+ * or null when no matching account is found.
256
+ * This API is provided for convenience but getAccountById should be used for best reliability
257
+ * @param userName
258
+ * @returns The account object stored in MSAL
259
+ * @deprecated - Use getAccount instead
260
+ */
261
+ getAccountByUsername(userName: string): AccountInfo | null {
262
+ return this.controller.getAccountByUsername(userName);
263
+ }
264
+
265
+ /**
266
+ * Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.
267
+ * @param accountFilter - (Optional) filter to narrow down the accounts returned
268
+ * @returns Array of AccountInfo objects in cache
269
+ */
270
+ getAllAccounts(accountFilter?: AccountFilter): AccountInfo[] {
271
+ return this.controller.getAllAccounts(accountFilter);
272
+ }
273
+
274
+ /**
275
+ * Event handler function which allows users to fire events after the PublicClientApplication object
276
+ * has loaded during redirect flows. This should be invoked on all page loads involved in redirect
277
+ * auth flows.
278
+ * @param hash Hash to process. Defaults to the current value of window.location.hash. Only needs to be provided explicitly if the response to be handled is not contained in the current value.
279
+ * @returns Token response or null. If the return value is null, then no auth redirect was detected.
280
+ */
281
+ handleRedirectPromise(
282
+ hash?: string | undefined
283
+ ): Promise<AuthenticationResult | null> {
284
+ return this.controller.handleRedirectPromise(hash);
285
+ }
286
+
287
+ /**
288
+ * Use when initiating the login process via opening a popup window in the user's browser
289
+ *
290
+ * @param request
291
+ *
292
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
293
+ */
294
+ loginPopup(
295
+ request?: PopupRequest | undefined
296
+ ): Promise<AuthenticationResult> {
297
+ return this.controller.loginPopup(request);
298
+ }
299
+
300
+ /**
301
+ * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so
302
+ * any code that follows this function will not execute.
303
+ *
304
+ * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current
305
+ * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
306
+ *
307
+ * @param request
308
+ */
309
+ loginRedirect(request?: RedirectRequest | undefined): Promise<void> {
310
+ return this.controller.loginRedirect(request);
311
+ }
312
+
313
+ /**
314
+ * Deprecated logout function. Use logoutRedirect or logoutPopup instead
315
+ * @param logoutRequest
316
+ * @deprecated
317
+ */
318
+ logout(logoutRequest?: EndSessionRequest): Promise<void> {
319
+ return this.controller.logout(logoutRequest);
320
+ }
321
+
322
+ /**
323
+ * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
324
+ * Default behaviour is to redirect the user to `window.location.href`.
325
+ * @param logoutRequest
326
+ */
327
+ logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void> {
328
+ return this.controller.logoutRedirect(logoutRequest);
329
+ }
330
+
331
+ /**
332
+ * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
333
+ * @param logoutRequest
334
+ */
335
+ logoutPopup(logoutRequest?: EndSessionRequest): Promise<void> {
336
+ return this.controller.logoutPopup(logoutRequest);
337
+ }
338
+
339
+ /**
340
+ * This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:
341
+ * - Any browser using a form of Intelligent Tracking Prevention
342
+ * - If there is not an established session with the service
343
+ *
344
+ * In these cases, the request must be done inside a popup or full frame redirect.
345
+ *
346
+ * For the cases where interaction is required, you cannot send a request with prompt=none.
347
+ *
348
+ * If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as
349
+ * you session on the server still exists.
350
+ * @param request {@link SsoSilentRequest}
351
+ *
352
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
353
+ */
354
+ ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult> {
355
+ return this.controller.ssoSilent(request);
356
+ }
357
+
358
+ /**
359
+ * Gets the token cache for the application.
360
+ */
361
+ getTokenCache(): ITokenCache {
362
+ return this.controller.getTokenCache();
363
+ }
364
+
365
+ /**
366
+ * Returns the logger instance
367
+ */
368
+ getLogger(): Logger {
369
+ return this.controller.getLogger();
370
+ }
371
+
372
+ /**
373
+ * Replaces the default logger set in configurations with new Logger with new configurations
374
+ * @param logger Logger instance
375
+ */
376
+ setLogger(logger: Logger): void {
377
+ this.controller.setLogger(logger);
378
+ }
379
+
380
+ /**
381
+ * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
382
+ * @param account
383
+ */
384
+ setActiveAccount(account: AccountInfo | null): void {
385
+ this.controller.setActiveAccount(account);
386
+ }
387
+
388
+ /**
389
+ * Gets the currently active account
390
+ */
391
+ getActiveAccount(): AccountInfo | null {
392
+ return this.controller.getActiveAccount();
393
+ }
394
+
395
+ /**
396
+ * Called by wrapper libraries (Angular & React) to set SKU and Version passed down to telemetry, logger, etc.
397
+ * @param sku
398
+ * @param version
399
+ */
400
+ initializeWrapperLibrary(sku: WrapperSKU, version: string): void {
401
+ return this.controller.initializeWrapperLibrary(sku, version);
402
+ }
403
+
404
+ /**
405
+ * Sets navigation client
406
+ * @param navigationClient
407
+ */
408
+ setNavigationClient(navigationClient: INavigationClient): void {
409
+ this.controller.setNavigationClient(navigationClient);
410
+ }
411
+
412
+ /**
413
+ * Returns the configuration object
414
+ * @internal
415
+ */
416
+ getConfiguration(): BrowserConfiguration {
417
+ return this.controller.getConfiguration();
418
+ }
419
+
420
+ /**
421
+ * Hydrates cache with the tokens and account in the AuthenticationResult object
422
+ * @param result
423
+ * @param request - The request object that was used to obtain the AuthenticationResult
424
+ * @returns
425
+ */
426
+ async hydrateCache(
427
+ result: AuthenticationResult,
428
+ request:
429
+ | SilentRequest
430
+ | SsoSilentRequest
431
+ | RedirectRequest
432
+ | PopupRequest
433
+ ): Promise<void> {
434
+ return this.controller.hydrateCache(result, request);
435
+ }
436
+
437
+ /**
438
+ * Clears tokens and account from the browser cache.
439
+ * @param logoutRequest
440
+ */
441
+ clearCache(logoutRequest?: ClearCacheRequest): Promise<void> {
442
+ return this.controller.clearCache(logoutRequest);
443
+ }
444
+ }