@azure/msal-browser 3.20.0 → 3.21.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 (208) hide show
  1. package/dist/app/IPublicClientApplication.d.ts +53 -53
  2. package/dist/app/IPublicClientApplication.mjs +105 -105
  3. package/dist/app/PublicClientApplication.d.ts +293 -293
  4. package/dist/app/PublicClientApplication.mjs +364 -364
  5. package/dist/app/PublicClientNext.d.ts +276 -276
  6. package/dist/app/PublicClientNext.mjs +354 -354
  7. package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +62 -62
  8. package/dist/broker/nativeBroker/NativeMessageHandler.mjs +254 -254
  9. package/dist/broker/nativeBroker/NativeRequest.d.ts +45 -45
  10. package/dist/broker/nativeBroker/NativeResponse.d.ts +48 -48
  11. package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +7 -7
  12. package/dist/broker/nativeBroker/NativeStatusCodes.mjs +11 -11
  13. package/dist/cache/AccountManager.d.ts +48 -48
  14. package/dist/cache/AccountManager.mjs +126 -126
  15. package/dist/cache/AsyncMemoryStorage.d.ts +50 -50
  16. package/dist/cache/AsyncMemoryStorage.mjs +131 -131
  17. package/dist/cache/BrowserCacheManager.d.ts +410 -385
  18. package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
  19. package/dist/cache/BrowserCacheManager.mjs +1364 -1294
  20. package/dist/cache/BrowserCacheManager.mjs.map +1 -1
  21. package/dist/cache/BrowserStorage.d.ts +11 -11
  22. package/dist/cache/BrowserStorage.mjs +32 -32
  23. package/dist/cache/DatabaseStorage.d.ts +56 -56
  24. package/dist/cache/DatabaseStorage.mjs +200 -200
  25. package/dist/cache/IAsyncStorage.d.ts +27 -27
  26. package/dist/cache/ITokenCache.d.ts +11 -11
  27. package/dist/cache/IWindowStorage.d.ts +27 -27
  28. package/dist/cache/MemoryStorage.d.ts +11 -11
  29. package/dist/cache/MemoryStorage.mjs +31 -31
  30. package/dist/cache/TokenCache.d.ts +77 -77
  31. package/dist/cache/TokenCache.mjs +195 -195
  32. package/dist/config/Configuration.d.ts +213 -208
  33. package/dist/config/Configuration.d.ts.map +1 -1
  34. package/dist/config/Configuration.mjs +128 -128
  35. package/dist/config/Configuration.mjs.map +1 -1
  36. package/dist/controllers/ControllerFactory.d.ts +5 -5
  37. package/dist/controllers/ControllerFactory.mjs +25 -25
  38. package/dist/controllers/IController.d.ts +60 -60
  39. package/dist/controllers/NestedAppAuthController.d.ts +202 -202
  40. package/dist/controllers/NestedAppAuthController.mjs +473 -473
  41. package/dist/controllers/StandardController.d.ts +405 -405
  42. package/dist/controllers/StandardController.d.ts.map +1 -1
  43. package/dist/controllers/StandardController.mjs +1334 -1316
  44. package/dist/controllers/StandardController.mjs.map +1 -1
  45. package/dist/controllers/UnknownOperatingContextController.d.ts +86 -86
  46. package/dist/controllers/UnknownOperatingContextController.mjs +256 -256
  47. package/dist/crypto/BrowserCrypto.d.ts +52 -52
  48. package/dist/crypto/BrowserCrypto.mjs +151 -151
  49. package/dist/crypto/CryptoOps.d.ts +74 -74
  50. package/dist/crypto/CryptoOps.mjs +176 -176
  51. package/dist/crypto/PkceGenerator.d.ts +8 -8
  52. package/dist/crypto/PkceGenerator.mjs +54 -54
  53. package/dist/crypto/SignedHttpRequest.d.ts +30 -30
  54. package/dist/crypto/SignedHttpRequest.mjs +39 -39
  55. package/dist/encode/Base64Decode.d.ts +9 -9
  56. package/dist/encode/Base64Decode.mjs +36 -36
  57. package/dist/encode/Base64Encode.d.ts +19 -19
  58. package/dist/encode/Base64Encode.mjs +43 -43
  59. package/dist/error/BrowserAuthError.d.ts +256 -255
  60. package/dist/error/BrowserAuthError.d.ts.map +1 -1
  61. package/dist/error/BrowserAuthError.mjs +265 -264
  62. package/dist/error/BrowserAuthError.mjs.map +1 -1
  63. package/dist/error/BrowserAuthErrorCodes.d.ts +47 -46
  64. package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
  65. package/dist/error/BrowserAuthErrorCodes.mjs +53 -52
  66. package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
  67. package/dist/error/BrowserConfigurationAuthError.d.ts +33 -33
  68. package/dist/error/BrowserConfigurationAuthError.mjs +40 -40
  69. package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
  70. package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +3 -3
  71. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +7 -7
  72. package/dist/error/NativeAuthError.d.ts +29 -29
  73. package/dist/error/NativeAuthError.mjs +60 -60
  74. package/dist/error/NativeAuthErrorCodes.d.ts +2 -2
  75. package/dist/error/NativeAuthErrorCodes.mjs +6 -6
  76. package/dist/error/NestedAppAuthError.d.ts +14 -14
  77. package/dist/error/NestedAppAuthError.mjs +23 -23
  78. package/dist/event/EventHandler.d.ts +41 -41
  79. package/dist/event/EventHandler.mjs +125 -125
  80. package/dist/event/EventMessage.d.ts +25 -25
  81. package/dist/event/EventMessage.mjs +68 -68
  82. package/dist/event/EventType.d.ts +29 -29
  83. package/dist/event/EventType.mjs +32 -32
  84. package/dist/index.d.ts +40 -40
  85. package/dist/index.mjs +1 -1
  86. package/dist/interaction_client/BaseInteractionClient.d.ts +50 -50
  87. package/dist/interaction_client/BaseInteractionClient.mjs +106 -106
  88. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
  89. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +10 -10
  90. package/dist/interaction_client/NativeInteractionClient.d.ts +151 -151
  91. package/dist/interaction_client/NativeInteractionClient.mjs +621 -621
  92. package/dist/interaction_client/PopupClient.d.ts +118 -105
  93. package/dist/interaction_client/PopupClient.d.ts.map +1 -1
  94. package/dist/interaction_client/PopupClient.mjs +460 -434
  95. package/dist/interaction_client/PopupClient.mjs.map +1 -1
  96. package/dist/interaction_client/RedirectClient.d.ts +50 -50
  97. package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
  98. package/dist/interaction_client/RedirectClient.mjs +349 -317
  99. package/dist/interaction_client/RedirectClient.mjs.map +1 -1
  100. package/dist/interaction_client/SilentAuthCodeClient.d.ts +23 -23
  101. package/dist/interaction_client/SilentAuthCodeClient.mjs +57 -57
  102. package/dist/interaction_client/SilentCacheClient.d.ts +16 -16
  103. package/dist/interaction_client/SilentCacheClient.mjs +42 -42
  104. package/dist/interaction_client/SilentIframeClient.d.ts +32 -32
  105. package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
  106. package/dist/interaction_client/SilentIframeClient.mjs +111 -101
  107. package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
  108. package/dist/interaction_client/SilentRefreshClient.d.ts +20 -20
  109. package/dist/interaction_client/SilentRefreshClient.mjs +47 -47
  110. package/dist/interaction_client/StandardInteractionClient.d.ts +48 -48
  111. package/dist/interaction_client/StandardInteractionClient.mjs +199 -199
  112. package/dist/interaction_handler/InteractionHandler.d.ts +33 -33
  113. package/dist/interaction_handler/InteractionHandler.mjs +93 -93
  114. package/dist/interaction_handler/RedirectHandler.d.ts +32 -32
  115. package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
  116. package/dist/interaction_handler/RedirectHandler.mjs +135 -134
  117. package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
  118. package/dist/interaction_handler/SilentHandler.d.ts +13 -13
  119. package/dist/interaction_handler/SilentHandler.mjs +134 -134
  120. package/dist/naa/AccountInfo.d.ts +11 -11
  121. package/dist/naa/AuthBridge.d.ts +8 -8
  122. package/dist/naa/AuthResult.d.ts +6 -6
  123. package/dist/naa/BridgeAccountContext.d.ts +12 -12
  124. package/dist/naa/BridgeCapabilities.d.ts +3 -3
  125. package/dist/naa/BridgeError.d.ts +9 -9
  126. package/dist/naa/BridgeError.mjs +7 -7
  127. package/dist/naa/BridgeProxy.d.ts +67 -67
  128. package/dist/naa/BridgeProxy.d.ts.map +1 -1
  129. package/dist/naa/BridgeProxy.mjs +153 -148
  130. package/dist/naa/BridgeProxy.mjs.map +1 -1
  131. package/dist/naa/BridgeRequest.d.ts +7 -7
  132. package/dist/naa/BridgeRequestEnvelope.d.ts +12 -12
  133. package/dist/naa/BridgeResponseEnvelope.d.ts +13 -13
  134. package/dist/naa/BridgeStatusCode.d.ts +11 -11
  135. package/dist/naa/BridgeStatusCode.mjs +14 -14
  136. package/dist/naa/IBridgeProxy.d.ts +10 -10
  137. package/dist/naa/InitContext.d.ts +8 -8
  138. package/dist/naa/TokenRequest.d.ts +18 -18
  139. package/dist/naa/TokenResponse.d.ts +13 -13
  140. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +35 -35
  141. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +179 -179
  142. package/dist/navigation/INavigationClient.d.ts +16 -16
  143. package/dist/navigation/NavigationClient.d.ts +22 -22
  144. package/dist/navigation/NavigationClient.mjs +40 -40
  145. package/dist/navigation/NavigationOptions.d.ts +12 -12
  146. package/dist/network/FetchClient.d.ts +26 -26
  147. package/dist/network/FetchClient.mjs +99 -99
  148. package/dist/operatingcontext/BaseOperatingContext.d.ts +41 -41
  149. package/dist/operatingcontext/BaseOperatingContext.mjs +94 -94
  150. package/dist/operatingcontext/NestedAppOperatingContext.d.ts +34 -34
  151. package/dist/operatingcontext/NestedAppOperatingContext.mjs +71 -71
  152. package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
  153. package/dist/operatingcontext/StandardOperatingContext.mjs +43 -43
  154. package/dist/operatingcontext/UnknownOperatingContext.d.ts +25 -25
  155. package/dist/operatingcontext/UnknownOperatingContext.mjs +42 -42
  156. package/dist/packageMetadata.d.ts +2 -2
  157. package/dist/packageMetadata.mjs +4 -4
  158. package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
  159. package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
  160. package/dist/request/ClearCacheRequest.d.ts +10 -10
  161. package/dist/request/EndSessionPopupRequest.d.ts +18 -18
  162. package/dist/request/EndSessionRequest.d.ts +15 -15
  163. package/dist/request/InitializeApplicationRequest.d.ts +8 -8
  164. package/dist/request/PopupRequest.d.ts +34 -34
  165. package/dist/request/PopupWindowAttributes.d.ts +15 -15
  166. package/dist/request/RedirectRequest.d.ts +40 -35
  167. package/dist/request/RedirectRequest.d.ts.map +1 -1
  168. package/dist/request/RequestHelpers.d.ts +13 -13
  169. package/dist/request/RequestHelpers.mjs +53 -53
  170. package/dist/request/SilentRequest.d.ts +33 -33
  171. package/dist/request/SsoSilentRequest.d.ts +29 -29
  172. package/dist/response/AuthenticationResult.d.ts +4 -4
  173. package/dist/response/ResponseHandler.d.ts +7 -7
  174. package/dist/response/ResponseHandler.mjs +36 -36
  175. package/dist/telemetry/BrowserPerformanceClient.d.ts +38 -34
  176. package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
  177. package/dist/telemetry/BrowserPerformanceClient.mjs +163 -163
  178. package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
  179. package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
  180. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +92 -92
  181. package/dist/utils/BrowserConstants.d.ts +182 -180
  182. package/dist/utils/BrowserConstants.d.ts.map +1 -1
  183. package/dist/utils/BrowserConstants.mjs +214 -212
  184. package/dist/utils/BrowserConstants.mjs.map +1 -1
  185. package/dist/utils/BrowserProtocolUtils.d.ts +11 -11
  186. package/dist/utils/BrowserProtocolUtils.mjs +21 -21
  187. package/dist/utils/BrowserUtils.d.ts +75 -75
  188. package/dist/utils/BrowserUtils.mjs +157 -157
  189. package/lib/msal-browser.cjs +19027 -18857
  190. package/lib/msal-browser.cjs.map +1 -1
  191. package/lib/msal-browser.js +19027 -18857
  192. package/lib/msal-browser.js.map +1 -1
  193. package/lib/msal-browser.min.js +62 -62
  194. package/package.json +2 -2
  195. package/src/cache/BrowserCacheManager.ts +95 -0
  196. package/src/config/Configuration.ts +9 -1
  197. package/src/controllers/StandardController.ts +30 -12
  198. package/src/error/BrowserAuthError.ts +2 -0
  199. package/src/error/BrowserAuthErrorCodes.ts +1 -0
  200. package/src/interaction_client/PopupClient.ts +202 -117
  201. package/src/interaction_client/RedirectClient.ts +62 -2
  202. package/src/interaction_client/SilentIframeClient.ts +41 -3
  203. package/src/interaction_handler/RedirectHandler.ts +1 -0
  204. package/src/naa/BridgeProxy.ts +7 -2
  205. package/src/packageMetadata.ts +1 -1
  206. package/src/request/RedirectRequest.ts +5 -0
  207. package/src/telemetry/BrowserPerformanceClient.ts +1 -1
  208. package/src/utils/BrowserConstants.ts +2 -0
