@azure/msal-browser 3.2.0 → 3.4.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.mjs +1 -1
- package/dist/app/PublicClientApplication.d.ts.map +1 -1
- package/dist/app/PublicClientApplication.mjs +3 -4
- 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 +360 -0
- package/dist/app/PublicClientNext.mjs.map +1 -0
- package/dist/broker/nativeBroker/NativeMessageHandler.mjs +1 -1
- package/dist/broker/nativeBroker/NativeStatusCodes.mjs +1 -1
- package/dist/cache/AsyncMemoryStorage.mjs +1 -1
- package/dist/cache/BrowserCacheManager.d.ts +2 -13
- package/dist/cache/BrowserCacheManager.d.ts.map +1 -1
- package/dist/cache/BrowserCacheManager.mjs +26 -83
- package/dist/cache/BrowserCacheManager.mjs.map +1 -1
- package/dist/cache/BrowserStorage.mjs +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.d.ts.map +1 -1
- package/dist/cache/TokenCache.mjs +5 -5
- package/dist/cache/TokenCache.mjs.map +1 -1
- package/dist/config/Configuration.d.ts +4 -0
- package/dist/config/Configuration.d.ts.map +1 -1
- package/dist/config/Configuration.mjs +2 -1
- package/dist/config/Configuration.mjs.map +1 -1
- package/dist/controllers/ControllerFactory.d.ts +2 -7
- package/dist/controllers/ControllerFactory.d.ts.map +1 -1
- package/dist/controllers/ControllerFactory.mjs +24 -34
- package/dist/controllers/ControllerFactory.mjs.map +1 -1
- package/dist/controllers/IController.d.ts +1 -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 +4 -4
- package/dist/controllers/StandardController.d.ts.map +1 -1
- package/dist/controllers/StandardController.mjs +43 -42
- 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.map +1 -1
- package/dist/crypto/BrowserCrypto.mjs +3 -3
- package/dist/crypto/BrowserCrypto.mjs.map +1 -1
- package/dist/crypto/CryptoOps.d.ts.map +1 -1
- package/dist/crypto/CryptoOps.mjs +8 -5
- package/dist/crypto/CryptoOps.mjs.map +1 -1
- package/dist/crypto/PkceGenerator.mjs +1 -1
- package/dist/crypto/SignedHttpRequest.mjs +1 -1
- package/dist/encode/Base64Decode.mjs +1 -1
- package/dist/encode/Base64Encode.mjs +1 -1
- package/dist/error/BrowserAuthError.mjs +1 -1
- package/dist/error/BrowserAuthErrorCodes.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthError.mjs +1 -1
- package/dist/error/BrowserConfigurationAuthErrorCodes.mjs +1 -1
- package/dist/error/NativeAuthError.mjs +1 -1
- package/dist/error/NativeAuthErrorCodes.mjs +1 -1
- 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.mjs +1 -1
- package/dist/event/EventMessage.mjs +1 -1
- package/dist/event/EventType.mjs +1 -1
- package/dist/index.d.ts +3 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/index.mjs.map +1 -1
- package/dist/interaction_client/BaseInteractionClient.mjs +4 -4
- package/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs +1 -1
- package/dist/interaction_client/NativeInteractionClient.d.ts.map +1 -1
- package/dist/interaction_client/NativeInteractionClient.mjs +18 -7
- package/dist/interaction_client/NativeInteractionClient.mjs.map +1 -1
- package/dist/interaction_client/PopupClient.d.ts +1 -2
- package/dist/interaction_client/PopupClient.d.ts.map +1 -1
- package/dist/interaction_client/PopupClient.mjs +13 -25
- 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 +17 -25
- 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 +6 -8
- 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 +4 -3
- 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 +28 -19
- 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 +2 -12
- package/dist/interaction_client/SilentRefreshClient.mjs.map +1 -1
- package/dist/interaction_client/StandardInteractionClient.mjs +5 -5
- package/dist/interaction_handler/InteractionHandler.d.ts +6 -13
- package/dist/interaction_handler/InteractionHandler.d.ts.map +1 -1
- package/dist/interaction_handler/InteractionHandler.mjs +29 -56
- package/dist/interaction_handler/InteractionHandler.mjs.map +1 -1
- package/dist/interaction_handler/RedirectHandler.d.ts +14 -7
- package/dist/interaction_handler/RedirectHandler.d.ts.map +1 -1
- package/dist/interaction_handler/RedirectHandler.mjs +28 -9
- 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 -155
- 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.mjs +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 +13221 -12385
- package/lib/msal-browser.cjs.map +1 -1
- package/lib/msal-browser.js +13221 -12385
- package/lib/msal-browser.js.map +1 -1
- package/lib/msal-browser.min.js +67 -68
- package/package.json +2 -2
- package/src/app/PublicClientApplication.ts +4 -3
- package/src/app/PublicClientNext.ts +444 -0
- package/src/cache/BrowserCacheManager.ts +33 -140
- package/src/cache/TokenCache.ts +5 -4
- package/src/config/Configuration.ts +5 -0
- package/src/controllers/ControllerFactory.ts +35 -43
- package/src/controllers/IController.ts +0 -6
- package/src/controllers/NestedAppAuthController.ts +525 -0
- package/src/controllers/StandardController.ts +50 -52
- package/src/controllers/UnknownOperatingContextController.ts +383 -0
- package/src/crypto/BrowserCrypto.ts +2 -2
- package/src/crypto/CryptoOps.ts +8 -5
- package/src/error/NestedAppAuthError.ts +32 -0
- package/src/index.ts +3 -10
- package/src/interaction_client/BaseInteractionClient.ts +1 -1
- package/src/interaction_client/NativeInteractionClient.ts +23 -6
- package/src/interaction_client/PopupClient.ts +41 -61
- package/src/interaction_client/RedirectClient.ts +42 -47
- package/src/interaction_client/SilentAuthCodeClient.ts +6 -16
- package/src/interaction_client/SilentCacheClient.ts +11 -3
- package/src/interaction_client/SilentIframeClient.ts +54 -34
- package/src/interaction_client/SilentRefreshClient.ts +5 -19
- package/src/interaction_client/StandardInteractionClient.ts +1 -1
- package/src/interaction_handler/InteractionHandler.ts +34 -104
- package/src/interaction_handler/RedirectHandler.ts +48 -22
- package/src/interaction_handler/SilentHandler.ts +177 -233
- 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/BrowserUtils.ts +133 -125
- 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/utils/BrowserStringUtils.ts +0 -143
package/src/index.ts
CHANGED
|
@@ -8,12 +8,11 @@
|
|
|
8
8
|
* @module @azure/msal-browser
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
* Breaking changes to these APIs will be shipped under a minor version, instead of a major version.
|
|
14
|
-
*/
|
|
11
|
+
import * as BrowserUtils from "./utils/BrowserUtils";
|
|
12
|
+
export { BrowserUtils };
|
|
15
13
|
|
|
16
14
|
export { PublicClientApplication } from "./app/PublicClientApplication";
|
|
15
|
+
export { PublicClientNext } from "./app/PublicClientNext";
|
|
17
16
|
export { IController } from "./controllers/IController";
|
|
18
17
|
export {
|
|
19
18
|
Configuration,
|
|
@@ -32,12 +31,6 @@ export {
|
|
|
32
31
|
ApiId,
|
|
33
32
|
CacheLookupPolicy,
|
|
34
33
|
} from "./utils/BrowserConstants";
|
|
35
|
-
export { BrowserUtils } from "./utils/BrowserUtils";
|
|
36
|
-
|
|
37
|
-
/*
|
|
38
|
-
* export { IController} from "./controllers/IController";
|
|
39
|
-
* export { StandardController } from "./controllers/StandardController";
|
|
40
|
-
*/
|
|
41
34
|
|
|
42
35
|
// Browser Errors
|
|
43
36
|
export {
|
|
@@ -32,7 +32,7 @@ import { PopupRequest } from "../request/PopupRequest";
|
|
|
32
32
|
import { SsoSilentRequest } from "../request/SsoSilentRequest";
|
|
33
33
|
import { version } from "../packageMetadata";
|
|
34
34
|
import { BrowserConstants } from "../utils/BrowserConstants";
|
|
35
|
-
import
|
|
35
|
+
import * as BrowserUtils from "../utils/BrowserUtils";
|
|
36
36
|
import { INavigationClient } from "../navigation/INavigationClient";
|
|
37
37
|
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
|
|
38
38
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
@@ -33,6 +33,7 @@ import {
|
|
|
33
33
|
invokeAsync,
|
|
34
34
|
createAuthError,
|
|
35
35
|
AuthErrorCodes,
|
|
36
|
+
CacheHelpers,
|
|
36
37
|
} from "@azure/msal-common";
|
|
37
38
|
import { BaseInteractionClient } from "./BaseInteractionClient";
|
|
38
39
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
@@ -238,9 +239,10 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
238
239
|
throw createClientAuthError(ClientAuthErrorCodes.noAccountFound);
|
|
239
240
|
}
|
|
240
241
|
// fetch the account from browser cache
|
|
241
|
-
const account = this.browserStorage.
|
|
242
|
+
const account = this.browserStorage.getBaseAccountInfo({
|
|
242
243
|
nativeAccountId,
|
|
243
244
|
});
|
|
245
|
+
|
|
244
246
|
if (!account) {
|
|
245
247
|
throw createClientAuthError(ClientAuthErrorCodes.noAccountFound);
|
|
246
248
|
}
|
|
@@ -254,9 +256,15 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
254
256
|
const result = await this.silentCacheClient.acquireToken(
|
|
255
257
|
silentRequest
|
|
256
258
|
);
|
|
259
|
+
|
|
260
|
+
const fullAccount = {
|
|
261
|
+
...account,
|
|
262
|
+
idTokenClaims: result?.idTokenClaims as TokenClaims,
|
|
263
|
+
};
|
|
264
|
+
|
|
257
265
|
return {
|
|
258
266
|
...result,
|
|
259
|
-
account,
|
|
267
|
+
account: fullAccount,
|
|
260
268
|
};
|
|
261
269
|
} catch (e) {
|
|
262
270
|
throw e;
|
|
@@ -572,6 +580,15 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
572
580
|
idTokenClaims.tid ||
|
|
573
581
|
Constants.EMPTY_STRING;
|
|
574
582
|
|
|
583
|
+
const fullAccountEntity: AccountEntity = idTokenClaims
|
|
584
|
+
? Object.assign(new AccountEntity(), {
|
|
585
|
+
...accountEntity,
|
|
586
|
+
idTokenClaims: idTokenClaims,
|
|
587
|
+
})
|
|
588
|
+
: accountEntity;
|
|
589
|
+
|
|
590
|
+
const accountInfo = fullAccountEntity.getAccountInfo();
|
|
591
|
+
|
|
575
592
|
// generate PoP token as needed
|
|
576
593
|
const responseAccessToken = await this.generatePopAccessToken(
|
|
577
594
|
response,
|
|
@@ -587,7 +604,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
587
604
|
uniqueId: uid,
|
|
588
605
|
tenantId: tid,
|
|
589
606
|
scopes: responseScopes.asArray(),
|
|
590
|
-
account:
|
|
607
|
+
account: accountInfo,
|
|
591
608
|
idToken: response.id_token,
|
|
592
609
|
idTokenClaims: idTokenClaims,
|
|
593
610
|
accessToken: responseAccessToken,
|
|
@@ -640,7 +657,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
640
657
|
reqTimestamp: number
|
|
641
658
|
): void {
|
|
642
659
|
const cachedIdToken: IdTokenEntity | null =
|
|
643
|
-
|
|
660
|
+
CacheHelpers.createIdTokenEntity(
|
|
644
661
|
homeAccountIdentifier,
|
|
645
662
|
request.authority,
|
|
646
663
|
response.id_token || "",
|
|
@@ -659,7 +676,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
659
676
|
const responseScopes = this.generateScopes(response, request);
|
|
660
677
|
|
|
661
678
|
const cachedAccessToken: AccessTokenEntity | null =
|
|
662
|
-
|
|
679
|
+
CacheHelpers.createAccessTokenEntity(
|
|
663
680
|
homeAccountIdentifier,
|
|
664
681
|
request.authority,
|
|
665
682
|
responseAccessToken,
|
|
@@ -668,7 +685,7 @@ export class NativeInteractionClient extends BaseInteractionClient {
|
|
|
668
685
|
responseScopes.printScopes(),
|
|
669
686
|
tokenExpirationSeconds,
|
|
670
687
|
0,
|
|
671
|
-
|
|
688
|
+
base64Decode
|
|
672
689
|
);
|
|
673
690
|
|
|
674
691
|
const nativeCacheRecord = new CacheRecord(
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
ICrypto,
|
|
21
21
|
ProtocolMode,
|
|
22
22
|
ServerResponseType,
|
|
23
|
+
invokeAsync,
|
|
23
24
|
} from "@azure/msal-common";
|
|
24
25
|
import { StandardInteractionClient } from "./StandardInteractionClient";
|
|
25
26
|
import { EventType } from "../event/EventType";
|
|
@@ -30,7 +31,7 @@ import {
|
|
|
30
31
|
} from "../utils/BrowserConstants";
|
|
31
32
|
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
|
|
32
33
|
import { NavigationOptions } from "../navigation/NavigationOptions";
|
|
33
|
-
import
|
|
34
|
+
import * as BrowserUtils from "../utils/BrowserUtils";
|
|
34
35
|
import { PopupRequest } from "../request/PopupRequest";
|
|
35
36
|
import { NativeInteractionClient } from "./NativeInteractionClient";
|
|
36
37
|
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
|
|
@@ -42,15 +43,12 @@ import { INavigationClient } from "../navigation/INavigationClient";
|
|
|
42
43
|
import { EventHandler } from "../event/EventHandler";
|
|
43
44
|
import { BrowserCacheManager } from "../cache/BrowserCacheManager";
|
|
44
45
|
import { BrowserConfiguration } from "../config/Configuration";
|
|
45
|
-
import {
|
|
46
|
-
InteractionHandler,
|
|
47
|
-
InteractionParams,
|
|
48
|
-
} from "../interaction_handler/InteractionHandler";
|
|
46
|
+
import { InteractionHandler } from "../interaction_handler/InteractionHandler";
|
|
49
47
|
import { PopupWindowAttributes } from "../request/PopupWindowAttributes";
|
|
50
48
|
import { EventError } from "../event/EventMessage";
|
|
51
49
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
52
50
|
|
|
53
|
-
export type PopupParams =
|
|
51
|
+
export type PopupParams = {
|
|
54
52
|
popup?: Window | null;
|
|
55
53
|
popupName: string;
|
|
56
54
|
popupWindowAttributes: PopupWindowAttributes;
|
|
@@ -203,43 +201,39 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
203
201
|
ApiId.acquireTokenPopup
|
|
204
202
|
);
|
|
205
203
|
|
|
206
|
-
|
|
204
|
+
const validRequest = await invokeAsync(
|
|
205
|
+
this.initializeAuthorizationRequest.bind(this),
|
|
207
206
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
);
|
|
214
|
-
this.browserStorage.updateCacheEntries(
|
|
215
|
-
validRequest.state,
|
|
216
|
-
validRequest.nonce,
|
|
217
|
-
validRequest.authority,
|
|
218
|
-
validRequest.loginHint || Constants.EMPTY_STRING,
|
|
219
|
-
validRequest.account || null
|
|
220
|
-
);
|
|
207
|
+
this.logger,
|
|
208
|
+
this.performanceClient,
|
|
209
|
+
this.correlationId
|
|
210
|
+
)(request, InteractionType.Popup);
|
|
211
|
+
|
|
212
|
+
BrowserUtils.preconnect(validRequest.authority);
|
|
221
213
|
|
|
222
214
|
try {
|
|
223
215
|
// Create auth code request and generate PKCE params
|
|
224
|
-
this.performanceClient.setPreQueueTime(
|
|
225
|
-
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
226
|
-
request.correlationId
|
|
227
|
-
);
|
|
228
216
|
const authCodeRequest: CommonAuthorizationCodeRequest =
|
|
229
|
-
await
|
|
217
|
+
await invokeAsync(
|
|
218
|
+
this.initializeAuthorizationCodeRequest.bind(this),
|
|
219
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
220
|
+
this.logger,
|
|
221
|
+
this.performanceClient,
|
|
222
|
+
this.correlationId
|
|
223
|
+
)(validRequest);
|
|
230
224
|
|
|
231
225
|
// Initialize the client
|
|
232
|
-
|
|
226
|
+
const authClient: AuthorizationCodeClient = await invokeAsync(
|
|
227
|
+
this.createAuthCodeClient.bind(this),
|
|
233
228
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
234
|
-
|
|
229
|
+
this.logger,
|
|
230
|
+
this.performanceClient,
|
|
231
|
+
this.correlationId
|
|
232
|
+
)(
|
|
233
|
+
serverTelemetryManager,
|
|
234
|
+
validRequest.authority,
|
|
235
|
+
validRequest.azureCloudOptions
|
|
235
236
|
);
|
|
236
|
-
const authClient: AuthorizationCodeClient =
|
|
237
|
-
await this.createAuthCodeClient(
|
|
238
|
-
serverTelemetryManager,
|
|
239
|
-
validRequest.authority,
|
|
240
|
-
validRequest.azureCloudOptions
|
|
241
|
-
);
|
|
242
|
-
this.logger.verbose("Auth code client created");
|
|
243
237
|
|
|
244
238
|
const isNativeBroker = NativeMessageHandler.isNativeAvailable(
|
|
245
239
|
this.config,
|
|
@@ -294,11 +288,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
294
288
|
// Deserialize hash fragment response parameters.
|
|
295
289
|
const serverParams: ServerAuthorizationCodeResponse =
|
|
296
290
|
UrlString.getDeserializedHash(hash);
|
|
297
|
-
const state = this.validateAndExtractStateFromHash(
|
|
298
|
-
serverParams,
|
|
299
|
-
InteractionType.Popup,
|
|
300
|
-
validRequest.correlationId
|
|
301
|
-
);
|
|
302
291
|
// Remove throttle if it exists
|
|
303
292
|
ThrottlingUtils.removeThrottle(
|
|
304
293
|
this.browserStorage,
|
|
@@ -339,25 +328,19 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
339
328
|
);
|
|
340
329
|
const { userRequestState } = ProtocolUtils.parseRequestState(
|
|
341
330
|
this.browserCrypto,
|
|
342
|
-
state
|
|
331
|
+
validRequest.state
|
|
343
332
|
);
|
|
344
|
-
return nativeInteractionClient
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
})
|
|
350
|
-
.finally(() => {
|
|
351
|
-
this.browserStorage.cleanRequestByState(state);
|
|
352
|
-
});
|
|
333
|
+
return nativeInteractionClient.acquireToken({
|
|
334
|
+
...validRequest,
|
|
335
|
+
state: userRequestState,
|
|
336
|
+
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
|
337
|
+
});
|
|
353
338
|
}
|
|
354
339
|
|
|
355
340
|
// Handle response from hash string.
|
|
356
341
|
const result = await interactionHandler.handleCodeResponseFromHash(
|
|
357
342
|
hash,
|
|
358
|
-
|
|
359
|
-
authClient.authority,
|
|
360
|
-
this.networkClient
|
|
343
|
+
validRequest
|
|
361
344
|
);
|
|
362
345
|
|
|
363
346
|
return result;
|
|
@@ -371,7 +354,6 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
371
354
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
372
355
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
373
356
|
}
|
|
374
|
-
this.browserStorage.cleanRequestByState(validRequest.state);
|
|
375
357
|
throw e;
|
|
376
358
|
}
|
|
377
359
|
}
|
|
@@ -409,15 +391,13 @@ export class PopupClient extends StandardInteractionClient {
|
|
|
409
391
|
await this.clearCacheOnLogout(validRequest.account);
|
|
410
392
|
|
|
411
393
|
// Initialize the client
|
|
412
|
-
|
|
394
|
+
const authClient = await invokeAsync(
|
|
395
|
+
this.createAuthCodeClient.bind(this),
|
|
413
396
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
requestAuthority
|
|
419
|
-
);
|
|
420
|
-
this.logger.verbose("Auth code client created");
|
|
397
|
+
this.logger,
|
|
398
|
+
this.performanceClient,
|
|
399
|
+
this.correlationId
|
|
400
|
+
)(serverTelemetryManager, requestAuthority);
|
|
421
401
|
|
|
422
402
|
try {
|
|
423
403
|
authClient.authority.endSessionEndpoint;
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
IPerformanceClient,
|
|
19
19
|
PerformanceEvents,
|
|
20
20
|
ProtocolMode,
|
|
21
|
+
invokeAsync,
|
|
21
22
|
} from "@azure/msal-common";
|
|
22
23
|
import { StandardInteractionClient } from "./StandardInteractionClient";
|
|
23
24
|
import {
|
|
@@ -26,7 +27,7 @@ import {
|
|
|
26
27
|
TemporaryCacheKeys,
|
|
27
28
|
} from "../utils/BrowserConstants";
|
|
28
29
|
import { RedirectHandler } from "../interaction_handler/RedirectHandler";
|
|
29
|
-
import
|
|
30
|
+
import * as BrowserUtils from "../utils/BrowserUtils";
|
|
30
31
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
31
32
|
import { EventType } from "../event/EventType";
|
|
32
33
|
import { NavigationOptions } from "../navigation/NavigationOptions";
|
|
@@ -78,19 +79,19 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
78
79
|
* @param request
|
|
79
80
|
*/
|
|
80
81
|
async acquireToken(request: RedirectRequest): Promise<void> {
|
|
81
|
-
|
|
82
|
+
const validRequest = await invokeAsync(
|
|
83
|
+
this.initializeAuthorizationRequest.bind(this),
|
|
82
84
|
PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
);
|
|
85
|
+
this.logger,
|
|
86
|
+
this.performanceClient,
|
|
87
|
+
this.correlationId
|
|
88
|
+
)(request, InteractionType.Redirect);
|
|
89
|
+
|
|
89
90
|
this.browserStorage.updateCacheEntries(
|
|
90
91
|
validRequest.state,
|
|
91
92
|
validRequest.nonce,
|
|
92
93
|
validRequest.authority,
|
|
93
|
-
validRequest.loginHint ||
|
|
94
|
+
validRequest.loginHint || "",
|
|
94
95
|
validRequest.account || null
|
|
95
96
|
);
|
|
96
97
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
@@ -113,25 +114,27 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
113
114
|
|
|
114
115
|
try {
|
|
115
116
|
// Create auth code request and generate PKCE params
|
|
116
|
-
this.performanceClient.setPreQueueTime(
|
|
117
|
-
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
118
|
-
request.correlationId
|
|
119
|
-
);
|
|
120
117
|
const authCodeRequest: CommonAuthorizationCodeRequest =
|
|
121
|
-
await
|
|
118
|
+
await invokeAsync(
|
|
119
|
+
this.initializeAuthorizationCodeRequest.bind(this),
|
|
120
|
+
PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest,
|
|
121
|
+
this.logger,
|
|
122
|
+
this.performanceClient,
|
|
123
|
+
this.correlationId
|
|
124
|
+
)(validRequest);
|
|
122
125
|
|
|
123
126
|
// Initialize the client
|
|
124
|
-
|
|
127
|
+
const authClient: AuthorizationCodeClient = await invokeAsync(
|
|
128
|
+
this.createAuthCodeClient.bind(this),
|
|
125
129
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
126
|
-
|
|
130
|
+
this.logger,
|
|
131
|
+
this.performanceClient,
|
|
132
|
+
this.correlationId
|
|
133
|
+
)(
|
|
134
|
+
serverTelemetryManager,
|
|
135
|
+
validRequest.authority,
|
|
136
|
+
validRequest.azureCloudOptions
|
|
127
137
|
);
|
|
128
|
-
const authClient: AuthorizationCodeClient =
|
|
129
|
-
await this.createAuthCodeClient(
|
|
130
|
-
serverTelemetryManager,
|
|
131
|
-
validRequest.authority,
|
|
132
|
-
validRequest.azureCloudOptions
|
|
133
|
-
);
|
|
134
|
-
this.logger.verbose("Auth code client created");
|
|
135
138
|
|
|
136
139
|
// Create redirect interaction handler.
|
|
137
140
|
const interactionHandler = new RedirectHandler(
|
|
@@ -139,7 +142,6 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
139
142
|
this.browserStorage,
|
|
140
143
|
authCodeRequest,
|
|
141
144
|
this.logger,
|
|
142
|
-
this.browserCrypto,
|
|
143
145
|
this.performanceClient
|
|
144
146
|
);
|
|
145
147
|
|
|
@@ -444,15 +446,15 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
444
446
|
BrowserAuthErrorCodes.noCachedAuthorityError
|
|
445
447
|
);
|
|
446
448
|
}
|
|
447
|
-
|
|
449
|
+
|
|
450
|
+
const authClient = await invokeAsync(
|
|
451
|
+
this.createAuthCodeClient.bind(this),
|
|
448
452
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
);
|
|
455
|
-
this.logger.verbose("Auth code client created");
|
|
453
|
+
this.logger,
|
|
454
|
+
this.performanceClient,
|
|
455
|
+
this.correlationId
|
|
456
|
+
)(serverTelemetryManager, currentAuthority);
|
|
457
|
+
|
|
456
458
|
ThrottlingUtils.removeThrottle(
|
|
457
459
|
this.browserStorage,
|
|
458
460
|
this.config.auth.clientId,
|
|
@@ -463,15 +465,9 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
463
465
|
this.browserStorage,
|
|
464
466
|
cachedRequest,
|
|
465
467
|
this.logger,
|
|
466
|
-
this.browserCrypto,
|
|
467
468
|
this.performanceClient
|
|
468
469
|
);
|
|
469
|
-
return await interactionHandler.handleCodeResponseFromHash(
|
|
470
|
-
hash,
|
|
471
|
-
state,
|
|
472
|
-
authClient.authority,
|
|
473
|
-
this.networkClient
|
|
474
|
-
);
|
|
470
|
+
return await interactionHandler.handleCodeResponseFromHash(hash, state);
|
|
475
471
|
}
|
|
476
472
|
|
|
477
473
|
/**
|
|
@@ -501,15 +497,14 @@ export class RedirectClient extends StandardInteractionClient {
|
|
|
501
497
|
timeout: this.config.system.redirectNavigationTimeout,
|
|
502
498
|
noHistory: false,
|
|
503
499
|
};
|
|
504
|
-
|
|
500
|
+
|
|
501
|
+
const authClient = await invokeAsync(
|
|
502
|
+
this.createAuthCodeClient.bind(this),
|
|
505
503
|
PerformanceEvents.StandardInteractionClientCreateAuthCodeClient,
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
logoutRequest && logoutRequest.authority
|
|
511
|
-
);
|
|
512
|
-
this.logger.verbose("Auth code client created");
|
|
504
|
+
this.logger,
|
|
505
|
+
this.performanceClient,
|
|
506
|
+
this.correlationId
|
|
507
|
+
)(serverTelemetryManager, logoutRequest && logoutRequest.authority);
|
|
513
508
|
|
|
514
509
|
if (authClient.authority.protocolMode === ProtocolMode.OIDC) {
|
|
515
510
|
try {
|
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
Logger,
|
|
9
9
|
CommonAuthorizationCodeRequest,
|
|
10
10
|
AuthError,
|
|
11
|
-
Constants,
|
|
12
11
|
IPerformanceClient,
|
|
13
12
|
PerformanceEvents,
|
|
14
13
|
invokeAsync,
|
|
@@ -24,11 +23,11 @@ import {
|
|
|
24
23
|
BrowserAuthErrorCodes,
|
|
25
24
|
} from "../error/BrowserAuthError";
|
|
26
25
|
import { InteractionType, ApiId } from "../utils/BrowserConstants";
|
|
27
|
-
import { SilentHandler } from "../interaction_handler/SilentHandler";
|
|
28
26
|
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
|
|
29
27
|
import { HybridSpaAuthorizationCodeClient } from "./HybridSpaAuthorizationCodeClient";
|
|
30
28
|
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
|
|
31
29
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
30
|
+
import { InteractionHandler } from "../interaction_handler/InteractionHandler";
|
|
32
31
|
|
|
33
32
|
export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
34
33
|
private apiId: ApiId;
|
|
@@ -81,13 +80,6 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
81
80
|
this.performanceClient,
|
|
82
81
|
request.correlationId
|
|
83
82
|
)(request, InteractionType.Silent);
|
|
84
|
-
this.browserStorage.updateCacheEntries(
|
|
85
|
-
silentRequest.state,
|
|
86
|
-
silentRequest.nonce,
|
|
87
|
-
silentRequest.authority,
|
|
88
|
-
silentRequest.loginHint || Constants.EMPTY_STRING,
|
|
89
|
-
silentRequest.account || null
|
|
90
|
-
);
|
|
91
83
|
|
|
92
84
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
93
85
|
this.apiId
|
|
@@ -113,18 +105,19 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
113
105
|
this.logger.verbose("Auth code client created");
|
|
114
106
|
|
|
115
107
|
// Create silent handler
|
|
116
|
-
const
|
|
108
|
+
const interactionHandler = new InteractionHandler(
|
|
117
109
|
authClient,
|
|
118
110
|
this.browserStorage,
|
|
119
111
|
authCodeRequest,
|
|
120
112
|
this.logger,
|
|
121
|
-
this.config.system,
|
|
122
113
|
this.performanceClient
|
|
123
114
|
);
|
|
124
115
|
|
|
125
116
|
// Handle auth code parameters from request
|
|
126
117
|
return invokeAsync(
|
|
127
|
-
|
|
118
|
+
interactionHandler.handleCodeResponseFromServer.bind(
|
|
119
|
+
interactionHandler
|
|
120
|
+
),
|
|
128
121
|
PerformanceEvents.HandleCodeResponseFromServer,
|
|
129
122
|
this.logger,
|
|
130
123
|
this.performanceClient,
|
|
@@ -136,9 +129,7 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
136
129
|
cloud_graph_host_name: request.cloudGraphHostName,
|
|
137
130
|
cloud_instance_host_name: request.cloudInstanceHostName,
|
|
138
131
|
},
|
|
139
|
-
silentRequest
|
|
140
|
-
authClient.authority,
|
|
141
|
-
this.networkClient,
|
|
132
|
+
silentRequest,
|
|
142
133
|
false
|
|
143
134
|
);
|
|
144
135
|
} catch (e) {
|
|
@@ -146,7 +137,6 @@ export class SilentAuthCodeClient extends StandardInteractionClient {
|
|
|
146
137
|
(e as AuthError).setCorrelationId(this.correlationId);
|
|
147
138
|
serverTelemetryManager.cacheFailedRequest(e);
|
|
148
139
|
}
|
|
149
|
-
this.browserStorage.cleanRequestByState(silentRequest.state);
|
|
150
140
|
throw e;
|
|
151
141
|
}
|
|
152
142
|
}
|
|
@@ -30,6 +30,10 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
30
30
|
async acquireToken(
|
|
31
31
|
silentRequest: CommonSilentFlowRequest
|
|
32
32
|
): Promise<AuthenticationResult> {
|
|
33
|
+
this.performanceClient.addQueueMeasurement(
|
|
34
|
+
PerformanceEvents.SilentCacheClientAcquireToken,
|
|
35
|
+
silentRequest.correlationId
|
|
36
|
+
);
|
|
33
37
|
// Telemetry manager only used to increment cacheHits here
|
|
34
38
|
const serverTelemetryManager = this.initializeServerTelemetryManager(
|
|
35
39
|
ApiId.acquireTokenSilent_silentFlow
|
|
@@ -43,9 +47,13 @@ export class SilentCacheClient extends StandardInteractionClient {
|
|
|
43
47
|
this.logger.verbose("Silent auth client created");
|
|
44
48
|
|
|
45
49
|
try {
|
|
46
|
-
const response = await
|
|
47
|
-
|
|
48
|
-
|
|
50
|
+
const response = await invokeAsync(
|
|
51
|
+
silentAuthClient.acquireCachedToken.bind(silentAuthClient),
|
|
52
|
+
PerformanceEvents.SilentFlowClientAcquireCachedToken,
|
|
53
|
+
this.logger,
|
|
54
|
+
this.performanceClient,
|
|
55
|
+
silentRequest.correlationId
|
|
56
|
+
)(silentRequest);
|
|
49
57
|
const authResponse = response[0] as AuthenticationResult;
|
|
50
58
|
|
|
51
59
|
this.performanceClient.addFields(
|