@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
|
@@ -10,22 +10,24 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
Logger,
|
|
12
12
|
AuthError,
|
|
13
|
+
createAuthError,
|
|
14
|
+
AuthErrorCodes,
|
|
13
15
|
AuthenticationScheme,
|
|
14
16
|
InProgressPerformanceEvent,
|
|
15
17
|
PerformanceEvents,
|
|
16
18
|
IPerformanceClient,
|
|
17
|
-
ICrypto,
|
|
18
19
|
} from "@azure/msal-common";
|
|
19
20
|
import {
|
|
20
21
|
NativeExtensionRequest,
|
|
21
22
|
NativeExtensionRequestBody,
|
|
22
23
|
} from "./NativeRequest";
|
|
23
|
-
import {
|
|
24
|
+
import { createNativeAuthError } from "../../error/NativeAuthError";
|
|
24
25
|
import {
|
|
25
26
|
createBrowserAuthError,
|
|
26
27
|
BrowserAuthErrorCodes,
|
|
27
28
|
} from "../../error/BrowserAuthError";
|
|
28
29
|
import { BrowserConfiguration } from "../../config/Configuration";
|
|
30
|
+
import { createNewGuid } from "../../crypto/BrowserCrypto";
|
|
29
31
|
|
|
30
32
|
type ResponseResolvers<T> = {
|
|
31
33
|
resolve: (value: T | PromiseLike<T>) => void;
|
|
@@ -38,7 +40,6 @@ export class NativeMessageHandler {
|
|
|
38
40
|
private extensionId: string | undefined;
|
|
39
41
|
private extensionVersion: string | undefined;
|
|
40
42
|
private logger: Logger;
|
|
41
|
-
private crypto: ICrypto;
|
|
42
43
|
private readonly handshakeTimeoutMs: number;
|
|
43
44
|
private timeoutId: number | undefined;
|
|
44
45
|
private resolvers: Map<string, ResponseResolvers<object>>;
|
|
@@ -52,7 +53,6 @@ export class NativeMessageHandler {
|
|
|
52
53
|
logger: Logger,
|
|
53
54
|
handshakeTimeoutMs: number,
|
|
54
55
|
performanceClient: IPerformanceClient,
|
|
55
|
-
crypto: ICrypto,
|
|
56
56
|
extensionId?: string
|
|
57
57
|
) {
|
|
58
58
|
this.logger = logger;
|
|
@@ -66,7 +66,6 @@ export class NativeMessageHandler {
|
|
|
66
66
|
this.handshakeEvent = performanceClient.startMeasurement(
|
|
67
67
|
PerformanceEvents.NativeMessageHandlerHandshake
|
|
68
68
|
);
|
|
69
|
-
this.crypto = crypto;
|
|
70
69
|
}
|
|
71
70
|
|
|
72
71
|
/**
|
|
@@ -78,7 +77,7 @@ export class NativeMessageHandler {
|
|
|
78
77
|
const req: NativeExtensionRequest = {
|
|
79
78
|
channel: NativeConstants.CHANNEL_ID,
|
|
80
79
|
extensionId: this.extensionId,
|
|
81
|
-
responseId:
|
|
80
|
+
responseId: createNewGuid(),
|
|
82
81
|
body: body,
|
|
83
82
|
};
|
|
84
83
|
|
|
@@ -107,8 +106,7 @@ export class NativeMessageHandler {
|
|
|
107
106
|
static async createProvider(
|
|
108
107
|
logger: Logger,
|
|
109
108
|
handshakeTimeoutMs: number,
|
|
110
|
-
performanceClient: IPerformanceClient
|
|
111
|
-
crypto: ICrypto
|
|
109
|
+
performanceClient: IPerformanceClient
|
|
112
110
|
): Promise<NativeMessageHandler> {
|
|
113
111
|
logger.trace("NativeMessageHandler - createProvider called.");
|
|
114
112
|
try {
|
|
@@ -116,7 +114,6 @@ export class NativeMessageHandler {
|
|
|
116
114
|
logger,
|
|
117
115
|
handshakeTimeoutMs,
|
|
118
116
|
performanceClient,
|
|
119
|
-
crypto,
|
|
120
117
|
NativeConstants.PREFERRED_EXTENSION_ID
|
|
121
118
|
);
|
|
122
119
|
await preferredProvider.sendHandshakeRequest();
|
|
@@ -126,8 +123,7 @@ export class NativeMessageHandler {
|
|
|
126
123
|
const backupProvider = new NativeMessageHandler(
|
|
127
124
|
logger,
|
|
128
125
|
handshakeTimeoutMs,
|
|
129
|
-
performanceClient
|
|
130
|
-
crypto
|
|
126
|
+
performanceClient
|
|
131
127
|
);
|
|
132
128
|
await backupProvider.sendHandshakeRequest();
|
|
133
129
|
return backupProvider;
|
|
@@ -147,7 +143,7 @@ export class NativeMessageHandler {
|
|
|
147
143
|
const req: NativeExtensionRequest = {
|
|
148
144
|
channel: NativeConstants.CHANNEL_ID,
|
|
149
145
|
extensionId: this.extensionId,
|
|
150
|
-
responseId:
|
|
146
|
+
responseId: createNewGuid(),
|
|
151
147
|
body: {
|
|
152
148
|
method: NativeExtensionMethod.HandshakeRequest,
|
|
153
149
|
},
|
|
@@ -283,7 +279,7 @@ export class NativeMessageHandler {
|
|
|
283
279
|
);
|
|
284
280
|
if (response.status !== "Success") {
|
|
285
281
|
resolver.reject(
|
|
286
|
-
|
|
282
|
+
createNativeAuthError(
|
|
287
283
|
response.code,
|
|
288
284
|
response.description,
|
|
289
285
|
response.ext
|
|
@@ -295,7 +291,7 @@ export class NativeMessageHandler {
|
|
|
295
291
|
response.result["description"]
|
|
296
292
|
) {
|
|
297
293
|
resolver.reject(
|
|
298
|
-
|
|
294
|
+
createNativeAuthError(
|
|
299
295
|
response.result["code"],
|
|
300
296
|
response.result["description"],
|
|
301
297
|
response.result["ext"]
|
|
@@ -305,7 +301,8 @@ export class NativeMessageHandler {
|
|
|
305
301
|
resolver.resolve(response.result);
|
|
306
302
|
}
|
|
307
303
|
} else {
|
|
308
|
-
throw
|
|
304
|
+
throw createAuthError(
|
|
305
|
+
AuthErrorCodes.unexpectedError,
|
|
309
306
|
"Event does not contain result."
|
|
310
307
|
);
|
|
311
308
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Status Codes that can be thrown by WAM
|
|
7
|
+
export const USER_INTERACTION_REQUIRED = "USER_INTERACTION_REQUIRED";
|
|
8
|
+
export const USER_CANCEL = "USER_CANCEL";
|
|
9
|
+
export const NO_NETWORK = "NO_NETWORK";
|
|
10
|
+
export const TRANSIENT_ERROR = "TRANSIENT_ERROR";
|
|
11
|
+
export const PERSISTENT_ERROR = "PERSISTENT_ERROR";
|
|
12
|
+
export const DISABLED = "DISABLED";
|
|
13
|
+
export const ACCOUNT_UNAVAILABLE = "ACCOUNT_UNAVAILABLE";
|
|
@@ -27,11 +27,15 @@ import {
|
|
|
27
27
|
CcsCredentialType,
|
|
28
28
|
AuthToken,
|
|
29
29
|
ValidCredentialType,
|
|
30
|
-
ClientAuthError,
|
|
31
30
|
TokenKeys,
|
|
32
31
|
CredentialType,
|
|
33
32
|
CacheRecord,
|
|
34
33
|
AuthenticationScheme,
|
|
34
|
+
createClientAuthError,
|
|
35
|
+
ClientAuthErrorCodes,
|
|
36
|
+
PerformanceEvents,
|
|
37
|
+
IPerformanceClient,
|
|
38
|
+
StaticAuthorityOptions,
|
|
35
39
|
} from "@azure/msal-common";
|
|
36
40
|
import { CacheOptions } from "../config/Configuration";
|
|
37
41
|
import {
|
|
@@ -82,9 +86,10 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
82
86
|
clientId: string,
|
|
83
87
|
cacheConfig: Required<CacheOptions>,
|
|
84
88
|
cryptoImpl: ICrypto,
|
|
85
|
-
logger: Logger
|
|
89
|
+
logger: Logger,
|
|
90
|
+
staticAuthorityOptions?: StaticAuthorityOptions
|
|
86
91
|
) {
|
|
87
|
-
super(clientId, cryptoImpl, logger);
|
|
92
|
+
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
|
88
93
|
this.cacheConfig = cacheConfig;
|
|
89
94
|
this.logger = logger;
|
|
90
95
|
this.internalStorage = new MemoryStorage();
|
|
@@ -614,7 +619,9 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
614
619
|
this.logger.error(
|
|
615
620
|
`BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: ${type}`
|
|
616
621
|
);
|
|
617
|
-
|
|
622
|
+
throw createClientAuthError(
|
|
623
|
+
ClientAuthErrorCodes.unexpectedCredentialType
|
|
624
|
+
);
|
|
618
625
|
}
|
|
619
626
|
|
|
620
627
|
this.setItem(
|
|
@@ -685,7 +692,9 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
685
692
|
this.logger.error(
|
|
686
693
|
`BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: ${type}`
|
|
687
694
|
);
|
|
688
|
-
|
|
695
|
+
throw createClientAuthError(
|
|
696
|
+
ClientAuthErrorCodes.unexpectedCredentialType
|
|
697
|
+
);
|
|
689
698
|
}
|
|
690
699
|
|
|
691
700
|
this.setItem(
|
|
@@ -1021,10 +1030,9 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1021
1030
|
);
|
|
1022
1031
|
return null;
|
|
1023
1032
|
}
|
|
1024
|
-
const activeAccount =
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
})[0] || null;
|
|
1033
|
+
const activeAccount = this.getAccountInfoFilteredBy({
|
|
1034
|
+
localAccountId: activeAccountValueLocal,
|
|
1035
|
+
});
|
|
1028
1036
|
if (activeAccount) {
|
|
1029
1037
|
this.logger.trace(
|
|
1030
1038
|
"BrowserCacheManager.getActiveAccount: Legacy active account cache schema found"
|
|
@@ -1044,12 +1052,10 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1044
1052
|
this.logger.trace(
|
|
1045
1053
|
"BrowserCacheManager.getActiveAccount: Active account filters schema found"
|
|
1046
1054
|
);
|
|
1047
|
-
return (
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
})[0] || null
|
|
1052
|
-
);
|
|
1055
|
+
return this.getAccountInfoFilteredBy({
|
|
1056
|
+
homeAccountId: activeAccountValueObj.homeAccountId,
|
|
1057
|
+
localAccountId: activeAccountValueObj.localAccountId,
|
|
1058
|
+
});
|
|
1053
1059
|
}
|
|
1054
1060
|
this.logger.trace(
|
|
1055
1061
|
"BrowserCacheManager.getActiveAccount: No active account found"
|
|
@@ -1091,92 +1097,6 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1091
1097
|
}
|
|
1092
1098
|
}
|
|
1093
1099
|
|
|
1094
|
-
/**
|
|
1095
|
-
* Gets a list of accounts that match all of the filters provided
|
|
1096
|
-
* @param account
|
|
1097
|
-
*/
|
|
1098
|
-
getAccountInfoByFilter(
|
|
1099
|
-
accountFilter: Partial<Omit<AccountInfo, "idTokenClaims" | "name">>
|
|
1100
|
-
): AccountInfo[] {
|
|
1101
|
-
const allAccounts = this.getAllAccounts();
|
|
1102
|
-
this.logger.trace(
|
|
1103
|
-
`BrowserCacheManager.getAccountInfoByFilter: total ${allAccounts.length} accounts found`
|
|
1104
|
-
);
|
|
1105
|
-
|
|
1106
|
-
return allAccounts.filter((accountObj) => {
|
|
1107
|
-
if (
|
|
1108
|
-
accountFilter.username &&
|
|
1109
|
-
accountFilter.username.toLowerCase() !==
|
|
1110
|
-
accountObj.username.toLowerCase()
|
|
1111
|
-
) {
|
|
1112
|
-
return false;
|
|
1113
|
-
}
|
|
1114
|
-
|
|
1115
|
-
if (
|
|
1116
|
-
accountFilter.homeAccountId &&
|
|
1117
|
-
accountFilter.homeAccountId !== accountObj.homeAccountId
|
|
1118
|
-
) {
|
|
1119
|
-
return false;
|
|
1120
|
-
}
|
|
1121
|
-
|
|
1122
|
-
if (
|
|
1123
|
-
accountFilter.localAccountId &&
|
|
1124
|
-
accountFilter.localAccountId !== accountObj.localAccountId
|
|
1125
|
-
) {
|
|
1126
|
-
return false;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
|
-
if (
|
|
1130
|
-
accountFilter.tenantId &&
|
|
1131
|
-
accountFilter.tenantId !== accountObj.tenantId
|
|
1132
|
-
) {
|
|
1133
|
-
return false;
|
|
1134
|
-
}
|
|
1135
|
-
|
|
1136
|
-
if (
|
|
1137
|
-
accountFilter.environment &&
|
|
1138
|
-
accountFilter.environment !== accountObj.environment
|
|
1139
|
-
) {
|
|
1140
|
-
return false;
|
|
1141
|
-
}
|
|
1142
|
-
|
|
1143
|
-
return true;
|
|
1144
|
-
});
|
|
1145
|
-
}
|
|
1146
|
-
|
|
1147
|
-
/**
|
|
1148
|
-
* Checks the cache for accounts matching loginHint or SID
|
|
1149
|
-
* @param loginHint
|
|
1150
|
-
* @param sid
|
|
1151
|
-
*/
|
|
1152
|
-
getAccountInfoByHints(
|
|
1153
|
-
loginHint?: string,
|
|
1154
|
-
sid?: string
|
|
1155
|
-
): AccountInfo | null {
|
|
1156
|
-
const matchingAccounts = this.getAllAccounts().filter((accountInfo) => {
|
|
1157
|
-
if (sid) {
|
|
1158
|
-
const accountSid =
|
|
1159
|
-
accountInfo.idTokenClaims &&
|
|
1160
|
-
accountInfo.idTokenClaims["sid"];
|
|
1161
|
-
return sid === accountSid;
|
|
1162
|
-
}
|
|
1163
|
-
|
|
1164
|
-
if (loginHint) {
|
|
1165
|
-
return loginHint === accountInfo.username;
|
|
1166
|
-
}
|
|
1167
|
-
|
|
1168
|
-
return false;
|
|
1169
|
-
});
|
|
1170
|
-
|
|
1171
|
-
if (matchingAccounts.length === 1) {
|
|
1172
|
-
return matchingAccounts[0];
|
|
1173
|
-
} else if (matchingAccounts.length > 1) {
|
|
1174
|
-
throw ClientAuthError.createMultipleMatchingAccountsInCacheError();
|
|
1175
|
-
}
|
|
1176
|
-
|
|
1177
|
-
return null;
|
|
1178
|
-
}
|
|
1179
|
-
|
|
1180
1100
|
/**
|
|
1181
1101
|
* fetch throttling entity from the platform cache
|
|
1182
1102
|
* @param throttlingCacheKey
|
|
@@ -1353,10 +1273,16 @@ export class BrowserCacheManager extends CacheManager {
|
|
|
1353
1273
|
|
|
1354
1274
|
/**
|
|
1355
1275
|
* Clears all access tokes that have claims prior to saving the current one
|
|
1356
|
-
* @param
|
|
1276
|
+
* @param performanceClient {IPerformanceClient}
|
|
1357
1277
|
* @returns
|
|
1358
1278
|
*/
|
|
1359
|
-
async clearTokensAndKeysWithClaims(
|
|
1279
|
+
async clearTokensAndKeysWithClaims(
|
|
1280
|
+
performanceClient: IPerformanceClient
|
|
1281
|
+
): Promise<void> {
|
|
1282
|
+
performanceClient.addQueueMeasurement(
|
|
1283
|
+
PerformanceEvents.ClearTokensAndKeysWithClaims
|
|
1284
|
+
);
|
|
1285
|
+
|
|
1360
1286
|
const tokenKeys = this.getTokenKeys();
|
|
1361
1287
|
|
|
1362
1288
|
const removedAccessTokens: Array<Promise<void>> = [];
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
BrowserConfigurationAuthErrorCodes,
|
|
8
|
+
createBrowserConfigurationAuthError,
|
|
9
|
+
} from "../error/BrowserConfigurationAuthError";
|
|
7
10
|
import { BrowserCacheLocation } from "../utils/BrowserConstants";
|
|
8
11
|
import { IWindowStorage } from "./IWindowStorage";
|
|
9
12
|
|
|
@@ -17,17 +20,12 @@ export class BrowserStorage implements IWindowStorage<string> {
|
|
|
17
20
|
|
|
18
21
|
private validateWindowStorage(cacheLocation: string): void {
|
|
19
22
|
if (
|
|
20
|
-
cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
21
|
-
|
|
23
|
+
(cacheLocation !== BrowserCacheLocation.LocalStorage &&
|
|
24
|
+
cacheLocation !== BrowserCacheLocation.SessionStorage) ||
|
|
25
|
+
!window[cacheLocation]
|
|
22
26
|
) {
|
|
23
|
-
throw
|
|
24
|
-
|
|
25
|
-
);
|
|
26
|
-
}
|
|
27
|
-
const storageSupported = !!window[cacheLocation];
|
|
28
|
-
if (!storageSupported) {
|
|
29
|
-
throw BrowserConfigurationAuthError.createStorageNotSupportedError(
|
|
30
|
-
cacheLocation
|
|
27
|
+
throw createBrowserConfigurationAuthError(
|
|
28
|
+
BrowserConfigurationAuthErrorCodes.storageNotSupported
|
|
31
29
|
);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
@@ -17,9 +17,11 @@ import {
|
|
|
17
17
|
AzureCloudInstance,
|
|
18
18
|
AzureCloudOptions,
|
|
19
19
|
ApplicationTelemetry,
|
|
20
|
-
|
|
20
|
+
createClientConfigurationError,
|
|
21
|
+
ClientConfigurationErrorCodes,
|
|
21
22
|
IPerformanceClient,
|
|
22
23
|
StubPerformanceClient,
|
|
24
|
+
Logger,
|
|
23
25
|
} from "@azure/msal-common";
|
|
24
26
|
import {
|
|
25
27
|
BrowserCacheLocation,
|
|
@@ -91,6 +93,10 @@ export type BrowserAuthOptions = {
|
|
|
91
93
|
* Flag of whether to use the local metadata cache
|
|
92
94
|
*/
|
|
93
95
|
skipAuthorityMetadataCache?: boolean;
|
|
96
|
+
/**
|
|
97
|
+
* App supports nested app auth or not; defaults to false
|
|
98
|
+
*/
|
|
99
|
+
supportsNestedAppAuth?: boolean;
|
|
94
100
|
};
|
|
95
101
|
|
|
96
102
|
/** @internal */
|
|
@@ -271,6 +277,7 @@ export function buildConfiguration(
|
|
|
271
277
|
tenant: Constants.EMPTY_STRING,
|
|
272
278
|
},
|
|
273
279
|
skipAuthorityMetadataCache: false,
|
|
280
|
+
supportsNestedAppAuth: false,
|
|
274
281
|
};
|
|
275
282
|
|
|
276
283
|
// Default cache options for browser
|
|
@@ -323,7 +330,8 @@ export function buildConfiguration(
|
|
|
323
330
|
pollIntervalMilliseconds: BrowserConstants.DEFAULT_POLL_INTERVAL_MS,
|
|
324
331
|
};
|
|
325
332
|
|
|
326
|
-
const providedSystemOptions: BrowserSystemOptions = {
|
|
333
|
+
const providedSystemOptions: Required<BrowserSystemOptions> = {
|
|
334
|
+
...DEFAULT_BROWSER_SYSTEM_OPTIONS,
|
|
327
335
|
...userInputSystem,
|
|
328
336
|
loggerOptions: userInputSystem?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
|
|
329
337
|
};
|
|
@@ -341,10 +349,13 @@ export function buildConfiguration(
|
|
|
341
349
|
userInputAuth?.protocolMode !== ProtocolMode.OIDC &&
|
|
342
350
|
userInputAuth?.OIDCOptions
|
|
343
351
|
) {
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
352
|
+
const logger = new Logger(providedSystemOptions.loggerOptions);
|
|
353
|
+
logger.warning(
|
|
354
|
+
JSON.stringify(
|
|
355
|
+
createClientConfigurationError(
|
|
356
|
+
ClientConfigurationErrorCodes.cannotSetOIDCOptions
|
|
357
|
+
)
|
|
358
|
+
)
|
|
348
359
|
);
|
|
349
360
|
}
|
|
350
361
|
|
|
@@ -354,7 +365,9 @@ export function buildConfiguration(
|
|
|
354
365
|
userInputAuth.protocolMode !== ProtocolMode.AAD &&
|
|
355
366
|
providedSystemOptions?.allowNativeBroker
|
|
356
367
|
) {
|
|
357
|
-
throw
|
|
368
|
+
throw createClientConfigurationError(
|
|
369
|
+
ClientConfigurationErrorCodes.cannotAllowNativeBroker
|
|
370
|
+
);
|
|
358
371
|
}
|
|
359
372
|
|
|
360
373
|
const overlayedConfig: BrowserConfiguration = {
|
|
@@ -367,7 +380,7 @@ export function buildConfiguration(
|
|
|
367
380
|
},
|
|
368
381
|
},
|
|
369
382
|
cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },
|
|
370
|
-
system:
|
|
383
|
+
system: providedSystemOptions,
|
|
371
384
|
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry },
|
|
372
385
|
};
|
|
373
386
|
|
|
@@ -25,31 +25,42 @@ export class ControllerFactory {
|
|
|
25
25
|
this.logger = new Logger(loggerOptions, name, version);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
async
|
|
28
|
+
async createV3Controller(): Promise<IController> {
|
|
29
29
|
const standard = new StandardOperatingContext(this.config);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
return
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
30
|
+
|
|
31
|
+
await standard.initialize();
|
|
32
|
+
|
|
33
|
+
const controller = await import("./StandardController");
|
|
34
|
+
return await controller.StandardController.createController(standard);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
async createController(): Promise<IController | null> {
|
|
38
|
+
const standard = new StandardOperatingContext(this.config);
|
|
39
|
+
const teamsApp = new TeamsAppOperatingContext(this.config);
|
|
40
|
+
|
|
41
|
+
const operatingContexts = [
|
|
42
|
+
standard.initialize(),
|
|
43
|
+
teamsApp.initialize(),
|
|
44
|
+
];
|
|
45
|
+
|
|
46
|
+
await Promise.all(operatingContexts);
|
|
47
|
+
|
|
48
|
+
if (
|
|
49
|
+
teamsApp.isAvailable() &&
|
|
50
|
+
teamsApp.getConfig().auth.supportsNestedAppAuth
|
|
51
|
+
) {
|
|
52
|
+
const controller = await import("./NestedAppAuthController");
|
|
53
|
+
return await controller.NestedAppAuthController.createController(
|
|
54
|
+
teamsApp
|
|
55
|
+
);
|
|
56
|
+
} else if (standard.isAvailable()) {
|
|
57
|
+
const controller = await import("./StandardController");
|
|
58
|
+
return await controller.StandardController.createController(
|
|
59
|
+
standard
|
|
60
|
+
);
|
|
61
|
+
} else {
|
|
62
|
+
// Since neither of the actual operating contexts are available keep the UnknownOperatingContextController
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
54
65
|
}
|
|
55
66
|
}
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
PerformanceCallbackFunction,
|
|
10
10
|
IPerformanceClient,
|
|
11
11
|
CommonSilentFlowRequest,
|
|
12
|
+
AccountFilter,
|
|
12
13
|
} from "@azure/msal-common";
|
|
13
14
|
import { RedirectRequest } from "../request/RedirectRequest";
|
|
14
15
|
import { PopupRequest } from "../request/PopupRequest";
|
|
@@ -64,13 +65,15 @@ export interface IController {
|
|
|
64
65
|
|
|
65
66
|
disableAccountStorageEvents(): void;
|
|
66
67
|
|
|
68
|
+
getAccount(accountFilter: AccountFilter): AccountInfo | null;
|
|
69
|
+
|
|
67
70
|
getAccountByHomeId(homeAccountId: string): AccountInfo | null;
|
|
68
71
|
|
|
69
72
|
getAccountByLocalId(localId: string): AccountInfo | null;
|
|
70
73
|
|
|
71
74
|
getAccountByUsername(userName: string): AccountInfo | null;
|
|
72
75
|
|
|
73
|
-
getAllAccounts(): AccountInfo[];
|
|
76
|
+
getAllAccounts(accountFilter?: AccountFilter): AccountInfo[];
|
|
74
77
|
|
|
75
78
|
handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;
|
|
76
79
|
|