@@ -1,9 +1,9 @@
1
- /*! @azure/msal-browser v3.20.0 2024-07-23 */
1
+ /*! @azure/msal-browser v3.21.0 2024-08-13 */
2
2
  'use strict';
3
- import { PerformanceEvents, PromptValue, invokeAsync, AuthError, invoke, ProtocolUtils } from '@azure/msal-common';
3
+ import { PerformanceEvents, PromptValue, invokeAsync, AuthError, ServerError, invoke, ProtocolUtils } from '@azure/msal-common';
4
4
  import { StandardInteractionClient } from './StandardInteractionClient.mjs';
5
5
  import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
6
- import { InteractionType } from '../utils/BrowserConstants.mjs';
6
+ import { InteractionType, BrowserConstants } from '../utils/BrowserConstants.mjs';
7
7
  import { initiateAuthRequest, monitorIframeForHash } from '../interaction_handler/SilentHandler.mjs';
8
8
  import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.mjs';
9
9
  import { NativeInteractionClient } from './NativeInteractionClient.mjs';
@@ -12,104 +12,114 @@ import { preconnect } from '../utils/BrowserUtils.mjs';
12
12
  import { deserializeResponse } from '../response/ResponseHandler.mjs';
13
13
  import { silentLogoutUnsupported, nativeConnectionNotEstablished } from '../error/BrowserAuthErrorCodes.mjs';
