@azure/msal-browser 3.0.0-alpha.1 → 3.0.0-alpha.2

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 (142) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +213 -213
  3. package/dist/app/IPublicClientApplication.d.ts +45 -45
  4. package/dist/app/IPublicClientApplication.js +96 -96
  5. package/dist/app/PublicClientApplication.d.ts +244 -244
  6. package/dist/app/PublicClientApplication.js +307 -307
  7. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +63 -63
  8. package/dist/broker/nativeBroker/NativeMessageHandler.js +255 -255
  9. package/dist/broker/nativeBroker/NativeRequest.d.ts +43 -43
  10. package/dist/broker/nativeBroker/NativeResponse.d.ts +48 -48
  11. package/dist/cache/AsyncMemoryStorage.d.ts +51 -51
  12. package/dist/cache/AsyncMemoryStorage.js +132 -132
  13. package/dist/cache/BrowserCacheManager.d.ts +377 -377
  14. package/dist/cache/BrowserCacheManager.js +1276 -1276
  15. package/dist/cache/BrowserStorage.d.ts +11 -11
  16. package/dist/cache/BrowserStorage.js +35 -35
  17. package/dist/cache/CryptoKeyStore.d.ts +17 -17
  18. package/dist/cache/CryptoKeyStore.js +41 -41
  19. package/dist/cache/DatabaseStorage.d.ts +56 -56
  20. package/dist/cache/DatabaseStorage.js +190 -190
  21. package/dist/cache/IAsyncMemoryStorage.d.ts +27 -27
  22. package/dist/cache/ITokenCache.d.ts +10 -10
  23. package/dist/cache/IWindowStorage.d.ts +27 -27
  24. package/dist/cache/MemoryStorage.d.ts +11 -11
  25. package/dist/cache/MemoryStorage.js +31 -31
  26. package/dist/cache/TokenCache.d.ts +76 -76
  27. package/dist/cache/TokenCache.js +225 -225
  28. package/dist/config/Configuration.d.ts +203 -203
  29. package/dist/config/Configuration.js +101 -101
  30. package/dist/controllers/ControllerFactory.d.ts +9 -9
  31. package/dist/controllers/ControllerFactory.js +37 -37
  32. package/dist/controllers/IController.d.ts +66 -66
  33. package/dist/controllers/StandardController.d.ts +413 -413
  34. package/dist/controllers/StandardController.js +1272 -1272
  35. package/dist/crypto/BrowserCrypto.d.ts +61 -61
  36. package/dist/crypto/BrowserCrypto.js +131 -131
  37. package/dist/crypto/CryptoOps.d.ts +73 -73
  38. package/dist/crypto/CryptoOps.js +150 -150
  39. package/dist/crypto/GuidGenerator.d.ts +12 -12
  40. package/dist/crypto/GuidGenerator.js +96 -96
  41. package/dist/crypto/ISubtleCrypto.d.ts +9 -9
  42. package/dist/crypto/ModernBrowserCrypto.d.ts +9 -9
  43. package/dist/crypto/ModernBrowserCrypto.js +24 -24
  44. package/dist/crypto/MsBrowserCrypto.d.ts +9 -9
  45. package/dist/crypto/MsBrowserCrypto.js +79 -79
  46. package/dist/crypto/MsrBrowserCrypto.d.ts +17 -17
  47. package/dist/crypto/MsrBrowserCrypto.js +28 -28
  48. package/dist/crypto/PkceGenerator.d.ts +24 -24
  49. package/dist/crypto/PkceGenerator.js +58 -58
  50. package/dist/crypto/SignedHttpRequest.d.ts +30 -30
  51. package/dist/crypto/SignedHttpRequest.js +39 -39
  52. package/dist/encode/Base64Decode.d.ts +22 -22
  53. package/dist/encode/Base64Decode.js +73 -73
  54. package/dist/encode/Base64Encode.d.ts +31 -31
  55. package/dist/encode/Base64Encode.js +79 -79
  56. package/dist/error/BrowserAuthError.d.ts +382 -382
  57. package/dist/error/BrowserAuthError.js +483 -483
  58. package/dist/error/BrowserConfigurationAuthError.d.ts +70 -70
  59. package/dist/error/BrowserConfigurationAuthError.js +96 -96
  60. package/dist/error/NativeAuthError.d.ts +56 -56
  61. package/dist/error/NativeAuthError.js +88 -88
  62. package/dist/event/EventHandler.d.ts +41 -41
  63. package/dist/event/EventHandler.js +119 -119
  64. package/dist/event/EventMessage.d.ts +25 -25
  65. package/dist/event/EventMessage.js +67 -67
  66. package/dist/event/EventType.d.ts +26 -26
  67. package/dist/event/EventType.js +31 -31
  68. package/dist/index.d.ts +35 -35
  69. package/dist/index.js +1 -1
  70. package/dist/interaction_client/BaseInteractionClient.d.ts +52 -52
  71. package/dist/interaction_client/BaseInteractionClient.js +138 -138
  72. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
  73. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.js +10 -10
  74. package/dist/interaction_client/NativeInteractionClient.d.ts +148 -148
  75. package/dist/interaction_client/NativeInteractionClient.js +516 -516
  76. package/dist/interaction_client/PopupClient.d.ts +111 -111
  77. package/dist/interaction_client/PopupClient.js +476 -476
  78. package/dist/interaction_client/RedirectClient.d.ts +48 -48
  79. package/dist/interaction_client/RedirectClient.js +290 -290
  80. package/dist/interaction_client/SilentAuthCodeClient.d.ts +22 -22
  81. package/dist/interaction_client/SilentAuthCodeClient.js +62 -62
  82. package/dist/interaction_client/SilentCacheClient.d.ts +21 -21
  83. package/dist/interaction_client/SilentCacheClient.js +67 -67
  84. package/dist/interaction_client/SilentIframeClient.d.ts +31 -31
  85. package/dist/interaction_client/SilentIframeClient.js +127 -127
  86. package/dist/interaction_client/SilentRefreshClient.d.ts +19 -19
  87. package/dist/interaction_client/SilentRefreshClient.js +62 -62
  88. package/dist/interaction_client/StandardInteractionClient.d.ts +59 -59
  89. package/dist/interaction_client/StandardInteractionClient.js +259 -259
  90. package/dist/interaction_handler/InteractionHandler.d.ts +39 -39
  91. package/dist/interaction_handler/InteractionHandler.js +127 -127
  92. package/dist/interaction_handler/RedirectHandler.d.ts +24 -24
  93. package/dist/interaction_handler/RedirectHandler.js +118 -118
  94. package/dist/interaction_handler/SilentHandler.d.ts +47 -47
  95. package/dist/interaction_handler/SilentHandler.js +162 -162
  96. package/dist/internals.d.ts +23 -23
  97. package/dist/internals.js +4 -4
  98. package/dist/navigation/INavigationClient.d.ts +16 -16
  99. package/dist/navigation/NavigationClient.d.ts +22 -22
  100. package/dist/navigation/NavigationClient.js +40 -40
  101. package/dist/navigation/NavigationOptions.d.ts +12 -12
  102. package/dist/network/FetchClient.d.ts +26 -26
  103. package/dist/network/FetchClient.js +99 -99
  104. package/dist/network/XhrClient.d.ts +40 -40
  105. package/dist/network/XhrClient.js +117 -117
  106. package/dist/operatingcontext/BaseOperatingContext.d.ts +40 -40
  107. package/dist/operatingcontext/BaseOperatingContext.js +44 -44
  108. package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
  109. package/dist/operatingcontext/StandardOperatingContext.js +43 -43
  110. package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +25 -25
  111. package/dist/operatingcontext/TeamsAppOperatingContext.js +42 -42
  112. package/dist/packageMetadata.d.ts +2 -2
  113. package/dist/packageMetadata.js +4 -4
  114. package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
  115. package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
  116. package/dist/request/EndSessionPopupRequest.d.ts +18 -18
  117. package/dist/request/EndSessionRequest.d.ts +15 -15
  118. package/dist/request/PopupRequest.d.ts +32 -32
  119. package/dist/request/PopupWindowAttributes.d.ts +15 -15
  120. package/dist/request/RedirectRequest.d.ts +33 -33
  121. package/dist/request/SilentRequest.d.ts +30 -30
  122. package/dist/request/SsoSilentRequest.d.ts +26 -26
  123. package/dist/telemetry/BrowserPerformanceClient.d.ts +38 -38
  124. package/dist/telemetry/BrowserPerformanceClient.js +124 -124
  125. package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
  126. package/dist/telemetry/BrowserPerformanceMeasurement.js +92 -92
  127. package/dist/utils/BrowserConstants.d.ts +166 -166
  128. package/dist/utils/BrowserConstants.js +214 -214
  129. package/dist/utils/BrowserProtocolUtils.d.ts +18 -18
  130. package/dist/utils/BrowserProtocolUtils.js +34 -34
  131. package/dist/utils/BrowserStringUtils.d.ts +26 -26
  132. package/dist/utils/BrowserStringUtils.js +149 -149
  133. package/dist/utils/BrowserUtils.d.ts +65 -65
  134. package/dist/utils/BrowserUtils.js +138 -138
  135. package/dist/utils/MathUtils.d.ts +11 -11
  136. package/dist/utils/MathUtils.js +21 -21
  137. package/lib/msal-browser.cjs.js +18383 -0
  138. package/lib/msal-browser.cjs.js.map +1 -0
  139. package/lib/msal-browser.js +18389 -0
  140. package/lib/msal-browser.js.map +1 -0
  141. package/lib/msal-browser.min.js +74 -0
  142. package/package.json +97 -95
