@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
|
@@ -19,7 +19,6 @@ import {
|
|
|
19
19
|
IPerformanceClient,
|
|
20
20
|
BaseAuthRequest,
|
|
21
21
|
PromptValue,
|
|
22
|
-
ClientAuthError,
|
|
23
22
|
InProgressPerformanceEvent,
|
|
24
23
|
RequestThumbprint,
|
|
25
24
|
ServerError,
|
|
@@ -27,6 +26,10 @@ import {
|
|
|
27
26
|
ServerResponseType,
|
|
28
27
|
UrlString,
|
|
29
28
|
invokeAsync,
|
|
29
|
+
createClientAuthError,
|
|
30
|
+
ClientAuthErrorCodes,
|
|
31
|
+
AccountFilter,
|
|
32
|
+
buildStaticAuthorityOptions,
|
|
30
33
|
} from "@azure/msal-common";
|
|
31
34
|
import {
|
|
32
35
|
BrowserCacheManager,
|
|
@@ -43,14 +46,17 @@ import {
|
|
|
43
46
|
DEFAULT_REQUEST,
|
|
44
47
|
BrowserConstants,
|
|
45
48
|
} from "../utils/BrowserConstants";
|
|
46
|
-
import
|
|
49
|
+
import * as BrowserUtils from "../utils/BrowserUtils";
|
|
47
50
|
import { RedirectRequest } from "../request/RedirectRequest";
|
|
48
51
|
import { PopupRequest } from "../request/PopupRequest";
|
|
49
52
|
import { SsoSilentRequest } from "../request/SsoSilentRequest";
|
|
50
53
|
import { EventCallbackFunction, EventError } from "../event/EventMessage";
|
|
51
54
|
import { EventType } from "../event/EventType";
|
|
52
55
|
import { EndSessionRequest } from "../request/EndSessionRequest";
|
|
53
|
-
import {
|
|
56
|
+
import {
|
|
57
|
+
BrowserConfigurationAuthErrorCodes,
|
|
58
|
+
createBrowserConfigurationAuthError,
|
|
59
|
+
} from "../error/BrowserConfigurationAuthError";
|
|
54
60
|
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
|
|
55
61
|
import { INavigationClient } from "../navigation/INavigationClient";
|
|
56
62
|
import { EventHandler } from "../event/EventHandler";
|
|
@@ -63,7 +69,10 @@ import { ITokenCache } from "../cache/ITokenCache";
|
|
|
63
69
|
import { NativeInteractionClient } from "../interaction_client/NativeInteractionClient";
|
|
64
70
|
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
|
|
65
71
|
import { SilentRequest } from "../request/SilentRequest";
|
|
66
|
-
import {
|
|
72
|
+
import {
|
|
73
|
+
NativeAuthError,
|
|
74
|
+
isFatalNativeAuthError,
|
|
75
|
+
} from "../error/NativeAuthError";
|
|
67
76
|
import { SilentCacheClient } from "../interaction_client/SilentCacheClient";
|
|
68
77
|
import { SilentAuthCodeClient } from "../interaction_client/SilentAuthCodeClient";
|
|
69
78
|
import {
|
|
@@ -77,6 +86,7 @@ import { BaseOperatingContext } from "../operatingcontext/BaseOperatingContext";
|
|
|
77
86
|
import { IController } from "./IController";
|
|
78
87
|
import { AuthenticationResult } from "../response/AuthenticationResult";
|
|
79
88
|
import { ClearCacheRequest } from "../request/ClearCacheRequest";
|
|
89
|
+
import { createNewGuid } from "../crypto/BrowserCrypto";
|
|
80
90
|
|
|
81
91
|
export class StandardController implements IController {
|
|
82
92
|
// OperatingContext
|
|
@@ -198,7 +208,8 @@ export class StandardController implements IController {
|
|
|
198
208
|
this.config.auth.clientId,
|
|
199
209
|
this.config.cache,
|
|
200
210
|
this.browserCrypto,
|
|
201
|
-
this.logger
|
|
211
|
+
this.logger,
|
|
212
|
+
buildStaticAuthorityOptions(this.config.auth)
|
|
202
213
|
)
|
|
203
214
|
: DEFAULT_BROWSER_CACHE_MANAGER(
|
|
204
215
|
this.config.auth.clientId,
|
|
@@ -281,8 +292,7 @@ export class StandardController implements IController {
|
|
|
281
292
|
await NativeMessageHandler.createProvider(
|
|
282
293
|
this.logger,
|
|
283
294
|
this.config.system.nativeBrokerHandshakeTimeout,
|
|
284
|
-
this.performanceClient
|
|
285
|
-
this.browserCrypto
|
|
295
|
+
this.performanceClient
|
|
286
296
|
);
|
|
287
297
|
} catch (e) {
|
|
288
298
|
this.logger.verbose(e as string);
|
|
@@ -301,7 +311,7 @@ export class StandardController implements IController {
|
|
|
301
311
|
PerformanceEvents.ClearTokensAndKeysWithClaims,
|
|
302
312
|
this.logger,
|
|
303
313
|
this.performanceClient
|
|
304
|
-
)();
|
|
314
|
+
)(this.performanceClient);
|
|
305
315
|
}
|
|
306
316
|
|
|
307
317
|
this.initialized = true;
|
|
@@ -528,7 +538,10 @@ export class StandardController implements IController {
|
|
|
528
538
|
result = nativeClient
|
|
529
539
|
.acquireTokenRedirect(request)
|
|
530
540
|
.catch((e: AuthError) => {
|
|
531
|
-
if (
|
|
541
|
+
if (
|
|
542
|
+
e instanceof NativeAuthError &&
|
|
543
|
+
isFatalNativeAuthError(e)
|
|
544
|
+
) {
|
|
532
545
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
533
546
|
const redirectClient = this.createRedirectClient(
|
|
534
547
|
request.correlationId
|
|
@@ -630,7 +643,10 @@ export class StandardController implements IController {
|
|
|
630
643
|
return response;
|
|
631
644
|
})
|
|
632
645
|
.catch((e: AuthError) => {
|
|
633
|
-
if (
|
|
646
|
+
if (
|
|
647
|
+
e instanceof NativeAuthError &&
|
|
648
|
+
isFatalNativeAuthError(e)
|
|
649
|
+
) {
|
|
634
650
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
635
651
|
const popupClient = this.createPopupClient(
|
|
636
652
|
request.correlationId
|
|
@@ -781,7 +797,7 @@ export class StandardController implements IController {
|
|
|
781
797
|
ApiId.ssoSilent
|
|
782
798
|
).catch((e: AuthError) => {
|
|
783
799
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
784
|
-
if (e instanceof NativeAuthError && e
|
|
800
|
+
if (e instanceof NativeAuthError && isFatalNativeAuthError(e)) {
|
|
785
801
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
786
802
|
const silentIframeClient = this.createSilentIframeClient(
|
|
787
803
|
validRequest.correlationId
|
|
@@ -931,7 +947,10 @@ export class StandardController implements IController {
|
|
|
931
947
|
request.nativeAccountId
|
|
932
948
|
).catch((e: AuthError) => {
|
|
933
949
|
// If native token acquisition fails for availability reasons fallback to standard flow
|
|
934
|
-
if (
|
|
950
|
+
if (
|
|
951
|
+
e instanceof NativeAuthError &&
|
|
952
|
+
isFatalNativeAuthError(e)
|
|
953
|
+
) {
|
|
935
954
|
this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
|
|
936
955
|
}
|
|
937
956
|
throw e;
|
|
@@ -1038,9 +1057,17 @@ export class StandardController implements IController {
|
|
|
1038
1057
|
case CacheLookupPolicy.Default:
|
|
1039
1058
|
case CacheLookupPolicy.AccessToken:
|
|
1040
1059
|
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
1041
|
-
return
|
|
1060
|
+
return invokeAsync(
|
|
1061
|
+
silentCacheClient.acquireToken.bind(silentCacheClient),
|
|
1062
|
+
PerformanceEvents.SilentCacheClientAcquireToken,
|
|
1063
|
+
this.logger,
|
|
1064
|
+
this.performanceClient,
|
|
1065
|
+
commonRequest.correlationId
|
|
1066
|
+
)(commonRequest);
|
|
1042
1067
|
default:
|
|
1043
|
-
throw
|
|
1068
|
+
throw createClientAuthError(
|
|
1069
|
+
ClientAuthErrorCodes.tokenRefreshRequired
|
|
1070
|
+
);
|
|
1044
1071
|
}
|
|
1045
1072
|
}
|
|
1046
1073
|
|
|
@@ -1067,13 +1094,17 @@ export class StandardController implements IController {
|
|
|
1067
1094
|
commonRequest.correlationId
|
|
1068
1095
|
);
|
|
1069
1096
|
|
|
1070
|
-
|
|
1097
|
+
return invokeAsync(
|
|
1098
|
+
silentRefreshClient.acquireToken.bind(silentRefreshClient),
|
|
1071
1099
|
PerformanceEvents.SilentRefreshClientAcquireToken,
|
|
1100
|
+
this.logger,
|
|
1101
|
+
this.performanceClient,
|
|
1072
1102
|
commonRequest.correlationId
|
|
1073
|
-
);
|
|
1074
|
-
return silentRefreshClient.acquireToken(commonRequest);
|
|
1103
|
+
)(commonRequest);
|
|
1075
1104
|
default:
|
|
1076
|
-
throw
|
|
1105
|
+
throw createClientAuthError(
|
|
1106
|
+
ClientAuthErrorCodes.tokenRefreshRequired
|
|
1107
|
+
);
|
|
1077
1108
|
}
|
|
1078
1109
|
}
|
|
1079
1110
|
|
|
@@ -1168,18 +1199,45 @@ export class StandardController implements IController {
|
|
|
1168
1199
|
// #region Account APIs
|
|
1169
1200
|
|
|
1170
1201
|
/**
|
|
1171
|
-
* Returns all accounts that
|
|
1172
|
-
*
|
|
1173
|
-
*
|
|
1174
|
-
* @returns Array of account objects in cache
|
|
1202
|
+
* Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.
|
|
1203
|
+
* @param accountFilter - (Optional) filter to narrow down the accounts returned
|
|
1204
|
+
* @returns Array of AccountInfo objects in cache
|
|
1175
1205
|
*/
|
|
1176
|
-
getAllAccounts(): AccountInfo[] {
|
|
1206
|
+
getAllAccounts(accountFilter?: AccountFilter): AccountInfo[] {
|
|
1177
1207
|
this.logger.verbose("getAllAccounts called");
|
|
1178
1208
|
return this.isBrowserEnvironment
|
|
1179
|
-
? this.browserStorage.getAllAccounts()
|
|
1209
|
+
? this.browserStorage.getAllAccounts(accountFilter)
|
|
1180
1210
|
: [];
|
|
1181
1211
|
}
|
|
1182
1212
|
|
|
1213
|
+
/**
|
|
1214
|
+
* Returns the first account found in the cache that matches the account filter passed in.
|
|
1215
|
+
* @param accountFilter
|
|
1216
|
+
* @returns The first account found in the cache matching the provided filter or null if no account could be found.
|
|
1217
|
+
*/
|
|
1218
|
+
getAccount(accountFilter: AccountFilter): AccountInfo | null {
|
|
1219
|
+
this.logger.trace("getAccount called");
|
|
1220
|
+
if (Object.keys(accountFilter).length === 0) {
|
|
1221
|
+
this.logger.warning("getAccount: No accountFilter provided");
|
|
1222
|
+
return null;
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
const account: AccountInfo | null =
|
|
1226
|
+
this.browserStorage.getAccountInfoFilteredBy(accountFilter);
|
|
1227
|
+
|
|
1228
|
+
if (account) {
|
|
1229
|
+
this.logger.verbose(
|
|
1230
|
+
"getAccount: Account matching provided filter found, returning"
|
|
1231
|
+
);
|
|
1232
|
+
return account;
|
|
1233
|
+
} else {
|
|
1234
|
+
this.logger.verbose(
|
|
1235
|
+
"getAccount: No matching account found, returning null"
|
|
1236
|
+
);
|
|
1237
|
+
return null;
|
|
1238
|
+
}
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1183
1241
|
/**
|
|
1184
1242
|
* Returns the signed in account matching username.
|
|
1185
1243
|
* (the account object is created at the time of successful login)
|
|
@@ -1375,7 +1433,9 @@ export class StandardController implements IController {
|
|
|
1375
1433
|
BrowserCacheLocation.MemoryStorage &&
|
|
1376
1434
|
!this.config.cache.storeAuthStateInCookie
|
|
1377
1435
|
) {
|
|
1378
|
-
throw
|
|
1436
|
+
throw createBrowserConfigurationAuthError(
|
|
1437
|
+
BrowserConfigurationAuthErrorCodes.inMemRedirectUnavailable
|
|
1438
|
+
);
|
|
1379
1439
|
}
|
|
1380
1440
|
|
|
1381
1441
|
if (
|
|
@@ -1501,10 +1561,10 @@ export class StandardController implements IController {
|
|
|
1501
1561
|
): string {
|
|
1502
1562
|
const account =
|
|
1503
1563
|
request.account ||
|
|
1504
|
-
this.browserStorage.
|
|
1505
|
-
request.loginHint,
|
|
1506
|
-
request.sid
|
|
1507
|
-
) ||
|
|
1564
|
+
this.browserStorage.getAccountInfoFilteredBy({
|
|
1565
|
+
loginHint: request.loginHint,
|
|
1566
|
+
sid: request.sid,
|
|
1567
|
+
}) ||
|
|
1508
1568
|
this.getActiveAccount();
|
|
1509
1569
|
|
|
1510
1570
|
return (account && account.nativeAccountId) || "";
|
|
@@ -1768,7 +1828,7 @@ export class StandardController implements IController {
|
|
|
1768
1828
|
}
|
|
1769
1829
|
|
|
1770
1830
|
if (this.isBrowserEnvironment) {
|
|
1771
|
-
return
|
|
1831
|
+
return createNewGuid();
|
|
1772
1832
|
}
|
|
1773
1833
|
|
|
1774
1834
|
/*
|
|
@@ -1862,11 +1922,13 @@ export class StandardController implements IController {
|
|
|
1862
1922
|
correlationId
|
|
1863
1923
|
);
|
|
1864
1924
|
|
|
1865
|
-
|
|
1925
|
+
const response = invokeAsync(
|
|
1926
|
+
this.acquireTokenSilentAsync.bind(this),
|
|
1866
1927
|
PerformanceEvents.AcquireTokenSilentAsync,
|
|
1928
|
+
this.logger,
|
|
1929
|
+
this.performanceClient,
|
|
1867
1930
|
correlationId
|
|
1868
|
-
)
|
|
1869
|
-
const response = this.acquireTokenSilentAsync(
|
|
1931
|
+
)(
|
|
1870
1932
|
{
|
|
1871
1933
|
...request,
|
|
1872
1934
|
correlationId,
|
|
@@ -1960,7 +2022,7 @@ export class StandardController implements IController {
|
|
|
1960
2022
|
ApiId.acquireTokenSilent_silentFlow
|
|
1961
2023
|
).catch(async (e: AuthError) => {
|
|
1962
2024
|
// If native token acquisition fails for availability reasons fallback to web flow
|
|
1963
|
-
if (e instanceof NativeAuthError && e
|
|
2025
|
+
if (e instanceof NativeAuthError && isFatalNativeAuthError(e)) {
|
|
1964
2026
|
this.logger.verbose(
|
|
1965
2027
|
"acquireTokenSilent - native platform unavailable, falling back to web flow"
|
|
1966
2028
|
);
|
|
@@ -1983,15 +2045,15 @@ export class StandardController implements IController {
|
|
|
1983
2045
|
request.correlationId
|
|
1984
2046
|
);
|
|
1985
2047
|
|
|
1986
|
-
|
|
2048
|
+
const silentRequest = await invokeAsync(
|
|
2049
|
+
silentCacheClient.initializeSilentRequest.bind(
|
|
2050
|
+
silentCacheClient
|
|
2051
|
+
),
|
|
1987
2052
|
PerformanceEvents.InitializeSilentRequest,
|
|
2053
|
+
this.logger,
|
|
2054
|
+
this.performanceClient,
|
|
1988
2055
|
request.correlationId
|
|
1989
|
-
);
|
|
1990
|
-
const silentRequest =
|
|
1991
|
-
await silentCacheClient.initializeSilentRequest(
|
|
1992
|
-
request,
|
|
1993
|
-
account
|
|
1994
|
-
);
|
|
2056
|
+
)(request, account);
|
|
1995
2057
|
|
|
1996
2058
|
const requestWithCLP = {
|
|
1997
2059
|
...request,
|
|
@@ -2000,72 +2062,75 @@ export class StandardController implements IController {
|
|
|
2000
2062
|
request.cacheLookupPolicy || CacheLookupPolicy.Default,
|
|
2001
2063
|
};
|
|
2002
2064
|
|
|
2003
|
-
|
|
2065
|
+
result = invokeAsync(
|
|
2066
|
+
this.acquireTokenFromCache.bind(this),
|
|
2004
2067
|
PerformanceEvents.AcquireTokenFromCache,
|
|
2068
|
+
this.logger,
|
|
2069
|
+
this.performanceClient,
|
|
2005
2070
|
silentRequest.correlationId
|
|
2006
|
-
)
|
|
2007
|
-
|
|
2008
|
-
silentCacheClient,
|
|
2009
|
-
silentRequest,
|
|
2010
|
-
requestWithCLP
|
|
2011
|
-
).catch((cacheError: AuthError) => {
|
|
2012
|
-
if (
|
|
2013
|
-
requestWithCLP.cacheLookupPolicy ===
|
|
2014
|
-
CacheLookupPolicy.AccessToken
|
|
2015
|
-
) {
|
|
2016
|
-
throw cacheError;
|
|
2017
|
-
}
|
|
2018
|
-
|
|
2019
|
-
// block the reload if it occurred inside a hidden iframe
|
|
2020
|
-
BrowserUtils.blockReloadInHiddenIframes();
|
|
2021
|
-
this.eventHandler.emitEvent(
|
|
2022
|
-
EventType.ACQUIRE_TOKEN_NETWORK_START,
|
|
2023
|
-
InteractionType.Silent,
|
|
2024
|
-
silentRequest
|
|
2025
|
-
);
|
|
2026
|
-
|
|
2027
|
-
this.performanceClient.setPreQueueTime(
|
|
2028
|
-
PerformanceEvents.AcquireTokenByRefreshToken,
|
|
2029
|
-
silentRequest.correlationId
|
|
2030
|
-
);
|
|
2031
|
-
return this.acquireTokenByRefreshToken(
|
|
2032
|
-
silentRequest,
|
|
2033
|
-
requestWithCLP
|
|
2034
|
-
).catch((refreshTokenError: AuthError) => {
|
|
2035
|
-
const isServerError =
|
|
2036
|
-
refreshTokenError instanceof ServerError;
|
|
2037
|
-
const isInteractionRequiredError =
|
|
2038
|
-
refreshTokenError instanceof
|
|
2039
|
-
InteractionRequiredAuthError;
|
|
2040
|
-
const isInvalidGrantError =
|
|
2041
|
-
refreshTokenError.errorCode ===
|
|
2042
|
-
BrowserConstants.INVALID_GRANT_ERROR;
|
|
2043
|
-
|
|
2071
|
+
)(silentCacheClient, silentRequest, requestWithCLP).catch(
|
|
2072
|
+
(cacheError: AuthError) => {
|
|
2044
2073
|
if (
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
isInteractionRequiredError ||
|
|
2048
|
-
requestWithCLP.cacheLookupPolicy ===
|
|
2049
|
-
CacheLookupPolicy.AccessTokenAndRefreshToken ||
|
|
2050
|
-
requestWithCLP.cacheLookupPolicy ===
|
|
2051
|
-
CacheLookupPolicy.RefreshToken) &&
|
|
2052
|
-
requestWithCLP.cacheLookupPolicy !==
|
|
2053
|
-
CacheLookupPolicy.Skip
|
|
2074
|
+
requestWithCLP.cacheLookupPolicy ===
|
|
2075
|
+
CacheLookupPolicy.AccessToken
|
|
2054
2076
|
) {
|
|
2055
|
-
throw
|
|
2077
|
+
throw cacheError;
|
|
2056
2078
|
}
|
|
2057
2079
|
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2080
|
+
// block the reload if it occurred inside a hidden iframe
|
|
2081
|
+
BrowserUtils.blockReloadInHiddenIframes();
|
|
2082
|
+
this.eventHandler.emitEvent(
|
|
2083
|
+
EventType.ACQUIRE_TOKEN_NETWORK_START,
|
|
2084
|
+
InteractionType.Silent,
|
|
2085
|
+
silentRequest
|
|
2061
2086
|
);
|
|
2062
|
-
|
|
2063
|
-
|
|
2087
|
+
|
|
2088
|
+
return invokeAsync(
|
|
2089
|
+
this.acquireTokenByRefreshToken.bind(this),
|
|
2090
|
+
PerformanceEvents.AcquireTokenByRefreshToken,
|
|
2091
|
+
this.logger,
|
|
2092
|
+
this.performanceClient,
|
|
2064
2093
|
silentRequest.correlationId
|
|
2094
|
+
)(silentRequest, requestWithCLP).catch(
|
|
2095
|
+
(refreshTokenError: AuthError) => {
|
|
2096
|
+
const isServerError =
|
|
2097
|
+
refreshTokenError instanceof ServerError;
|
|
2098
|
+
const isInteractionRequiredError =
|
|
2099
|
+
refreshTokenError instanceof
|
|
2100
|
+
InteractionRequiredAuthError;
|
|
2101
|
+
const isInvalidGrantError =
|
|
2102
|
+
refreshTokenError.errorCode ===
|
|
2103
|
+
BrowserConstants.INVALID_GRANT_ERROR;
|
|
2104
|
+
|
|
2105
|
+
if (
|
|
2106
|
+
(!isServerError ||
|
|
2107
|
+
!isInvalidGrantError ||
|
|
2108
|
+
isInteractionRequiredError ||
|
|
2109
|
+
requestWithCLP.cacheLookupPolicy ===
|
|
2110
|
+
CacheLookupPolicy.AccessTokenAndRefreshToken ||
|
|
2111
|
+
requestWithCLP.cacheLookupPolicy ===
|
|
2112
|
+
CacheLookupPolicy.RefreshToken) &&
|
|
2113
|
+
requestWithCLP.cacheLookupPolicy !==
|
|
2114
|
+
CacheLookupPolicy.Skip
|
|
2115
|
+
) {
|
|
2116
|
+
throw refreshTokenError;
|
|
2117
|
+
}
|
|
2118
|
+
|
|
2119
|
+
this.logger.verbose(
|
|
2120
|
+
"Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.",
|
|
2121
|
+
request.correlationId
|
|
2122
|
+
);
|
|
2123
|
+
return invokeAsync(
|
|
2124
|
+
this.acquireTokenBySilentIframe.bind(this),
|
|
2125
|
+
PerformanceEvents.AcquireTokenBySilentIframe,
|
|
2126
|
+
this.logger,
|
|
2127
|
+
this.performanceClient,
|
|
2128
|
+
silentRequest.correlationId
|
|
2129
|
+
)(silentRequest);
|
|
2130
|
+
}
|
|
2065
2131
|
);
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
});
|
|
2132
|
+
}
|
|
2133
|
+
);
|
|
2069
2134
|
}
|
|
2070
2135
|
|
|
2071
2136
|
return result
|