daftari 3.13.0 → 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 +28 -0
- package/dist/distill/propose.d.ts +10 -0
- package/dist/distill/propose.d.ts.map +1 -1
- package/dist/distill/propose.js +49 -10
- package/dist/distill/propose.js.map +1 -1
- package/dist/distill/state.d.ts +6 -0
- package/dist/distill/state.d.ts.map +1 -1
- package/dist/distill/state.js +1 -1
- package/dist/distill/state.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/distill.d.ts.map +1 -1
- package/dist/integrations/distill.js +1 -0
- package/dist/integrations/distill.js.map +1 -1
- package/dist/integrations/engine.d.ts +208 -2
- package/dist/integrations/engine.d.ts.map +1 -1
- package/dist/integrations/engine.js +360 -30
- 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 +13 -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 +525 -11
- 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 +51 -11
- 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 +74 -5
- package/dist/integrations/state.js.map +1 -1
- package/dist/integrations/types.d.ts +84 -1
- 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/okf/import.d.ts.map +1 -1
- package/dist/okf/import.js +208 -65
- package/dist/okf/import.js.map +1 -1
- package/dist/okf/index.d.ts.map +1 -1
- package/dist/okf/index.js +5 -0
- package/dist/okf/index.js.map +1 -1
- package/dist/okf/map.d.ts.map +1 -1
- package/dist/okf/map.js +3 -2
- package/dist/okf/map.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 -18
- 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 +11 -4
- 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
package/src/integrations/microsoft/assets/vendor/msal-common/cache/persistence/TokenCacheContext.mjs
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*! @azure/msal-common v16.14.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* This class instance helps track the memory changes facilitating
|
|
9
|
+
* decisions to read from and write to the persistent cache
|
|
10
|
+
*/ class TokenCacheContext {
|
|
11
|
+
constructor(tokenCache, hasChanged) {
|
|
12
|
+
this.cache = tokenCache;
|
|
13
|
+
this.hasChanged = hasChanged;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* boolean which indicates the changes in cache
|
|
17
|
+
*/
|
|
18
|
+
get cacheHasChanged() {
|
|
19
|
+
return this.hasChanged;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* function to retrieve the token cache
|
|
23
|
+
*/
|
|
24
|
+
get tokenCache() {
|
|
25
|
+
return this.cache;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export { TokenCacheContext };
|
package/src/integrations/microsoft/assets/vendor/msal-common/cache/utils/AccountEntityUtils.mjs
ADDED
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
/*! @azure/msal-common v16.14.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { CACHE_ACCOUNT_TYPE_GENERIC, CACHE_KEY_SEPARATOR, CACHE_ACCOUNT_TYPE_ADFS, CACHE_ACCOUNT_TYPE_MSSTS } from '../../utils/Constants.mjs';
|
|
4
|
+
import { buildClientInfo } from '../../account/ClientInfo.mjs';
|
|
5
|
+
import { buildTenantProfile } from '../../account/AccountInfo.mjs';
|
|
6
|
+
import { createClientAuthError } from '../../error/ClientAuthError.mjs';
|
|
7
|
+
import { AuthorityType } from '../../authority/AuthorityType.mjs';
|
|
8
|
+
import { getTenantIdFromIdTokenClaims } from '../../account/TokenClaims.mjs';
|
|
9
|
+
import { ProtocolMode } from '../../authority/ProtocolMode.mjs';
|
|
10
|
+
import { invalidCacheEnvironment } from '../../error/ClientAuthErrorCodes.mjs';
|
|
11
|
+
|
|
12
|
+
/*
|
|
13
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
14
|
+
* Licensed under the MIT License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
function generateAccountId(accountEntity) {
|
|
21
|
+
const accountId = [
|
|
22
|
+
accountEntity.homeAccountId,
|
|
23
|
+
accountEntity.environment,
|
|
24
|
+
];
|
|
25
|
+
return accountId.join(CACHE_KEY_SEPARATOR).toLowerCase();
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Returns the AccountInfo interface for this account.
|
|
29
|
+
* @internal
|
|
30
|
+
*/
|
|
31
|
+
function getAccountInfo(accountEntity) {
|
|
32
|
+
const tenantProfiles = accountEntity.tenantProfiles || [];
|
|
33
|
+
// Ensure at least the home tenant profile exists
|
|
34
|
+
if (tenantProfiles.length === 0 &&
|
|
35
|
+
accountEntity.realm &&
|
|
36
|
+
accountEntity.localAccountId) {
|
|
37
|
+
tenantProfiles.push(buildTenantProfile(accountEntity.homeAccountId, accountEntity.localAccountId, accountEntity.realm, accountEntity.nativeAccountId));
|
|
38
|
+
}
|
|
39
|
+
// Resolve nativeAccountId from the home tenant profile first, fall back to top-level (deprecated) for old cache entries
|
|
40
|
+
const homeTenantProfile = tenantProfiles.find((tp) => tp.tenantId === accountEntity.realm);
|
|
41
|
+
const nativeAccountId = homeTenantProfile?.nativeAccountId || accountEntity.nativeAccountId;
|
|
42
|
+
return {
|
|
43
|
+
homeAccountId: accountEntity.homeAccountId,
|
|
44
|
+
environment: accountEntity.environment,
|
|
45
|
+
tenantId: accountEntity.realm,
|
|
46
|
+
username: accountEntity.username,
|
|
47
|
+
localAccountId: accountEntity.localAccountId,
|
|
48
|
+
loginHint: accountEntity.loginHint,
|
|
49
|
+
name: accountEntity.name,
|
|
50
|
+
nativeAccountId: nativeAccountId,
|
|
51
|
+
authorityType: accountEntity.authorityType,
|
|
52
|
+
// Deserialize tenant profiles array into a Map
|
|
53
|
+
tenantProfiles: new Map(tenantProfiles.map((tenantProfile) => {
|
|
54
|
+
return [tenantProfile.tenantId, tenantProfile];
|
|
55
|
+
})),
|
|
56
|
+
dataBoundary: accountEntity.dataBoundary,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Returns true if the account entity is in single tenant format (outdated), false otherwise
|
|
61
|
+
* @internal
|
|
62
|
+
*/
|
|
63
|
+
function isSingleTenant(accountEntity) {
|
|
64
|
+
return !accountEntity.tenantProfiles;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
|
|
68
|
+
* @param accountDetails
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
function createAccountEntity(accountDetails, authority, correlationId, base64Decode) {
|
|
72
|
+
let authorityType;
|
|
73
|
+
if (authority.authorityType === AuthorityType.Adfs) {
|
|
74
|
+
authorityType = CACHE_ACCOUNT_TYPE_ADFS;
|
|
75
|
+
}
|
|
76
|
+
else if (authority.protocolMode === ProtocolMode.OIDC) {
|
|
77
|
+
authorityType = CACHE_ACCOUNT_TYPE_GENERIC;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
authorityType = CACHE_ACCOUNT_TYPE_MSSTS;
|
|
81
|
+
}
|
|
82
|
+
let clientInfo;
|
|
83
|
+
let dataBoundary;
|
|
84
|
+
if (accountDetails.clientInfo && base64Decode) {
|
|
85
|
+
clientInfo = buildClientInfo(accountDetails.clientInfo, base64Decode);
|
|
86
|
+
if (clientInfo.xms_tdbr) {
|
|
87
|
+
dataBoundary = clientInfo.xms_tdbr === "EU" ? "EU" : "None";
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const env = accountDetails.environment ||
|
|
91
|
+
(authority && authority.getPreferredCache());
|
|
92
|
+
if (!env) {
|
|
93
|
+
throw createClientAuthError(invalidCacheEnvironment, correlationId);
|
|
94
|
+
}
|
|
95
|
+
/*
|
|
96
|
+
* In B2C scenarios the emails claim is used instead of preferred_username and it is an array.
|
|
97
|
+
* In most cases it will contain a single email. This field should not be relied upon if a custom
|
|
98
|
+
* policy is configured to return more than 1 email.
|
|
99
|
+
*/
|
|
100
|
+
const preferredUsername = accountDetails.idTokenClaims?.preferred_username ||
|
|
101
|
+
accountDetails.idTokenClaims?.upn;
|
|
102
|
+
const email = accountDetails.idTokenClaims?.emails
|
|
103
|
+
? accountDetails.idTokenClaims.emails[0]
|
|
104
|
+
: null;
|
|
105
|
+
const username = preferredUsername || email || "";
|
|
106
|
+
const loginHint = accountDetails.idTokenClaims?.login_hint;
|
|
107
|
+
const realm = clientInfo?.utid ||
|
|
108
|
+
getTenantIdFromIdTokenClaims(accountDetails.idTokenClaims) ||
|
|
109
|
+
""; // non-AAD scenarios can have empty realm
|
|
110
|
+
// How do you account for MSA CID here?
|
|
111
|
+
const localAccountId = clientInfo?.uid ||
|
|
112
|
+
accountDetails.idTokenClaims?.oid ||
|
|
113
|
+
accountDetails.idTokenClaims?.sub ||
|
|
114
|
+
"";
|
|
115
|
+
let tenantProfiles;
|
|
116
|
+
if (accountDetails.tenantProfiles) {
|
|
117
|
+
tenantProfiles = accountDetails.tenantProfiles;
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
const tenantProfile = buildTenantProfile(accountDetails.homeAccountId, localAccountId, realm, accountDetails.nativeAccountId, accountDetails.idTokenClaims);
|
|
121
|
+
tenantProfiles = [tenantProfile];
|
|
122
|
+
}
|
|
123
|
+
return {
|
|
124
|
+
homeAccountId: accountDetails.homeAccountId,
|
|
125
|
+
environment: env,
|
|
126
|
+
realm: realm,
|
|
127
|
+
localAccountId: localAccountId,
|
|
128
|
+
username: username,
|
|
129
|
+
authorityType: authorityType,
|
|
130
|
+
loginHint: loginHint,
|
|
131
|
+
clientInfo: accountDetails.clientInfo,
|
|
132
|
+
name: accountDetails.idTokenClaims?.name || "",
|
|
133
|
+
lastModificationTime: undefined,
|
|
134
|
+
lastModificationApp: undefined,
|
|
135
|
+
cloudGraphHostName: accountDetails.cloudGraphHostName,
|
|
136
|
+
msGraphHost: accountDetails.msGraphHost,
|
|
137
|
+
nativeAccountId: accountDetails.nativeAccountId,
|
|
138
|
+
tenantProfiles: tenantProfiles,
|
|
139
|
+
dataBoundary,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Creates an AccountEntity object from AccountInfo
|
|
144
|
+
* @param accountInfo
|
|
145
|
+
* @param cloudGraphHostName
|
|
146
|
+
* @param msGraphHost
|
|
147
|
+
* @returns
|
|
148
|
+
* @internal
|
|
149
|
+
*/
|
|
150
|
+
function createAccountEntityFromAccountInfo(accountInfo, cloudGraphHostName, msGraphHost) {
|
|
151
|
+
// Serialize tenant profiles map into an array
|
|
152
|
+
const tenantProfiles = Array.from(accountInfo.tenantProfiles?.values() || []);
|
|
153
|
+
// Ensure at least the home tenant profile exists
|
|
154
|
+
if (tenantProfiles.length === 0 &&
|
|
155
|
+
accountInfo.tenantId &&
|
|
156
|
+
accountInfo.localAccountId) {
|
|
157
|
+
tenantProfiles.push(buildTenantProfile(accountInfo.homeAccountId, accountInfo.localAccountId, accountInfo.tenantId, accountInfo.nativeAccountId, accountInfo.idTokenClaims));
|
|
158
|
+
}
|
|
159
|
+
else if (accountInfo.nativeAccountId) {
|
|
160
|
+
// Ensure nativeAccountId is set on the matching tenant profile
|
|
161
|
+
const matchingProfile = tenantProfiles.find((tp) => tp.tenantId === accountInfo.tenantId);
|
|
162
|
+
if (matchingProfile && !matchingProfile.nativeAccountId) {
|
|
163
|
+
matchingProfile.nativeAccountId = accountInfo.nativeAccountId;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
return {
|
|
167
|
+
authorityType: accountInfo.authorityType || CACHE_ACCOUNT_TYPE_GENERIC,
|
|
168
|
+
homeAccountId: accountInfo.homeAccountId,
|
|
169
|
+
localAccountId: accountInfo.localAccountId,
|
|
170
|
+
nativeAccountId: accountInfo.nativeAccountId,
|
|
171
|
+
realm: accountInfo.tenantId,
|
|
172
|
+
environment: accountInfo.environment,
|
|
173
|
+
username: accountInfo.username,
|
|
174
|
+
loginHint: accountInfo.loginHint,
|
|
175
|
+
name: accountInfo.name,
|
|
176
|
+
cloudGraphHostName: cloudGraphHostName,
|
|
177
|
+
msGraphHost: msGraphHost,
|
|
178
|
+
tenantProfiles: tenantProfiles,
|
|
179
|
+
dataBoundary: accountInfo.dataBoundary,
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Generate HomeAccountId from server response
|
|
184
|
+
* @param serverClientInfo
|
|
185
|
+
* @param authType
|
|
186
|
+
*/
|
|
187
|
+
function generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj, correlationId, idTokenClaims) {
|
|
188
|
+
// ADFS does not have tid and does not set client_info
|
|
189
|
+
if (authType !== AuthorityType.Adfs) {
|
|
190
|
+
// for cases where there is clientInfo
|
|
191
|
+
if (serverClientInfo) {
|
|
192
|
+
try {
|
|
193
|
+
const clientInfo = buildClientInfo(serverClientInfo, cryptoObj.base64Decode);
|
|
194
|
+
if (clientInfo.uid && clientInfo.utid) {
|
|
195
|
+
return `${clientInfo.uid}.${clientInfo.utid}`;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
catch (e) { }
|
|
199
|
+
}
|
|
200
|
+
logger.warning("1ub6wv", correlationId);
|
|
201
|
+
}
|
|
202
|
+
// default to "sub" claim
|
|
203
|
+
return idTokenClaims?.sub || "";
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Validates an entity: checks for all expected params
|
|
207
|
+
* @param entity
|
|
208
|
+
* @internal
|
|
209
|
+
*/
|
|
210
|
+
function isAccountEntity(entity) {
|
|
211
|
+
if (!entity) {
|
|
212
|
+
return false;
|
|
213
|
+
}
|
|
214
|
+
return (entity.hasOwnProperty("homeAccountId") &&
|
|
215
|
+
entity.hasOwnProperty("environment") &&
|
|
216
|
+
entity.hasOwnProperty("realm") &&
|
|
217
|
+
entity.hasOwnProperty("localAccountId") &&
|
|
218
|
+
entity.hasOwnProperty("username") &&
|
|
219
|
+
entity.hasOwnProperty("authorityType"));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export { createAccountEntity, createAccountEntityFromAccountInfo, generateAccountId, generateHomeAccountId, getAccountInfo, isAccountEntity, isSingleTenant };
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
/*! @azure/msal-common v16.14.0 2026-08-28 */
|
|
2
|
+
'use strict';
|
|
3
|
+
import { extractTokenClaims } from '../../account/AuthToken.mjs';
|
|
4
|
+
import { createClientAuthError } from '../../error/ClientAuthError.mjs';
|
|
5
|
+
import { AuthenticationScheme, CredentialType, APP_METADATA, CACHE_KEY_SEPARATOR, AUTHORITY_METADATA_REFRESH_TIME_SECONDS, AUTHORITY_METADATA_CACHE_KEY, SERVER_TELEM_CACHE_KEY, THROTTLING_PREFIX } from '../../utils/Constants.mjs';
|
|
6
|
+
import { nowSeconds } from '../../utils/TimeUtils.mjs';
|
|
7
|
+
import { keyIdMissing, tokenClaimsCnfRequiredForSignedJwt } from '../../error/ClientAuthErrorCodes.mjs';
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
11
|
+
* Licensed under the MIT License.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Create IdTokenEntity
|
|
15
|
+
* @param homeAccountId
|
|
16
|
+
* @param authenticationResult
|
|
17
|
+
* @param clientId
|
|
18
|
+
* @param authority
|
|
19
|
+
*/
|
|
20
|
+
function createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {
|
|
21
|
+
const idTokenEntity = {
|
|
22
|
+
credentialType: CredentialType.ID_TOKEN,
|
|
23
|
+
homeAccountId: homeAccountId,
|
|
24
|
+
environment: environment,
|
|
25
|
+
clientId: clientId,
|
|
26
|
+
secret: idToken,
|
|
27
|
+
realm: tenantId,
|
|
28
|
+
lastUpdatedAt: Date.now().toString(), // Set the last updated time to now
|
|
29
|
+
};
|
|
30
|
+
return idTokenEntity;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create AccessTokenEntity
|
|
34
|
+
* @param homeAccountId
|
|
35
|
+
* @param environment
|
|
36
|
+
* @param accessToken
|
|
37
|
+
* @param clientId
|
|
38
|
+
* @param tenantId
|
|
39
|
+
* @param scopes
|
|
40
|
+
* @param expiresOn
|
|
41
|
+
* @param extExpiresOn
|
|
42
|
+
*/
|
|
43
|
+
function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, correlationId, refreshOn, tokenType, userAssertionHash, keyId, additionalCacheKeyComponents) {
|
|
44
|
+
const atEntity = {
|
|
45
|
+
homeAccountId: homeAccountId,
|
|
46
|
+
credentialType: CredentialType.ACCESS_TOKEN,
|
|
47
|
+
secret: accessToken,
|
|
48
|
+
cachedAt: nowSeconds().toString(),
|
|
49
|
+
expiresOn: expiresOn.toString(),
|
|
50
|
+
extendedExpiresOn: extExpiresOn.toString(),
|
|
51
|
+
environment: environment,
|
|
52
|
+
clientId: clientId,
|
|
53
|
+
realm: tenantId,
|
|
54
|
+
target: scopes,
|
|
55
|
+
tokenType: tokenType || AuthenticationScheme.BEARER,
|
|
56
|
+
lastUpdatedAt: Date.now().toString(), // Set the last updated time to now
|
|
57
|
+
};
|
|
58
|
+
if (userAssertionHash) {
|
|
59
|
+
atEntity.userAssertionHash = userAssertionHash;
|
|
60
|
+
}
|
|
61
|
+
if (refreshOn) {
|
|
62
|
+
atEntity.refreshOn = refreshOn.toString();
|
|
63
|
+
}
|
|
64
|
+
const normalizedTokenType = atEntity.tokenType?.toLowerCase();
|
|
65
|
+
/*
|
|
66
|
+
* Create Access Token With Auth Scheme instead of regular access token
|
|
67
|
+
* Cast to lower to handle "bearer" from ADFS
|
|
68
|
+
*/
|
|
69
|
+
if (atEntity.tokenType?.toLowerCase() !==
|
|
70
|
+
AuthenticationScheme.BEARER.toLowerCase()) {
|
|
71
|
+
atEntity.credentialType =
|
|
72
|
+
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
|
73
|
+
switch (normalizedTokenType) {
|
|
74
|
+
case AuthenticationScheme.POP:
|
|
75
|
+
// Make sure keyId is present and add it to credential
|
|
76
|
+
const tokenClaims = extractTokenClaims(accessToken, base64Decode, correlationId);
|
|
77
|
+
if (!tokenClaims?.cnf?.kid) {
|
|
78
|
+
throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt, correlationId);
|
|
79
|
+
}
|
|
80
|
+
atEntity.keyId = tokenClaims.cnf.kid;
|
|
81
|
+
break;
|
|
82
|
+
case "dpop":
|
|
83
|
+
if (!keyId) {
|
|
84
|
+
throw createClientAuthError(keyIdMissing, correlationId);
|
|
85
|
+
}
|
|
86
|
+
atEntity.keyId = keyId;
|
|
87
|
+
break;
|
|
88
|
+
case AuthenticationScheme.SSH:
|
|
89
|
+
atEntity.keyId = keyId;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/* Additional cache key components for cache isolation (e.g., FMI path) */
|
|
93
|
+
if (additionalCacheKeyComponents &&
|
|
94
|
+
Object.keys(additionalCacheKeyComponents).length > 0) {
|
|
95
|
+
atEntity.additionalCacheKeyComponents = additionalCacheKeyComponents;
|
|
96
|
+
}
|
|
97
|
+
return atEntity;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Create RefreshTokenEntity
|
|
101
|
+
* @param homeAccountId
|
|
102
|
+
* @param authenticationResult
|
|
103
|
+
* @param clientId
|
|
104
|
+
* @param authority
|
|
105
|
+
*/
|
|
106
|
+
function createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash, expiresOn) {
|
|
107
|
+
const rtEntity = {
|
|
108
|
+
credentialType: CredentialType.REFRESH_TOKEN,
|
|
109
|
+
homeAccountId: homeAccountId,
|
|
110
|
+
environment: environment,
|
|
111
|
+
clientId: clientId,
|
|
112
|
+
secret: refreshToken,
|
|
113
|
+
lastUpdatedAt: Date.now().toString(),
|
|
114
|
+
};
|
|
115
|
+
if (userAssertionHash) {
|
|
116
|
+
rtEntity.userAssertionHash = userAssertionHash;
|
|
117
|
+
}
|
|
118
|
+
if (familyId) {
|
|
119
|
+
rtEntity.familyId = familyId;
|
|
120
|
+
}
|
|
121
|
+
if (expiresOn) {
|
|
122
|
+
rtEntity.expiresOn = expiresOn.toString();
|
|
123
|
+
}
|
|
124
|
+
return rtEntity;
|
|
125
|
+
}
|
|
126
|
+
function isCredentialEntity(entity) {
|
|
127
|
+
return (entity.hasOwnProperty("homeAccountId") &&
|
|
128
|
+
entity.hasOwnProperty("environment") &&
|
|
129
|
+
entity.hasOwnProperty("credentialType") &&
|
|
130
|
+
entity.hasOwnProperty("clientId") &&
|
|
131
|
+
entity.hasOwnProperty("secret"));
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Validates an entity: checks for all expected params
|
|
135
|
+
* @param entity
|
|
136
|
+
*/
|
|
137
|
+
function isAccessTokenEntity(entity) {
|
|
138
|
+
if (!entity) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
return (isCredentialEntity(entity) &&
|
|
142
|
+
entity.hasOwnProperty("realm") &&
|
|
143
|
+
entity.hasOwnProperty("target") &&
|
|
144
|
+
(entity["credentialType"] === CredentialType.ACCESS_TOKEN ||
|
|
145
|
+
entity["credentialType"] ===
|
|
146
|
+
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Validates an entity: checks for all expected params
|
|
150
|
+
* @param entity
|
|
151
|
+
*/
|
|
152
|
+
function isIdTokenEntity(entity) {
|
|
153
|
+
if (!entity) {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
return (isCredentialEntity(entity) &&
|
|
157
|
+
entity.hasOwnProperty("realm") &&
|
|
158
|
+
entity["credentialType"] === CredentialType.ID_TOKEN);
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Validates an entity: checks for all expected params
|
|
162
|
+
* @param entity
|
|
163
|
+
*/
|
|
164
|
+
function isRefreshTokenEntity(entity) {
|
|
165
|
+
if (!entity) {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
return (isCredentialEntity(entity) &&
|
|
169
|
+
entity["credentialType"] === CredentialType.REFRESH_TOKEN);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* validates if a given cache entry is "Telemetry", parses <key,value>
|
|
173
|
+
* @param key
|
|
174
|
+
* @param entity
|
|
175
|
+
*/
|
|
176
|
+
function isServerTelemetryEntity(key, entity) {
|
|
177
|
+
const validateKey = key.indexOf(SERVER_TELEM_CACHE_KEY) === 0;
|
|
178
|
+
let validateEntity = true;
|
|
179
|
+
if (entity) {
|
|
180
|
+
validateEntity =
|
|
181
|
+
entity.hasOwnProperty("failedRequests") &&
|
|
182
|
+
entity.hasOwnProperty("errors") &&
|
|
183
|
+
entity.hasOwnProperty("cacheHits");
|
|
184
|
+
}
|
|
185
|
+
return validateKey && validateEntity;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* validates if a given cache entry is "Throttling", parses <key,value>
|
|
189
|
+
* @param key
|
|
190
|
+
* @param entity
|
|
191
|
+
*/
|
|
192
|
+
function isThrottlingEntity(key, entity) {
|
|
193
|
+
let validateKey = false;
|
|
194
|
+
if (key) {
|
|
195
|
+
validateKey = key.indexOf(THROTTLING_PREFIX) === 0;
|
|
196
|
+
}
|
|
197
|
+
let validateEntity = true;
|
|
198
|
+
if (entity) {
|
|
199
|
+
validateEntity = entity.hasOwnProperty("throttleTime");
|
|
200
|
+
}
|
|
201
|
+
return validateKey && validateEntity;
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Generate AppMetadata Cache Key as per the schema: appmetadata-<environment>-<client_id>
|
|
205
|
+
*/
|
|
206
|
+
function generateAppMetadataKey({ environment, clientId, }) {
|
|
207
|
+
const appMetaDataKeyArray = [
|
|
208
|
+
APP_METADATA,
|
|
209
|
+
environment,
|
|
210
|
+
clientId,
|
|
211
|
+
];
|
|
212
|
+
return appMetaDataKeyArray
|
|
213
|
+
.join(CACHE_KEY_SEPARATOR)
|
|
214
|
+
.toLowerCase();
|
|
215
|
+
}
|
|
216
|
+
/*
|
|
217
|
+
* Validates an entity: checks for all expected params
|
|
218
|
+
* @param entity
|
|
219
|
+
*/
|
|
220
|
+
function isAppMetadataEntity(key, entity) {
|
|
221
|
+
if (!entity) {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
return (key.indexOf(APP_METADATA) === 0 &&
|
|
225
|
+
entity.hasOwnProperty("clientId") &&
|
|
226
|
+
entity.hasOwnProperty("environment"));
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Validates an entity: checks for all expected params
|
|
230
|
+
* @param entity
|
|
231
|
+
*/
|
|
232
|
+
function isAuthorityMetadataEntity(key, entity) {
|
|
233
|
+
if (!entity) {
|
|
234
|
+
return false;
|
|
235
|
+
}
|
|
236
|
+
return (key.indexOf(AUTHORITY_METADATA_CACHE_KEY) === 0 &&
|
|
237
|
+
entity.hasOwnProperty("aliases") &&
|
|
238
|
+
entity.hasOwnProperty("preferred_cache") &&
|
|
239
|
+
entity.hasOwnProperty("preferred_network") &&
|
|
240
|
+
entity.hasOwnProperty("canonical_authority") &&
|
|
241
|
+
entity.hasOwnProperty("authorization_endpoint") &&
|
|
242
|
+
entity.hasOwnProperty("token_endpoint") &&
|
|
243
|
+
entity.hasOwnProperty("issuer") &&
|
|
244
|
+
entity.hasOwnProperty("aliasesFromNetwork") &&
|
|
245
|
+
entity.hasOwnProperty("endpointsFromNetwork") &&
|
|
246
|
+
entity.hasOwnProperty("expiresAt") &&
|
|
247
|
+
entity.hasOwnProperty("jwks_uri"));
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* Reset the exiresAt value
|
|
251
|
+
*/
|
|
252
|
+
function generateAuthorityMetadataExpiresAt() {
|
|
253
|
+
return (nowSeconds() +
|
|
254
|
+
AUTHORITY_METADATA_REFRESH_TIME_SECONDS);
|
|
255
|
+
}
|
|
256
|
+
/** @internal */
|
|
257
|
+
function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {
|
|
258
|
+
authorityMetadata.authorization_endpoint =
|
|
259
|
+
updatedValues.authorization_endpoint;
|
|
260
|
+
authorityMetadata.token_endpoint = updatedValues.token_endpoint;
|
|
261
|
+
authorityMetadata.end_session_endpoint = updatedValues.end_session_endpoint;
|
|
262
|
+
authorityMetadata.issuer = updatedValues.issuer;
|
|
263
|
+
authorityMetadata.endpointsFromNetwork = fromNetwork;
|
|
264
|
+
authorityMetadata.jwks_uri = updatedValues.jwks_uri;
|
|
265
|
+
}
|
|
266
|
+
/** @internal */
|
|
267
|
+
function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetwork) {
|
|
268
|
+
authorityMetadata.aliases = updatedValues.aliases;
|
|
269
|
+
authorityMetadata.preferred_cache = updatedValues.preferred_cache;
|
|
270
|
+
authorityMetadata.preferred_network = updatedValues.preferred_network;
|
|
271
|
+
authorityMetadata.aliasesFromNetwork = fromNetwork;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Returns whether or not the data needs to be refreshed
|
|
275
|
+
* @internal
|
|
276
|
+
*/
|
|
277
|
+
function isAuthorityMetadataExpired(metadata) {
|
|
278
|
+
return metadata.expiresAt <= nowSeconds();
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Serialize attribute tokens synchronously (sort and join).
|
|
282
|
+
* This is a sync-only operation for use at request construction time.
|
|
283
|
+
* @param attributeTokens - array of tokens
|
|
284
|
+
* @returns serialized partition string or undefined if no tokens
|
|
285
|
+
*/
|
|
286
|
+
function serializeAttributeTokens(attributeTokens) {
|
|
287
|
+
if (!attributeTokens || attributeTokens.length === 0) {
|
|
288
|
+
return undefined;
|
|
289
|
+
}
|
|
290
|
+
// Serialize: sort and join tokens
|
|
291
|
+
return [...attributeTokens].sort().join(" ");
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
export { createAccessTokenEntity, createIdTokenEntity, createRefreshTokenEntity, generateAppMetadataKey, generateAuthorityMetadataExpiresAt, isAccessTokenEntity, isAppMetadataEntity, isAuthorityMetadataEntity, isAuthorityMetadataExpired, isCredentialEntity, isIdTokenEntity, isRefreshTokenEntity, isServerTelemetryEntity, isThrottlingEntity, serializeAttributeTokens, updateAuthorityEndpointMetadata, updateCloudDiscoveryMetadata };
|