@azure/msal-browser 3.5.0 → 3.5.1-beta.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 (192) hide show
  1. package/dist/app/IPublicClientApplication.d.ts +51 -51
  2. package/dist/app/IPublicClientApplication.mjs +102 -102
  3. package/dist/app/PublicClientApplication.d.ts +268 -268
  4. package/dist/app/PublicClientApplication.mjs +333 -333
  5. package/dist/app/PublicClientNext.d.ts +273 -273
  6. package/dist/app/PublicClientNext.mjs +351 -351
  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 +44 -44
  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/AsyncMemoryStorage.d.ts +51 -51
  14. package/dist/cache/AsyncMemoryStorage.mjs +132 -132
  15. package/dist/cache/BrowserCacheManager.d.ts +383 -383
  16. package/dist/cache/BrowserCacheManager.mjs +1262 -1262
  17. package/dist/cache/BrowserStorage.d.ts +11 -11
  18. package/dist/cache/BrowserStorage.mjs +32 -32
  19. package/dist/cache/CryptoKeyStore.d.ts +18 -18
  20. package/dist/cache/CryptoKeyStore.mjs +40 -40
  21. package/dist/cache/DatabaseStorage.d.ts +56 -56
  22. package/dist/cache/DatabaseStorage.mjs +190 -190
  23. package/dist/cache/IAsyncMemoryStorage.d.ts +27 -27
  24. package/dist/cache/ITokenCache.d.ts +11 -11
  25. package/dist/cache/IWindowStorage.d.ts +27 -27
  26. package/dist/cache/MemoryStorage.d.ts +11 -11
  27. package/dist/cache/MemoryStorage.mjs +31 -31
  28. package/dist/cache/TokenCache.d.ts +77 -77
  29. package/dist/cache/TokenCache.mjs +224 -224
  30. package/dist/config/Configuration.d.ts +206 -206
  31. package/dist/config/Configuration.mjs +128 -128
  32. package/dist/controllers/ControllerFactory.d.ts +4 -4
  33. package/dist/controllers/ControllerFactory.mjs +29 -29
  34. package/dist/controllers/IController.d.ts +61 -61
  35. package/dist/controllers/NestedAppAuthController.d.ts +95 -95
  36. package/dist/controllers/NestedAppAuthController.d.ts.map +1 -1
  37. package/dist/controllers/NestedAppAuthController.mjs +335 -333
  38. package/dist/controllers/NestedAppAuthController.mjs.map +1 -1
  39. package/dist/controllers/StandardController.d.ts +407 -407
  40. package/dist/controllers/StandardController.d.ts.map +1 -1
  41. package/dist/controllers/StandardController.mjs +1293 -1291
  42. package/dist/controllers/StandardController.mjs.map +1 -1
  43. package/dist/controllers/UnknownOperatingContextController.d.ts +87 -87
  44. package/dist/controllers/UnknownOperatingContextController.mjs +264 -264
  45. package/dist/crypto/BrowserCrypto.d.ts +44 -44
  46. package/dist/crypto/BrowserCrypto.mjs +93 -93
  47. package/dist/crypto/CryptoOps.d.ts +63 -63
  48. package/dist/crypto/CryptoOps.mjs +145 -145
  49. package/dist/crypto/PkceGenerator.d.ts +8 -8
  50. package/dist/crypto/PkceGenerator.mjs +54 -54
  51. package/dist/crypto/SignedHttpRequest.d.ts +30 -30
  52. package/dist/crypto/SignedHttpRequest.mjs +39 -39
  53. package/dist/encode/Base64Decode.d.ts +9 -9
  54. package/dist/encode/Base64Decode.mjs +36 -36
  55. package/dist/encode/Base64Encode.d.ts +19 -19
  56. package/dist/encode/Base64Encode.mjs +43 -43
  57. package/dist/error/BrowserAuthError.d.ts +250 -250
  58. package/dist/error/BrowserAuthError.mjs +258 -258
  59. package/dist/error/BrowserAuthErrorCodes.d.ts +45 -45
  60. package/dist/error/BrowserAuthErrorCodes.mjs +49 -49
  61. package/dist/error/BrowserConfigurationAuthError.d.ts +33 -33
  62. package/dist/error/BrowserConfigurationAuthError.mjs +40 -40
  63. package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +3 -3
  64. package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +7 -7
  65. package/dist/error/NativeAuthError.d.ts +29 -29
  66. package/dist/error/NativeAuthError.mjs +60 -60
  67. package/dist/error/NativeAuthErrorCodes.d.ts +2 -2
  68. package/dist/error/NativeAuthErrorCodes.mjs +6 -6
  69. package/dist/error/NestedAppAuthError.d.ts +14 -14
  70. package/dist/error/NestedAppAuthError.mjs +23 -23
  71. package/dist/event/EventHandler.d.ts +41 -41
  72. package/dist/event/EventHandler.mjs +119 -119
  73. package/dist/event/EventMessage.d.ts +25 -25
  74. package/dist/event/EventMessage.mjs +68 -68
  75. package/dist/event/EventType.d.ts +28 -28
  76. package/dist/event/EventType.mjs +31 -31
  77. package/dist/index.d.ts +39 -39
  78. package/dist/index.mjs +1 -1
  79. package/dist/interaction_client/BaseInteractionClient.d.ts +54 -54
  80. package/dist/interaction_client/BaseInteractionClient.mjs +152 -152
  81. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
  82. package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +10 -10
  83. package/dist/interaction_client/NativeInteractionClient.d.ts +140 -140
  84. package/dist/interaction_client/NativeInteractionClient.mjs +548 -548
  85. package/dist/interaction_client/PopupClient.d.ts +105 -105
  86. package/dist/interaction_client/PopupClient.mjs +432 -432
  87. package/dist/interaction_client/RedirectClient.d.ts +49 -49
  88. package/dist/interaction_client/RedirectClient.mjs +311 -311
  89. package/dist/interaction_client/SilentAuthCodeClient.d.ts +23 -23
  90. package/dist/interaction_client/SilentAuthCodeClient.mjs +57 -57
  91. package/dist/interaction_client/SilentCacheClient.d.ts +24 -24
  92. package/dist/interaction_client/SilentCacheClient.mjs +61 -61
  93. package/dist/interaction_client/SilentIframeClient.d.ts +32 -32
  94. package/dist/interaction_client/SilentIframeClient.mjs +96 -96
  95. package/dist/interaction_client/SilentRefreshClient.d.ts +20 -20
  96. package/dist/interaction_client/SilentRefreshClient.mjs +43 -43
  97. package/dist/interaction_client/StandardInteractionClient.d.ts +54 -54
  98. package/dist/interaction_client/StandardInteractionClient.mjs +222 -222
  99. package/dist/interaction_handler/InteractionHandler.d.ts +33 -33
  100. package/dist/interaction_handler/InteractionHandler.mjs +93 -93
  101. package/dist/interaction_handler/RedirectHandler.d.ts +32 -32
  102. package/dist/interaction_handler/RedirectHandler.mjs +134 -134
  103. package/dist/interaction_handler/SilentHandler.d.ts +13 -13
  104. package/dist/interaction_handler/SilentHandler.mjs +133 -133
  105. package/dist/naa/AccountInfo.d.ts +11 -12
  106. package/dist/naa/AccountInfo.d.ts.map +1 -1
  107. package/dist/naa/AccountRequests.d.ts +9 -9
  108. package/dist/naa/AuthBridge.d.ts +5 -5
  109. package/dist/naa/BridgeCapabilities.d.ts +3 -3
  110. package/dist/naa/BridgeError.d.ts +9 -9
  111. package/dist/naa/BridgeError.d.ts.map +1 -1
  112. package/dist/naa/BridgeError.mjs +7 -7
  113. package/dist/naa/BridgeError.mjs.map +1 -1
  114. package/dist/naa/BridgeProxy.d.ts +72 -71
  115. package/dist/naa/BridgeProxy.d.ts.map +1 -1
  116. package/dist/naa/BridgeProxy.mjs +152 -149
  117. package/dist/naa/BridgeProxy.mjs.map +1 -1
  118. package/dist/naa/BridgeRequest.d.ts +6 -6
  119. package/dist/naa/BridgeRequestEnvelope.d.ts +13 -13
  120. package/dist/naa/BridgeResponseEnvelope.d.ts +10 -10
  121. package/dist/naa/BridgeStatusCode.d.ts +10 -10
  122. package/dist/naa/BridgeStatusCode.mjs +15 -15
  123. package/dist/naa/IBridgeProxy.d.ts +12 -10
  124. package/dist/naa/IBridgeProxy.d.ts.map +1 -1
  125. package/dist/naa/InitializeBridgeResponse.d.ts +6 -6
  126. package/dist/naa/InitializeBridgeResponse.d.ts.map +1 -1
  127. package/dist/naa/TokenRequest.d.ts +19 -21
  128. package/dist/naa/TokenRequest.d.ts.map +1 -1
  129. package/dist/naa/TokenResponse.d.ts +15 -16
  130. package/dist/naa/TokenResponse.d.ts.map +1 -1
  131. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +23 -25
  132. package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -1
  133. package/dist/naa/mapping/NestedAppAuthAdapter.mjs +142 -170
  134. package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -1
  135. package/dist/navigation/INavigationClient.d.ts +16 -16
  136. package/dist/navigation/NavigationClient.d.ts +22 -22
  137. package/dist/navigation/NavigationClient.mjs +40 -40
  138. package/dist/navigation/NavigationOptions.d.ts +12 -12
  139. package/dist/network/FetchClient.d.ts +26 -26
  140. package/dist/network/FetchClient.mjs +99 -99
  141. package/dist/operatingcontext/BaseOperatingContext.d.ts +40 -40
  142. package/dist/operatingcontext/BaseOperatingContext.mjs +44 -44
  143. package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
  144. package/dist/operatingcontext/StandardOperatingContext.mjs +43 -43
  145. package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +32 -32
  146. package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
  147. package/dist/operatingcontext/TeamsAppOperatingContext.mjs +85 -82
  148. package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
  149. package/dist/operatingcontext/UnknownOperatingContext.d.ts +25 -25
  150. package/dist/operatingcontext/UnknownOperatingContext.mjs +42 -42
  151. package/dist/packageMetadata.d.ts +2 -2
  152. package/dist/packageMetadata.mjs +3 -3
  153. package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
  154. package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
  155. package/dist/request/ClearCacheRequest.d.ts +10 -10
  156. package/dist/request/EndSessionPopupRequest.d.ts +18 -18
  157. package/dist/request/EndSessionRequest.d.ts +15 -15
  158. package/dist/request/PopupRequest.d.ts +34 -34
  159. package/dist/request/PopupWindowAttributes.d.ts +15 -15
  160. package/dist/request/RedirectRequest.d.ts +35 -35
  161. package/dist/request/SilentRequest.d.ts +32 -32
  162. package/dist/request/SsoSilentRequest.d.ts +29 -29
  163. package/dist/response/AuthenticationResult.d.ts +4 -4
  164. package/dist/response/ResponseHandler.d.ts +7 -7
  165. package/dist/response/ResponseHandler.mjs +36 -36
  166. package/dist/telemetry/BrowserPerformanceClient.d.ts +36 -36
  167. package/dist/telemetry/BrowserPerformanceClient.mjs +125 -125
  168. package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
  169. package/dist/telemetry/BrowserPerformanceMeasurement.mjs +92 -92
  170. package/dist/utils/BrowserConstants.d.ts +176 -176
  171. package/dist/utils/BrowserConstants.mjs +204 -204
  172. package/dist/utils/BrowserProtocolUtils.d.ts +11 -11
  173. package/dist/utils/BrowserProtocolUtils.mjs +21 -21
  174. package/dist/utils/BrowserUtils.d.ts +56 -56
  175. package/dist/utils/BrowserUtils.mjs +125 -125
  176. package/lib/msal-browser.cjs +17920 -17926
  177. package/lib/msal-browser.cjs.map +1 -1
  178. package/lib/msal-browser.js +17920 -17926
  179. package/lib/msal-browser.js.map +1 -1
  180. package/lib/msal-browser.min.js +59 -59
  181. package/package.json +102 -102
  182. package/src/controllers/NestedAppAuthController.ts +8 -3
  183. package/src/controllers/StandardController.ts +3 -1
  184. package/src/naa/AccountInfo.ts +3 -4
  185. package/src/naa/BridgeError.ts +4 -4
  186. package/src/naa/BridgeProxy.ts +6 -2
  187. package/src/naa/IBridgeProxy.ts +2 -0
  188. package/src/naa/InitializeBridgeResponse.ts +1 -1
  189. package/src/naa/TokenRequest.ts +0 -2
  190. package/src/naa/TokenResponse.ts +1 -2
  191. package/src/naa/mapping/NestedAppAuthAdapter.ts +72 -80
  192. package/src/operatingcontext/TeamsAppOperatingContext.ts +4 -1
