@azure/msal-browser 3.0.2 → 3.2.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 +2 -0
- package/dist/app/IPublicClientApplication.d.ts.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +22 -18
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +20 -6
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +24 -7
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts +3 -4
- package/dist/broker/nativeBroker/NativeMessageHandler.d.ts.map +1 -1
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +17 -16
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs.map +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts +8 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.d.ts.map +1 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +16 -0
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs.map +1 -0
- package/dist/cache/AsyncMemoryStorage.mjs +4 -3
- package/dist/cache/AsyncMemoryStorage.mjs.map +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +10 -3
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +58 -29
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.d.ts.map +1 -1
- package/dist/cache/BrowserStorage.mjs +7 -9
- package/dist/cache/BrowserStorage.mjs.map +1 -1
- package/dist/cache/CryptoKeyStore.mjs +1 -1
- package/dist/cache/CryptoKeyStore.mjs.map +1 -1
- package/dist/cache/DatabaseStorage.d.ts.map +1 -1
- package/dist/cache/DatabaseStorage.mjs +9 -8
- package/dist/cache/DatabaseStorage.mjs.map +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs.map +1 -1
- package/dist/cache/TokenCache.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +30 -30
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +1 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +12 -16
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +1 -1
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +5 -28
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/StandardController.d.ts +17 -31
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +78 -83
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/crypto/BrowserCrypto.d.ts +44 -49
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +78 -77
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -10
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +23 -34
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +6 -22
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +48 -49
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs.map +1 -1
- package/dist/encode/Base64Decode.d.ts +6 -19
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.mjs +31 -68
- package/dist/encode/Base64Decode.mjs.map +1 -1
- package/dist/encode/Base64Encode.d.ts +15 -27
- package/dist/encode/Base64Encode.d.ts.map +1 -1
- package/dist/encode/Base64Encode.mjs +36 -75
- package/dist/encode/Base64Encode.mjs.map +1 -1
- package/dist/error/BrowserAuthError.d.ts +63 -195
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +159 -381
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +46 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/BrowserAuthErrorCodes.mjs +54 -0
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -0
- package/dist/error/BrowserConfigurationAuthError.d.ts +9 -46
- package/dist/error/BrowserConfigurationAuthError.d.ts.map +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +20 -73
- package/dist/error/BrowserConfigurationAuthError.mjs.map +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts +4 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +12 -0
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs.map +1 -0
- package/dist/error/NativeAuthError.d.ts +17 -45
- package/dist/error/NativeAuthError.d.ts.map +1 -1
- package/dist/error/NativeAuthError.mjs +49 -79
- package/dist/error/NativeAuthError.mjs.map +1 -1
- package/dist/error/NativeAuthErrorCodes.d.ts +3 -0
- package/dist/error/NativeAuthErrorCodes.d.ts.map +1 -0
- package/dist/error/NativeAuthErrorCodes.mjs +11 -0
- package/dist/error/NativeAuthErrorCodes.mjs.map +1 -0
- package/dist/event/EventHandler.d.ts.map +1 -1
- package/dist/event/EventHandler.mjs +3 -2
- package/dist/event/EventHandler.mjs.map +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventMessage.mjs.map +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/event/EventType.mjs.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +8 -4
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts +2 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +7 -8
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts +4 -10
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +32 -38
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +16 -15
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.d.ts.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +7 -6
- package/dist/interaction_client/RedirectClient.mjs.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +9 -11
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts +4 -2
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +19 -25
- package/dist/interaction_client/SilentCacheClient.mjs.map +1 -1
- package/dist/interaction_client/SilentIframeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentIframeClient.mjs +20 -47
- package/dist/interaction_client/SilentIframeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentRefreshClient.mjs +11 -20
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +18 -38
- package/dist/interaction_client/StandardInteractionClient.mjs.map +1 -1
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +13 -16
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +12 -11
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +11 -11
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/navigation/NavigationClient.mjs.map +1 -1
- package/dist/network/FetchClient.d.ts.map +1 -1
- package/dist/network/FetchClient.mjs +9 -8
- package/dist/network/FetchClient.mjs.map +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/packageMetadata.mjs.map +1 -1
- package/dist/request/ClearCacheRequest.d.ts +11 -0
- package/dist/request/ClearCacheRequest.d.ts.map +1 -0
- package/dist/telemetry/BrowserPerformanceClient.d.ts +2 -4
- package/dist/telemetry/BrowserPerformanceClient.d.ts.map +1 -1
- package/dist/telemetry/BrowserPerformanceClient.mjs +2 -6
- package/dist/telemetry/BrowserPerformanceClient.mjs.map +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs.map +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs.map +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +4 -4
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserStringUtils.mjs +1 -1
- package/dist/utils/BrowserStringUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.d.ts +0 -9
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +8 -33
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +8729 -9566
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +8729 -9566
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +68 -62
- package/package.json +7 -5
- package/src/app/IPublicClientApplication.ts +236 -0
- package/src/app/PublicClientApplication.ts +417 -0
- package/src/broker/nativeBroker/NativeMessageHandler.ts +416 -0
- package/src/broker/nativeBroker/NativeRequest.ts +52 -0
- package/src/broker/nativeBroker/NativeResponse.ts +56 -0
- package/src/broker/nativeBroker/NativeStatusCodes.ts +13 -0
- package/src/cache/AsyncMemoryStorage.ts +158 -0
- package/src/cache/BrowserCacheManager.ts +2009 -0
- package/src/cache/BrowserStorage.ts +52 -0
- package/src/cache/CryptoKeyStore.ts +63 -0
- package/src/cache/DatabaseStorage.ts +287 -0
- package/src/cache/IAsyncMemoryStorage.ts +36 -0
- package/src/cache/ITokenCache.ts +21 -0
- package/src/cache/IWindowStorage.ts +36 -0
- package/src/cache/MemoryStorage.ts +42 -0
- package/src/cache/TokenCache.ts +484 -0
- package/src/config/Configuration.ts +383 -0
- package/src/controllers/ControllerFactory.ts +55 -0
- package/src/controllers/IController.ts +134 -0
- package/src/controllers/StandardController.ts +2170 -0
- package/src/crypto/BrowserCrypto.ts +151 -0
- package/src/crypto/CryptoOps.ts +235 -0
- package/src/crypto/PkceGenerator.ts +115 -0
- package/src/crypto/SignedHttpRequest.ts +76 -0
- package/src/encode/Base64Decode.ts +46 -0
- package/src/encode/Base64Encode.ts +52 -0
- package/src/error/BrowserAuthError.ts +352 -0
- package/src/error/BrowserAuthErrorCodes.ts +57 -0
- package/src/error/BrowserConfigurationAuthError.ts +64 -0
- package/src/error/BrowserConfigurationAuthErrorCodes.ts +9 -0
- package/src/error/NativeAuthError.ts +113 -0
- package/src/error/NativeAuthErrorCodes.ts +7 -0
- package/src/event/EventHandler.ts +177 -0
- package/src/event/EventMessage.ts +125 -0
- package/src/event/EventType.ts +33 -0
- package/src/index.ts +157 -0
- package/src/interaction_client/BaseInteractionClient.ts +307 -0
- package/src/interaction_client/HybridSpaAuthorizationCodeClient.ts +16 -0
- package/src/interaction_client/NativeInteractionClient.ts +925 -0
- package/src/interaction_client/PopupClient.ts +926 -0
- package/src/interaction_client/RedirectClient.ts +616 -0
- package/src/interaction_client/SilentAuthCodeClient.ts +165 -0
- package/src/interaction_client/SilentCacheClient.ts +125 -0
- package/src/interaction_client/SilentIframeClient.ts +301 -0
- package/src/interaction_client/SilentRefreshClient.ts +118 -0
- package/src/interaction_client/StandardInteractionClient.ts +450 -0
- package/src/interaction_handler/InteractionHandler.ts +251 -0
- package/src/interaction_handler/RedirectHandler.ts +229 -0
- package/src/interaction_handler/SilentHandler.ts +269 -0
- package/src/navigation/INavigationClient.ts +23 -0
- package/src/navigation/NavigationClient.ts +55 -0
- package/src/navigation/NavigationOptions.ts +18 -0
- package/src/network/FetchClient.ts +130 -0
- package/src/operatingcontext/BaseOperatingContext.ts +82 -0
- package/src/operatingcontext/StandardOperatingContext.ts +49 -0
- package/src/operatingcontext/TeamsAppOperatingContext.ts +48 -0
- package/src/packageMetadata.ts +3 -0
- package/src/request/AuthorizationCodeRequest.ts +19 -0
- package/src/request/AuthorizationUrlRequest.ts +17 -0
- package/src/request/ClearCacheRequest.ts +16 -0
- package/src/request/EndSessionPopupRequest.ts +26 -0
- package/src/request/EndSessionRequest.ts +23 -0
- package/src/request/PopupRequest.ts +51 -0
- package/src/request/PopupWindowAttributes.ts +22 -0
- package/src/request/RedirectRequest.ts +51 -0
- package/src/request/SilentRequest.ts +49 -0
- package/src/request/SsoSilentRequest.ts +44 -0
- package/src/response/AuthenticationResult.ts +13 -0
- package/src/telemetry/BrowserPerformanceClient.ts +226 -0
- package/src/telemetry/BrowserPerformanceMeasurement.ts +144 -0
- package/src/utils/BrowserConstants.ts +241 -0
- package/src/utils/BrowserProtocolUtils.ts +58 -0
- package/src/utils/BrowserStringUtils.ts +143 -0
- package/src/utils/BrowserUtils.ts +156 -0
- package/dist/crypto/GuidGenerator.d.ts +0 -13
- package/dist/crypto/GuidGenerator.d.ts.map +0 -1
- package/dist/crypto/GuidGenerator.mjs +0 -104
- package/dist/crypto/GuidGenerator.mjs.map +0 -1
- package/dist/crypto/ISubtleCrypto.d.ts +0 -10
- package/dist/crypto/ISubtleCrypto.d.ts.map +0 -1
- package/dist/crypto/ModernBrowserCrypto.d.ts +0 -10
- package/dist/crypto/ModernBrowserCrypto.d.ts.map +0 -1
- package/dist/crypto/ModernBrowserCrypto.mjs +0 -31
- package/dist/crypto/ModernBrowserCrypto.mjs.map +0 -1
- package/dist/internals.d.ts +0 -23
- package/dist/internals.d.ts.map +0 -1
- package/dist/internals.mjs +0 -28
- package/dist/internals.mjs.map +0 -1
- package/dist/network/XhrClient.d.ts +0 -41
- package/dist/network/XhrClient.d.ts.map +0 -1
- package/dist/network/XhrClient.mjs +0 -125
- package/dist/network/XhrClient.mjs.map +0 -1
- package/dist/utils/MathUtils.d.ts +0 -12
- package/dist/utils/MathUtils.d.ts.map +0 -1
- package/dist/utils/MathUtils.mjs +0 -26
- package/dist/utils/MathUtils.mjs.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0
|
|
1
|
+
/*! @azure/msal-browser v3.2.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import { PerformanceEvents,
|
|
3
|
+
import { PerformanceEvents, PromptValue, invokeAsync, Constants, AuthError, UrlString, ProtocolUtils } from '@azure/msal-common';
|
|
4
4
|
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
|
5
|
-
import {
|
|
5
|
+
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
6
6
|
import { InteractionType } from '../utils/BrowserConstants.mjs';
|
|
7
7
|
import { SilentHandler } from '../interaction_handler/SilentHandler.mjs';
|
|
8
8
|
import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.mjs';
|
|
9
9
|
import { NativeInteractionClient } from './NativeInteractionClient.mjs';
|
|
10
|
+
import { silentPromptValueError, silentLogoutUnsupported, nativeConnectionNotEstablished } from '../error/BrowserAuthErrorCodes.mjs';
|
|
10
11
|
|
|
11
12
|
/*
|
|
12
13
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -24,26 +25,20 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
24
25
|
*/
|
|
25
26
|
async acquireToken(request) {
|
|
26
27
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
27
|
-
this.logger.verbose("acquireTokenByIframe called");
|
|
28
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
|
29
28
|
// Check that we have some SSO data
|
|
30
|
-
if (
|
|
31
|
-
|
|
32
|
-
(!request.account ||
|
|
29
|
+
if (!request.loginHint &&
|
|
30
|
+
!request.sid &&
|
|
31
|
+
(!request.account || !request.account.username)) {
|
|
33
32
|
this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
|
|
34
33
|
}
|
|
35
34
|
// Check that prompt is set to none or no_session, throw error if it is set to anything else.
|
|
36
35
|
if (request.prompt &&
|
|
37
36
|
request.prompt !== PromptValue.NONE &&
|
|
38
37
|
request.prompt !== PromptValue.NO_SESSION) {
|
|
39
|
-
|
|
40
|
-
success: false,
|
|
41
|
-
});
|
|
42
|
-
throw BrowserAuthError.createSilentPromptValueError(request.prompt);
|
|
38
|
+
throw createBrowserAuthError(silentPromptValueError);
|
|
43
39
|
}
|
|
44
40
|
// Create silent request
|
|
45
|
-
this.
|
|
46
|
-
const silentRequest = await this.initializeAuthorizationRequest({
|
|
41
|
+
const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)({
|
|
47
42
|
...request,
|
|
48
43
|
prompt: request.prompt || PromptValue.NONE,
|
|
49
44
|
}, InteractionType.Silent);
|
|
@@ -51,18 +46,8 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
51
46
|
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
|
52
47
|
try {
|
|
53
48
|
// Initialize the client
|
|
54
|
-
this.
|
|
55
|
-
|
|
56
|
-
this.logger.verbose("Auth code client created");
|
|
57
|
-
this.performanceClient.setPreQueueTime(PerformanceEvents.SilentIframeClientTokenHelper, request.correlationId);
|
|
58
|
-
return await this.silentTokenHelper(authClient, silentRequest).then((result) => {
|
|
59
|
-
acquireTokenMeasurement.end({
|
|
60
|
-
success: true,
|
|
61
|
-
fromCache: false,
|
|
62
|
-
requestId: result.requestId,
|
|
63
|
-
});
|
|
64
|
-
return result;
|
|
65
|
-
});
|
|
49
|
+
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
50
|
+
return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, request.correlationId)(authClient, silentRequest);
|
|
66
51
|
}
|
|
67
52
|
catch (e) {
|
|
68
53
|
if (e instanceof AuthError) {
|
|
@@ -70,11 +55,6 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
70
55
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
71
56
|
}
|
|
72
57
|
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
73
|
-
acquireTokenMeasurement.end({
|
|
74
|
-
errorCode: (e instanceof AuthError && e.errorCode) || undefined,
|
|
75
|
-
subErrorCode: (e instanceof AuthError && e.subError) || undefined,
|
|
76
|
-
success: false,
|
|
77
|
-
});
|
|
78
58
|
throw e;
|
|
79
59
|
}
|
|
80
60
|
}
|
|
@@ -83,7 +63,7 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
83
63
|
*/
|
|
84
64
|
logout() {
|
|
85
65
|
// Synchronous so we must reject
|
|
86
|
-
return Promise.reject(
|
|
66
|
+
return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
|
|
87
67
|
}
|
|
88
68
|
/**
|
|
89
69
|
* Helper which acquires an authorization code silently using a hidden iframe from given url
|
|
@@ -94,45 +74,38 @@ class SilentIframeClient extends StandardInteractionClient {
|
|
|
94
74
|
async silentTokenHelper(authClient, silentRequest) {
|
|
95
75
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, silentRequest.correlationId);
|
|
96
76
|
// Create auth code request and generate PKCE params
|
|
97
|
-
this.
|
|
98
|
-
const authCodeRequest = await this.initializeAuthorizationCodeRequest(silentRequest);
|
|
77
|
+
const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
|
99
78
|
// Create authorize request url
|
|
100
|
-
|
|
101
|
-
const navigateUrl = await authClient.getAuthCodeUrl({
|
|
79
|
+
const navigateUrl = await invokeAsync(authClient.getAuthCodeUrl.bind(authClient), PerformanceEvents.GetAuthCodeUrl, this.logger, this.performanceClient, silentRequest.correlationId)({
|
|
102
80
|
...silentRequest,
|
|
103
81
|
nativeBroker: NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
|
|
104
82
|
});
|
|
105
83
|
// Create silent handler
|
|
106
84
|
const silentHandler = new SilentHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.config.system, this.performanceClient);
|
|
107
85
|
// Get the frame handle for the silent request
|
|
108
|
-
|
|
109
|
-
const msalFrame = await silentHandler.initiateAuthRequest(navigateUrl);
|
|
86
|
+
const msalFrame = await invokeAsync(silentHandler.initiateAuthRequest.bind(silentHandler), PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, silentRequest.correlationId)(navigateUrl);
|
|
110
87
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
111
|
-
|
|
112
|
-
const hash = await silentHandler.monitorIframeForHash(msalFrame, this.config.system.iframeHashTimeout);
|
|
88
|
+
const hash = await invokeAsync(silentHandler.monitorIframeForHash.bind(silentHandler), PerformanceEvents.SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, silentRequest.correlationId)(msalFrame, this.config.system.iframeHashTimeout);
|
|
113
89
|
// Deserialize hash fragment response parameters.
|
|
114
90
|
const serverParams = UrlString.getDeserializedHash(hash);
|
|
115
91
|
const state = this.validateAndExtractStateFromHash(serverParams, InteractionType.Silent, authCodeRequest.correlationId);
|
|
116
92
|
if (serverParams.accountId) {
|
|
117
93
|
this.logger.verbose("Account id found in hash, calling WAM for token");
|
|
118
94
|
if (!this.nativeMessageHandler) {
|
|
119
|
-
throw
|
|
95
|
+
throw createBrowserAuthError(nativeConnectionNotEstablished);
|
|
120
96
|
}
|
|
121
97
|
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, this.correlationId);
|
|
122
98
|
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);
|
|
123
|
-
return nativeInteractionClient
|
|
124
|
-
.acquireToken({
|
|
99
|
+
return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), PerformanceEvents.NativeInteractionClientAcquireToken, this.logger, this.performanceClient, silentRequest.correlationId)({
|
|
125
100
|
...silentRequest,
|
|
126
101
|
state: userRequestState,
|
|
127
102
|
prompt: silentRequest.prompt || PromptValue.NONE,
|
|
128
|
-
})
|
|
129
|
-
.finally(() => {
|
|
103
|
+
}).finally(() => {
|
|
130
104
|
this.browserStorage.cleanRequestByState(state);
|
|
131
105
|
});
|
|
132
106
|
}
|
|
133
107
|
// Handle response from hash string
|
|
134
|
-
|
|
135
|
-
return silentHandler.handleCodeResponseFromHash(hash, state, authClient.authority, this.networkClient);
|
|
108
|
+
return invokeAsync(silentHandler.handleCodeResponseFromHash.bind(silentHandler), PerformanceEvents.HandleCodeResponseFromHash, this.logger, this.performanceClient, silentRequest.correlationId)(hash, state, authClient.authority, this.networkClient);
|
|
136
109
|
}
|
|
137
110
|
}
|
|
138
111
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SilentIframeClient.mjs","sources":["../../src/interaction_client/SilentIframeClient.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SilentIframeClient.mjs","sources":["../../src/interaction_client/SilentIframeClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAKA;AAeA;AACA;AACA;AAea,MAAA,kBAAA,kCAAoD,CAAA;AAC7D,IAAA,WAAU,CAAA,MAAO,EAAA,WAAM,EAAA,aAAA,EAAA,MAAA,EAAA,YAAA,EAAA,gBAAA,EAAA,KAAA,EAAA,iBAAA,EAAA,iBAAA,EAAA,oBAAA,EAAA,aAAA,EAAA;AACvB,QAAA,KAAS,CAAC,MAAA,EAAA,WAAe,EAAA,aAAmB,EAAC,MAAA,EAAA,YAAA,EAAA,gBAAA,EAAA,iBAAA,EAAA,oBAAA,EAAA,aAAA,CAAA,CAAA;AAGzC,QAAA,IAAA,CAAA,KAAA,GAAA,KAA4B,CAAA;AA2BhC,QAAA,IAAA,CAAA,aAAA,GAAA,iBAAA,CAAA;;;AAGG;;AAuFH;;AAEG,QAAA,IAAA,CAAA,iBAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,8BAAA,EAAA,OAAA,CAAA,aAAA,CAAA,CAAA;AACH;AASA,QAAA,IAAA,CAAA,OAAA,CAAA,SAAA;;;;;AAKG;AACa,QAAA,IAAA,OAAA,CAAA,MAAA;AA2HnB,YAAA,OAAA,CAAA,MAAA,KAAA,WAAA,CAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SilentRefreshClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/SilentRefreshClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAElB,iBAAiB,
|
|
1
|
+
{"version":3,"file":"SilentRefreshClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/SilentRefreshClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAElB,iBAAiB,EAGpB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,qBAAa,mBAAoB,SAAQ,yBAAyB;IAC9D;;;OAGG;IACG,YAAY,CACd,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,CAAC;IAwDhC;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IASvB;;;;OAIG;cACa,wBAAwB,CACpC,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,CAAC,EAAE,MAAM,EACrB,iBAAiB,CAAC,EAAE,iBAAiB,GACtC,OAAO,CAAC,kBAAkB,CAAC;CAWjC"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0
|
|
1
|
+
/*! @azure/msal-browser v3.2.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
3
|
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
|
4
|
-
import { PerformanceEvents, RefreshTokenClient } from '@azure/msal-common';
|
|
4
|
+
import { PerformanceEvents, invokeAsync, RefreshTokenClient } from '@azure/msal-common';
|
|
5
5
|
import { ApiId } from '../utils/BrowserConstants.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
7
|
+
import { silentLogoutUnsupported } from '../error/BrowserAuthErrorCodes.mjs';
|
|
7
8
|
|
|
8
9
|
/*
|
|
9
10
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -16,36 +17,27 @@ class SilentRefreshClient extends StandardInteractionClient {
|
|
|
16
17
|
*/
|
|
17
18
|
async acquireToken(request) {
|
|
18
19
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
|
19
|
-
this.
|
|
20
|
+
const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, request.account);
|
|
20
21
|
const silentRequest = {
|
|
21
22
|
...request,
|
|
22
|
-
...
|
|
23
|
+
...baseRequest,
|
|
23
24
|
};
|
|
24
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
|
|
25
25
|
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
|
26
26
|
const refreshTokenClient = await this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions);
|
|
27
27
|
this.logger.verbose("Refresh token client created");
|
|
28
28
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
29
|
-
|
|
30
|
-
return refreshTokenClient
|
|
31
|
-
.acquireTokenByRefreshToken(silentRequest)
|
|
29
|
+
return invokeAsync(refreshTokenClient.acquireTokenByRefreshToken.bind(refreshTokenClient), PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, this.logger, this.performanceClient, request.correlationId)(silentRequest)
|
|
32
30
|
.then((result) => result)
|
|
33
31
|
.then((result) => {
|
|
34
|
-
|
|
35
|
-
success: true,
|
|
32
|
+
this.performanceClient.addFields({
|
|
36
33
|
fromCache: result.fromCache,
|
|
37
34
|
requestId: result.requestId,
|
|
38
|
-
});
|
|
35
|
+
}, request.correlationId);
|
|
39
36
|
return result;
|
|
40
37
|
})
|
|
41
38
|
.catch((e) => {
|
|
42
39
|
e.setCorrelationId(this.correlationId);
|
|
43
40
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
44
|
-
acquireTokenMeasurement.end({
|
|
45
|
-
errorCode: e.errorCode,
|
|
46
|
-
subErrorCode: e.subError,
|
|
47
|
-
success: false,
|
|
48
|
-
});
|
|
49
41
|
throw e;
|
|
50
42
|
});
|
|
51
43
|
}
|
|
@@ -54,7 +46,7 @@ class SilentRefreshClient extends StandardInteractionClient {
|
|
|
54
46
|
*/
|
|
55
47
|
logout() {
|
|
56
48
|
// Synchronous so we must reject
|
|
57
|
-
return Promise.reject(
|
|
49
|
+
return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
|
|
58
50
|
}
|
|
59
51
|
/**
|
|
60
52
|
* Creates a Refresh Client with the given authority, or the default authority.
|
|
@@ -63,8 +55,7 @@ class SilentRefreshClient extends StandardInteractionClient {
|
|
|
63
55
|
*/
|
|
64
56
|
async createRefreshTokenClient(serverTelemetryManager, authorityUrl, azureCloudOptions) {
|
|
65
57
|
// Create auth module.
|
|
66
|
-
this.
|
|
67
|
-
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
58
|
+
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
68
59
|
return new RefreshTokenClient(clientConfig, this.performanceClient);
|
|
69
60
|
}
|
|
70
61
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SilentRefreshClient.mjs","sources":["../../src/interaction_client/SilentRefreshClient.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SilentRefreshClient.mjs","sources":["../../src/interaction_client/SilentRefreshClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;AAKA;AACA;AAcA;AAEA;AAKsB,MAAA,mBACL,SAAA;AAyDb;;AAEG;AACH;AASA,IAAA,MAAA,YAAA,CAAA,OAAA,EAAA;;;;AAIG,YAAA,GAAA,OAAA;AACa,YAAA,GAAA,WAAA;AAenB,SAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/StandardInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAE9B,uBAAuB,EACvB,mBAAmB,EAEnB,SAAS,EAET,+BAA+B,EAE/B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"StandardInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/StandardInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAE9B,uBAAuB,EACvB,mBAAmB,EAEnB,SAAS,EAET,+BAA+B,EAE/B,uBAAuB,EAIvB,WAAW,EACX,iBAAiB,EAIpB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAAoB,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAU9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAI/D;;GAEG;AACH,8BAAsB,yBAA0B,SAAQ,qBAAqB;IACzE;;;OAGG;cACa,kCAAkC,CAC9C,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,8BAA8B,CAAC;IA0B1C;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAC7B,aAAa,CAAC,EAAE,iBAAiB,GAClC,uBAAuB;IA+F1B;;;;OAIG;IACH,SAAS,CAAC,8BAA8B,CACpC,OAAO,EAAE,WAAW,GACrB,MAAM,GAAG,IAAI;IAmBhB;;;;OAIG;cACa,oBAAoB,CAChC,sBAAsB,EAAE,sBAAsB,EAC9C,YAAY,CAAC,EAAE,MAAM,EACrB,wBAAwB,CAAC,EAAE,iBAAiB,GAC7C,OAAO,CAAC,uBAAuB,CAAC;IAmBnC;;;;;OAKG;cACa,sBAAsB,CAClC,sBAAsB,EAAE,sBAAsB,EAC9C,gBAAgB,CAAC,EAAE,MAAM,EACzB,wBAAwB,CAAC,EAAE,iBAAiB,GAC7C,OAAO,CAAC,mBAAmB,CAAC;IAiD/B;;;OAGG;IACH,SAAS,CAAC,+BAA+B,CACrC,YAAY,EAAE,+BAA+B,EAC7C,eAAe,EAAE,eAAe,EAChC,oBAAoB,CAAC,EAAE,MAAM,GAC9B,MAAM;IA8BT;;;;OAIG;cACa,sBAAsB,CAClC,gBAAgB,CAAC,EAAE,MAAM,EACzB,wBAAwB,CAAC,EAAE,iBAAiB,GAC7C,OAAO,CAAC,SAAS,CAAC;IA0CrB;;;;OAIG;cACa,8BAA8B,CAC1C,OAAO,EAAE,eAAe,GAAG,YAAY,GAAG,gBAAgB,EAC1D,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC,uBAAuB,CAAC;CAyDtC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0
|
|
1
|
+
/*! @azure/msal-browser v3.2.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import { PerformanceEvents, Constants, UrlString, AuthorizationCodeClient, Authority, AuthorityFactory, ProtocolUtils
|
|
3
|
+
import { PerformanceEvents, invokeAsync, Constants, UrlString, AuthorizationCodeClient, Authority, AuthorityFactory, ProtocolUtils } from '@azure/msal-common';
|
|
4
4
|
import { BaseInteractionClient } from './BaseInteractionClient.mjs';
|
|
5
5
|
import { BrowserConstants } from '../utils/BrowserConstants.mjs';
|
|
6
6
|
import { version } from '../packageMetadata.mjs';
|
|
7
|
-
import {
|
|
7
|
+
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
8
8
|
import { BrowserProtocolUtils } from '../utils/BrowserProtocolUtils.mjs';
|
|
9
9
|
import { BrowserUtils } from '../utils/BrowserUtils.mjs';
|
|
10
|
+
import { generatePkceCodes } from '../crypto/PkceGenerator.mjs';
|
|
11
|
+
import { createNewGuid } from '../crypto/BrowserCrypto.mjs';
|
|
12
|
+
import { noStateInHash, unableToParseState, stateInteractionTypeMismatch } from '../error/BrowserAuthErrorCodes.mjs';
|
|
10
13
|
|
|
11
14
|
/*
|
|
12
15
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -22,8 +25,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
22
25
|
*/
|
|
23
26
|
async initializeAuthorizationCodeRequest(request) {
|
|
24
27
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, request.correlationId);
|
|
25
|
-
this.logger.
|
|
26
|
-
const generatedPkceParams = await this.browserCrypto.generatePkceCodes();
|
|
28
|
+
const generatedPkceParams = await invokeAsync(generatePkceCodes, PerformanceEvents.GeneratePkceCodes, this.logger, this.performanceClient, this.correlationId)(this.performanceClient, this.logger, this.correlationId);
|
|
27
29
|
const authCodeRequest = {
|
|
28
30
|
...request,
|
|
29
31
|
redirectUri: request.redirectUri,
|
|
@@ -41,7 +43,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
41
43
|
initializeLogoutRequest(logoutRequest) {
|
|
42
44
|
this.logger.verbose("initializeLogoutRequest called", logoutRequest?.correlationId);
|
|
43
45
|
const validLogoutRequest = {
|
|
44
|
-
correlationId: this.correlationId ||
|
|
46
|
+
correlationId: this.correlationId || createNewGuid(),
|
|
45
47
|
...logoutRequest,
|
|
46
48
|
};
|
|
47
49
|
/**
|
|
@@ -126,8 +128,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
126
128
|
async createAuthCodeClient(serverTelemetryManager, authorityUrl, requestAzureCloudOptions) {
|
|
127
129
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);
|
|
128
130
|
// Create auth module.
|
|
129
|
-
this.
|
|
130
|
-
const clientConfig = await this.getClientConfiguration(serverTelemetryManager, authorityUrl, requestAzureCloudOptions);
|
|
131
|
+
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(serverTelemetryManager, authorityUrl, requestAzureCloudOptions);
|
|
131
132
|
return new AuthorizationCodeClient(clientConfig, this.performanceClient);
|
|
132
133
|
}
|
|
133
134
|
/**
|
|
@@ -138,9 +139,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
138
139
|
*/
|
|
139
140
|
async getClientConfiguration(serverTelemetryManager, requestAuthority, requestAzureCloudOptions) {
|
|
140
141
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
|
141
|
-
this.
|
|
142
|
-
this.performanceClient.setPreQueueTime(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
143
|
-
const discoveredAuthority = await this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions);
|
|
142
|
+
const discoveredAuthority = await invokeAsync(this.getDiscoveredAuthority.bind(this), PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, this.correlationId)(requestAuthority, requestAzureCloudOptions);
|
|
144
143
|
const logger = this.config.system.loggerOptions;
|
|
145
144
|
return {
|
|
146
145
|
authOptions: {
|
|
@@ -181,14 +180,14 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
181
180
|
validateAndExtractStateFromHash(serverParams, interactionType, requestCorrelationId) {
|
|
182
181
|
this.logger.verbose("validateAndExtractStateFromHash called", requestCorrelationId);
|
|
183
182
|
if (!serverParams.state) {
|
|
184
|
-
throw
|
|
183
|
+
throw createBrowserAuthError(noStateInHash);
|
|
185
184
|
}
|
|
186
185
|
const platformStateObj = BrowserProtocolUtils.extractBrowserRequestState(this.browserCrypto, serverParams.state);
|
|
187
186
|
if (!platformStateObj) {
|
|
188
|
-
throw
|
|
187
|
+
throw createBrowserAuthError(unableToParseState);
|
|
189
188
|
}
|
|
190
189
|
if (platformStateObj.interactionType !== interactionType) {
|
|
191
|
-
throw
|
|
190
|
+
throw createBrowserAuthError(stateInteractionTypeMismatch);
|
|
192
191
|
}
|
|
193
192
|
this.logger.verbose("Returning state from hash", requestCorrelationId);
|
|
194
193
|
return serverParams.state;
|
|
@@ -200,8 +199,6 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
200
199
|
*/
|
|
201
200
|
async getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions) {
|
|
202
201
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
203
|
-
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
|
|
204
|
-
const getAuthorityMeasurement = this.performanceClient?.startMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
|
205
202
|
const authorityOptions = {
|
|
206
203
|
protocolMode: this.config.auth.protocolMode,
|
|
207
204
|
OIDCOptions: this.config.auth.OIDCOptions,
|
|
@@ -216,23 +213,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
216
213
|
: this.config.auth.authority;
|
|
217
214
|
// fall back to the authority from config
|
|
218
215
|
const builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
|
|
219
|
-
this.logger.
|
|
220
|
-
this.performanceClient.setPreQueueTime(PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.correlationId);
|
|
221
|
-
return await AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId)
|
|
222
|
-
.then((result) => {
|
|
223
|
-
getAuthorityMeasurement.end({
|
|
224
|
-
success: true,
|
|
225
|
-
});
|
|
226
|
-
return result;
|
|
227
|
-
})
|
|
228
|
-
.catch((error) => {
|
|
229
|
-
getAuthorityMeasurement.end({
|
|
230
|
-
errorCode: error.errorCode,
|
|
231
|
-
subErrorCode: error.subError,
|
|
232
|
-
success: false,
|
|
233
|
-
});
|
|
234
|
-
throw error;
|
|
235
|
-
});
|
|
216
|
+
return await invokeAsync(AuthorityFactory.createDiscoveredInstance.bind(AuthorityFactory), PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.logger, this.performanceClient, this.correlationId)(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.performanceClient, this.correlationId);
|
|
236
217
|
}
|
|
237
218
|
/**
|
|
238
219
|
* Helper to initialize required request parameters for interactive APIs and ssoSilent()
|
|
@@ -241,18 +222,17 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
241
222
|
*/
|
|
242
223
|
async initializeAuthorizationRequest(request, interactionType) {
|
|
243
224
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.correlationId);
|
|
244
|
-
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
|
|
245
225
|
const redirectUri = this.getRedirectUri(request.redirectUri);
|
|
246
226
|
const browserState = {
|
|
247
227
|
interactionType: interactionType,
|
|
248
228
|
};
|
|
249
229
|
const state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
|
250
|
-
this.
|
|
230
|
+
const baseRequest = await invokeAsync(this.initializeBaseRequest.bind(this), PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)(request);
|
|
251
231
|
const validatedRequest = {
|
|
252
|
-
...
|
|
232
|
+
...baseRequest,
|
|
253
233
|
redirectUri: redirectUri,
|
|
254
234
|
state: state,
|
|
255
|
-
nonce: request.nonce ||
|
|
235
|
+
nonce: request.nonce || createNewGuid(),
|
|
256
236
|
responseMode: this.config.auth.OIDCOptions
|
|
257
237
|
.serverResponseType,
|
|
258
238
|
};
|
|
@@ -263,7 +243,7 @@ class StandardInteractionClient extends BaseInteractionClient {
|
|
|
263
243
|
validatedRequest.account = account;
|
|
264
244
|
}
|
|
265
245
|
// Check for ADAL/MSAL v1 SSO
|
|
266
|
-
if (
|
|
246
|
+
if (!validatedRequest.loginHint && !account) {
|
|
267
247
|
const legacyLoginHint = this.browserStorage.getLegacyLoginHint();
|
|
268
248
|
if (legacyLoginHint) {
|
|
269
249
|
validatedRequest.loginHint = legacyLoginHint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StandardInteractionClient.mjs","sources":["../../src/interaction_client/StandardInteractionClient.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StandardInteractionClient.mjs","sources":["../../src/interaction_client/StandardInteractionClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AAKA;AAqBA;AACA;AACA;;;AAyBO;+BAC+C,SAAA,qBACrC,CAAA;AA2Bb;;;AAGG;IACH,MAAS,kCACL,CAAA,OAAc,EAAE;AAgGpB,QAAA,IAAA,CAAA,iBAAA,CAAA,mBAAA,CAAA,iBAAA,CAAA,2DAAA,EAAA,OAAA,CAAA,aAAA,CAAA,CAAA;;;;AAIG,YAAA,WAAA,EAAA,OAAA,CAAA,WAAA;YACM;AAqBT,YAAA,YAAA,EAAA,mBAAA,CAAA,QAAA;;;;AAIG,QAAA,OAAA,eAAA,CAAA;AACa,KAAA;AAuBhB;;;;;AAKG,QAAA,IAAA,CAAA,MAAA,CAAA,OAAA,CAAA,gCAAA,EAAA,aAAA,EAAA,aAAA,CAAA,CAAA;AACa,QAAA,MAAA,kBAAA,GAAA;AAqDhB,YAAA,aAAA,EAAA,IAAA,CAAA,aAAA,IAAA,aAAA,EAAA;;;AAGG;AACH;AAkCA;;;;AAIG,YAAA,IAAA,CAAA,aAAA,CAAA,UAAA,EAAA;AACa,gBAAA,IAAA,aAAA,CAAA,OACZ,EAAA;AA4CJ,oBAAA,MAAA,UAAA,GAAA,IAAA,CAAA,8BAAA,CAAA,aAAA,CAAA,OAAA,CAAA,CAAA;;;;AAIG,qBAAA;AACa,iBAAA;AA4DnB,qBAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionHandler.d.ts","sourceRoot":"","sources":["../../src/interaction_handler/InteractionHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,wBAAwB,
|
|
1
|
+
{"version":3,"file":"InteractionHandler.d.ts","sourceRoot":"","sources":["../../src/interaction_handler/InteractionHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,wBAAwB,EACxB,8BAA8B,EAC9B,uBAAuB,EAEvB,SAAS,EACT,cAAc,EACd,aAAa,EACb,MAAM,EAEN,kBAAkB,EAKrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAMnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAEnC;;GAEG;AACH,qBAAa,kBAAkB;IAC3B,SAAS,CAAC,UAAU,EAAE,uBAAuB,CAAC;IAC9C,SAAS,CAAC,cAAc,EAAE,mBAAmB,CAAC;IAC9C,SAAS,CAAC,eAAe,EAAE,8BAA8B,CAAC;IAC1D,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,iBAAiB,EAAE,kBAAkB,CAAC;gBAG5C,cAAc,EAAE,uBAAuB,EACvC,WAAW,EAAE,mBAAmB,EAChC,eAAe,EAAE,8BAA8B,EAC/C,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,kBAAkB;IASzC;;;OAGG;IACG,0BAA0B,CAC5B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,cAAc,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IAiDhC;;;;;;;OAOG;IACG,4BAA4B,CAC9B,gBAAgB,EAAE,wBAAwB,EAC1C,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,cAAc,EAC7B,aAAa,GAAE,OAAc,GAC9B,OAAO,CAAC,oBAAoB,CAAC;IAsEhC;;;;;OAKG;cACa,4BAA4B,CACxC,qBAAqB,EAAE,MAAM,EAC7B,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,cAAc,GAC9B,OAAO,CAAC,IAAI,CAAC;IAmBhB;;OAEG;IACH,SAAS,CAAC,mBAAmB,IAAI,aAAa,GAAG,IAAI;CAoBxD"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/*! @azure/msal-browser v3.0
|
|
1
|
+
/*! @azure/msal-browser v3.2.0 2023-10-05 */
|
|
2
2
|
'use strict';
|
|
3
|
-
import { PerformanceEvents,
|
|
4
|
-
import {
|
|
3
|
+
import { PerformanceEvents, createClientAuthError, ClientAuthErrorCodes, ServerError, invokeAsync, AuthorityFactory } from '@azure/msal-common';
|
|
4
|
+
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
|
5
5
|
import { TemporaryCacheKeys } from '../utils/BrowserConstants.mjs';
|
|
6
|
+
import { hashEmptyError, userCancelled } from '../error/BrowserAuthErrorCodes.mjs';
|
|
6
7
|
|
|
7
8
|
/*
|
|
8
9
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
@@ -25,16 +26,15 @@ class InteractionHandler {
|
|
|
25
26
|
*/
|
|
26
27
|
async handleCodeResponseFromHash(locationHash, state, authority, networkModule) {
|
|
27
28
|
this.performanceClient.addQueueMeasurement(PerformanceEvents.HandleCodeResponseFromHash, this.authCodeRequest.correlationId);
|
|
28
|
-
this.logger.verbose("InteractionHandler.handleCodeResponse called");
|
|
29
29
|
// Check that location hash isn't empty.
|
|
30
|
-
if (
|
|
31
|
-
throw
|
|
30
|
+
if (!locationHash) {
|
|
31
|
+
throw createBrowserAuthError(hashEmptyError);
|
|
32
32
|
}
|
|
33
33
|
// Handle code response.
|
|
34
34
|
const stateKey = this.browserStorage.generateStateKey(state);
|
|
35
35
|
const requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
36
36
|
if (!requestState) {
|
|
37
|
-
throw
|
|
37
|
+
throw createClientAuthError(ClientAuthErrorCodes.stateNotFound, "Cached State");
|
|
38
38
|
}
|
|
39
39
|
let authCodeResponse;
|
|
40
40
|
try {
|
|
@@ -42,16 +42,15 @@ class InteractionHandler {
|
|
|
42
42
|
}
|
|
43
43
|
catch (e) {
|
|
44
44
|
if (e instanceof ServerError &&
|
|
45
|
-
e.subError ===
|
|
45
|
+
e.subError === userCancelled) {
|
|
46
46
|
// Translate server error caused by user closing native prompt to corresponding first class MSAL error
|
|
47
|
-
throw
|
|
47
|
+
throw createBrowserAuthError(userCancelled);
|
|
48
48
|
}
|
|
49
49
|
else {
|
|
50
50
|
throw e;
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
|
-
this.
|
|
54
|
-
return this.handleCodeResponseFromServer(authCodeResponse, state, authority, networkModule);
|
|
53
|
+
return invokeAsync(this.handleCodeResponseFromServer.bind(this), PerformanceEvents.HandleCodeResponseFromServer, this.logger, this.performanceClient, this.authCodeRequest.correlationId)(authCodeResponse, state, authority, networkModule);
|
|
55
54
|
}
|
|
56
55
|
/**
|
|
57
56
|
* Process auth code response from AAD
|
|
@@ -68,7 +67,7 @@ class InteractionHandler {
|
|
|
68
67
|
const stateKey = this.browserStorage.generateStateKey(state);
|
|
69
68
|
const requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
70
69
|
if (!requestState) {
|
|
71
|
-
throw
|
|
70
|
+
throw createClientAuthError(ClientAuthErrorCodes.stateNotFound, "Cached State");
|
|
72
71
|
}
|
|
73
72
|
// Get cached items
|
|
74
73
|
const nonceKey = this.browserStorage.generateNonceKey(requestState);
|
|
@@ -77,8 +76,7 @@ class InteractionHandler {
|
|
|
77
76
|
this.authCodeRequest.code = authCodeResponse.code;
|
|
78
77
|
// Check for new cloud instance
|
|
79
78
|
if (authCodeResponse.cloud_instance_host_name) {
|
|
80
|
-
this.
|
|
81
|
-
await this.updateTokenEndpointAuthority(authCodeResponse.cloud_instance_host_name, authority, networkModule);
|
|
79
|
+
await invokeAsync(this.updateTokenEndpointAuthority.bind(this), PerformanceEvents.UpdateTokenEndpointAuthority, this.logger, this.performanceClient, this.authCodeRequest.correlationId)(authCodeResponse.cloud_instance_host_name, authority, networkModule);
|
|
82
80
|
}
|
|
83
81
|
// Nonce validation not needed when redirect not involved (e.g. hybrid spa, renewing token via rt)
|
|
84
82
|
if (validateNonce) {
|
|
@@ -96,8 +94,7 @@ class InteractionHandler {
|
|
|
96
94
|
}
|
|
97
95
|
}
|
|
98
96
|
// Acquire token with retrieved code.
|
|
99
|
-
this.
|
|
100
|
-
const tokenResponse = (await this.authModule.acquireToken(this.authCodeRequest, authCodeResponse));
|
|
97
|
+
const tokenResponse = (await invokeAsync(this.authModule.acquireToken.bind(this.authModule), PerformanceEvents.AuthClientAcquireToken, this.logger, this.performanceClient, this.authCodeRequest.correlationId)(this.authCodeRequest, authCodeResponse));
|
|
101
98
|
this.browserStorage.cleanRequestByState(state);
|
|
102
99
|
return tokenResponse;
|
|
103
100
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InteractionHandler.mjs","sources":["../../src/interaction_handler/InteractionHandler.ts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"InteractionHandler.mjs","sources":["../../src/interaction_handler/InteractionHandler.ts"],"sourcesContent":[null],"names":["BrowserAuthErrorCodes.hashEmptyError"],"mappings":";;;;;;;AAKA;AAiBA;AAMA;AAEA;AAKA;AACI;AACA;AACA,MAAS,kBAAkB,CAAA;AAC3B,IAAA,WAAU,CAAA,cAAe,EAAA,WAAA,EAAA,eAAA,EAAA,MAAA,EAAA,iBAAA,EAAA;AACzB,QAAA,IAAA,CAAS,UAAC,GAAA,cAAmB,CAAA;AAGzB,QAAA,IAAA,CAAA,cAAA,GAAc,WAAyB,CAAA;AAa3C,QAAA,IAAA,CAAA,eAAA,GAAA,eAAA,CAAA;;;AAGG,KAAA;;AAuDH;;;;;;;AAOG,YAAA,MAAA,sBAAA,CAAAA,cAAA,CAAA,CAAA;SAC+B;AA4ElC;;;;;AAKG,SAAA;AACa,QAAA,IAAA,gBAAA,CAAA;AAuBhB,QAAA,IAAA;;AAEG,SAAA;AACH,QAAA,OAAU,CAAA,EAAA;AAoBb,YAAA,IAAA,CAAA,YAAA,WAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RedirectHandler.d.ts","sourceRoot":"","sources":["../../src/interaction_handler/RedirectHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,uBAAuB,
|
|
1
|
+
{"version":3,"file":"RedirectHandler.d.ts","sourceRoot":"","sources":["../../src/interaction_handler/RedirectHandler.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,uBAAuB,EACvB,8BAA8B,EAC9B,OAAO,EACP,SAAS,EACT,cAAc,EACd,MAAM,EAEN,kBAAkB,EAGrB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AAExE,MAAM,MAAM,cAAc,GAAG,iBAAiB,GAAG;IAC7C,gBAAgB,EAAE,iBAAiB,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC;CACxD,CAAC;AAEF,qBAAa,eAAgB,SAAQ,kBAAkB;IACnD,OAAO,CAAC,aAAa,CAAU;gBAG3B,cAAc,EAAE,uBAAuB,EACvC,WAAW,EAAE,mBAAmB,EAChC,eAAe,EAAE,8BAA8B,EAC/C,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,OAAO,EACtB,iBAAiB,EAAE,kBAAkB;IAYzC;;;OAGG;IACG,mBAAmB,CACrB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,cAAc,GACvB,OAAO,CAAC,IAAI,CAAC;IA6EhB;;;OAGG;IACG,0BAA0B,CAC5B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,EACpB,aAAa,EAAE,cAAc,GAC9B,OAAO,CAAC,oBAAoB,CAAC;CA+EnC"}
|