@@ -1,245 +1,245 @@
1
- import { ITokenCache } from "../cache/ITokenCache";
2
- import { INavigationClient } from "../navigation/INavigationClient";
3
- import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
4
- import { PopupRequest } from "../request/PopupRequest";
5
- import { RedirectRequest } from "../request/RedirectRequest";
6
- import { SilentRequest } from "../request/SilentRequest";
7
- import { WrapperSKU } from "../utils/BrowserConstants";
8
- import { IPublicClientApplication } from "./IPublicClientApplication";
9
- import { IController } from "../controllers/IController";
10
- import { AuthenticationResult, PerformanceCallbackFunction, AccountInfo, Logger } from "@azure/msal-common";
11
- import { EndSessionRequest } from "../request/EndSessionRequest";
12
- import { SsoSilentRequest } from "../request/SsoSilentRequest";
13
- import { BrowserConfiguration, Configuration } from "../config/Configuration";
14
- /**
15
- * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications
16
- * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.
17
- */
18
- export declare class PublicClientApplication implements IPublicClientApplication {
19
- protected controller: IController;
20
- static createPublicClientApplication(configuration: Configuration): Promise<IPublicClientApplication>;
21
- /**
22
- * @constructor
23
- * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object
24
- *
25
- * Important attributes in the Configuration object for auth are:
26
- * - 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
27
- * - authority: the authority URL for your application.
28
- * - redirect_uri: the uri of your application registered in the portal.
29
- *
30
- * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.
31
- * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}
32
- * 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).
33
- * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
34
- * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
35
- * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
36
- *
37
- * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/
38
- * Full B2C functionality will be available in this library in future versions.
39
- *
40
- * @param configuration Object for the MSAL PublicClientApplication instance
41
- * @param IController Optional parameter to explictly set the controller. (Will be removed when we remove public constructor)
42
- */
43
- constructor(configuration: Configuration, controller?: IController);
44
- /**
45
- * Initializer function to perform async startup tasks such as connecting to WAM extension
46
- */
47
- initialize(): Promise<void>;
48
- /**
49
- * Use when you want to obtain an access_token for your API via opening a popup window in the user's browser
50
- *
51
- * @param request
52
- *
53
- * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
54
- */
55
- acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
56
- /**
57
- * 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
58
- * the page, so any code that follows this function will not execute.
59
- *
60
- * 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
61
- * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
62
- *
63
- * @param request
64
- */
65
- acquireTokenRedirect(request: RedirectRequest): Promise<void>;
66
- /**
67
- * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.
68
- *
69
- * @param {@link (SilentRequest:type)}
70
- * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
71
- */
72
- acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;
73
- /**
74
- * This function redeems an authorization code (passed as code) from the eSTS token endpoint.
75
- * This authorization code should be acquired server-side using a confidential client to acquire a spa_code.
76
- * This API is not indended for normal authorization code acquisition and redemption.
77
- *
78
- * Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.
79
- *
80
- * @param request {@link AuthorizationCodeRequest}
81
- * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
82
- */
83
- acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
84
- /**
85
- * Adds event callbacks to array
86
- * @param callback
87
- */
88
- addEventCallback(callback: Function): string | null;
89
- /**
90
- * Removes callback with provided id from callback array
91
- * @param callbackId
92
- */
93
- removeEventCallback(callbackId: string): void;
94
- /**
95
- * Registers a callback to receive performance events.
96
- *
97
- * @param {PerformanceCallbackFunction} callback
98
- * @returns {string}
99
- */
100
- addPerformanceCallback(callback: PerformanceCallbackFunction): string;
101
- /**
102
- * Removes a callback registered with addPerformanceCallback.
103
- *
104
- * @param {string} callbackId
105
- * @returns {boolean}
106
- */
107
- removePerformanceCallback(callbackId: string): boolean;
108
- /**
109
- * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
110
- */
111
- enableAccountStorageEvents(): void;
112
- /**
113
- * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
114
- */
115
- disableAccountStorageEvents(): void;
116
- /**
117
- * Returns the signed in account matching homeAccountId.
118
- * (the account object is created at the time of successful login)
119
- * or null when no matching account is found
120
- * @param homeAccountId
121
- * @returns The account object stored in MSAL
122
- */
123
- getAccountByHomeId(homeAccountId: string): AccountInfo | null;
124
- /**
125
- * Returns the signed in account matching localAccountId.
126
- * (the account object is created at the time of successful login)
127
- * or null when no matching account is found
128
- * @param localAccountId
129
- * @returns The account object stored in MSAL
130
- */
131
- getAccountByLocalId(localId: string): AccountInfo | null;
132
- /**
133
- * Returns the signed in account matching username.
134
- * (the account object is created at the time of successful login)
135
- * or null when no matching account is found.
136
- * This API is provided for convenience but getAccountById should be used for best reliability
137
- * @param userName
138
- * @returns The account object stored in MSAL
139
- */
140
- getAccountByUsername(userName: string): AccountInfo | null;
141
- /**
142
- * Returns all accounts that MSAL currently has data for.
143
- * (the account object is created at the time of successful login)
144
- * or empty array when no accounts are found
145
- * @returns Array of account objects in cache
146
- */
147
- getAllAccounts(): AccountInfo[];
148
- /**
149
- * Event handler function which allows users to fire events after the PublicClientApplication object
150
- * has loaded during redirect flows. This should be invoked on all page loads involved in redirect
151
- * auth flows.
152
- * @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.
153
- * @returns Token response or null. If the return value is null, then no auth redirect was detected.
154
- */
155
- handleRedirectPromise(hash?: string | undefined): Promise<AuthenticationResult | null>;
156
- /**
157
- * Use when initiating the login process via opening a popup window in the user's browser
158
- *
159
- * @param request
160
- *
161
- * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
162
- */
163
- loginPopup(request?: PopupRequest | undefined): Promise<AuthenticationResult>;
164
- /**
165
- * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so
166
- * any code that follows this function will not execute.
167
- *
168
- * 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
169
- * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
170
- *
171
- * @param request
172
- */
173
- loginRedirect(request?: RedirectRequest | undefined): Promise<void>;
174
- /**
175
- * Deprecated logout function. Use logoutRedirect or logoutPopup instead
176
- * @param logoutRequest
177
- * @deprecated
178
- */
179
- logout(logoutRequest?: EndSessionRequest): Promise<void>;
180
- /**
181
- * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
182
- * Default behaviour is to redirect the user to `window.location.href`.
183
- * @param logoutRequest
184
- */
185
- logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;
186
- /**
187
- * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
188
- * @param logoutRequest
189
- */
190
- logoutPopup(logoutRequest?: EndSessionRequest): Promise<void>;
191
- /**
192
- * This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:
193
- * - Any browser using a form of Intelligent Tracking Prevention
194
- * - If there is not an established session with the service
195
- *
196
- * In these cases, the request must be done inside a popup or full frame redirect.
197
- *
198
- * For the cases where interaction is required, you cannot send a request with prompt=none.
199
- *
200
- * If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as
201
- * you session on the server still exists.
202
- * @param request {@link SsoSilentRequest}
203
- *
204
- * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
205
- */
206
- ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;
207
- /**
208
- * Gets the token cache for the application.
209
- */
210
- getTokenCache(): ITokenCache;
211
- /**
212
- * Returns the logger instance
213
- */
214
- getLogger(): Logger;
215
- /**
216
- * Replaces the default logger set in configurations with new Logger with new configurations
217
- * @param logger Logger instance
218
- */
219
- setLogger(logger: Logger): void;
220
- /**
221
- * 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.
222
- * @param account
223
- */
224
- setActiveAccount(account: AccountInfo | null): void;
225
- /**
226
- * Gets the currently active account
227
- */
228
- getActiveAccount(): AccountInfo | null;
229
- /**
230
- * Called by wrapper libraries (Angular & React) to set SKU and Version passed down to telemetry, logger, etc.
231
- * @param sku
232
- * @param version
233
- */
234
- initializeWrapperLibrary(sku: WrapperSKU, version: string): void;
235
- /**
236
- * Sets navigation client
237
- * @param navigationClient
238
- */
239
- setNavigationClient(navigationClient: INavigationClient): void;
240
- /**
241
- * Returns the configuration object
242
- */
243
- getConfiguration(): BrowserConfiguration;
244
- }
1
+ import { ITokenCache } from "../cache/ITokenCache";
2
+ import { INavigationClient } from "../navigation/INavigationClient";
3
+ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
4
+ import { PopupRequest } from "../request/PopupRequest";
5
+ import { RedirectRequest } from "../request/RedirectRequest";
6
+ import { SilentRequest } from "../request/SilentRequest";
7
+ import { WrapperSKU } from "../utils/BrowserConstants";
8
+ import { IPublicClientApplication } from "./IPublicClientApplication";
9
+ import { IController } from "../controllers/IController";
10
+ import { AuthenticationResult, PerformanceCallbackFunction, AccountInfo, Logger } from "@azure/msal-common";
11
+ import { EndSessionRequest } from "../request/EndSessionRequest";
12
+ import { SsoSilentRequest } from "../request/SsoSilentRequest";
13
+ import { BrowserConfiguration, Configuration } from "../config/Configuration";
14
+ /**
15
+ * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications
16
+ * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.
17
+ */
18
+ export declare class PublicClientApplication implements IPublicClientApplication {
19
+ protected controller: IController;
20
+ static createPublicClientApplication(configuration: Configuration): Promise<IPublicClientApplication>;
21
+ /**
22
+ * @constructor
23
+ * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object
24
+ *
25
+ * Important attributes in the Configuration object for auth are:
26
+ * - 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
27
+ * - authority: the authority URL for your application.
28
+ * - redirect_uri: the uri of your application registered in the portal.
29
+ *
30
+ * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.
31
+ * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}
32
+ * 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).
33
+ * If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
34
+ * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
35
+ * To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
36
+ *
37
+ * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/
38
+ * Full B2C functionality will be available in this library in future versions.
39
+ *
40
+ * @param configuration Object for the MSAL PublicClientApplication instance
41
+ * @param IController Optional parameter to explictly set the controller. (Will be removed when we remove public constructor)
42
+ */
43
+ constructor(configuration: Configuration, controller?: IController);
44
+ /**
45
+ * Initializer function to perform async startup tasks such as connecting to WAM extension
46
+ */
47
+ initialize(): Promise<void>;
48
+ /**
49
+ * Use when you want to obtain an access_token for your API via opening a popup window in the user's browser
50
+ *
51
+ * @param request
52
+ *
53
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
54
+ */
55
+ acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
56
+ /**
57
+ * 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
58
+ * the page, so any code that follows this function will not execute.
59
+ *
60
+ * 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
61
+ * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
62
+ *
63
+ * @param request
64
+ */
65
+ acquireTokenRedirect(request: RedirectRequest): Promise<void>;
66
+ /**
67
+ * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.
68
+ *
69
+ * @param {@link (SilentRequest:type)}
70
+ * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
71
+ */
72
+ acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;
73
+ /**
74
+ * This function redeems an authorization code (passed as code) from the eSTS token endpoint.
75
+ * This authorization code should be acquired server-side using a confidential client to acquire a spa_code.
76
+ * This API is not indended for normal authorization code acquisition and redemption.
77
+ *
78
+ * Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.
79
+ *
80
+ * @param request {@link AuthorizationCodeRequest}
81
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
82
+ */
83
+ acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
84
+ /**
85
+ * Adds event callbacks to array
86
+ * @param callback
87
+ */
88
+ addEventCallback(callback: Function): string | null;
89
+ /**
90
+ * Removes callback with provided id from callback array
91
+ * @param callbackId
92
+ */
93
+ removeEventCallback(callbackId: string): void;
94
+ /**
95
+ * Registers a callback to receive performance events.
96
+ *
97
+ * @param {PerformanceCallbackFunction} callback
98
+ * @returns {string}
99
+ */
100
+ addPerformanceCallback(callback: PerformanceCallbackFunction): string;
101
+ /**
102
+ * Removes a callback registered with addPerformanceCallback.
103
+ *
104
+ * @param {string} callbackId
105
+ * @returns {boolean}
106
+ */
107
+ removePerformanceCallback(callbackId: string): boolean;
108
+ /**
109
+ * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
110
+ */
111
+ enableAccountStorageEvents(): void;
112
+ /**
113
+ * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
114
+ */
115
+ disableAccountStorageEvents(): void;
116
+ /**
117
+ * Returns the signed in account matching homeAccountId.
118
+ * (the account object is created at the time of successful login)
119
+ * or null when no matching account is found
120
+ * @param homeAccountId
121
+ * @returns The account object stored in MSAL
122
+ */
123
+ getAccountByHomeId(homeAccountId: string): AccountInfo | null;
124
+ /**
125
+ * Returns the signed in account matching localAccountId.
126
+ * (the account object is created at the time of successful login)
127
+ * or null when no matching account is found
128
+ * @param localAccountId
129
+ * @returns The account object stored in MSAL
130
+ */
131
+ getAccountByLocalId(localId: string): AccountInfo | null;
132
+ /**
133
+ * Returns the signed in account matching username.
134
+ * (the account object is created at the time of successful login)
135
+ * or null when no matching account is found.
136
+ * This API is provided for convenience but getAccountById should be used for best reliability
137
+ * @param userName
138
+ * @returns The account object stored in MSAL
139
+ */
140
+ getAccountByUsername(userName: string): AccountInfo | null;
141
+ /**
142
+ * Returns all accounts that MSAL currently has data for.
143
+ * (the account object is created at the time of successful login)
144
+ * or empty array when no accounts are found
145
+ * @returns Array of account objects in cache
146
+ */
147
+ getAllAccounts(): AccountInfo[];
148
+ /**
149
+ * Event handler function which allows users to fire events after the PublicClientApplication object
150
+ * has loaded during redirect flows. This should be invoked on all page loads involved in redirect
151
+ * auth flows.
152
+ * @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.
153
+ * @returns Token response or null. If the return value is null, then no auth redirect was detected.
154
+ */
155
+ handleRedirectPromise(hash?: string | undefined): Promise<AuthenticationResult | null>;
156
+ /**
157
+ * Use when initiating the login process via opening a popup window in the user's browser
158
+ *
159
+ * @param request
160
+ *
161
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
162
+ */
163
+ loginPopup(request?: PopupRequest | undefined): Promise<AuthenticationResult>;
164
+ /**
165
+ * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so
166
+ * any code that follows this function will not execute.
167
+ *
168
+ * 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
169
+ * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
170
+ *
171
+ * @param request
172
+ */
173
+ loginRedirect(request?: RedirectRequest | undefined): Promise<void>;
174
+ /**
175
+ * Deprecated logout function. Use logoutRedirect or logoutPopup instead
176
+ * @param logoutRequest
177
+ * @deprecated
178
+ */
179
+ logout(logoutRequest?: EndSessionRequest): Promise<void>;
180
+ /**
181
+ * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
182
+ * Default behaviour is to redirect the user to `window.location.href`.
183
+ * @param logoutRequest
184
+ */
185
+ logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;
186
+ /**
187
+ * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
188
+ * @param logoutRequest
189
+ */
190
+ logoutPopup(logoutRequest?: EndSessionRequest): Promise<void>;
191
+ /**
192
+ * This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:
193
+ * - Any browser using a form of Intelligent Tracking Prevention
194
+ * - If there is not an established session with the service
195
+ *
196
+ * In these cases, the request must be done inside a popup or full frame redirect.
197
+ *
198
+ * For the cases where interaction is required, you cannot send a request with prompt=none.
199
+ *
200
+ * If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as
201
+ * you session on the server still exists.
202
+ * @param request {@link SsoSilentRequest}
203
+ *
204
+ * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
205
+ */
206
+ ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;
207
+ /**
208
+ * Gets the token cache for the application.
209
+ */
210
+ getTokenCache(): ITokenCache;
211
+ /**
212
+ * Returns the logger instance
213
+ */
214
+ getLogger(): Logger;
215
+ /**
216
+ * Replaces the default logger set in configurations with new Logger with new configurations
217
+ * @param logger Logger instance
218
+ */
219
+ setLogger(logger: Logger): void;
220
+ /**
221
+ * 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.
222
+ * @param account
223
+ */
224
+ setActiveAccount(account: AccountInfo | null): void;
225
+ /**
226
+ * Gets the currently active account
227
+ */
228
+ getActiveAccount(): AccountInfo | null;
229
+ /**
230
+ * Called by wrapper libraries (Angular & React) to set SKU and Version passed down to telemetry, logger, etc.
231
+ * @param sku
232
+ * @param version
233
+ */
234
+ initializeWrapperLibrary(sku: WrapperSKU, version: string): void;
235
+ /**
236
+ * Sets navigation client
237
+ * @param navigationClient
238
+ */
239
+ setNavigationClient(navigationClient: INavigationClient): void;
240
+ /**
241
+ * Returns the configuration object
242
+ */
243
+ getConfiguration(): BrowserConfiguration;
244
+ }
245
245
  //# sourceMappingURL=PublicClientApplication.d.ts.map