@@ -1,24 +1,24 @@
1
- import { ICrypto, Logger, IPerformanceClient } from "@azure/msal-common";
2
- import { StandardInteractionClient } from "./StandardInteractionClient";
3
- import { BrowserConfiguration } from "../config/Configuration";
4
- import { BrowserCacheManager } from "../cache/BrowserCacheManager";
5
- import { EventHandler } from "../event/EventHandler";
6
- import { INavigationClient } from "../navigation/INavigationClient";
7
- import { ApiId } from "../utils/BrowserConstants";
8
- import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
9
- import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
10
- import { AuthenticationResult } from "../response/AuthenticationResult";
11
- export declare class SilentAuthCodeClient extends StandardInteractionClient {
12
- private apiId;
13
- constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
14
- /**
15
- * Acquires a token silently by redeeming an authorization code against the /token endpoint
16
- * @param request
17
- */
18
- acquireToken(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
19
- /**
20
- * Currently Unsupported
21
- */
22
- logout(): Promise<void>;
23
- }
1
+ import { ICrypto, Logger, IPerformanceClient } from "@azure/msal-common";
2
+ import { StandardInteractionClient } from "./StandardInteractionClient";
3
+ import { BrowserConfiguration } from "../config/Configuration";
4
+ import { BrowserCacheManager } from "../cache/BrowserCacheManager";
5
+ import { EventHandler } from "../event/EventHandler";
6
+ import { INavigationClient } from "../navigation/INavigationClient";
7
+ import { ApiId } from "../utils/BrowserConstants";
8
+ import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
9
+ import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
10
+ import { AuthenticationResult } from "../response/AuthenticationResult";
11
+ export declare class SilentAuthCodeClient extends StandardInteractionClient {
12
+ private apiId;
13
+ constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
14
+ /**
15
+ * Acquires a token silently by redeeming an authorization code against the /token endpoint
16
+ * @param request
17
+ */
18
+ acquireToken(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
19
+ /**
20
+ * Currently Unsupported
21
+ */
22
+ logout(): Promise<void>;
23
+ }
24
24
  //# sourceMappingURL=SilentAuthCodeClient.d.ts.map
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v3.5.0 2023-11-07 */
1
+ /*! @azure/msal-browser v3.5.1-beta.0 2023-11-14 */
2
2
  'use strict';
3
3
  import { invokeAsync, PerformanceEvents, AuthError } from '@azure/msal-common';
4
4
  import { StandardInteractionClient } from './StandardInteractionClient.mjs';
@@ -8,62 +8,62 @@ import { HybridSpaAuthorizationCodeClient } from './HybridSpaAuthorizationCodeCl
8
8
  import { InteractionHandler } from '../interaction_handler/InteractionHandler.mjs';
9
9
  import { authCodeRequired, silentLogoutUnsupported } from '../error/BrowserAuthErrorCodes.mjs';
10
10
 
11
- /*
12
- * Copyright (c) Microsoft Corporation. All rights reserved.
13
- * Licensed under the MIT License.
14
- */
15
- class SilentAuthCodeClient extends StandardInteractionClient {
16
- constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeMessageHandler, correlationId) {
17
- super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
18
- this.apiId = apiId;
19
- }
20
- /**
21
- * Acquires a token silently by redeeming an authorization code against the /token endpoint
22
- * @param request
23
- */
24
- async acquireToken(request) {
25
- // Auth code payload is required
26
- if (!request.code) {
27
- throw createBrowserAuthError(authCodeRequired);
28
- }
29
- // Create silent request
30
- const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(request, InteractionType.Silent);
31
- const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
32
- try {
33
- // Create auth code request (PKCE not needed)
34
- const authCodeRequest = {
35
- ...silentRequest,
36
- code: request.code,
37
- };
38
- // Initialize the client
39
- const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority);
40
- const authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
41
- this.logger.verbose("Auth code client created");
42
- // Create silent handler
43
- const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
44
- // Handle auth code parameters from request
45
- return invokeAsync(interactionHandler.handleCodeResponseFromServer.bind(interactionHandler), PerformanceEvents.HandleCodeResponseFromServer, this.logger, this.performanceClient, request.correlationId)({
46
- code: request.code,
47
- msgraph_host: request.msGraphHost,
48
- cloud_graph_host_name: request.cloudGraphHostName,
49
- cloud_instance_host_name: request.cloudInstanceHostName,
50
- }, silentRequest, false);
51
- }
52
- catch (e) {
53
- if (e instanceof AuthError) {
54
- e.setCorrelationId(this.correlationId);
55
- serverTelemetryManager.cacheFailedRequest(e);
56
- }
57
- throw e;
58
- }
59
- }
60
- /**
61
- * Currently Unsupported
62
- */
63
- logout() {
64
- // Synchronous so we must reject
65
- return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
66
- }
11
+ /*
12
+ * Copyright (c) Microsoft Corporation. All rights reserved.
13
+ * Licensed under the MIT License.
14
+ */
15
+ class SilentAuthCodeClient extends StandardInteractionClient {
16
+ constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeMessageHandler, correlationId) {
17
+ super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
18
+ this.apiId = apiId;
19
+ }
20
+ /**
21
+ * Acquires a token silently by redeeming an authorization code against the /token endpoint
22
+ * @param request
23
+ */
24
+ async acquireToken(request) {
25
+ // Auth code payload is required
26
+ if (!request.code) {
27
+ throw createBrowserAuthError(authCodeRequired);
28
+ }
29
+ // Create silent request
30
+ const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(request, InteractionType.Silent);
31
+ const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
32
+ try {
33
+ // Create auth code request (PKCE not needed)
34
+ const authCodeRequest = {
35
+ ...silentRequest,
36
+ code: request.code,
37
+ };
38
+ // Initialize the client
39
+ const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority);
40
+ const authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
41
+ this.logger.verbose("Auth code client created");
42
+ // Create silent handler
43
+ const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
44
+ // Handle auth code parameters from request
45
+ return invokeAsync(interactionHandler.handleCodeResponseFromServer.bind(interactionHandler), PerformanceEvents.HandleCodeResponseFromServer, this.logger, this.performanceClient, request.correlationId)({
46
+ code: request.code,
47
+ msgraph_host: request.msGraphHost,
48
+ cloud_graph_host_name: request.cloudGraphHostName,
49
+ cloud_instance_host_name: request.cloudInstanceHostName,
50
+ }, silentRequest, false);
51
+ }
52
+ catch (e) {
53
+ if (e instanceof AuthError) {
54
+ e.setCorrelationId(this.correlationId);
55
+ serverTelemetryManager.cacheFailedRequest(e);
56
+ }
57
+ throw e;
58
+ }
59
+ }
60
+ /**
61
+ * Currently Unsupported
62
+ */
63
+ logout() {
64
+ // Synchronous so we must reject
65
+ return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
66
+ }
67
67
  }