14
14
 
15
- /*
16
- * Copyright (c) Microsoft Corporation. All rights reserved.
17
- * Licensed under the MIT License.
18
- */
19
- class SilentIframeClient extends StandardInteractionClient {
20
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
21
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
22
- this.apiId = apiId;
23
- this.nativeStorage = nativeStorageImpl;
24
- }
25
- /**
26
- * Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session
27
- * @param request
28
- */
29
- async acquireToken(request) {
30
- this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
31
- // Check that we have some SSO data
32
- if (!request.loginHint &&
33
- !request.sid &&
34
- (!request.account || !request.account.username)) {
35
- this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
36
- }
37
- // Check the prompt value
38
- const inputRequest = { ...request };
39
- if (inputRequest.prompt) {
40
- if (inputRequest.prompt !== PromptValue.NONE &&
41
- inputRequest.prompt !== PromptValue.NO_SESSION) {
42
- this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${inputRequest.prompt} with ${PromptValue.NONE}`);
43
- inputRequest.prompt = PromptValue.NONE;
44
- }
45
- }
46
- else {
47
- inputRequest.prompt = PromptValue.NONE;
48
- }
49
- // Create silent request
50
- const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(inputRequest, InteractionType.Silent);
51
- preconnect(silentRequest.authority);
52
- const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
53
- try {
54
- // Initialize the client
55
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
56
- return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, request.correlationId)(authClient, silentRequest);
57
- }
58
- catch (e) {
59
- if (e instanceof AuthError) {
60
- e.setCorrelationId(this.correlationId);
61
- serverTelemetryManager.cacheFailedRequest(e);
62
- }
63
- throw e;
64
- }
65
- }
66
- /**
67
- * Currently Unsupported
68
- */
69
- logout() {
70
- // Synchronous so we must reject
71
- return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
72
- }
73
- /**
74
- * Helper which acquires an authorization code silently using a hidden iframe from given url
75
- * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
76
- * @param navigateUrl
77
- * @param userRequestScopes
78
- */
79
- async silentTokenHelper(authClient, silentRequest) {
80
- const correlationId = silentRequest.correlationId;
81
- this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, correlationId);
82
- // Create auth code request and generate PKCE params
83
- const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, correlationId)(silentRequest);
84
- // Create authorize request url
85
- const navigateUrl = await invokeAsync(authClient.getAuthCodeUrl.bind(authClient), PerformanceEvents.GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)({
86
- ...silentRequest,
87
- nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
88
- });
89
- // Create silent handler
90
- const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
91
- // Get the frame handle for the silent request
92
- const msalFrame = await invokeAsync(initiateAuthRequest, PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(navigateUrl, this.performanceClient, this.logger, correlationId, this.config.system.navigateFrameWait);
93
- const responseType = this.config.auth.OIDCOptions.serverResponseType;
94
- // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
95
- const responseString = await invokeAsync(monitorIframeForHash, PerformanceEvents.SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(msalFrame, this.config.system.iframeHashTimeout, this.config.system.pollIntervalMilliseconds, this.performanceClient, this.logger, correlationId, responseType);
96
- const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, responseType, this.logger);
97
- if (serverParams.accountId) {
98
- this.logger.verbose("Account id found in hash, calling WAM for token");
99
- if (!this.nativeMessageHandler) {
100
- throw createBrowserAuthError(nativeConnectionNotEstablished);
101
- }
102
- const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.apiId, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, correlationId);
103
- const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, silentRequest.state);
104
- return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), PerformanceEvents.NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)({
105
- ...silentRequest,
106
- state: userRequestState,
107
- prompt: silentRequest.prompt || PromptValue.NONE,
108
- });
109
- }
110
- // Handle response from hash string
111
- return invokeAsync(interactionHandler.handleCodeResponse.bind(interactionHandler), PerformanceEvents.HandleCodeResponse, this.logger, this.performanceClient, correlationId)(serverParams, silentRequest);
112
- }
15
+ /*
16
+ * Copyright (c) Microsoft Corporation. All rights reserved.
17
+ * Licensed under the MIT License.
18
+ */
19
+ class SilentIframeClient extends StandardInteractionClient {
20
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
21
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
22
+ this.apiId = apiId;
23
+ this.nativeStorage = nativeStorageImpl;
24
+ }
25
+ /**
26
+ * Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session
27
+ * @param request
28
+ */
29
+ async acquireToken(request) {
30
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
31
+ // Check that we have some SSO data
32
+ if (!request.loginHint &&
33
+ !request.sid &&
34
+ (!request.account || !request.account.username)) {
35
+ this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
36
+ }
37
+ // Check the prompt value
38
+ const inputRequest = { ...request };
39
+ if (inputRequest.prompt) {
40
+ if (inputRequest.prompt !== PromptValue.NONE &&
41
+ inputRequest.prompt !== PromptValue.NO_SESSION) {
42
+ this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${inputRequest.prompt} with ${PromptValue.NONE}`);
43
+ inputRequest.prompt = PromptValue.NONE;
44
+ }
45
+ }
46
+ else {
47
+ inputRequest.prompt = PromptValue.NONE;
48
+ }
49
+ // Create silent request
50
+ const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(inputRequest, InteractionType.Silent);
51
+ preconnect(silentRequest.authority);
52
+ const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
53
+ let authClient;
54
+ try {
55
+ // Initialize the client
56
+ authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
57
+ return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, request.correlationId)(authClient, silentRequest);
58
+ }
59
+ catch (e) {
60
+ if (e instanceof AuthError) {
61
+ e.setCorrelationId(this.correlationId);
62
+ serverTelemetryManager.cacheFailedRequest(e);
63
+ }
64
+ if (!authClient ||
65
+ !(e instanceof ServerError) ||
66
+ e.errorCode !== BrowserConstants.INVALID_GRANT_ERROR) {
67
+ throw e;
68
+ }
69
+ this.performanceClient.addFields({
70
+ retryError: e.errorCode,
71
+ }, this.correlationId);
72
+ const retrySilentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(inputRequest, InteractionType.Silent);
73
+ return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, this.correlationId)(authClient, retrySilentRequest);
74
+ }
75
+ }
76
+ /**
77
+ * Currently Unsupported
78
+ */
79
+ logout() {
80
+ // Synchronous so we must reject
81
+ return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
82
+ }
83
+ /**
84
+ * Helper which acquires an authorization code silently using a hidden iframe from given url
85
+ * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
86
+ * @param navigateUrl
87
+ * @param userRequestScopes
88
+ */
89
+ async silentTokenHelper(authClient, silentRequest) {
90
+ const correlationId = silentRequest.correlationId;
91
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, correlationId);
92
+ // Create auth code request and generate PKCE params
93
+ const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, correlationId)(silentRequest);
94
+ // Create authorize request url
95
+ const navigateUrl = await invokeAsync(authClient.getAuthCodeUrl.bind(authClient), PerformanceEvents.GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)({
96
+ ...silentRequest,
97
+ nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
98
+ });
99
+ // Create silent handler
100
+ const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
101
+ // Get the frame handle for the silent request
102
+ const msalFrame = await invokeAsync(initiateAuthRequest, PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(navigateUrl, this.performanceClient, this.logger, correlationId, this.config.system.navigateFrameWait);
103
+ const responseType = this.config.auth.OIDCOptions.serverResponseType;
104
+ // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
105
+ const responseString = await invokeAsync(monitorIframeForHash, PerformanceEvents.SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(msalFrame, this.config.system.iframeHashTimeout, this.config.system.pollIntervalMilliseconds, this.performanceClient, this.logger, correlationId, responseType);
106
+ const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, responseType, this.logger);
107
+ if (serverParams.accountId) {
108
+ this.logger.verbose("Account id found in hash, calling WAM for token");
109
+ if (!this.nativeMessageHandler) {
110
+ throw createBrowserAuthError(nativeConnectionNotEstablished);
111
+ }
112
+ const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.apiId, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, correlationId);
113
+ const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, silentRequest.state);
114
+ return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), PerformanceEvents.NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)({
115
+ ...silentRequest,
116
+ state: userRequestState,
117
+ prompt: silentRequest.prompt || PromptValue.NONE,
118
+ });
119
+ }
120
+ // Handle response from hash string
121
+ return invokeAsync(interactionHandler.handleCodeResponse.bind(interactionHandler), PerformanceEvents.HandleCodeResponse, this.logger, this.performanceClient, correlationId)(serverParams, silentRequest);
122
+ }
113
123
  }
