@azure/msal-browser 3.20.0 → 3.22.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.
- package/dist/app/IPublicClientApplication.d.ts +53 -53
- package/dist/app/IPublicClientApplication.mjs +105 -105
- package/dist/app/PublicClientApplication.d.ts +293 -293
- package/dist/app/PublicClientApplication.mjs +364 -364
- package/dist/app/PublicClientNext.d.ts +276 -276
- package/dist/app/PublicClientNext.mjs +354 -354
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +62 -62
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +254 -254
- package/dist/broker/nativeBroker/NativeRequest.d.ts +45 -45
- package/dist/broker/nativeBroker/NativeResponse.d.ts +48 -48
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +7 -7
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +11 -11
- package/dist/cache/AccountManager.d.ts +48 -48
- package/dist/cache/AccountManager.mjs +126 -126
- package/dist/cache/AsyncMemoryStorage.d.ts +50 -50
- package/dist/cache/AsyncMemoryStorage.mjs +131 -131
- package/dist/cache/BrowserCacheManager.d.ts +385 -385
- package/dist/cache/BrowserCacheManager.mjs +1294 -1294
- package/dist/cache/BrowserStorage.d.ts +11 -11
- package/dist/cache/BrowserStorage.mjs +32 -32
- package/dist/cache/DatabaseStorage.d.ts +56 -56
- package/dist/cache/DatabaseStorage.mjs +200 -200
- package/dist/cache/IAsyncStorage.d.ts +27 -27
- package/dist/cache/ITokenCache.d.ts +11 -11
- package/dist/cache/IWindowStorage.d.ts +27 -27
- package/dist/cache/MemoryStorage.d.ts +11 -11
- package/dist/cache/MemoryStorage.mjs +31 -31
- package/dist/cache/TokenCache.d.ts +77 -77
- package/dist/cache/TokenCache.mjs +195 -195
- package/dist/config/Configuration.d.ts +213 -208
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +128 -128
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.d.ts +5 -5
- package/dist/controllers/ControllerFactory.mjs +25 -25
- package/dist/controllers/IController.d.ts +60 -60
- package/dist/controllers/NestedAppAuthController.d.ts +202 -202
- package/dist/controllers/NestedAppAuthController.mjs +473 -473
- package/dist/controllers/StandardController.d.ts +405 -405
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +1334 -1316
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +86 -86
- package/dist/controllers/UnknownOperatingContextController.mjs +256 -256
- package/dist/crypto/BrowserCrypto.d.ts +52 -52
- package/dist/crypto/BrowserCrypto.mjs +151 -151
- package/dist/crypto/CryptoOps.d.ts +74 -74
- package/dist/crypto/CryptoOps.mjs +176 -176
- package/dist/crypto/PkceGenerator.d.ts +8 -8
- package/dist/crypto/PkceGenerator.mjs +54 -54
- package/dist/crypto/SignedHttpRequest.d.ts +30 -30
- package/dist/crypto/SignedHttpRequest.mjs +39 -39
- package/dist/encode/Base64Decode.d.ts +9 -9
- package/dist/encode/Base64Decode.mjs +36 -36
- package/dist/encode/Base64Encode.d.ts +19 -19
- package/dist/encode/Base64Encode.mjs +43 -43
- package/dist/error/BrowserAuthError.d.ts +255 -255
- package/dist/error/BrowserAuthError.mjs +263 -263
- package/dist/error/BrowserAuthErrorCodes.d.ts +46 -46
- package/dist/error/BrowserAuthErrorCodes.mjs +50 -50
- package/dist/error/BrowserConfigurationAuthError.d.ts +33 -33
- package/dist/error/BrowserConfigurationAuthError.mjs +40 -40
- package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +3 -3
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +7 -7
- package/dist/error/NativeAuthError.d.ts +29 -29
- package/dist/error/NativeAuthError.mjs +60 -60
- package/dist/error/NativeAuthErrorCodes.d.ts +2 -2
- package/dist/error/NativeAuthErrorCodes.mjs +6 -6
- package/dist/error/NestedAppAuthError.d.ts +14 -14
- package/dist/error/NestedAppAuthError.mjs +23 -23
- package/dist/event/EventHandler.d.ts +41 -41
- package/dist/event/EventHandler.mjs +125 -125
- package/dist/event/EventMessage.d.ts +25 -25
- package/dist/event/EventMessage.mjs +68 -68
- package/dist/event/EventType.d.ts +29 -29
- package/dist/event/EventType.mjs +32 -32
- package/dist/index.d.ts +40 -40
- package/dist/index.mjs +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +50 -50
- package/dist/interaction_client/BaseInteractionClient.mjs +106 -106
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts +4 -4
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +10 -10
- package/dist/interaction_client/NativeInteractionClient.d.ts +151 -151
- package/dist/interaction_client/NativeInteractionClient.mjs +621 -621
- package/dist/interaction_client/PopupClient.d.ts +105 -105
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +433 -433
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts +50 -50
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +315 -314
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts +23 -23
- package/dist/interaction_client/SilentAuthCodeClient.mjs +57 -57
- package/dist/interaction_client/SilentCacheClient.d.ts +16 -16
- package/dist/interaction_client/SilentCacheClient.mjs +42 -42
- package/dist/interaction_client/SilentIframeClient.d.ts +32 -32
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +110 -100
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts +20 -20
- package/dist/interaction_client/SilentRefreshClient.mjs +47 -47
- package/dist/interaction_client/StandardInteractionClient.d.ts +48 -48
- package/dist/interaction_client/StandardInteractionClient.mjs +199 -199
- package/dist/interaction_handler/InteractionHandler.d.ts +33 -33
- package/dist/interaction_handler/InteractionHandler.mjs +93 -93
- package/dist/interaction_handler/RedirectHandler.d.ts +32 -32
- package/dist/interaction_handler/RedirectHandler.mjs +134 -134
- package/dist/interaction_handler/SilentHandler.d.ts +13 -13
- package/dist/interaction_handler/SilentHandler.mjs +134 -134
- package/dist/naa/AccountInfo.d.ts +11 -11
- package/dist/naa/AuthBridge.d.ts +8 -8
- package/dist/naa/AuthResult.d.ts +6 -6
- package/dist/naa/BridgeAccountContext.d.ts +12 -12
- package/dist/naa/BridgeCapabilities.d.ts +3 -3
- package/dist/naa/BridgeError.d.ts +9 -9
- package/dist/naa/BridgeError.mjs +7 -7
- package/dist/naa/BridgeProxy.d.ts +67 -67
- package/dist/naa/BridgeProxy.mjs +148 -148
- package/dist/naa/BridgeRequest.d.ts +7 -7
- package/dist/naa/BridgeRequestEnvelope.d.ts +12 -12
- package/dist/naa/BridgeResponseEnvelope.d.ts +13 -13
- package/dist/naa/BridgeStatusCode.d.ts +11 -11
- package/dist/naa/BridgeStatusCode.mjs +14 -14
- package/dist/naa/IBridgeProxy.d.ts +10 -10
- package/dist/naa/InitContext.d.ts +8 -8
- package/dist/naa/TokenRequest.d.ts +18 -18
- package/dist/naa/TokenResponse.d.ts +13 -13
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +35 -35
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +179 -179
- package/dist/navigation/INavigationClient.d.ts +16 -16
- package/dist/navigation/NavigationClient.d.ts +22 -22
- package/dist/navigation/NavigationClient.mjs +40 -40
- package/dist/navigation/NavigationOptions.d.ts +12 -12
- package/dist/network/FetchClient.d.ts +26 -26
- package/dist/network/FetchClient.mjs +99 -99
- package/dist/operatingcontext/BaseOperatingContext.d.ts +41 -41
- package/dist/operatingcontext/BaseOperatingContext.mjs +94 -94
- package/dist/operatingcontext/NestedAppOperatingContext.d.ts +34 -34
- package/dist/operatingcontext/NestedAppOperatingContext.mjs +71 -71
- package/dist/operatingcontext/StandardOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/StandardOperatingContext.mjs +43 -43
- package/dist/operatingcontext/UnknownOperatingContext.d.ts +25 -25
- package/dist/operatingcontext/UnknownOperatingContext.mjs +42 -42
- package/dist/packageMetadata.d.ts +2 -2
- package/dist/packageMetadata.mjs +4 -4
- package/dist/request/AuthorizationCodeRequest.d.ts +8 -8
- package/dist/request/AuthorizationUrlRequest.d.ts +8 -8
- package/dist/request/ClearCacheRequest.d.ts +10 -10
- package/dist/request/EndSessionPopupRequest.d.ts +18 -18
- package/dist/request/EndSessionRequest.d.ts +15 -15
- package/dist/request/InitializeApplicationRequest.d.ts +8 -8
- package/dist/request/PopupRequest.d.ts +34 -34
- package/dist/request/PopupWindowAttributes.d.ts +15 -15
- package/dist/request/RedirectRequest.d.ts +40 -35
- package/dist/request/RedirectRequest.d.ts.map +1 -1
- package/dist/request/RequestHelpers.d.ts +13 -13
- package/dist/request/RequestHelpers.mjs +53 -53
- package/dist/request/SilentRequest.d.ts +33 -33
- package/dist/request/SsoSilentRequest.d.ts +29 -29
- package/dist/response/AuthenticationResult.d.ts +4 -4
- package/dist/response/ResponseHandler.d.ts +7 -7
- package/dist/response/ResponseHandler.mjs +36 -36
- package/dist/telemetry/BrowserPerformanceClient.d.ts +34 -34
- package/dist/telemetry/BrowserPerformanceClient.mjs +162 -162
- package/dist/telemetry/BrowserPerformanceMeasurement.d.ts +21 -21
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +92 -92
- package/dist/utils/BrowserConstants.d.ts +180 -180
- package/dist/utils/BrowserConstants.mjs +212 -212
- package/dist/utils/BrowserProtocolUtils.d.ts +11 -11
- package/dist/utils/BrowserProtocolUtils.mjs +21 -21
- package/dist/utils/BrowserUtils.d.ts +75 -75
- package/dist/utils/BrowserUtils.mjs +157 -157
- package/lib/msal-browser.cjs +18884 -18855
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +18884 -18855
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +59 -59
- package/package.json +2 -2
- package/src/config/Configuration.ts +9 -1
- package/src/controllers/StandardController.ts +30 -12
- package/src/interaction_client/PopupClient.ts +1 -0
- package/src/interaction_client/RedirectClient.ts +4 -1
- package/src/interaction_client/SilentIframeClient.ts +40 -3
- package/src/packageMetadata.ts +1 -1
- package/src/request/RedirectRequest.ts +5 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.
|
|
1
|
+
/*! @azure/msal-browser v3.22.0 2024-08-28 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { PerformanceEvents, PromptValue, invokeAsync, AuthError, 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
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
const
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const
|
|
94
|
-
//
|
|
95
|
-
const
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
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 AuthError) ||
|
|
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;
|
|
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;AA0CG,MAAO,kBAAmB,SAAQ,yBAAyB,CAAA;IAI7D,WACI,CAAA,MAA4B,EAC5B,WAAgC,EAChC,aAAsB,EACtB,MAAc,EACd,YAA0B,EAC1B,gBAAmC,EACnC,KAAY,EACZ,iBAAqC,EACrC,iBAAsC,EACtC,oBAA2C,EAC3C,aAAsB,EAAA;AAEtB,QAAA,KAAK,CACD,MAAM,EACN,WAAW,EACX,aA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AAC,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.
|
|
1
|
+
/*! @azure/msal-browser v3.22.0 2024-08-28 */
|
|
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
|