68
68
 
69
69
  export { SilentAuthCodeClient };
@@ -1,25 +1,25 @@
1
- import { StandardInteractionClient } from "./StandardInteractionClient";
2
- import { CommonSilentFlowRequest, SilentFlowClient, ServerTelemetryManager, AccountInfo, AzureCloudOptions } from "@azure/msal-common";
3
- import { SilentRequest } from "../request/SilentRequest";
4
- import { AuthenticationResult } from "../response/AuthenticationResult";
5
- import { ClearCacheRequest } from "../request/ClearCacheRequest";
6
- export declare class SilentCacheClient extends StandardInteractionClient {
7
- /**
8
- * Returns unexpired tokens from the cache, if available
9
- * @param silentRequest
10
- */
11
- acquireToken(silentRequest: CommonSilentFlowRequest): Promise<AuthenticationResult>;
12
- /**
13
- * API to silenty clear the browser cache.
14
- * @param logoutRequest
15
- */
16
- logout(logoutRequest?: ClearCacheRequest): Promise<void>;
17
- /**
18
- * Creates an Silent Flow Client with the given authority, or the default authority.
19
- * @param serverTelemetryManager
20
- * @param authorityUrl
21
- */
22
- protected createSilentFlowClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions): Promise<SilentFlowClient>;
23
- initializeSilentRequest(request: SilentRequest, account: AccountInfo): Promise<CommonSilentFlowRequest>;
24
- }
1
+ import { StandardInteractionClient } from "./StandardInteractionClient";
2
+ import { CommonSilentFlowRequest, SilentFlowClient, ServerTelemetryManager, AccountInfo, AzureCloudOptions } from "@azure/msal-common";
3
+ import { SilentRequest } from "../request/SilentRequest";
4
+ import { AuthenticationResult } from "../response/AuthenticationResult";
5
+ import { ClearCacheRequest } from "../request/ClearCacheRequest";
6
+ export declare class SilentCacheClient extends StandardInteractionClient {
7
+ /**
8
+ * Returns unexpired tokens from the cache, if available
9
+ * @param silentRequest
10
+ */
11
+ acquireToken(silentRequest: CommonSilentFlowRequest): Promise<AuthenticationResult>;
12
+ /**
13
+ * API to silenty clear the browser cache.
14
+ * @param logoutRequest
15
+ */
16
+ logout(logoutRequest?: ClearCacheRequest): Promise<void>;
17
+ /**
18
+ * Creates an Silent Flow Client with the given authority, or the default authority.
19
+ * @param serverTelemetryManager
20
+ * @param authorityUrl
21
+ */
22
+ protected createSilentFlowClient(serverTelemetryManager: ServerTelemetryManager, authorityUrl?: string, azureCloudOptions?: AzureCloudOptions): Promise<SilentFlowClient>;
23
+ initializeSilentRequest(request: SilentRequest, account: AccountInfo): Promise<CommonSilentFlowRequest>;
24
+ }
25
25
  //# sourceMappingURL=SilentCacheClient.d.ts.map
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v3.5.0 2023-11-07 */
1
+ /*! @azure/msal-browser v3.5.1-beta.0 2023-11-14 */
2
2
  'use strict';