114
124
 
115
125
  export { SilentIframeClient };
@@ -1 +1 @@
1
- {"version":3,"file":"SilentIframeClient.mjs","sources":["../../src/interaction_client/SilentIframeClient.ts"],"sourcesContent":[null],"names":["BrowserUtils.preconnect","BrowserAuthErrorCodes.silentLogoutUnsupported","ResponseHandler.deserializeResponse","BrowserAuthErrorCodes.nativeConnectionNotEstablished"],"mappings":";;;;;;;;;;;;;;AAAA;;;AAGG;AAsCG,MAAO,kBAAmB,SAAQ,yBAAyB,CAAA;IAI7D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M,EACX,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,gBAAgB,EACrB,IAAI,CAAC,KAAK,EACV,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,oBAAoB,EACzB,YAAY,CAAC,SAAS,EACtB,IAAI,CAAC,cAAc,EACnB,aAAa,CAChB,CAAC;AACF,YAAA,MAAM,EAAE,gBAAgB,EAAE,GAAG,aAAa,CAAC,iBAAiB,CACxD,IAAI,CAAC,aAAa,EAClB,aAAa,CAAC,KAAK,CACtB,CAAC;YACF,OAAO,WAAW,CACd,uBAAuB,CAAC,YAAY,CAAC,IAAI,CACrC,uBAAuB,CAC1B,EACD,iBAAiB,CAAC,mCAAmC,EACrD,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,iBAAiB,EACtB,aAAa,CAChB,CAAC;AACE,gBAAA,GAAG,aAAa;AAChB,gBAAA,KAAK,EAAE,gBAAgB;AACvB,gBAAA,MAAM,EAAE,aAAa,CAAC,MAAM,IAAI,WAAW,CAAC,IAAI;AACnD,aAAA,CAAC,CAAC;AACN,SAAA;;AAGD,QAAA,OAAO,WAAW,CACd,kBAAkB,CAAC,kBAAkB,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAC9D,iBAAiB,CAAC,kBAAkB,EACpC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,iBAAiB,EACtB,aAAa,CAChB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;KAClC;AACJ;;;;"}
1
+ {"version":3,"file":"SilentIframeClient.mjs","sources":["../../src/interaction_client/SilentIframeClient.ts"],"sourcesContent":[null],"names":["BrowserUtils.preconnect","BrowserAuthErrorCodes.silentLogoutUnsupported","ResponseHandler.deserializeResponse","BrowserAuthErrorCodes.nativeConnectionNotEstablished"],"mappings":";;;;;;;;;;;;;;AAAA;;;AAGG;AA2CG,MAAO,kBAAmB,SAAQ,yBAAyB,CAAA;IAI7D,WACI,CAAA,MAA4B,EAC5B,WAAgC,EAChC,aAAsB,EACtB,MAAc,EACd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AChB,CAAC;AACE,gBAAA,GAAG,aAAa;AAChB,gBAAA,KAAK,EAAE,gBAAgB;AACvB,gBAAA,MAAM,EAAE,aAAa,CAAC,MAAM,IAAI,WAAW,CAAC,IAAI;AACnD,aAAA,CAAC,CAAC;AACN,SAAA;;AAGD,QAAA,OAAO,WAAW,CACd,kBAAkB,CAAC,kBAAkB,CAAC,IAAI,CAAC,kBAAkB,CAAC,EAC9D,iBAAiB,CAAC,kBAAkB,EACpC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,iBAAiB,EACtB,aAAa,CAChB,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;KAClC;AACJ;;;;"}
@@ -1,21 +1,21 @@
1
- import { StandardInteractionClient } from "./StandardInteractionClient";
2
- import { CommonSilentFlowRequest, ServerTelemetryManager, RefreshTokenClient, AzureCloudOptions, AccountInfo } from "@azure/msal-common";
3
- import { AuthenticationResult } from "../response/AuthenticationResult";
4
- export declare class SilentRefreshClient extends StandardInteractionClient {
5
- /**
6
- * Exchanges the refresh token for new tokens
7
- * @param request
8
- */
9
- acquireToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult>;
10
- /**
11
- * Currently Unsupported
12
- */
13
- logout(): Promise<void>;
14
- /**
15
- * Creates a Refresh Client with the given authority, or the default authority.
16
- * @param serverTelemetryManager
17
- * @param authorityUrl
18
- */
19
- protected createRefreshTokenClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<RefreshTokenClient>;
20
- }
1
+ import { StandardInteractionClient } from "./StandardInteractionClient";
2
+ import { CommonSilentFlowRequest, ServerTelemetryManager, RefreshTokenClient, AzureCloudOptions, AccountInfo } from "@azure/msal-common";
3
+ import { AuthenticationResult } from "../response/AuthenticationResult";
4
+ export declare class SilentRefreshClient extends StandardInteractionClient {
5
+ /**
6
+ * Exchanges the refresh token for new tokens
7
+ * @param request
8
+ */
9
+ acquireToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult>;
10
+ /**
11
+ * Currently Unsupported
12
+ */
13
+ logout(): Promise<void>;
14
+ /**
15
+ * Creates a Refresh Client with the given authority, or the default authority.
16
+ * @param serverTelemetryManager
17
+ * @param authorityUrl
18
+ */
19
+ protected createRefreshTokenClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<RefreshTokenClient>;
20
+ }
21
21
  //# sourceMappingURL=SilentRefreshClient.d.ts.map
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v3.20.0 2024-07-23 */
1
+ /*! @azure/msal-browser v3.21.0 2024-08-13 */
2
2
  'use strict';
