daftari 3.13.1 → 3.14.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/CHANGELOG.md +16 -0
- package/dist/distill/propose.d.ts.map +1 -1
- package/dist/distill/propose.js +10 -3
- package/dist/distill/propose.js.map +1 -1
- package/dist/extract/index.d.ts +16 -0
- package/dist/extract/index.d.ts.map +1 -0
- package/dist/extract/index.js +95 -0
- package/dist/extract/index.js.map +1 -0
- package/dist/extract/normalize.d.ts +7 -0
- package/dist/extract/normalize.d.ts.map +1 -0
- package/dist/extract/normalize.js +52 -0
- package/dist/extract/normalize.js.map +1 -0
- package/dist/extract/office.d.ts +63 -0
- package/dist/extract/office.d.ts.map +1 -0
- package/dist/extract/office.js +763 -0
- package/dist/extract/office.js.map +1 -0
- package/dist/extract/pdf.d.ts +16 -0
- package/dist/extract/pdf.d.ts.map +1 -0
- package/dist/extract/pdf.js +196 -0
- package/dist/extract/pdf.js.map +1 -0
- package/dist/extract/types.d.ts +55 -0
- package/dist/extract/types.d.ts.map +1 -0
- package/dist/extract/types.js +47 -0
- package/dist/extract/types.js.map +1 -0
- package/dist/extract/worker.d.ts +2 -0
- package/dist/extract/worker.d.ts.map +1 -0
- package/dist/extract/worker.js +57 -0
- package/dist/extract/worker.js.map +1 -0
- package/dist/integrations/engine.d.ts +174 -3
- package/dist/integrations/engine.d.ts.map +1 -1
- package/dist/integrations/engine.js +184 -16
- package/dist/integrations/engine.js.map +1 -1
- package/dist/integrations/google.d.ts +2 -1
- package/dist/integrations/google.d.ts.map +1 -1
- package/dist/integrations/google.js +12 -117
- package/dist/integrations/google.js.map +1 -1
- package/dist/integrations/http-json.d.ts +27 -0
- package/dist/integrations/http-json.d.ts.map +1 -0
- package/dist/integrations/http-json.js +148 -0
- package/dist/integrations/http-json.js.map +1 -0
- package/dist/integrations/microsoft.d.ts +22 -0
- package/dist/integrations/microsoft.d.ts.map +1 -0
- package/dist/integrations/microsoft.js +1780 -0
- package/dist/integrations/microsoft.js.map +1 -0
- package/dist/integrations/microsoft.ui.d.ts +18 -0
- package/dist/integrations/microsoft.ui.d.ts.map +1 -0
- package/dist/integrations/microsoft.ui.js +131 -0
- package/dist/integrations/microsoft.ui.js.map +1 -0
- package/dist/integrations/oauth.d.ts.map +1 -1
- package/dist/integrations/oauth.js +10 -2
- package/dist/integrations/oauth.js.map +1 -1
- package/dist/integrations/queue.d.ts +1 -1
- package/dist/integrations/queue.d.ts.map +1 -1
- package/dist/integrations/queue.js +23 -1
- package/dist/integrations/queue.js.map +1 -1
- package/dist/integrations/routes.d.ts +26 -0
- package/dist/integrations/routes.d.ts.map +1 -1
- package/dist/integrations/routes.js +502 -8
- package/dist/integrations/routes.js.map +1 -1
- package/dist/integrations/runtime.d.ts +14 -2
- package/dist/integrations/runtime.d.ts.map +1 -1
- package/dist/integrations/runtime.js +39 -7
- package/dist/integrations/runtime.js.map +1 -1
- package/dist/integrations/state.d.ts +1 -1
- package/dist/integrations/state.d.ts.map +1 -1
- package/dist/integrations/state.js +48 -8
- package/dist/integrations/state.js.map +1 -1
- package/dist/integrations/types.d.ts +54 -3
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js +21 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/search/watcher.d.ts.map +1 -1
- package/dist/search/watcher.js +3 -22
- package/dist/search/watcher.js.map +1 -1
- package/dist/serve/index.d.ts.map +1 -1
- package/dist/serve/index.js +7 -0
- package/dist/serve/index.js.map +1 -1
- package/dist/sleep/index.js +2 -2
- package/dist/sleep/report.js +1 -1
- package/dist/sleep/report.js.map +1 -1
- package/dist/sleep/tension-scan.d.ts.map +1 -1
- package/dist/sleep/tension-scan.js +0 -0
- package/dist/sleep/tension-scan.js.map +1 -1
- package/dist/storage/local.d.ts +1 -0
- package/dist/storage/local.d.ts.map +1 -1
- package/dist/storage/local.js +8 -1
- package/dist/storage/local.js.map +1 -1
- package/dist/utils/config.d.ts +8 -1
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +143 -19
- package/dist/utils/config.js.map +1 -1
- package/dist/view/pages.d.ts.map +1 -1
- package/dist/view/pages.js +11 -0
- package/dist/view/pages.js.map +1 -1
- package/dist/view/render.d.ts.map +1 -1
- package/dist/view/render.js +37 -2
- package/dist/view/render.js.map +1 -1
- package/package.json +8 -3
- package/src/integrations/microsoft/assets/VENDORING.md +109 -0
- package/src/integrations/microsoft/assets/glue.js +244 -0
- package/src/integrations/microsoft/assets/picker-serializer.js +99 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/app/IPublicClientApplication.mjs +91 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/app/PublicClientApplication.mjs +355 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/NativeStatusCodes.mjs +15 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthDOMHandler.mjs +153 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthExtensionHandler.mjs +271 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/broker/nativeBroker/PlatformAuthProvider.mjs +95 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/AccountManager.mjs +49 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/AsyncMemoryStorage.mjs +144 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/BrowserCacheManager.mjs +1465 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CacheHelpers.mjs +45 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CacheKeys.mjs +32 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/CookieStorage.mjs +94 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/DatabaseStorage.mjs +208 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/EncryptedData.mjs +13 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/LocalStorage.mjs +319 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/MemoryStorage.mjs +48 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/SessionStorage.mjs +46 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/cache/TokenCache.mjs +220 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/config/Configuration.mjs +138 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/controllers/NestedAppAuthController.mjs +483 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/controllers/StandardController.mjs +1532 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/BrowserCrypto.mjs +354 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/CryptoOps.mjs +146 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/PkceGenerator.mjs +63 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/SignedHttpRequest.mjs +50 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/crypto/TokenBindingKeyManager.mjs +156 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/encode/Base64Decode.mjs +43 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/encode/Base64Encode.mjs +47 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserAuthError.mjs +26 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserAuthErrorCodes.mjs +65 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserConfigurationAuthError.mjs +24 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/BrowserConfigurationAuthErrorCodes.mjs +11 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/NativeAuthError.mjs +79 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/NativeAuthErrorCodes.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/error/NestedAppAuthError.mjs +25 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventHandler.mjs +110 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventMessage.mjs +60 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/event/EventType.mjs +30 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/index.mjs +48 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/BaseInteractionClient.mjs +150 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/HybridSpaAuthorizationCodeClient.mjs +16 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/PlatformAuthInteractionClient.mjs +734 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/PopupClient.mjs +528 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/RedirectClient.mjs +464 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentAuthCodeClient.mjs +85 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentCacheClient.mjs +58 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentIframeClient.mjs +255 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/SilentRefreshClient.mjs +77 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_client/StandardInteractionClient.mjs +217 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_handler/InteractionHandler.mjs +95 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/interaction_handler/SilentHandler.mjs +71 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeError.mjs +11 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeProxy.mjs +152 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/BridgeStatusCode.mjs +18 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/naa/mapping/NestedAppAuthAdapter.mjs +239 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/navigation/NavigationClient.mjs +47 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/network/FetchClient.mjs +153 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/BaseOperatingContext.mjs +112 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/NestedAppOperatingContext.mjs +79 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/operatingcontext/StandardOperatingContext.mjs +50 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/packageMetadata.mjs +7 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/popup_relay/constants.mjs +20 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/popup_relay/relayClient.mjs +113 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/protocol/Authorize.mjs +326 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/request/RequestHelpers.mjs +143 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/response/ResponseHandler.mjs +45 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceClient.mjs +126 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceEvents.mjs +133 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserPerformanceMeasurement.mjs +96 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/telemetry/BrowserRootPerformanceEvents.mjs +53 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserConstants.mjs +220 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserProtocolUtils.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/BrowserUtils.mjs +364 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/Helpers.mjs +19 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/utils/MsalFrameStatsUtils.mjs +38 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/PendingRequestRegistry.mjs +63 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/WebBrokerBridgeError.mjs +38 -0
- package/src/integrations/microsoft/assets/vendor/msal-browser/webBrokerBridge/WebBrokerBridgeErrorMap.mjs +57 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/AccountInfo.mjs +91 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/AuthToken.mjs +70 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/CcsCredential.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/ClientInfo.mjs +43 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/account/TokenClaims.mjs +24 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/Authority.mjs +988 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityFactory.mjs +41 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityMetadata.mjs +158 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityOptions.mjs +20 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/AuthorityType.mjs +16 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/CloudInstanceDiscoveryErrorResponse.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/CloudInstanceDiscoveryResponse.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/OpenIdConfigResponse.mjs +14 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/ProtocolMode.mjs +26 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/authority/RegionDiscovery.mjs +116 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/CacheManager.mjs +1202 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/persistence/TokenCacheContext.mjs +29 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/utils/AccountEntityUtils.mjs +222 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/cache/utils/CacheHelpers.mjs +294 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/client/AuthorizationCodeClient.mjs +289 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/client/RefreshTokenClient.mjs +262 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/client/SilentFlowClient.mjs +142 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/config/ClientConfiguration.mjs +111 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/constants/AADServerParamKeys.mjs +74 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/DpopProofGenerator.mjs +152 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/ICrypto.mjs +52 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/ITokenBindingKeyManager.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/JoseHeader.mjs +72 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/crypto/PopTokenGenerator.mjs +109 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/AuthError.mjs +31 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/AuthErrorCodes.mjs +13 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/CacheError.mjs +44 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/CacheErrorCodes.mjs +10 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientAuthError.mjs +26 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientAuthErrorCodes.mjs +46 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientConfigurationError.mjs +23 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ClientConfigurationErrorCodes.mjs +38 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/InteractionRequiredAuthError.mjs +73 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/InteractionRequiredAuthErrorCodes.mjs +53 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/JoseHeaderError.mjs +24 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/JoseHeaderErrorCodes.mjs +12 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/NetworkError.mjs +34 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/PlatformBrokerError.mjs +48 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/error/ServerError.mjs +22 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/index-browser.mjs +79 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/logger/Logger.mjs +291 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/network/INetworkModule.mjs +20 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/network/RequestThumbprint.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/network/ThrottlingUtils.mjs +91 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/packageMetadata.mjs +7 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/protocol/Authorize.mjs +239 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/protocol/Token.mjs +148 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/AuthenticationHeaderParser.mjs +63 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/BaseAuthRequest.mjs +37 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/RequestParameterBuilder.mjs +529 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/request/ScopeSet.mjs +204 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/response/ResponseHandler.mjs +432 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceClient.mjs +557 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceEvent.mjs +68 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/PerformanceEvents.mjs +73 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/performance/StubPerformanceClient.mjs +61 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/telemetry/server/ServerTelemetryManager.mjs +297 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/url/UrlString.mjs +164 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/ClientAssertionUtils.mjs +21 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/Constants.mjs +304 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/FunctionWrappers.mjs +95 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/ObjectUtils.mjs +27 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/ProtocolUtils.mjs +76 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/StringUtils.mjs +82 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/TimeUtils.mjs +75 -0
- package/src/integrations/microsoft/assets/vendor/msal-common/utils/UrlUtils.mjs +128 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/*! @azure/msal-browser v5.20.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { StubPerformanceClient, ProtocolMode, Logger, LogLevel, createClientConfigurationError, ClientConfigurationErrorCodes, DEFAULT_SYSTEM_OPTIONS, Constants, AzureCloudInstance, StubbedNetworkModule } from '../../msal-common/index-browser.mjs';
|
|
4
|
+
import { BrowserCacheLocation } from '../utils/BrowserConstants.mjs';
|
|
5
|
+
import { NavigationClient } from '../navigation/NavigationClient.mjs';
|
|
6
|
+
import { FetchClient } from '../network/FetchClient.mjs';
|
|
7
|
+
import { name, version } from '../packageMetadata.mjs';
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11
|
+
* Licensed under the MIT License.
|
|
12
|
+
*/
|
|
13
|
+
// Default timeout for popup windows and iframes in milliseconds
|
|
14
|
+
const DEFAULT_POPUP_TIMEOUT_MS = 60000;
|
|
15
|
+
const DEFAULT_IFRAME_TIMEOUT_MS = 10000;
|
|
16
|
+
const DEFAULT_REDIRECT_TIMEOUT_MS = 30000;
|
|
17
|
+
const DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS = 2000;
|
|
18
|
+
/**
|
|
19
|
+
* MSAL function that sets the default options when not explicitly configured from app developer
|
|
20
|
+
*
|
|
21
|
+
* @param auth
|
|
22
|
+
* @param cache
|
|
23
|
+
* @param system
|
|
24
|
+
*
|
|
25
|
+
* @returns Configuration object
|
|
26
|
+
*/
|
|
27
|
+
function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem, experimental: userInputExperimental, telemetry: userInputTelemetry, }, isBrowserEnvironment) {
|
|
28
|
+
// Default auth options for browser
|
|
29
|
+
const DEFAULT_AUTH_OPTIONS = {
|
|
30
|
+
clientId: "",
|
|
31
|
+
authority: `${Constants.DEFAULT_AUTHORITY}`,
|
|
32
|
+
knownAuthorities: [],
|
|
33
|
+
cloudDiscoveryMetadata: "",
|
|
34
|
+
authorityMetadata: "",
|
|
35
|
+
redirectUri: typeof window !== "undefined" && window.location
|
|
36
|
+
? window.location.href.split("?")[0].split("#")[0]
|
|
37
|
+
: "",
|
|
38
|
+
postLogoutRedirectUri: "",
|
|
39
|
+
popupRelayUri: "",
|
|
40
|
+
clientCapabilities: [],
|
|
41
|
+
OIDCOptions: {
|
|
42
|
+
responseMode: Constants.ResponseMode.FRAGMENT,
|
|
43
|
+
defaultScopes: [
|
|
44
|
+
Constants.OPENID_SCOPE,
|
|
45
|
+
Constants.PROFILE_SCOPE,
|
|
46
|
+
Constants.OFFLINE_ACCESS_SCOPE,
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
azureCloudOptions: {
|
|
50
|
+
azureCloudInstance: AzureCloudInstance.None,
|
|
51
|
+
tenant: "",
|
|
52
|
+
},
|
|
53
|
+
instanceAware: false,
|
|
54
|
+
isMcp: false,
|
|
55
|
+
verifySSO: false,
|
|
56
|
+
};
|
|
57
|
+
// Default cache options for browser
|
|
58
|
+
const DEFAULT_CACHE_OPTIONS = {
|
|
59
|
+
cacheLocation: BrowserCacheLocation.SessionStorage,
|
|
60
|
+
cacheRetentionDays: 5,
|
|
61
|
+
};
|
|
62
|
+
// Default logger options for browser
|
|
63
|
+
const DEFAULT_LOGGER_OPTIONS = {
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
65
|
+
loggerCallback: () => {
|
|
66
|
+
// allow users to not set logger call back
|
|
67
|
+
},
|
|
68
|
+
logLevel: LogLevel.Info,
|
|
69
|
+
piiLoggingEnabled: false,
|
|
70
|
+
};
|
|
71
|
+
// Default system options for browser
|
|
72
|
+
const DEFAULT_BROWSER_SYSTEM_OPTIONS = {
|
|
73
|
+
...DEFAULT_SYSTEM_OPTIONS,
|
|
74
|
+
loggerOptions: DEFAULT_LOGGER_OPTIONS,
|
|
75
|
+
networkClient: isBrowserEnvironment
|
|
76
|
+
? new FetchClient()
|
|
77
|
+
: StubbedNetworkModule,
|
|
78
|
+
navigationClient: new NavigationClient(),
|
|
79
|
+
popupBridgeTimeout: userInputSystem?.popupBridgeTimeout || DEFAULT_POPUP_TIMEOUT_MS,
|
|
80
|
+
iframeBridgeTimeout: userInputSystem?.iframeBridgeTimeout || DEFAULT_IFRAME_TIMEOUT_MS,
|
|
81
|
+
redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS,
|
|
82
|
+
allowRedirectInIframe: false,
|
|
83
|
+
navigatePopups: true,
|
|
84
|
+
allowPlatformBroker: false,
|
|
85
|
+
nativeBrokerHandshakeTimeout: userInputSystem?.nativeBrokerHandshakeTimeout ||
|
|
86
|
+
DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS,
|
|
87
|
+
protocolMode: ProtocolMode.AAD,
|
|
88
|
+
serverTelemetryEnabled: false,
|
|
89
|
+
};
|
|
90
|
+
const providedSystemOptions = {
|
|
91
|
+
...DEFAULT_BROWSER_SYSTEM_OPTIONS,
|
|
92
|
+
...userInputSystem,
|
|
93
|
+
loggerOptions: userInputSystem?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
|
|
94
|
+
};
|
|
95
|
+
const DEFAULT_TELEMETRY_OPTIONS = {
|
|
96
|
+
application: {
|
|
97
|
+
appName: "",
|
|
98
|
+
appVersion: "",
|
|
99
|
+
},
|
|
100
|
+
client: new StubPerformanceClient(),
|
|
101
|
+
};
|
|
102
|
+
const DEFAULT_EXPERIMENTAL_OPTIONS = {
|
|
103
|
+
iframeTimeoutTelemetry: false,
|
|
104
|
+
allowPlatformBrokerWithDOM: false,
|
|
105
|
+
};
|
|
106
|
+
// Throw an error if user has set OIDCOptions without being in OIDC protocol mode
|
|
107
|
+
if (userInputSystem?.protocolMode !== ProtocolMode.OIDC &&
|
|
108
|
+
userInputAuth?.OIDCOptions) {
|
|
109
|
+
const logger = new Logger(providedSystemOptions.loggerOptions, name, version);
|
|
110
|
+
logger.warning(JSON.stringify(createClientConfigurationError(ClientConfigurationErrorCodes.cannotSetOIDCOptions, "")), "");
|
|
111
|
+
}
|
|
112
|
+
// Throw an error if user has set allowPlatformBroker to true with OIDC protocol mode
|
|
113
|
+
if (userInputSystem?.protocolMode &&
|
|
114
|
+
userInputSystem.protocolMode === ProtocolMode.OIDC &&
|
|
115
|
+
providedSystemOptions?.allowPlatformBroker) {
|
|
116
|
+
throw createClientConfigurationError(ClientConfigurationErrorCodes.cannotAllowPlatformBroker, "");
|
|
117
|
+
}
|
|
118
|
+
const overlayedConfig = {
|
|
119
|
+
auth: {
|
|
120
|
+
...DEFAULT_AUTH_OPTIONS,
|
|
121
|
+
...userInputAuth,
|
|
122
|
+
OIDCOptions: {
|
|
123
|
+
...DEFAULT_AUTH_OPTIONS.OIDCOptions,
|
|
124
|
+
...userInputAuth?.OIDCOptions,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
cache: { ...DEFAULT_CACHE_OPTIONS, ...userInputCache },
|
|
128
|
+
system: providedSystemOptions,
|
|
129
|
+
experimental: {
|
|
130
|
+
...DEFAULT_EXPERIMENTAL_OPTIONS,
|
|
131
|
+
...userInputExperimental,
|
|
132
|
+
},
|
|
133
|
+
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...userInputTelemetry },
|
|
134
|
+
};
|
|
135
|
+
return overlayedConfig;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { DEFAULT_IFRAME_TIMEOUT_MS, DEFAULT_NATIVE_BROKER_HANDSHAKE_TIMEOUT_MS, DEFAULT_POPUP_TIMEOUT_MS, DEFAULT_REDIRECT_TIMEOUT_MS, buildConfiguration };
|
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
/*! @azure/msal-browser v5.20.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { DEFAULT_CRYPTO_IMPLEMENTATION, DEFAULT_TOKEN_BINDING_KEY_MANAGER, buildStaticAuthorityOptions, enforceResourceParameter, TimeUtils, AuthError, Constants, AccountEntityUtils, AuthToken } from '../../msal-common/index-browser.mjs';
|
|
4
|
+
import { AcquireTokenPopup, SsoSilent, AcquireTokenSilent } from '../telemetry/BrowserRootPerformanceEvents.mjs';
|
|
5
|
+
import { InteractionType, CacheLookupPolicy, DEFAULT_REQUEST, ApiId } from '../utils/BrowserConstants.mjs';
|
|
6
|
+
import { CryptoOps } from '../crypto/CryptoOps.mjs';
|
|
7
|
+
import { TokenBindingKeyManager } from '../crypto/TokenBindingKeyManager.mjs';
|
|
8
|
+
import { NestedAppAuthAdapter } from '../naa/mapping/NestedAppAuthAdapter.mjs';
|
|
9
|
+
import { NestedAppAuthError } from '../error/NestedAppAuthError.mjs';
|
|
10
|
+
import { EventHandler } from '../event/EventHandler.mjs';
|
|
11
|
+
import { EventType } from '../event/EventType.mjs';
|
|
12
|
+
import { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER } from '../cache/BrowserCacheManager.mjs';
|
|
13
|
+
import { getAccount, getAllAccounts, setActiveAccount, getActiveAccount } from '../cache/AccountManager.mjs';
|
|
14
|
+
import { createNewGuid } from '../crypto/BrowserCrypto.mjs';
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
18
|
+
* Licensed under the MIT License.
|
|
19
|
+
*/
|
|
20
|
+
class NestedAppAuthController {
|
|
21
|
+
constructor(operatingContext) {
|
|
22
|
+
this.operatingContext = operatingContext;
|
|
23
|
+
const proxy = this.operatingContext.getBridgeProxy();
|
|
24
|
+
if (proxy !== undefined) {
|
|
25
|
+
this.bridgeProxy = proxy;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
throw new Error("unexpected: bridgeProxy is undefined");
|
|
29
|
+
}
|
|
30
|
+
// Set the configuration.
|
|
31
|
+
this.config = operatingContext.getConfig();
|
|
32
|
+
// Initialize logger
|
|
33
|
+
this.logger = this.operatingContext.getLogger();
|
|
34
|
+
// Initialize performance client
|
|
35
|
+
this.performanceClient = this.config.telemetry.client;
|
|
36
|
+
// Initialize the crypto class.
|
|
37
|
+
this.browserCrypto = operatingContext.isBrowserEnvironment()
|
|
38
|
+
? new CryptoOps(this.logger, this.performanceClient, true)
|
|
39
|
+
: DEFAULT_CRYPTO_IMPLEMENTATION;
|
|
40
|
+
const tokenBindingKeyManager = operatingContext.isBrowserEnvironment()
|
|
41
|
+
? new TokenBindingKeyManager(this.logger, this.performanceClient)
|
|
42
|
+
: DEFAULT_TOKEN_BINDING_KEY_MANAGER;
|
|
43
|
+
this.eventHandler = new EventHandler(this.logger);
|
|
44
|
+
// Initialize the browser storage class.
|
|
45
|
+
this.browserStorage = this.operatingContext.isBrowserEnvironment()
|
|
46
|
+
? new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger, this.performanceClient, this.eventHandler, buildStaticAuthorityOptions(this.config.auth), tokenBindingKeyManager)
|
|
47
|
+
: DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger, this.performanceClient, this.eventHandler, undefined, tokenBindingKeyManager);
|
|
48
|
+
this.nestedAppAuthAdapter = new NestedAppAuthAdapter(this.config.auth.clientId, this.config.auth.clientCapabilities, this.browserCrypto, this.logger);
|
|
49
|
+
// Set the active account if available
|
|
50
|
+
const accountContext = this.bridgeProxy.getAccountContext();
|
|
51
|
+
this.currentAccountContext = accountContext ? accountContext : null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Factory function to create a new instance of NestedAppAuthController
|
|
55
|
+
* @param operatingContext
|
|
56
|
+
* @returns Promise<IController>
|
|
57
|
+
*/
|
|
58
|
+
static async createController(operatingContext) {
|
|
59
|
+
const controller = new NestedAppAuthController(operatingContext);
|
|
60
|
+
return Promise.resolve(controller);
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Specific implementation of initialize function for NestedAppAuthController
|
|
64
|
+
* @returns
|
|
65
|
+
*/
|
|
66
|
+
async initialize(request,
|
|
67
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
68
|
+
isBroker) {
|
|
69
|
+
const initCorrelationId = request?.correlationId || createNewGuid();
|
|
70
|
+
await this.browserStorage.initialize(initCorrelationId);
|
|
71
|
+
return Promise.resolve();
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Validate the incoming request and add correlationId if not present
|
|
75
|
+
* @param request
|
|
76
|
+
* @returns
|
|
77
|
+
*/
|
|
78
|
+
ensureValidRequest(request) {
|
|
79
|
+
if (request?.correlationId) {
|
|
80
|
+
return request;
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
...request,
|
|
84
|
+
correlationId: this.browserCrypto.createNewGuid(),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Internal implementation of acquireTokenInteractive flow
|
|
89
|
+
* @param request
|
|
90
|
+
* @returns
|
|
91
|
+
*/
|
|
92
|
+
async acquireTokenInteractive(request) {
|
|
93
|
+
const validRequest = this.ensureValidRequest(request);
|
|
94
|
+
const correlationId = validRequest.correlationId || createNewGuid();
|
|
95
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, correlationId, InteractionType.Popup, validRequest);
|
|
96
|
+
const atPopupMeasurement = this.performanceClient.startMeasurement(AcquireTokenPopup, correlationId);
|
|
97
|
+
atPopupMeasurement.add({ nestedAppAuthRequest: true });
|
|
98
|
+
try {
|
|
99
|
+
enforceResourceParameter(this.config.auth.isMcp, validRequest);
|
|
100
|
+
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(validRequest);
|
|
101
|
+
const reqTimestamp = TimeUtils.nowSeconds();
|
|
102
|
+
const response = await this.bridgeProxy.getTokenInteractive(naaRequest);
|
|
103
|
+
const result = {
|
|
104
|
+
...this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp),
|
|
105
|
+
};
|
|
106
|
+
// cache the tokens in the response
|
|
107
|
+
try {
|
|
108
|
+
// cache hydration can fail in JS Runtime scenario that doesn't support full crypto API
|
|
109
|
+
await this.hydrateCache(result, request);
|
|
110
|
+
}
|
|
111
|
+
catch (error) {
|
|
112
|
+
this.logger.warningPii(`1mwr91 ${error}`, correlationId);
|
|
113
|
+
}
|
|
114
|
+
// cache the account context in memory after successful token fetch
|
|
115
|
+
this.currentAccountContext = {
|
|
116
|
+
homeAccountId: result.account.homeAccountId,
|
|
117
|
+
environment: result.account.environment,
|
|
118
|
+
tenantId: result.account.tenantId,
|
|
119
|
+
};
|
|
120
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, correlationId, InteractionType.Popup, result);
|
|
121
|
+
atPopupMeasurement.add({
|
|
122
|
+
accessTokenSize: result.accessToken.length,
|
|
123
|
+
idTokenSize: result.idToken.length,
|
|
124
|
+
});
|
|
125
|
+
atPopupMeasurement.end({
|
|
126
|
+
success: true,
|
|
127
|
+
requestId: result.requestId,
|
|
128
|
+
}, undefined, result.account);
|
|
129
|
+
return result;
|
|
130
|
+
}
|
|
131
|
+
catch (e) {
|
|
132
|
+
const error = e instanceof AuthError
|
|
133
|
+
? e
|
|
134
|
+
: this.nestedAppAuthAdapter.fromBridgeError(e);
|
|
135
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, correlationId, InteractionType.Popup, null, e);
|
|
136
|
+
atPopupMeasurement.end({
|
|
137
|
+
success: false,
|
|
138
|
+
}, e, request.account);
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Internal implementation of acquireTokenSilent flow
|
|
144
|
+
* @param request
|
|
145
|
+
* @returns
|
|
146
|
+
*/
|
|
147
|
+
async acquireTokenSilentInternal(request) {
|
|
148
|
+
const validRequest = this.ensureValidRequest(request);
|
|
149
|
+
const correlationId = validRequest.correlationId || createNewGuid();
|
|
150
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, correlationId, InteractionType.Silent, validRequest);
|
|
151
|
+
// Look for tokens in the cache first
|
|
152
|
+
const result = await this.acquireTokenFromCache(validRequest);
|
|
153
|
+
if (result) {
|
|
154
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, correlationId, InteractionType.Silent, result);
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
// proceed with acquiring tokens via the host
|
|
158
|
+
const ssoSilentMeasurement = this.performanceClient.startMeasurement(SsoSilent, correlationId);
|
|
159
|
+
ssoSilentMeasurement.increment({
|
|
160
|
+
visibilityChangeCount: 0,
|
|
161
|
+
});
|
|
162
|
+
ssoSilentMeasurement.add({
|
|
163
|
+
nestedAppAuthRequest: true,
|
|
164
|
+
});
|
|
165
|
+
try {
|
|
166
|
+
enforceResourceParameter(this.config.auth.isMcp, validRequest);
|
|
167
|
+
const naaRequest = this.nestedAppAuthAdapter.toNaaTokenRequest(validRequest);
|
|
168
|
+
naaRequest.forceRefresh = validRequest.forceRefresh;
|
|
169
|
+
const reqTimestamp = TimeUtils.nowSeconds();
|
|
170
|
+
const response = await this.bridgeProxy.getTokenSilent(naaRequest);
|
|
171
|
+
const result = this.nestedAppAuthAdapter.fromNaaTokenResponse(naaRequest, response, reqTimestamp);
|
|
172
|
+
// cache the tokens in the response
|
|
173
|
+
try {
|
|
174
|
+
// cache hydration can fail in JS Runtime scenario that doesn't support full crypto API
|
|
175
|
+
await this.hydrateCache(result, request);
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
this.logger.warningPii(`1mwr91 ${error}`, correlationId);
|
|
179
|
+
}
|
|
180
|
+
// cache the account context in memory after successful token fetch
|
|
181
|
+
this.currentAccountContext = {
|
|
182
|
+
homeAccountId: result.account.homeAccountId,
|
|
183
|
+
environment: result.account.environment,
|
|
184
|
+
tenantId: result.account.tenantId,
|
|
185
|
+
};
|
|
186
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, correlationId, InteractionType.Silent, result);
|
|
187
|
+
ssoSilentMeasurement?.add({
|
|
188
|
+
accessTokenSize: result.accessToken.length,
|
|
189
|
+
idTokenSize: result.idToken.length,
|
|
190
|
+
});
|
|
191
|
+
ssoSilentMeasurement?.end({
|
|
192
|
+
success: true,
|
|
193
|
+
requestId: result.requestId,
|
|
194
|
+
}, undefined, result.account);
|
|
195
|
+
return result;
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
const error = e instanceof AuthError
|
|
199
|
+
? e
|
|
200
|
+
: this.nestedAppAuthAdapter.fromBridgeError(e);
|
|
201
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, correlationId, InteractionType.Silent, null, e);
|
|
202
|
+
ssoSilentMeasurement?.end({
|
|
203
|
+
success: false,
|
|
204
|
+
}, e, request.account);
|
|
205
|
+
throw error;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* acquires tokens from cache
|
|
210
|
+
* @param request
|
|
211
|
+
* @returns
|
|
212
|
+
*/
|
|
213
|
+
async acquireTokenFromCache(request) {
|
|
214
|
+
const correlationId = request.correlationId || createNewGuid();
|
|
215
|
+
const atsMeasurement = this.performanceClient.startMeasurement(AcquireTokenSilent, correlationId);
|
|
216
|
+
atsMeasurement?.add({
|
|
217
|
+
nestedAppAuthRequest: true,
|
|
218
|
+
});
|
|
219
|
+
// if the request has claims, we cannot look up in the cache
|
|
220
|
+
if (request.claims) {
|
|
221
|
+
this.logger.verbose("11t57w", correlationId);
|
|
222
|
+
return null;
|
|
223
|
+
}
|
|
224
|
+
// if the request has forceRefresh, we cannot look up in the cache
|
|
225
|
+
if (request.forceRefresh) {
|
|
226
|
+
this.logger.verbose("1ovnmo", correlationId);
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
// respect cache lookup policy
|
|
230
|
+
let result = null;
|
|
231
|
+
if (!request.cacheLookupPolicy) {
|
|
232
|
+
request.cacheLookupPolicy = CacheLookupPolicy.Default;
|
|
233
|
+
}
|
|
234
|
+
switch (request.cacheLookupPolicy) {
|
|
235
|
+
case CacheLookupPolicy.Default:
|
|
236
|
+
case CacheLookupPolicy.AccessToken:
|
|
237
|
+
case CacheLookupPolicy.AccessTokenAndRefreshToken:
|
|
238
|
+
result = await this.acquireTokenFromCacheInternal(request);
|
|
239
|
+
break;
|
|
240
|
+
default:
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
if (result) {
|
|
244
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, correlationId, InteractionType.Silent, result);
|
|
245
|
+
atsMeasurement.add({
|
|
246
|
+
accessTokenSize: result.accessToken.length,
|
|
247
|
+
idTokenSize: result.idToken.length,
|
|
248
|
+
});
|
|
249
|
+
atsMeasurement.end({
|
|
250
|
+
success: true,
|
|
251
|
+
}, undefined, result.account);
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
this.logger.warning("1yb4fi", correlationId);
|
|
255
|
+
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, correlationId, InteractionType.Silent, null);
|
|
256
|
+
atsMeasurement.end({
|
|
257
|
+
success: false,
|
|
258
|
+
}, undefined, request.account);
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
*
|
|
263
|
+
* @param request
|
|
264
|
+
* @returns
|
|
265
|
+
*/
|
|
266
|
+
async acquireTokenFromCacheInternal(request) {
|
|
267
|
+
// always prioritize the account context from the bridge
|
|
268
|
+
const accountContext = this.bridgeProxy.getAccountContext() || this.currentAccountContext;
|
|
269
|
+
const correlationId = request.correlationId || createNewGuid();
|
|
270
|
+
let currentAccount = null;
|
|
271
|
+
if (accountContext) {
|
|
272
|
+
currentAccount = getAccount(accountContext, this.logger, this.browserStorage, correlationId);
|
|
273
|
+
}
|
|
274
|
+
// fall back to brokering if no cached account is found
|
|
275
|
+
if (!currentAccount) {
|
|
276
|
+
this.logger.verbose("10qnr0", correlationId);
|
|
277
|
+
return Promise.resolve(null);
|
|
278
|
+
}
|
|
279
|
+
this.logger.verbose("1u7hux", correlationId);
|
|
280
|
+
const authRequest = {
|
|
281
|
+
...request,
|
|
282
|
+
correlationId: correlationId,
|
|
283
|
+
authority: request.authority || currentAccount.environment,
|
|
284
|
+
scopes: request.scopes?.length
|
|
285
|
+
? request.scopes
|
|
286
|
+
: [...Constants.OIDC_DEFAULT_SCOPES],
|
|
287
|
+
};
|
|
288
|
+
// fetch access token and check for expiry
|
|
289
|
+
const tokenKeys = this.browserStorage.getTokenKeys();
|
|
290
|
+
const cachedAccessToken = this.browserStorage.getAccessToken(currentAccount, authRequest, tokenKeys, currentAccount.tenantId);
|
|
291
|
+
// If there is no access token, log it and return null
|
|
292
|
+
if (!cachedAccessToken) {
|
|
293
|
+
this.logger.verbose("03vm49", correlationId);
|
|
294
|
+
return Promise.resolve(null);
|
|
295
|
+
}
|
|
296
|
+
else if (TimeUtils.wasClockTurnedBack(cachedAccessToken.cachedAt) ||
|
|
297
|
+
TimeUtils.isTokenExpired(cachedAccessToken.expiresOn, this.config.system.tokenRenewalOffsetSeconds)) {
|
|
298
|
+
this.logger.verbose("18egye", correlationId);
|
|
299
|
+
return Promise.resolve(null);
|
|
300
|
+
}
|
|
301
|
+
else if (authRequest.resource) {
|
|
302
|
+
const requestedResource = authRequest.resource;
|
|
303
|
+
const cachedResource = cachedAccessToken.resource;
|
|
304
|
+
if (!cachedResource || cachedResource !== requestedResource) {
|
|
305
|
+
this.logger.verbose("0qraxd", correlationId);
|
|
306
|
+
return Promise.resolve(null);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
const cachedIdToken = this.browserStorage.getIdToken(currentAccount, authRequest.correlationId, tokenKeys, currentAccount.tenantId);
|
|
310
|
+
if (!cachedIdToken) {
|
|
311
|
+
this.logger.verbose("0d68kd", correlationId);
|
|
312
|
+
return Promise.resolve(null);
|
|
313
|
+
}
|
|
314
|
+
return this.nestedAppAuthAdapter.toAuthenticationResultFromCache(currentAccount, cachedIdToken, cachedAccessToken, authRequest, authRequest.correlationId);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* acquireTokenPopup flow implementation
|
|
318
|
+
* @param request
|
|
319
|
+
* @returns
|
|
320
|
+
*/
|
|
321
|
+
async acquireTokenPopup(request) {
|
|
322
|
+
return this.acquireTokenInteractive(request);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* acquireTokenRedirect flow is not supported in nested app auth
|
|
326
|
+
* @param request
|
|
327
|
+
*/
|
|
328
|
+
acquireTokenRedirect(request) {
|
|
329
|
+
throw NestedAppAuthError.createUnsupportedError(request?.correlationId);
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* acquireTokenSilent flow implementation
|
|
333
|
+
* @param silentRequest
|
|
334
|
+
* @returns
|
|
335
|
+
*/
|
|
336
|
+
async acquireTokenSilent(silentRequest) {
|
|
337
|
+
return this.acquireTokenSilentInternal(silentRequest);
|
|
338
|
+
}
|
|
339
|
+
/**
|
|
340
|
+
* Hybrid flow is not currently supported in nested app auth
|
|
341
|
+
* @param request
|
|
342
|
+
*/
|
|
343
|
+
acquireTokenByCode(request) {
|
|
344
|
+
throw NestedAppAuthError.createUnsupportedError(request?.correlationId);
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Adds event callbacks to array
|
|
348
|
+
* @param callback
|
|
349
|
+
* @param eventTypes
|
|
350
|
+
*/
|
|
351
|
+
addEventCallback(callback, eventTypes) {
|
|
352
|
+
return this.eventHandler.addEventCallback(callback, eventTypes);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Removes callback with provided id from callback array
|
|
356
|
+
* @param callbackId
|
|
357
|
+
*/
|
|
358
|
+
removeEventCallback(callbackId) {
|
|
359
|
+
this.eventHandler.removeEventCallback(callbackId);
|
|
360
|
+
}
|
|
361
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
362
|
+
addPerformanceCallback(callback) {
|
|
363
|
+
// No request context: callback registration is not per-request
|
|
364
|
+
throw NestedAppAuthError.createUnsupportedError();
|
|
365
|
+
}
|
|
366
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
367
|
+
removePerformanceCallback(callbackId) {
|
|
368
|
+
// No request context: callback registration is not per-request
|
|
369
|
+
throw NestedAppAuthError.createUnsupportedError();
|
|
370
|
+
}
|
|
371
|
+
// #region Account APIs
|
|
372
|
+
/**
|
|
373
|
+
* Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.
|
|
374
|
+
* @param accountFilter - (Optional) filter to narrow down the accounts returned
|
|
375
|
+
* @returns Array of AccountInfo objects in cache
|
|
376
|
+
*/
|
|
377
|
+
getAllAccounts(accountFilter) {
|
|
378
|
+
return getAllAccounts(this.logger, this.browserStorage, this.isBrowserEnv(), createNewGuid(), accountFilter);
|
|
379
|
+
}
|
|
380
|
+
/**
|
|
381
|
+
* Returns the first account found in the cache that matches the account filter passed in.
|
|
382
|
+
* @param accountFilter
|
|
383
|
+
* @returns The first account found in the cache matching the provided filter or null if no account could be found.
|
|
384
|
+
*/
|
|
385
|
+
getAccount(accountFilter) {
|
|
386
|
+
return getAccount(accountFilter, this.logger, this.browserStorage, createNewGuid());
|
|
387
|
+
}
|
|
388
|
+
/**
|
|
389
|
+
* Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
|
|
390
|
+
* @param account
|
|
391
|
+
*/
|
|
392
|
+
setActiveAccount(account) {
|
|
393
|
+
/*
|
|
394
|
+
* StandardController uses this to allow the developer to set the active account
|
|
395
|
+
* in the nested app auth scenario the active account is controlled by the app hosting the nested app
|
|
396
|
+
*/
|
|
397
|
+
return setActiveAccount(account, this.browserStorage, createNewGuid());
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Gets the currently active account
|
|
401
|
+
*/
|
|
402
|
+
getActiveAccount() {
|
|
403
|
+
return getActiveAccount(this.browserStorage, createNewGuid());
|
|
404
|
+
}
|
|
405
|
+
// #endregion
|
|
406
|
+
handleRedirectPromise(options // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
407
|
+
) {
|
|
408
|
+
return Promise.resolve(null);
|
|
409
|
+
}
|
|
410
|
+
loginPopup(request // eslint-disable-line @typescript-eslint/no-unused-vars
|
|
411
|
+
) {
|
|
412
|
+
return this.acquireTokenInteractive(request || DEFAULT_REQUEST);
|
|
413
|
+
}
|
|
414
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
415
|
+
loginRedirect(request) {
|
|
416
|
+
throw NestedAppAuthError.createUnsupportedError(request?.correlationId);
|
|
417
|
+
}
|
|
418
|
+
logoutRedirect(logoutRequest) {
|
|
419
|
+
throw NestedAppAuthError.createUnsupportedError(logoutRequest?.correlationId);
|
|
420
|
+
}
|
|
421
|
+
logoutPopup(logoutRequest) {
|
|
422
|
+
throw NestedAppAuthError.createUnsupportedError(logoutRequest?.correlationId);
|
|
423
|
+
}
|
|
424
|
+
ssoSilent(
|
|
425
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
426
|
+
request) {
|
|
427
|
+
return this.acquireTokenSilentInternal(request);
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Returns the logger instance
|
|
431
|
+
*/
|
|
432
|
+
getLogger() {
|
|
433
|
+
return this.logger;
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Replaces the default logger set in configurations with new Logger with new configurations
|
|
437
|
+
* @param logger Logger instance
|
|
438
|
+
*/
|
|
439
|
+
setLogger(logger) {
|
|
440
|
+
this.logger = logger;
|
|
441
|
+
}
|
|
442
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
443
|
+
initializeWrapperLibrary(sku, version) {
|
|
444
|
+
/*
|
|
445
|
+
* Standard controller uses this to set the sku and version of the wrapper library in the storage
|
|
446
|
+
* we do nothing here
|
|
447
|
+
*/
|
|
448
|
+
return;
|
|
449
|
+
}
|
|
450
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
451
|
+
setNavigationClient(navigationClient) {
|
|
452
|
+
this.logger.warning("1k8729", "");
|
|
453
|
+
}
|
|
454
|
+
getConfiguration() {
|
|
455
|
+
return this.config;
|
|
456
|
+
}
|
|
457
|
+
isBrowserEnv() {
|
|
458
|
+
return this.operatingContext.isBrowserEnvironment();
|
|
459
|
+
}
|
|
460
|
+
getBrowserCrypto() {
|
|
461
|
+
return this.browserCrypto;
|
|
462
|
+
}
|
|
463
|
+
getPerformanceClient() {
|
|
464
|
+
// Accessor stub with no request context
|
|
465
|
+
throw NestedAppAuthError.createUnsupportedError();
|
|
466
|
+
}
|
|
467
|
+
getRedirectResponse() {
|
|
468
|
+
// Accessor stub with no request context
|
|
469
|
+
throw NestedAppAuthError.createUnsupportedError();
|
|
470
|
+
}
|
|
471
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
472
|
+
async clearCache(logoutRequest) {
|
|
473
|
+
throw NestedAppAuthError.createUnsupportedError(logoutRequest?.correlationId);
|
|
474
|
+
}
|
|
475
|
+
async hydrateCache(result, request) {
|
|
476
|
+
this.logger.verbose("16jycr", result.correlationId);
|
|
477
|
+
const accountEntity = AccountEntityUtils.createAccountEntityFromAccountInfo(result.account, result.cloudGraphHostName, result.msGraphHost);
|
|
478
|
+
await this.browserStorage.setAccount(accountEntity, result.correlationId, AuthToken.isKmsi(result.idTokenClaims), ApiId.hydrateCache);
|
|
479
|
+
return this.browserStorage.hydrateCache(result, request);
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
export { NestedAppAuthController };
|