3
3
  import { StandardInteractionClient } from './StandardInteractionClient.mjs';
4
4
  import { PerformanceEvents, invokeAsync, SilentFlowClient } from '@azure/msal-common';
@@ -6,66 +6,66 @@ import { ApiId } from '../utils/BrowserConstants.mjs';
6
6
  import { BrowserAuthError } from '../error/BrowserAuthError.mjs';
7
7
  import { cryptoKeyNotFound } from '../error/BrowserAuthErrorCodes.mjs';
8
8
 
9
- /*
10
- * Copyright (c) Microsoft Corporation. All rights reserved.
11
- * Licensed under the MIT License.
12
- */
13
- class SilentCacheClient extends StandardInteractionClient {
14
- /**
15
- * Returns unexpired tokens from the cache, if available
16
- * @param silentRequest
17
- */
18
- async acquireToken(silentRequest) {
19
- this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
20
- // Telemetry manager only used to increment cacheHits here
21
- const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
22
- const silentAuthClient = await this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
23
- this.logger.verbose("Silent auth client created");
24
- try {
25
- const response = await invokeAsync(silentAuthClient.acquireCachedToken.bind(silentAuthClient), PerformanceEvents.SilentFlowClientAcquireCachedToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
26
- const authResponse = response[0];
27
- this.performanceClient.addFields({
28
- fromCache: true,
29
- }, silentRequest.correlationId);
30
- return authResponse;
31
- }
32
- catch (error) {
33
- if (error instanceof BrowserAuthError &&
34
- error.errorCode === cryptoKeyNotFound) {
35
- this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
36
- }
37
- throw error;
38
- }
39
- }
40
- /**
41
- * API to silenty clear the browser cache.
42
- * @param logoutRequest
43
- */
44
- logout(logoutRequest) {
45
- this.logger.verbose("logoutRedirect called");
46
- const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
47
- return this.clearCacheOnLogout(validLogoutRequest?.account);
48
- }
49
- /**
50
- * Creates an Silent Flow Client with the given authority, or the default authority.
51
- * @param serverTelemetryManager
52
- * @param authorityUrl
53
- */
54
- async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
55
- // Create auth module.
56
- const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions);
57
- return new SilentFlowClient(clientConfig, this.performanceClient);
58
- }
59
- async initializeSilentRequest(request, account) {
60
- this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);
61
- const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)(request, account);
62
- return {
63
- ...request,
64
- ...baseRequest,
65
- account: account,
66
- forceRefresh: request.forceRefresh || false,
67
- };
68
- }
9
+ /*
10
+ * Copyright (c) Microsoft Corporation. All rights reserved.
11
+ * Licensed under the MIT License.
12
+ */
13
+ class SilentCacheClient extends StandardInteractionClient {
14
+ /**
15
+ * Returns unexpired tokens from the cache, if available
16
+ * @param silentRequest
17
+ */
18
+ async acquireToken(silentRequest) {
19
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
20
+ // Telemetry manager only used to increment cacheHits here
21
+ const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
22
+ const silentAuthClient = await this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
23
+ this.logger.verbose("Silent auth client created");
24
+ try {
25
+ const response = await invokeAsync(silentAuthClient.acquireCachedToken.bind(silentAuthClient), PerformanceEvents.SilentFlowClientAcquireCachedToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
26
+ const authResponse = response[0];
27
+ this.performanceClient.addFields({
28
+ fromCache: true,
29
+ }, silentRequest.correlationId);
30
+ return authResponse;
31
+ }
32
+ catch (error) {
33
+ if (error instanceof BrowserAuthError &&
34
+ error.errorCode === cryptoKeyNotFound) {
35
+ this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
36
+ }
37
+ throw error;
38
+ }
39
+ }
40
+ /**
41
+ * API to silenty clear the browser cache.
42
+ * @param logoutRequest
43
+ */
44
+ logout(logoutRequest) {
45
+ this.logger.verbose("logoutRedirect called");
46
+ const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
47
+ return this.clearCacheOnLogout(validLogoutRequest?.account);
48
+ }
49
+ /**
50
+ * Creates an Silent Flow Client with the given authority, or the default authority.
51
+ * @param serverTelemetryManager
52
+ * @param authorityUrl
53
+ */
54
+ async createSilentFlowClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
55
+ // Create auth module.
56
+ const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions);
57
+ return new SilentFlowClient(clientConfig, this.performanceClient);
58
+ }
59
+ async initializeSilentRequest(request, account) {
60
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.InitializeSilentRequest, this.correlationId);
61
+ const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)(request, account);
62
+ return {
63
+ ...request,
64
+ ...baseRequest,
65
+ account: account,
66
+ forceRefresh: request.forceRefresh || false,
67
+ };
68
+ }
69
69
  }