3
3
  import { StandardInteractionClient } from './StandardInteractionClient.mjs';
4
4
  import { PerformanceEvents, invokeAsync, RefreshTokenClient } from '@azure/msal-common';
@@ -7,52 +7,52 @@ import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
7
7
  import { initializeBaseRequest } from '../request/RequestHelpers.mjs';
8
8
  import { silentLogoutUnsupported } from '../error/BrowserAuthErrorCodes.mjs';
9
9
 
10
- /*
11
- * Copyright (c) Microsoft Corporation. All rights reserved.
12
- * Licensed under the MIT License.
13
- */
14
- class SilentRefreshClient extends StandardInteractionClient {
15
- /**
16
- * Exchanges the refresh token for new tokens
17
- * @param request
18
- */
19
- async acquireToken(request) {
20
- this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
21
- const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, this.config, this.performanceClient, this.logger);
22
- const silentRequest = {
23
- ...request,
24
- ...baseRequest,
25
- };
26
- if (request.redirectUri) {
27
- // Make sure any passed redirectUri is converted to an absolute URL - redirectUri is not a required parameter for refresh token redemption so only include if explicitly provided
28
- silentRequest.redirectUri = this.getRedirectUri(request.redirectUri);
29
- }
30
- const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
31
- const refreshTokenClient = await this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
32
- // Send request to renew token. Auth module will throw errors if token cannot be renewed.
33
- return invokeAsync(refreshTokenClient.acquireTokenByRefreshToken.bind(refreshTokenClient), PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, this.logger, this.performanceClient, request.correlationId)(silentRequest).catch((e) => {
34
- e.setCorrelationId(this.correlationId);
35
- serverTelemetryManager.cacheFailedRequest(e);
36
- throw e;
37
- });
38
- }
39
- /**
40
- * Currently Unsupported
41
- */
42
- logout() {
43
- // Synchronous so we must reject
44
- return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
45
- }
46
- /**
47
- * Creates a Refresh Client with the given authority, or the default authority.
48
- * @param serverTelemetryManager
49
- * @param authorityUrl
50
- */
51
- async createRefreshTokenClient(serverTelemetryManager, authorityUrl, azureCloudOptions, account) {
52
- // Create auth module.
53
- const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
54
- return new RefreshTokenClient(clientConfig, this.performanceClient);
55
- }
10
+ /*
11
+ * Copyright (c) Microsoft Corporation. All rights reserved.
12
+ * Licensed under the MIT License.
13
+ */
14
+ class SilentRefreshClient extends StandardInteractionClient {
15
+ /**
16
+ * Exchanges the refresh token for new tokens
17
+ * @param request
18
+ */
19
+ async acquireToken(request) {
20
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
21
+ const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, this.config, this.performanceClient, this.logger);
22
+ const silentRequest = {
23
+ ...request,
24
+ ...baseRequest,
25
+ };
26
+ if (request.redirectUri) {
27
+ // Make sure any passed redirectUri is converted to an absolute URL - redirectUri is not a required parameter for refresh token redemption so only include if explicitly provided
28
+ silentRequest.redirectUri = this.getRedirectUri(request.redirectUri);
29
+ }
30
+ const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
31
+ const refreshTokenClient = await this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions, silentRequest.account);
32
+ // Send request to renew token. Auth module will throw errors if token cannot be renewed.
33
+ return invokeAsync(refreshTokenClient.acquireTokenByRefreshToken.bind(refreshTokenClient), PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, this.logger, this.performanceClient, request.correlationId)(silentRequest).catch((e) => {
34
+ e.setCorrelationId(this.correlationId);
35
+ serverTelemetryManager.cacheFailedRequest(e);
36
+ throw e;
37
+ });
38
+ }
39
+ /**
40
+ * Currently Unsupported
41
+ */
42
+ logout() {
43
+ // Synchronous so we must reject
44
+ return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
45
+ }
46
+ /**
47
+ * Creates a Refresh Client with the given authority, or the default authority.
48
+ * @param serverTelemetryManager
49
+ * @param authorityUrl
50
+ */
51
+ async createRefreshTokenClient(serverTelemetryManager, authorityUrl, azureCloudOptions, account) {
52
+ // Create auth module.
53
+ const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions, account);
54
+ return new RefreshTokenClient(clientConfig, this.performanceClient);
55
+ }
56
56
  }
