@azure/msal-browser 3.1.0 → 3.3.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.map +1 -1
- package/dist/app/IPublicClientApplication.mjs +20 -19
- package/dist/app/IPublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientApplication.d.ts +14 -6
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +18 -8
- package/dist/app/PublicClientApplication.mjs.map +1 -1
- package/dist/app/PublicClientNext.d.ts +274 -0
- package/dist/app/PublicClientNext.d.ts.map +1 -0
- package/dist/app/PublicClientNext.mjs +362 -0
- package/dist/app/PublicClientNext.mjs.map +1 -0
- 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 +13 -13
- 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 +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +4 -15
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +13 -69
- 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/DatabaseStorage.mjs +1 -1
- package/dist/cache/MemoryStorage.mjs +1 -1
- package/dist/cache/TokenCache.mjs +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +8 -7
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.d.ts +2 -1
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +26 -19
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +3 -2
- package/dist/controllers/IController.d.ts.map +1 -1
- package/dist/controllers/NestedAppAuthController.d.ts +96 -0
- package/dist/controllers/NestedAppAuthController.d.ts.map +1 -0
- package/dist/controllers/NestedAppAuthController.mjs +345 -0
- package/dist/controllers/NestedAppAuthController.mjs.map +1 -0
- package/dist/controllers/StandardController.d.ts +11 -6
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +67 -45
- package/dist/controllers/StandardController.mjs.map +1 -1
- package/dist/controllers/UnknownOperatingContextController.d.ts +88 -0
- package/dist/controllers/UnknownOperatingContextController.d.ts.map +1 -0
- package/dist/controllers/UnknownOperatingContextController.mjs +275 -0
- package/dist/controllers/UnknownOperatingContextController.mjs.map +1 -0
- package/dist/crypto/BrowserCrypto.d.ts +44 -49
- package/dist/crypto/BrowserCrypto.d.ts.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +77 -77
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts +1 -7
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +18 -23
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.d.ts +6 -21
- package/dist/crypto/PkceGenerator.d.ts.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +45 -46
- package/dist/crypto/PkceGenerator.mjs.map +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.d.ts.map +1 -1
- package/dist/encode/Base64Decode.mjs +18 -2
- package/dist/encode/Base64Decode.mjs.map +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.d.ts +10 -1
- package/dist/error/BrowserAuthError.d.ts.map +1 -1
- package/dist/error/BrowserAuthError.mjs +12 -3
- package/dist/error/BrowserAuthError.mjs.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.d.ts +1 -0
- package/dist/error/BrowserAuthErrorCodes.d.ts.map +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +3 -2
- package/dist/error/BrowserAuthErrorCodes.mjs.map +1 -1
- 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 +47 -78
- 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/error/NestedAppAuthError.d.ts +15 -0
- package/dist/error/NestedAppAuthError.d.ts.map +1 -0
- package/dist/error/NestedAppAuthError.mjs +30 -0
- package/dist/error/NestedAppAuthError.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/EventType.mjs +1 -1
- package/dist/index.d.ts +5 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +7 -3
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +10 -11
- package/dist/interaction_client/BaseInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +26 -13
- 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 +5 -4
- package/dist/interaction_client/PopupClient.mjs.map +1 -1
- package/dist/interaction_client/RedirectClient.mjs +7 -7
- package/dist/interaction_client/SilentAuthCodeClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentAuthCodeClient.mjs +7 -10
- package/dist/interaction_client/SilentAuthCodeClient.mjs.map +1 -1
- package/dist/interaction_client/SilentCacheClient.d.ts.map +1 -1
- package/dist/interaction_client/SilentCacheClient.mjs +11 -18
- 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 +27 -13
- 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 +8 -18
- 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 +16 -37
- 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 +6 -9
- 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 +3 -3
- package/dist/interaction_handler/RedirectHandler.mjs.map +1 -1
- package/dist/interaction_handler/SilentHandler.d.ts +13 -47
- package/dist/interaction_handler/SilentHandler.d.ts.map +1 -1
- package/dist/interaction_handler/SilentHandler.mjs +120 -156
- package/dist/interaction_handler/SilentHandler.mjs.map +1 -1
- package/dist/naa/AccountInfo.d.ts +13 -0
- package/dist/naa/AccountInfo.d.ts.map +1 -0
- package/dist/naa/AccountRequests.d.ts +10 -0
- package/dist/naa/AccountRequests.d.ts.map +1 -0
- package/dist/naa/AuthBridge.d.ts +6 -0
- package/dist/naa/AuthBridge.d.ts.map +1 -0
- package/dist/naa/BridgeCapabilities.d.ts +4 -0
- package/dist/naa/BridgeCapabilities.d.ts.map +1 -0
- package/dist/naa/BridgeError.d.ts +10 -0
- package/dist/naa/BridgeError.d.ts.map +1 -0
- package/dist/naa/BridgeError.mjs +12 -0
- package/dist/naa/BridgeError.mjs.map +1 -0
- package/dist/naa/BridgeProxy.d.ts +72 -0
- package/dist/naa/BridgeProxy.d.ts.map +1 -0
- package/dist/naa/BridgeProxy.mjs +154 -0
- package/dist/naa/BridgeProxy.mjs.map +1 -0
- package/dist/naa/BridgeRequest.d.ts +7 -0
- package/dist/naa/BridgeRequest.d.ts.map +1 -0
- package/dist/naa/BridgeRequestEnvelope.d.ts +14 -0
- package/dist/naa/BridgeRequestEnvelope.d.ts.map +1 -0
- package/dist/naa/BridgeResponseEnvelope.d.ts +11 -0
- package/dist/naa/BridgeResponseEnvelope.d.ts.map +1 -0
- package/dist/naa/BridgeStatusCode.d.ts +11 -0
- package/dist/naa/BridgeStatusCode.d.ts.map +1 -0
- package/dist/naa/BridgeStatusCode.mjs +20 -0
- package/dist/naa/BridgeStatusCode.mjs.map +1 -0
- package/dist/naa/IBridgeProxy.d.ts +11 -0
- package/dist/naa/IBridgeProxy.d.ts.map +1 -0
- package/dist/naa/InitializeBridgeResponse.d.ts +7 -0
- package/dist/naa/InitializeBridgeResponse.d.ts.map +1 -0
- package/dist/naa/TokenRequest.d.ts +22 -0
- package/dist/naa/TokenRequest.d.ts.map +1 -0
- package/dist/naa/TokenResponse.d.ts +17 -0
- package/dist/naa/TokenResponse.d.ts.map +1 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts +26 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.d.ts.map +1 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs +178 -0
- package/dist/naa/mapping/NestedAppAuthAdapter.mjs.map +1 -0
- package/dist/navigation/NavigationClient.mjs +1 -1
- package/dist/network/FetchClient.mjs +1 -1
- package/dist/operatingcontext/BaseOperatingContext.mjs +1 -1
- package/dist/operatingcontext/StandardOperatingContext.mjs +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts +7 -0
- package/dist/operatingcontext/TeamsAppOperatingContext.d.ts.map +1 -1
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs +45 -4
- package/dist/operatingcontext/TeamsAppOperatingContext.mjs.map +1 -1
- package/dist/operatingcontext/UnknownOperatingContext.d.ts +26 -0
- package/dist/operatingcontext/UnknownOperatingContext.d.ts.map +1 -0
- package/dist/operatingcontext/UnknownOperatingContext.mjs +49 -0
- package/dist/operatingcontext/UnknownOperatingContext.mjs.map +1 -0
- package/dist/packageMetadata.d.ts +1 -1
- package/dist/packageMetadata.mjs +2 -2
- package/dist/telemetry/BrowserPerformanceClient.mjs +1 -1
- package/dist/telemetry/BrowserPerformanceMeasurement.mjs +1 -1
- package/dist/utils/BrowserConstants.mjs +1 -1
- package/dist/utils/BrowserProtocolUtils.d.ts.map +1 -1
- package/dist/utils/BrowserProtocolUtils.mjs +3 -3
- package/dist/utils/BrowserProtocolUtils.mjs.map +1 -1
- package/dist/utils/BrowserUtils.d.ts +54 -53
- package/dist/utils/BrowserUtils.d.ts.map +1 -1
- package/dist/utils/BrowserUtils.mjs +114 -102
- package/dist/utils/BrowserUtils.mjs.map +1 -1
- package/lib/msal-browser.cjs +61 -18042
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +13593 -12505
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +66 -65
- package/package.json +2 -2
- package/src/app/IPublicClientApplication.ts +55 -18
- package/src/app/PublicClientApplication.ts +19 -7
- package/src/app/PublicClientNext.ts +442 -0
- package/src/broker/nativeBroker/NativeMessageHandler.ts +12 -15
- package/src/broker/nativeBroker/NativeStatusCodes.ts +13 -0
- package/src/cache/BrowserCacheManager.ts +29 -103
- package/src/cache/BrowserStorage.ts +9 -11
- package/src/config/Configuration.ts +21 -8
- package/src/controllers/ControllerFactory.ts +36 -25
- package/src/controllers/IController.ts +4 -1
- package/src/controllers/NestedAppAuthController.ts +525 -0
- package/src/controllers/StandardController.ts +163 -98
- package/src/controllers/UnknownOperatingContextController.ts +383 -0
- package/src/crypto/BrowserCrypto.ts +119 -103
- package/src/crypto/CryptoOps.ts +18 -27
- package/src/crypto/PkceGenerator.ts +93 -54
- package/src/encode/Base64Decode.ts +21 -1
- package/src/error/BrowserAuthError.ts +13 -1
- package/src/error/BrowserAuthErrorCodes.ts +1 -0
- package/src/error/BrowserConfigurationAuthError.ts +33 -102
- package/src/error/BrowserConfigurationAuthErrorCodes.ts +9 -0
- package/src/error/NativeAuthError.ts +73 -101
- package/src/error/NativeAuthErrorCodes.ts +7 -0
- package/src/error/NestedAppAuthError.ts +32 -0
- package/src/event/EventHandler.ts +2 -1
- package/src/index.ts +8 -10
- package/src/interaction_client/BaseInteractionClient.ts +14 -8
- package/src/interaction_client/NativeInteractionClient.ts +48 -14
- package/src/interaction_client/PopupClient.ts +2 -1
- package/src/interaction_client/RedirectClient.ts +1 -1
- package/src/interaction_client/SilentAuthCodeClient.ts +22 -19
- package/src/interaction_client/SilentCacheClient.ts +28 -28
- package/src/interaction_client/SilentIframeClient.ts +54 -18
- package/src/interaction_client/SilentRefreshClient.ts +26 -28
- package/src/interaction_client/StandardInteractionClient.ts +37 -68
- package/src/interaction_handler/InteractionHandler.ts +20 -15
- package/src/interaction_handler/RedirectHandler.ts +6 -2
- package/src/interaction_handler/SilentHandler.ts +177 -230
- package/src/naa/AccountInfo.ts +17 -0
- package/src/naa/AccountRequests.ts +16 -0
- package/src/naa/AuthBridge.ts +16 -0
- package/src/naa/BridgeCapabilities.ts +8 -0
- package/src/naa/BridgeError.ts +18 -0
- package/src/naa/BridgeProxy.ts +230 -0
- package/src/naa/BridgeRequest.ts +12 -0
- package/src/naa/BridgeRequestEnvelope.ts +46 -0
- package/src/naa/BridgeResponseEnvelope.ts +21 -0
- package/src/naa/BridgeStatusCode.ts +15 -0
- package/src/naa/IBridgeProxy.ts +25 -0
- package/src/naa/InitializeBridgeResponse.ts +12 -0
- package/src/naa/TokenRequest.ts +26 -0
- package/src/naa/TokenResponse.ts +61 -0
- package/src/naa/mapping/NestedAppAuthAdapter.ts +252 -0
- package/src/operatingcontext/TeamsAppOperatingContext.ts +43 -3
- package/src/operatingcontext/UnknownOperatingContext.ts +48 -0
- package/src/packageMetadata.ts +1 -1
- package/src/utils/BrowserProtocolUtils.ts +3 -2
- package/src/utils/BrowserUtils.ts +133 -125
- 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/utils/BrowserStringUtils.d.ts +0 -22
- package/dist/utils/BrowserStringUtils.d.ts.map +0 -1
- package/dist/utils/BrowserStringUtils.mjs +0 -144
- package/dist/utils/BrowserStringUtils.mjs.map +0 -1
- package/src/crypto/ISubtleCrypto.ts +0 -30
- package/src/crypto/ModernBrowserCrypto.ts +0 -69
- package/src/utils/BrowserStringUtils.ts +0 -143
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
AccountInfo,
|
|
12
12
|
AzureCloudOptions,
|
|
13
13
|
PerformanceEvents,
|
|
14
|
-
|
|
14
|
+
invokeAsync,
|
|
15
15
|
} from "@azure/msal-common";
|
|
16
16
|
import { SilentRequest } from "../request/SilentRequest";
|
|
17
17
|
import { ApiId } from "../utils/BrowserConstants";
|
|
@@ -30,7 +30,7 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
30
30
|
async acquireToken(
|
|
31
31
|
silentRequest: CommonSilentFlowRequest
|
|
32
32
|
): Promise<AuthenticationResult> {
|
|
33
|
-
|
|
33
|
+
this.performanceClient.addQueueMeasurement(
|
|
34
34
|
PerformanceEvents.SilentCacheClientAcquireToken,
|
|
35
35
|
silentRequest.correlationId
|
|
36
36
|
);
|
|
@@ -47,15 +47,22 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
47
47
|
this.logger.verbose("Silent auth client created");
|
|
48
48
|
|
|
49
49
|
try {
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
const response = await invokeAsync(
|
|
51
|
+
silentAuthClient.acquireCachedToken.bind(silentAuthClient),
|
|
52
|
+
PerformanceEvents.SilentFlowClientAcquireCachedToken,
|
|
53
|
+
this.logger,
|
|
54
|
+
this.performanceClient,
|
|
55
|
+
silentRequest.correlationId
|
|
56
|
+
)(silentRequest);
|
|
57
|
+
const authResponse = response[0] as AuthenticationResult;
|
|
53
58
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
+
this.performanceClient.addFields(
|
|
60
|
+
{
|
|
61
|
+
fromCache: true,
|
|
62
|
+
},
|
|
63
|
+
silentRequest.correlationId
|
|
64
|
+
);
|
|
65
|
+
return authResponse;
|
|
59
66
|
} catch (error) {
|
|
60
67
|
if (
|
|
61
68
|
error instanceof BrowserAuthError &&
|
|
@@ -65,14 +72,6 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
65
72
|
"Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair."
|
|
66
73
|
);
|
|
67
74
|
}
|
|
68
|
-
acquireTokenMeasurement.end({
|
|
69
|
-
errorCode:
|
|
70
|
-
(error instanceof AuthError && error.errorCode) ||
|
|
71
|
-
undefined,
|
|
72
|
-
subErrorCode:
|
|
73
|
-
(error instanceof AuthError && error.subError) || undefined,
|
|
74
|
-
success: false,
|
|
75
|
-
});
|
|
76
75
|
throw error;
|
|
77
76
|
}
|
|
78
77
|
}
|
|
@@ -98,15 +97,13 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
98
97
|
azureCloudOptions?: AzureCloudOptions
|
|
99
98
|
): Promise<SilentFlowClient> {
|
|
100
99
|
// Create auth module.
|
|
101
|
-
|
|
100
|
+
const clientConfig = await invokeAsync(
|
|
101
|
+
this.getClientConfiguration.bind(this),
|
|
102
102
|
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
|
|
103
|
+
this.logger,
|
|
104
|
+
this.performanceClient,
|
|
103
105
|
this.correlationId
|
|
104
|
-
);
|
|
105
|
-
const clientConfig = await this.getClientConfiguration(
|
|
106
|
-
serverTelemetryManager,
|
|
107
|
-
authorityUrl,
|
|
108
|
-
azureCloudOptions
|
|
109
|
-
);
|
|
106
|
+
)(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
110
107
|
return new SilentFlowClient(clientConfig, this.performanceClient);
|
|
111
108
|
}
|
|
112
109
|
|
|
@@ -119,13 +116,16 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
119
116
|
this.correlationId
|
|
120
117
|
);
|
|
121
118
|
|
|
122
|
-
|
|
119
|
+
const baseRequest = await invokeAsync(
|
|
120
|
+
this.initializeBaseRequest.bind(this),
|
|
123
121
|
PerformanceEvents.InitializeBaseRequest,
|
|
122
|
+
this.logger,
|
|
123
|
+
this.performanceClient,
|
|
124
124
|
this.correlationId
|
|
125
|
-
);
|
|
125
|
+
)(request, account);
|
|
126
126
|
return {
|
|
127
127
|
...request,
|
|
128
|
-
...
|
|
128
|
+
...baseRequest,
|
|
129
129
|
account: account,
|
|
130
130
|
forceRefresh: request.forceRefresh || false,
|
|
131
131
|
};
|
|
@@ -29,11 +29,16 @@ import {
|
|
|
29
29
|
BrowserAuthErrorCodes,
|
|
30
30
|
} from "../error/BrowserAuthError";
|
|
31
31
|
import { InteractionType, ApiId } from "../utils/BrowserConstants";
|
|
32
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
initiateAuthRequest,
|
|
34
|
+
monitorIframeForHash,
|
|
35
|
+
} from "../interaction_handler/SilentHandler";
|
|
33
36
|
import { SsoSilentRequest } from "../request/SsoSilentRequest";
|
|
34
37
|
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
|
|
35
38
|
import { NativeInteractionClient } from "./NativeInteractionClient";
|
|
36
39
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
40
|
+
import { InteractionHandler } from "../interaction_handler/InteractionHandler";
|
|
41
|
+
import * as BrowserUtils from "../utils/BrowserUtils";
|
|
37
42
|
|
|
38
43
|
export class SilentIframeClient extends StandardInteractionClient {
|
|
39
44
|
protected apiId: ApiId;
|
|
@@ -114,6 +119,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
114
119
|
},
|
|
115
120
|
InteractionType.Silent
|
|
116
121
|
);
|
|
122
|
+
BrowserUtils.preconnect(silentRequest.authority);
|
|
117
123
|
this.browserStorage.updateCacheEntries(
|
|
118
124
|
silentRequest.state,
|
|
119
125
|
silentRequest.nonce,
|
|
@@ -179,9 +185,10 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
179
185
|
authClient: AuthorizationCodeClient,
|
|
180
186
|
silentRequest: AuthorizationUrlRequest
|
|
181
187
|
): Promise<AuthenticationResult> {
|
|
188
|
+
const correlationId = silentRequest.correlationId;
|
|
182
189
|
this.performanceClient.addQueueMeasurement(
|
|
183
190
|
PerformanceEvents.SilentIframeClientTokenHelper,
|
|
184
|
-
|
|
191
|
+
correlationId
|
|
185
192
|
);
|
|
186
193
|
|
|
187
194
|
// Create auth code request and generate PKCE params
|
|
@@ -191,7 +198,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
191
198
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
192
199
|
this.logger,
|
|
193
200
|
this.performanceClient,
|
|
194
|
-
|
|
201
|
+
correlationId
|
|
195
202
|
)(silentRequest);
|
|
196
203
|
|
|
197
204
|
// Create authorize request url
|
|
@@ -200,7 +207,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
200
207
|
PerformanceEvents.GetAuthCodeUrl,
|
|
201
208
|
this.logger,
|
|
202
209
|
this.performanceClient,
|
|
203
|
-
|
|
210
|
+
correlationId
|
|
204
211
|
)({
|
|
205
212
|
...silentRequest,
|
|
206
213
|
nativeBroker: NativeMessageHandler.isNativeAvailable(
|
|
@@ -212,37 +219,64 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
212
219
|
});
|
|
213
220
|
|
|
214
221
|
// Create silent handler
|
|
215
|
-
const
|
|
222
|
+
const interactionHandler = new InteractionHandler(
|
|
216
223
|
authClient,
|
|
217
224
|
this.browserStorage,
|
|
218
225
|
authCodeRequest,
|
|
219
226
|
this.logger,
|
|
220
|
-
this.config.system,
|
|
221
227
|
this.performanceClient
|
|
222
228
|
);
|
|
223
229
|
// Get the frame handle for the silent request
|
|
224
230
|
const msalFrame = await invokeAsync(
|
|
225
|
-
|
|
231
|
+
initiateAuthRequest,
|
|
226
232
|
PerformanceEvents.SilentHandlerInitiateAuthRequest,
|
|
227
233
|
this.logger,
|
|
228
234
|
this.performanceClient,
|
|
229
|
-
|
|
230
|
-
)(
|
|
235
|
+
correlationId
|
|
236
|
+
)(
|
|
237
|
+
navigateUrl,
|
|
238
|
+
this.performanceClient,
|
|
239
|
+
this.logger,
|
|
240
|
+
correlationId,
|
|
241
|
+
this.config.system.navigateFrameWait
|
|
242
|
+
);
|
|
231
243
|
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
|
232
244
|
const hash = await invokeAsync(
|
|
233
|
-
|
|
234
|
-
PerformanceEvents.
|
|
245
|
+
monitorIframeForHash,
|
|
246
|
+
PerformanceEvents.SilentHandlerMonitorIframeForHash,
|
|
235
247
|
this.logger,
|
|
236
248
|
this.performanceClient,
|
|
237
|
-
|
|
238
|
-
)(
|
|
249
|
+
correlationId
|
|
250
|
+
)(
|
|
251
|
+
msalFrame,
|
|
252
|
+
this.config.system.iframeHashTimeout,
|
|
253
|
+
this.config.system.pollIntervalMilliseconds,
|
|
254
|
+
this.performanceClient,
|
|
255
|
+
this.logger,
|
|
256
|
+
correlationId
|
|
257
|
+
);
|
|
258
|
+
if (!hash) {
|
|
259
|
+
// No hash is present
|
|
260
|
+
this.logger.error(
|
|
261
|
+
"The request has returned to the redirectUri but a hash is not present in the iframe. It's likely that the hash has been removed or the page has been redirected by code running on the redirectUri page."
|
|
262
|
+
);
|
|
263
|
+
throw createBrowserAuthError(BrowserAuthErrorCodes.hashEmptyError);
|
|
264
|
+
} else if (!UrlString.hashContainsKnownProperties(hash)) {
|
|
265
|
+
this.logger.error(
|
|
266
|
+
"A hash is present in the iframe but it does not contain known properties. It's likely that the hash has been replaced by code running on the redirectUri page."
|
|
267
|
+
);
|
|
268
|
+
this.logger.errorPii(`The hash detected in the iframe is: ${hash}`);
|
|
269
|
+
throw createBrowserAuthError(
|
|
270
|
+
BrowserAuthErrorCodes.hashDoesNotContainKnownProperties
|
|
271
|
+
);
|
|
272
|
+
}
|
|
239
273
|
// Deserialize hash fragment response parameters.
|
|
240
274
|
const serverParams: ServerAuthorizationCodeResponse =
|
|
241
275
|
UrlString.getDeserializedHash(hash);
|
|
242
276
|
const state = this.validateAndExtractStateFromHash(
|
|
243
277
|
serverParams,
|
|
244
278
|
InteractionType.Silent,
|
|
245
|
-
|
|
279
|
+
correlationId
|
|
246
280
|
);
|
|
247
281
|
|
|
248
282
|
if (serverParams.accountId) {
|
|
@@ -266,7 +300,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
266
300
|
this.nativeMessageHandler,
|
|
267
301
|
serverParams.accountId,
|
|
268
302
|
this.browserStorage,
|
|
269
|
-
|
|
303
|
+
correlationId
|
|
270
304
|
);
|
|
271
305
|
const { userRequestState } = ProtocolUtils.parseRequestState(
|
|
272
306
|
this.browserCrypto,
|
|
@@ -279,7 +313,7 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
279
313
|
PerformanceEvents.NativeInteractionClientAcquireToken,
|
|
280
314
|
this.logger,
|
|
281
315
|
this.performanceClient,
|
|
282
|
-
|
|
316
|
+
correlationId
|
|
283
317
|
)({
|
|
284
318
|
...silentRequest,
|
|
285
319
|
state: userRequestState,
|
|
@@ -291,11 +325,13 @@ export class SilentIframeClient extends StandardInteractionClient {
|
|
|
291
325
|
|
|
292
326
|
// Handle response from hash string
|
|
293
327
|
return invokeAsync(
|
|
294
|
-
|
|
328
|
+
interactionHandler.handleCodeResponseFromHash.bind(
|
|
329
|
+
interactionHandler
|
|
330
|
+
),
|
|
295
331
|
PerformanceEvents.HandleCodeResponseFromHash,
|
|
296
332
|
this.logger,
|
|
297
333
|
this.performanceClient,
|
|
298
|
-
|
|
334
|
+
correlationId
|
|
299
335
|
)(hash, state, authClient.authority, this.networkClient);
|
|
300
336
|
}
|
|
301
337
|
}
|
|
@@ -11,6 +11,7 @@ import {
|
|
|
11
11
|
AuthError,
|
|
12
12
|
AzureCloudOptions,
|
|
13
13
|
PerformanceEvents,
|
|
14
|
+
invokeAsync,
|
|
14
15
|
} from "@azure/msal-common";
|
|
15
16
|
import { ApiId } from "../utils/BrowserConstants";
|
|
16
17
|
import {
|
|
@@ -32,18 +33,17 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
32
33
|
request.correlationId
|
|
33
34
|
);
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
const baseRequest = await invokeAsync(
|
|
37
|
+
this.initializeBaseRequest.bind(this),
|
|
36
38
|
PerformanceEvents.InitializeBaseRequest,
|
|
39
|
+
this.logger,
|
|
40
|
+
this.performanceClient,
|
|
37
41
|
request.correlationId
|
|
38
|
-
);
|
|
42
|
+
)(request, request.account);
|
|
39
43
|
const silentRequest: CommonSilentFlowRequest = {
|
|
40
44
|
...request,
|
|
41
|
-
...
|
|
45
|
+
...baseRequest,
|
|
42
46
|
};
|
|
43
|
-
const acquireTokenMeasurement = this.performanceClient.startMeasurement(
|
|
44
|
-
PerformanceEvents.SilentRefreshClientAcquireToken,
|
|
45
|
-
silentRequest.correlationId
|
|
46
|
-
);
|
|
47
47
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
48
48
|
ApiId.acquireTokenSilent_silentFlow
|
|
49
49
|
);
|
|
@@ -55,30 +55,30 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
55
55
|
);
|
|
56
56
|
this.logger.verbose("Refresh token client created");
|
|
57
57
|
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
|
58
|
-
|
|
58
|
+
return invokeAsync(
|
|
59
|
+
refreshTokenClient.acquireTokenByRefreshToken.bind(
|
|
60
|
+
refreshTokenClient
|
|
61
|
+
),
|
|
59
62
|
PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken,
|
|
63
|
+
this.logger,
|
|
64
|
+
this.performanceClient,
|
|
60
65
|
request.correlationId
|
|
61
|
-
)
|
|
62
|
-
return refreshTokenClient
|
|
63
|
-
.acquireTokenByRefreshToken(silentRequest)
|
|
66
|
+
)(silentRequest)
|
|
64
67
|
.then((result) => result as AuthenticationResult)
|
|
65
68
|
.then((result: AuthenticationResult) => {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
69
|
+
this.performanceClient.addFields(
|
|
70
|
+
{
|
|
71
|
+
fromCache: result.fromCache,
|
|
72
|
+
requestId: result.requestId,
|
|
73
|
+
},
|
|
74
|
+
request.correlationId
|
|
75
|
+
);
|
|
71
76
|
|
|
72
77
|
return result;
|
|
73
78
|
})
|
|
74
79
|
.catch((e: AuthError) => {
|
|
75
80
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
76
81
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
77
|
-
acquireTokenMeasurement.end({
|
|
78
|
-
errorCode: e.errorCode,
|
|
79
|
-
subErrorCode: e.subError,
|
|
80
|
-
success: false,
|
|
81
|
-
});
|
|
82
82
|
throw e;
|
|
83
83
|
});
|
|
84
84
|
}
|
|
@@ -106,15 +106,13 @@ export class SilentRefreshClient extends StandardInteractionClient {
|
|
|
106
106
|
azureCloudOptions?: AzureCloudOptions
|
|
107
107
|
): Promise<RefreshTokenClient> {
|
|
108
108
|
// Create auth module.
|
|
109
|
-
|
|
109
|
+
const clientConfig = await invokeAsync(
|
|
110
|
+
this.getClientConfiguration.bind(this),
|
|
110
111
|
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
|
|
112
|
+
this.logger,
|
|
113
|
+
this.performanceClient,
|
|
111
114
|
this.correlationId
|
|
112
|
-
);
|
|
113
|
-
const clientConfig = await this.getClientConfiguration(
|
|
114
|
-
serverTelemetryManager,
|
|
115
|
-
authorityUrl,
|
|
116
|
-
azureCloudOptions
|
|
117
|
-
);
|
|
115
|
+
)(serverTelemetryManager, authorityUrl, azureCloudOptions);
|
|
118
116
|
return new RefreshTokenClient(clientConfig, this.performanceClient);
|
|
119
117
|
}
|
|
120
118
|
}
|
|
@@ -21,7 +21,8 @@ import {
|
|
|
21
21
|
AccountInfo,
|
|
22
22
|
AzureCloudOptions,
|
|
23
23
|
PerformanceEvents,
|
|
24
|
-
|
|
24
|
+
invokeAsync,
|
|
25
|
+
BaseAuthRequest,
|
|
25
26
|
} from "@azure/msal-common";
|
|
26
27
|
import { BaseInteractionClient } from "./BaseInteractionClient";
|
|
27
28
|
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest";
|
|
@@ -36,10 +37,12 @@ import {
|
|
|
36
37
|
BrowserStateObject,
|
|
37
38
|
} from "../utils/BrowserProtocolUtils";
|
|
38
39
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
39
|
-
import
|
|
40
|
+
import * as BrowserUtils from "../utils/BrowserUtils";
|
|
40
41
|
import { RedirectRequest } from "../request/RedirectRequest";
|
|
41
42
|
import { PopupRequest } from "../request/PopupRequest";
|
|
42
43
|
import { SsoSilentRequest } from "../request/SsoSilentRequest";
|
|
44
|
+
import { generatePkceCodes } from "../crypto/PkceGenerator";
|
|
45
|
+
import { createNewGuid } from "../crypto/BrowserCrypto";
|
|
43
46
|
|
|
44
47
|
/**
|
|
45
48
|
* Defines the class structure and helper functions used by the "standard", non-brokered auth flows (popup, redirect, silent (RT), silent (iframe))
|
|
@@ -56,12 +59,13 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
56
59
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
57
60
|
request.correlationId
|
|
58
61
|
);
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
const generatedPkceParams = await invokeAsync(
|
|
63
|
+
generatePkceCodes,
|
|
64
|
+
PerformanceEvents.GeneratePkceCodes,
|
|
65
|
+
this.logger,
|
|
66
|
+
this.performanceClient,
|
|
67
|
+
this.correlationId
|
|
68
|
+
)(this.performanceClient, this.logger, this.correlationId);
|
|
65
69
|
|
|
66
70
|
const authCodeRequest: CommonAuthorizationCodeRequest = {
|
|
67
71
|
...request,
|
|
@@ -89,8 +93,7 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
89
93
|
);
|
|
90
94
|
|
|
91
95
|
const validLogoutRequest: CommonEndSessionRequest = {
|
|
92
|
-
correlationId:
|
|
93
|
-
this.correlationId || this.browserCrypto.createNewGuid(),
|
|
96
|
+
correlationId: this.correlationId || createNewGuid(),
|
|
94
97
|
...logoutRequest,
|
|
95
98
|
};
|
|
96
99
|
|
|
@@ -219,15 +222,13 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
219
222
|
this.correlationId
|
|
220
223
|
);
|
|
221
224
|
// Create auth module.
|
|
222
|
-
|
|
225
|
+
const clientConfig = await invokeAsync(
|
|
226
|
+
this.getClientConfiguration.bind(this),
|
|
223
227
|
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
|
|
228
|
+
this.logger,
|
|
229
|
+
this.performanceClient,
|
|
224
230
|
this.correlationId
|
|
225
|
-
);
|
|
226
|
-
const clientConfig = await this.getClientConfiguration(
|
|
227
|
-
serverTelemetryManager,
|
|
228
|
-
authorityUrl,
|
|
229
|
-
requestAzureCloudOptions
|
|
230
|
-
);
|
|
231
|
+
)(serverTelemetryManager, authorityUrl, requestAzureCloudOptions);
|
|
231
232
|
return new AuthorizationCodeClient(
|
|
232
233
|
clientConfig,
|
|
233
234
|
this.performanceClient
|
|
@@ -249,18 +250,13 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
249
250
|
PerformanceEvents.StandardInteractionClientGetClientConfiguration,
|
|
250
251
|
this.correlationId
|
|
251
252
|
);
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
this.correlationId
|
|
255
|
-
);
|
|
256
|
-
this.performanceClient.setPreQueueTime(
|
|
253
|
+
const discoveredAuthority = await invokeAsync(
|
|
254
|
+
this.getDiscoveredAuthority.bind(this),
|
|
257
255
|
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
256
|
+
this.logger,
|
|
257
|
+
this.performanceClient,
|
|
258
258
|
this.correlationId
|
|
259
|
-
);
|
|
260
|
-
const discoveredAuthority = await this.getDiscoveredAuthority(
|
|
261
|
-
requestAuthority,
|
|
262
|
-
requestAzureCloudOptions
|
|
263
|
-
);
|
|
259
|
+
)(requestAuthority, requestAzureCloudOptions);
|
|
264
260
|
const logger = this.config.system.loggerOptions;
|
|
265
261
|
|
|
266
262
|
return {
|
|
@@ -349,15 +345,6 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
349
345
|
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
350
346
|
this.correlationId
|
|
351
347
|
);
|
|
352
|
-
this.logger.verbose(
|
|
353
|
-
"getDiscoveredAuthority called",
|
|
354
|
-
this.correlationId
|
|
355
|
-
);
|
|
356
|
-
const getAuthorityMeasurement =
|
|
357
|
-
this.performanceClient?.startMeasurement(
|
|
358
|
-
PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority,
|
|
359
|
-
this.correlationId
|
|
360
|
-
);
|
|
361
348
|
const authorityOptions: AuthorityOptions = {
|
|
362
349
|
protocolMode: this.config.auth.protocolMode,
|
|
363
350
|
OIDCOptions: this.config.auth.OIDCOptions,
|
|
@@ -378,15 +365,13 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
378
365
|
userAuthority,
|
|
379
366
|
requestAzureCloudOptions || this.config.auth.azureCloudOptions
|
|
380
367
|
);
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
this.correlationId
|
|
384
|
-
);
|
|
385
|
-
this.performanceClient.setPreQueueTime(
|
|
368
|
+
return await invokeAsync(
|
|
369
|
+
AuthorityFactory.createDiscoveredInstance.bind(AuthorityFactory),
|
|
386
370
|
PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance,
|
|
371
|
+
this.logger,
|
|
372
|
+
this.performanceClient,
|
|
387
373
|
this.correlationId
|
|
388
|
-
)
|
|
389
|
-
return await AuthorityFactory.createDiscoveredInstance(
|
|
374
|
+
)(
|
|
390
375
|
builtAuthority,
|
|
391
376
|
this.config.system.networkClient,
|
|
392
377
|
this.browserStorage,
|
|
@@ -394,23 +379,7 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
394
379
|
this.logger,
|
|
395
380
|
this.performanceClient,
|
|
396
381
|
this.correlationId
|
|
397
|
-
)
|
|
398
|
-
.then((result: Authority) => {
|
|
399
|
-
getAuthorityMeasurement.end({
|
|
400
|
-
success: true,
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
return result;
|
|
404
|
-
})
|
|
405
|
-
.catch((error: AuthError) => {
|
|
406
|
-
getAuthorityMeasurement.end({
|
|
407
|
-
errorCode: error.errorCode,
|
|
408
|
-
subErrorCode: error.subError,
|
|
409
|
-
success: false,
|
|
410
|
-
});
|
|
411
|
-
|
|
412
|
-
throw error;
|
|
413
|
-
});
|
|
382
|
+
);
|
|
414
383
|
}
|
|
415
384
|
|
|
416
385
|
/**
|
|
@@ -426,10 +395,7 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
426
395
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
427
396
|
this.correlationId
|
|
428
397
|
);
|
|
429
|
-
|
|
430
|
-
"initializeAuthorizationRequest called",
|
|
431
|
-
this.correlationId
|
|
432
|
-
);
|
|
398
|
+
|
|
433
399
|
const redirectUri = this.getRedirectUri(request.redirectUri);
|
|
434
400
|
const browserState: BrowserStateObject = {
|
|
435
401
|
interactionType: interactionType,
|
|
@@ -440,16 +406,19 @@ export abstract class StandardInteractionClient extends BaseInteractionClient {
|
|
|
440
406
|
browserState
|
|
441
407
|
);
|
|
442
408
|
|
|
443
|
-
|
|
409
|
+
const baseRequest: BaseAuthRequest = await invokeAsync(
|
|
410
|
+
this.initializeBaseRequest.bind(this),
|
|
444
411
|
PerformanceEvents.InitializeBaseRequest,
|
|
412
|
+
this.logger,
|
|
413
|
+
this.performanceClient,
|
|
445
414
|
this.correlationId
|
|
446
|
-
);
|
|
415
|
+
)(request);
|
|
447
416
|
|
|
448
417
|
const validatedRequest: AuthorizationUrlRequest = {
|
|
449
|
-
...
|
|
418
|
+
...baseRequest,
|
|
450
419
|
redirectUri: redirectUri,
|
|
451
420
|
state: state,
|
|
452
|
-
nonce: request.nonce ||
|
|
421
|
+
nonce: request.nonce || createNewGuid(),
|
|
453
422
|
responseMode: this.config.auth.OIDCOptions
|
|
454
423
|
.serverResponseType as ResponseMode,
|
|
455
424
|
};
|
|
@@ -10,13 +10,14 @@ import {
|
|
|
10
10
|
AuthorityFactory,
|
|
11
11
|
Authority,
|
|
12
12
|
INetworkModule,
|
|
13
|
-
ClientAuthError,
|
|
14
13
|
CcsCredential,
|
|
15
14
|
Logger,
|
|
16
15
|
ServerError,
|
|
17
16
|
IPerformanceClient,
|
|
18
17
|
PerformanceEvents,
|
|
19
18
|
invokeAsync,
|
|
19
|
+
createClientAuthError,
|
|
20
|
+
ClientAuthErrorCodes,
|
|
20
21
|
} from "@azure/msal-common";
|
|
21
22
|
|
|
22
23
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager";
|
|
@@ -67,7 +68,6 @@ export class InteractionHandler {
|
|
|
67
68
|
PerformanceEvents.HandleCodeResponseFromHash,
|
|
68
69
|
this.authCodeRequest.correlationId
|
|
69
70
|
);
|
|
70
|
-
this.logger.verbose("InteractionHandler.handleCodeResponse called");
|
|
71
71
|
// Check that location hash isn't empty.
|
|
72
72
|
if (!locationHash) {
|
|
73
73
|
throw createBrowserAuthError(BrowserAuthErrorCodes.hashEmptyError);
|
|
@@ -77,7 +77,10 @@ export class InteractionHandler {
|
|
|
77
77
|
const stateKey = this.browserStorage.generateStateKey(state);
|
|
78
78
|
const requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
79
79
|
if (!requestState) {
|
|
80
|
-
throw
|
|
80
|
+
throw createClientAuthError(
|
|
81
|
+
ClientAuthErrorCodes.stateNotFound,
|
|
82
|
+
"Cached State"
|
|
83
|
+
);
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
let authCodeResponse;
|
|
@@ -100,16 +103,13 @@ export class InteractionHandler {
|
|
|
100
103
|
}
|
|
101
104
|
}
|
|
102
105
|
|
|
103
|
-
|
|
106
|
+
return invokeAsync(
|
|
107
|
+
this.handleCodeResponseFromServer.bind(this),
|
|
104
108
|
PerformanceEvents.HandleCodeResponseFromServer,
|
|
109
|
+
this.logger,
|
|
110
|
+
this.performanceClient,
|
|
105
111
|
this.authCodeRequest.correlationId
|
|
106
|
-
);
|
|
107
|
-
return this.handleCodeResponseFromServer(
|
|
108
|
-
authCodeResponse,
|
|
109
|
-
state,
|
|
110
|
-
authority,
|
|
111
|
-
networkModule
|
|
112
|
-
);
|
|
112
|
+
)(authCodeResponse, state, authority, networkModule);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
/**
|
|
@@ -139,7 +139,10 @@ export class InteractionHandler {
|
|
|
139
139
|
const stateKey = this.browserStorage.generateStateKey(state);
|
|
140
140
|
const requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
141
141
|
if (!requestState) {
|
|
142
|
-
throw
|
|
142
|
+
throw createClientAuthError(
|
|
143
|
+
ClientAuthErrorCodes.stateNotFound,
|
|
144
|
+
"Cached State"
|
|
145
|
+
);
|
|
143
146
|
}
|
|
144
147
|
|
|
145
148
|
// Get cached items
|
|
@@ -151,11 +154,13 @@ export class InteractionHandler {
|
|
|
151
154
|
|
|
152
155
|
// Check for new cloud instance
|
|
153
156
|
if (authCodeResponse.cloud_instance_host_name) {
|
|
154
|
-
|
|
157
|
+
await invokeAsync(
|
|
158
|
+
this.updateTokenEndpointAuthority.bind(this),
|
|
155
159
|
PerformanceEvents.UpdateTokenEndpointAuthority,
|
|
160
|
+
this.logger,
|
|
161
|
+
this.performanceClient,
|
|
156
162
|
this.authCodeRequest.correlationId
|
|
157
|
-
)
|
|
158
|
-
await this.updateTokenEndpointAuthority(
|
|
163
|
+
)(
|
|
159
164
|
authCodeResponse.cloud_instance_host_name,
|
|
160
165
|
authority,
|
|
161
166
|
networkModule
|
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
ICrypto,
|
|
10
10
|
Authority,
|
|
11
11
|
INetworkModule,
|
|
12
|
-
ClientAuthError,
|
|
13
12
|
Logger,
|
|
14
13
|
ServerError,
|
|
15
14
|
IPerformanceClient,
|
|
15
|
+
createClientAuthError,
|
|
16
|
+
ClientAuthErrorCodes,
|
|
16
17
|
} from "@azure/msal-common";
|
|
17
18
|
import {
|
|
18
19
|
createBrowserAuthError,
|
|
@@ -161,7 +162,10 @@ export class RedirectHandler extends InteractionHandler {
|
|
|
161
162
|
const stateKey = this.browserStorage.generateStateKey(state);
|
|
162
163
|
const requestState = this.browserStorage.getTemporaryCache(stateKey);
|
|
163
164
|
if (!requestState) {
|
|
164
|
-
throw
|
|
165
|
+
throw createClientAuthError(
|
|
166
|
+
ClientAuthErrorCodes.stateNotFound,
|
|
167
|
+
"Cached State"
|
|
168
|
+
);
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
let authCodeResponse;
|