70
70
 
71
71
  export { SilentCacheClient };
@@ -1,33 +1,33 @@
1
- import { ICrypto, Logger, AuthorizationCodeClient, IPerformanceClient } from "@azure/msal-common";
2
- import { StandardInteractionClient } from "./StandardInteractionClient";
3
- import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
4
- import { BrowserConfiguration } from "../config/Configuration";
5
- import { BrowserCacheManager } from "../cache/BrowserCacheManager";
6
- import { EventHandler } from "../event/EventHandler";
7
- import { INavigationClient } from "../navigation/INavigationClient";
8
- import { ApiId } from "../utils/BrowserConstants";
9
- import { SsoSilentRequest } from "../request/SsoSilentRequest";
10
- import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
11
- import { AuthenticationResult } from "../response/AuthenticationResult";
12
- export declare class SilentIframeClient extends StandardInteractionClient {
13
- protected apiId: ApiId;
14
- protected nativeStorage: BrowserCacheManager;
15
- constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, nativeStorageImpl: BrowserCacheManager, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
16
- /**
17
- * Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session
18
- * @param request
19
- */
20
- acquireToken(request: SsoSilentRequest): Promise<AuthenticationResult>;
21
- /**
22
- * Currently Unsupported
23
- */
24
- logout(): Promise<void>;
25
- /**
26
- * Helper which acquires an authorization code silently using a hidden iframe from given url
27
- * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
28
- * @param navigateUrl
29
- * @param userRequestScopes
30
- */
31
- protected silentTokenHelper(authClient: AuthorizationCodeClient, silentRequest: AuthorizationUrlRequest): Promise<AuthenticationResult>;
32
- }
1
+ import { ICrypto, Logger, AuthorizationCodeClient, IPerformanceClient } from "@azure/msal-common";
2
+ import { StandardInteractionClient } from "./StandardInteractionClient";
3
+ import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
4
+ import { BrowserConfiguration } from "../config/Configuration";
5
+ import { BrowserCacheManager } from "../cache/BrowserCacheManager";
6
+ import { EventHandler } from "../event/EventHandler";
7
+ import { INavigationClient } from "../navigation/INavigationClient";
8
+ import { ApiId } from "../utils/BrowserConstants";
9
+ import { SsoSilentRequest } from "../request/SsoSilentRequest";
10
+ import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
11
+ import { AuthenticationResult } from "../response/AuthenticationResult";
12
+ export declare class SilentIframeClient extends StandardInteractionClient {
13
+ protected apiId: ApiId;
14
+ protected nativeStorage: BrowserCacheManager;
15
+ constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, nativeStorageImpl: BrowserCacheManager, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
16
+ /**
17
+ * Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session
18
+ * @param request
19
+ */
20
+ acquireToken(request: SsoSilentRequest): Promise<AuthenticationResult>;
21
+ /**
22
+ * Currently Unsupported
23
+ */
24
+ logout(): Promise<void>;
25
+ /**
26
+ * Helper which acquires an authorization code silently using a hidden iframe from given url
27
+ * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
28
+ * @param navigateUrl
29
+ * @param userRequestScopes
30
+ */
31
+ protected silentTokenHelper(authClient: AuthorizationCodeClient, silentRequest: AuthorizationUrlRequest): Promise<AuthenticationResult>;
32
+ }
33
33
  //# sourceMappingURL=SilentIframeClient.d.ts.map