57
57
 
58
58
  export { SilentRefreshClient };
@@ -1,49 +1,49 @@
1
- import { ServerTelemetryManager, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ClientConfiguration, CommonEndSessionRequest, AccountInfo, AzureCloudOptions } from "@azure/msal-common";
2
- import { BaseInteractionClient } from "./BaseInteractionClient";
3
- import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
4
- import { InteractionType } from "../utils/BrowserConstants";
5
- import { EndSessionRequest } from "../request/EndSessionRequest";
6
- import { RedirectRequest } from "../request/RedirectRequest";
7
- import { PopupRequest } from "../request/PopupRequest";
8
- import { SsoSilentRequest } from "../request/SsoSilentRequest";
9
- /**
10
- * Defines the class structure and helper functions used by the "standard", non-brokered auth flows (popup, redirect, silent (RT), silent (iframe))
11
- */
12
- export declare abstract class StandardInteractionClient extends BaseInteractionClient {
13
- /**
14
- * Generates an auth code request tied to the url request.
15
- * @param request
16
- */
17
- protected initializeAuthorizationCodeRequest(request: AuthorizationUrlRequest): Promise<CommonAuthorizationCodeRequest>;
18
- /**
19
- * Initializer for the logout request.
20
- * @param logoutRequest
21
- */
22
- protected initializeLogoutRequest(logoutRequest?: EndSessionRequest): CommonEndSessionRequest;
23
- /**
24
- * Parses login_hint ID Token Claim out of AccountInfo object to be used as
25
- * logout_hint in end session request.
26
- * @param account
27
- */
28
- protected getLogoutHintFromIdTokenClaims(account: AccountInfo): string | null;
29
- /**
30
- * Creates an Authorization Code Client with the given authority, or the default authority.
31
- * @param serverTelemetryManager
32
- * @param authorityUrl
33
- */
34
- protected createAuthCodeClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, requestAzureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<AuthorizationCodeClient>;
35
- /**
36
- * Creates a Client Configuration object with the given request authority, or the default authority.
37
- * @param serverTelemetryManager
38
- * @param requestAuthority
39
- * @param requestCorrelationId
40
- */
41
- protected getClientConfiguration(serverTelemetryManager: ServerTelemetryManager, requestAuthority?: string, requestAzureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<ClientConfiguration>;
42
- /**
43
- * Helper to initialize required request parameters for interactive APIs and ssoSilent()
44
- * @param request
45
- * @param interactionType
46
- */
47
- protected initializeAuthorizationRequest(request: RedirectRequest | PopupRequest | SsoSilentRequest, interactionType: InteractionType): Promise<AuthorizationUrlRequest>;
48
- }
1
+ import { ServerTelemetryManager, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ClientConfiguration, CommonEndSessionRequest, AccountInfo, AzureCloudOptions } from "@azure/msal-common";
2
+ import { BaseInteractionClient } from "./BaseInteractionClient";
3
+ import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
4
+ import { InteractionType } from "../utils/BrowserConstants";
5
+ import { EndSessionRequest } from "../request/EndSessionRequest";
6
+ import { RedirectRequest } from "../request/RedirectRequest";
7
+ import { PopupRequest } from "../request/PopupRequest";
8
+ import { SsoSilentRequest } from "../request/SsoSilentRequest";
9
+ /**
10
+ * Defines the class structure and helper functions used by the "standard", non-brokered auth flows (popup, redirect, silent (RT), silent (iframe))
11
+ */
12
+ export declare abstract class StandardInteractionClient extends BaseInteractionClient {
13
+ /**
14
+ * Generates an auth code request tied to the url request.
15
+ * @param request
16
+ */
17
+ protected initializeAuthorizationCodeRequest(request: AuthorizationUrlRequest): Promise<CommonAuthorizationCodeRequest>;
18
+ /**
19
+ * Initializer for the logout request.
20
+ * @param logoutRequest
21
+ */
22
+ protected initializeLogoutRequest(logoutRequest?: EndSessionRequest): CommonEndSessionRequest;
23
+ /**
24
+ * Parses login_hint ID Token Claim out of AccountInfo object to be used as
25
+ * logout_hint in end session request.
26
+ * @param account
27
+ */
28
+ protected getLogoutHintFromIdTokenClaims(account: AccountInfo): string | null;
29
+ /**
30
+ * Creates an Authorization Code Client with the given authority, or the default authority.
31
+ * @param serverTelemetryManager
32
+ * @param authorityUrl
33
+ */
34
+ protected createAuthCodeClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, requestAzureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<AuthorizationCodeClient>;
35
+ /**
36
+ * Creates a Client Configuration object with the given request authority, or the default authority.
37
+ * @param serverTelemetryManager
38
+ * @param requestAuthority
39
+ * @param requestCorrelationId
40
+ */
41
+ protected getClientConfiguration(serverTelemetryManager: ServerTelemetryManager, requestAuthority?: string, requestAzureCloudOptions?: AzureCloudOptions, account?: AccountInfo): Promise<ClientConfiguration>;
42
+ /**
43
+ * Helper to initialize required request parameters for interactive APIs and ssoSilent()
44
+ * @param request
45
+ * @param interactionType
46
+ */
47
+ protected initializeAuthorizationRequest(request: RedirectRequest | PopupRequest | SsoSilentRequest, interactionType: InteractionType): Promise<AuthorizationUrlRequest>;
48
+ }
49
49
  //# sourceMappingURL=StandardInteractionClient.d.ts.map