@@ -1,4 +1,4 @@
1
- /*! @azure/msal-browser v3.5.0 2023-11-07 */
1
+ /*! @azure/msal-browser v3.5.1-beta.0 2023-11-14 */
2
2
  'use strict';
3
3
  import { PerformanceEvents, PromptValue, invokeAsync, AuthError, invoke, ProtocolUtils } from '@azure/msal-common';
4
4
  import { StandardInteractionClient } from './StandardInteractionClient.mjs';
@@ -12,101 +12,101 @@ import { preconnect } from '../utils/BrowserUtils.mjs';
12
12
  import { deserializeResponse } from '../response/ResponseHandler.mjs';
13
13
  import { silentPromptValueError, 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 that prompt is set to none or no_session, throw error if it is set to anything else.
38
- if (request.prompt &&
39
- request.prompt !== PromptValue.NONE &&
40
- request.prompt !== PromptValue.NO_SESSION) {
41
- throw createBrowserAuthError(silentPromptValueError);
42
- }
43
- // Create silent request
44
- const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)({
45
- ...request,
46
- prompt: request.prompt || PromptValue.NONE,
47
- }, InteractionType.Silent);
48
- preconnect(silentRequest.authority);
49
- const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
50
- try {
51
- // Initialize the client
52
- const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
53
- return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, request.correlationId)(authClient, silentRequest);
54
- }
55
- catch (e) {
56
- if (e instanceof AuthError) {
57
- e.setCorrelationId(this.correlationId);
58
- serverTelemetryManager.cacheFailedRequest(e);
59
- }
60
- throw e;
61
- }
62
- }
63
- /**
64
- * Currently Unsupported
65
- */
66
- logout() {
67
- // Synchronous so we must reject
68
- return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
69
- }
70
- /**
71
- * Helper which acquires an authorization code silently using a hidden iframe from given url
72
- * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
73
- * @param navigateUrl
74
- * @param userRequestScopes
75
- */
76
- async silentTokenHelper(authClient, silentRequest) {
77
- const correlationId = silentRequest.correlationId;
78
- this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, correlationId);
79
- // Create auth code request and generate PKCE params
80
- const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, correlationId)(silentRequest);
81
- // Create authorize request url
82
- const navigateUrl = await invokeAsync(authClient.getAuthCodeUrl.bind(authClient), PerformanceEvents.GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)({
83
- ...silentRequest,
84
- nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
85
- });
86
- // Create silent handler
87
- const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
88
- // Get the frame handle for the silent request
89
- const msalFrame = await invokeAsync(initiateAuthRequest, PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(navigateUrl, this.performanceClient, this.logger, correlationId, this.config.system.navigateFrameWait);
90
- const responseType = this.config.auth.OIDCOptions.serverResponseType;
91
- // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
92
- 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);
93
- const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, responseType, this.logger);
94
- if (serverParams.accountId) {
95
- this.logger.verbose("Account id found in hash, calling WAM for token");
96
- if (!this.nativeMessageHandler) {
97
- throw createBrowserAuthError(nativeConnectionNotEstablished);
98
- }
99
- 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);
100
- const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, silentRequest.state);
101
- return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), PerformanceEvents.NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)({
102
- ...silentRequest,
103
- state: userRequestState,
104
- prompt: silentRequest.prompt || PromptValue.NONE,
105
- });
106
- }
107
- // Handle response from hash string
108
- return invokeAsync(interactionHandler.handleCodeResponse.bind(interactionHandler), PerformanceEvents.HandleCodeResponse, this.logger, this.performanceClient, correlationId)(serverParams, silentRequest);
109
- }
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 that prompt is set to none or no_session, throw error if it is set to anything else.
38
+ if (request.prompt &&
39
+ request.prompt !== PromptValue.NONE &&
40
+ request.prompt !== PromptValue.NO_SESSION) {
41
+ throw createBrowserAuthError(silentPromptValueError);
42
+ }
43
+ // Create silent request
44
+ const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)({
45
+ ...request,
46
+ prompt: request.prompt || PromptValue.NONE,
47
+ }, InteractionType.Silent);
48
+ preconnect(silentRequest.authority);
49
+ const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
50
+ try {
51
+ // Initialize the client
52
+ const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
53
+ return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, request.correlationId)(authClient, silentRequest);
54
+ }
55
+ catch (e) {
56
+ if (e instanceof AuthError) {
57
+ e.setCorrelationId(this.correlationId);
58
+ serverTelemetryManager.cacheFailedRequest(e);
59
+ }
60
+ throw e;
61
+ }
62
+ }
63
+ /**
64
+ * Currently Unsupported
65
+ */
66
+ logout() {
67
+ // Synchronous so we must reject
68
+ return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
69
+ }
70
+ /**
71
+ * Helper which acquires an authorization code silently using a hidden iframe from given url
72
+ * using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
73
+ * @param navigateUrl
74
+ * @param userRequestScopes
75
+ */
76
+ async silentTokenHelper(authClient, silentRequest) {
77
+ const correlationId = silentRequest.correlationId;
78
+ this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, correlationId);
79
+ // Create auth code request and generate PKCE params
80
+ const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, correlationId)(silentRequest);
81
+ // Create authorize request url
82
+ const navigateUrl = await invokeAsync(authClient.getAuthCodeUrl.bind(authClient), PerformanceEvents.GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)({
83
+ ...silentRequest,
84
+ nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
85
+ });
86
+ // Create silent handler
87
+ const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
88
+ // Get the frame handle for the silent request
89
+ const msalFrame = await invokeAsync(initiateAuthRequest, PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(navigateUrl, this.performanceClient, this.logger, correlationId, this.config.system.navigateFrameWait);
90
+ const responseType = this.config.auth.OIDCOptions.serverResponseType;
91
+ // Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
92
+ 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);
93
+ const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, responseType, this.logger);
94
+ if (serverParams.accountId) {
95
+ this.logger.verbose("Account id found in hash, calling WAM for token");
96
+ if (!this.nativeMessageHandler) {
97
+ throw createBrowserAuthError(nativeConnectionNotEstablished);
98
+ }
99
+ 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);
100
+ const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, silentRequest.state);
101
+ return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), PerformanceEvents.NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)({
102
+ ...silentRequest,
103
+ state: userRequestState,
104
+ prompt: silentRequest.prompt || PromptValue.NONE,
105
+ });
106
+ }
107
+ // Handle response from hash string
108
+ return invokeAsync(interactionHandler.handleCodeResponse.bind(interactionHandler), PerformanceEvents.HandleCodeResponse, this.logger, this.performanceClient, correlationId)(serverParams, silentRequest);
109
+ }
110
110
  }
111
111
 
112
112
  export { SilentIframeClient };