Commit iniziale
This commit is contained in:
16
node_modules/@azure/msal-node/dist/cache/ITokenCache.d.ts
generated
vendored
Normal file
16
node_modules/@azure/msal-node/dist/cache/ITokenCache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
import { AccountInfo } from "@azure/msal-common/node";
|
||||
/**
|
||||
* Token cache interface for the client, giving access to cache APIs
|
||||
* @public
|
||||
*/
|
||||
export interface ITokenCache {
|
||||
/** API that retrieves all accounts currently in cache to the user */
|
||||
getAllAccounts(): Promise<AccountInfo[]>;
|
||||
/** Returns the signed in account matching homeAccountId */
|
||||
getAccountByHomeId(homeAccountId: string): Promise<AccountInfo | null>;
|
||||
/** Returns the signed in account matching localAccountId */
|
||||
getAccountByLocalId(localAccountId: string): Promise<AccountInfo | null>;
|
||||
/** API to remove a specific account and the relevant data from cache */
|
||||
removeAccount(account: AccountInfo): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=ITokenCache.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/ITokenCache.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/ITokenCache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ITokenCache.d.ts","sourceRoot":"","sources":["../../src/cache/ITokenCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB,qEAAqE;IACrE,cAAc,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAEzC,2DAA2D;IAC3D,kBAAkB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEvE,4DAA4D;IAC5D,mBAAmB,CAAC,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IAEzE,wEAAwE;IACxE,aAAa,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD"}
|
||||
194
node_modules/@azure/msal-node/dist/cache/NodeStorage.d.ts
generated
vendored
Normal file
194
node_modules/@azure/msal-node/dist/cache/NodeStorage.d.ts
generated
vendored
Normal file
@@ -0,0 +1,194 @@
|
||||
import { TokenKeys, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, ThrottlingEntity, CacheManager, Logger, ValidCacheType, ICrypto, AuthorityMetadataEntity, ValidCredentialType, StaticAuthorityOptions } from "@azure/msal-common/node";
|
||||
import { InMemoryCache, JsonCache, CacheKVStore } from "./serializer/SerializerTypes.js";
|
||||
/**
|
||||
* This class implements Storage for node, reading cache from user specified storage location or an extension library
|
||||
* @public
|
||||
*/
|
||||
export declare class NodeStorage extends CacheManager {
|
||||
private logger;
|
||||
private cache;
|
||||
private changeEmitters;
|
||||
constructor(logger: Logger, clientId: string, cryptoImpl: ICrypto, staticAuthorityOptions?: StaticAuthorityOptions);
|
||||
/**
|
||||
* Queue up callbacks
|
||||
* @param func - a callback function for cache change indication
|
||||
*/
|
||||
registerChangeEmitter(func: () => void): void;
|
||||
/**
|
||||
* Invoke the callback when cache changes
|
||||
*/
|
||||
emitChange(): void;
|
||||
/**
|
||||
* Converts cacheKVStore to InMemoryCache
|
||||
* @param cache - key value store
|
||||
*/
|
||||
cacheToInMemoryCache(cache: CacheKVStore): InMemoryCache;
|
||||
/**
|
||||
* converts inMemoryCache to CacheKVStore
|
||||
* @param inMemoryCache - kvstore map for inmemory
|
||||
*/
|
||||
inMemoryCacheToCache(inMemoryCache: InMemoryCache): CacheKVStore;
|
||||
/**
|
||||
* gets the current in memory cache for the client
|
||||
*/
|
||||
getInMemoryCache(): InMemoryCache;
|
||||
/**
|
||||
* sets the current in memory cache for the client
|
||||
* @param inMemoryCache - key value map in memory
|
||||
*/
|
||||
setInMemoryCache(inMemoryCache: InMemoryCache): void;
|
||||
/**
|
||||
* get the current cache key-value store
|
||||
*/
|
||||
getCache(): CacheKVStore;
|
||||
/**
|
||||
* sets the current cache (key value store)
|
||||
* @param cacheMap - key value map
|
||||
*/
|
||||
setCache(cache: CacheKVStore): void;
|
||||
/**
|
||||
* Gets cache item with given key.
|
||||
* @param key - lookup key for the cache entry
|
||||
*/
|
||||
getItem(key: string): ValidCacheType;
|
||||
/**
|
||||
* Gets cache item with given key-value
|
||||
* @param key - lookup key for the cache entry
|
||||
* @param value - value of the cache entry
|
||||
*/
|
||||
setItem(key: string, value: ValidCacheType): void;
|
||||
getAccountKeys(): string[];
|
||||
getTokenKeys(): TokenKeys;
|
||||
/**
|
||||
* fetch the account entity
|
||||
* @param accountKey - lookup key to fetch cache type AccountEntity
|
||||
*/
|
||||
getAccount(accountKey: string): AccountEntity | null;
|
||||
/**
|
||||
* Reads account from cache, builds it into an account entity and returns it.
|
||||
* @param accountKey - lookup key to fetch cache type AccountEntity
|
||||
* @returns
|
||||
*/
|
||||
getCachedAccountEntity(accountKey: string): AccountEntity | null;
|
||||
/**
|
||||
* set account entity
|
||||
* @param account - cache value to be set of type AccountEntity
|
||||
*/
|
||||
setAccount(account: AccountEntity): void;
|
||||
/**
|
||||
* fetch the idToken credential
|
||||
* @param idTokenKey - lookup key to fetch cache type IdTokenEntity
|
||||
*/
|
||||
getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;
|
||||
/**
|
||||
* set idToken credential
|
||||
* @param idToken - cache value to be set of type IdTokenEntity
|
||||
*/
|
||||
setIdTokenCredential(idToken: IdTokenEntity): void;
|
||||
/**
|
||||
* fetch the accessToken credential
|
||||
* @param accessTokenKey - lookup key to fetch cache type AccessTokenEntity
|
||||
*/
|
||||
getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;
|
||||
/**
|
||||
* set accessToken credential
|
||||
* @param accessToken - cache value to be set of type AccessTokenEntity
|
||||
*/
|
||||
setAccessTokenCredential(accessToken: AccessTokenEntity): void;
|
||||
/**
|
||||
* fetch the refreshToken credential
|
||||
* @param refreshTokenKey - lookup key to fetch cache type RefreshTokenEntity
|
||||
*/
|
||||
getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;
|
||||
/**
|
||||
* set refreshToken credential
|
||||
* @param refreshToken - cache value to be set of type RefreshTokenEntity
|
||||
*/
|
||||
setRefreshTokenCredential(refreshToken: RefreshTokenEntity): void;
|
||||
/**
|
||||
* fetch appMetadata entity from the platform cache
|
||||
* @param appMetadataKey - lookup key to fetch cache type AppMetadataEntity
|
||||
*/
|
||||
getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;
|
||||
/**
|
||||
* set appMetadata entity to the platform cache
|
||||
* @param appMetadata - cache value to be set of type AppMetadataEntity
|
||||
*/
|
||||
setAppMetadata(appMetadata: AppMetadataEntity): void;
|
||||
/**
|
||||
* fetch server telemetry entity from the platform cache
|
||||
* @param serverTelemetrykey - lookup key to fetch cache type ServerTelemetryEntity
|
||||
*/
|
||||
getServerTelemetry(serverTelemetrykey: string): ServerTelemetryEntity | null;
|
||||
/**
|
||||
* set server telemetry entity to the platform cache
|
||||
* @param serverTelemetryKey - lookup key to fetch cache type ServerTelemetryEntity
|
||||
* @param serverTelemetry - cache value to be set of type ServerTelemetryEntity
|
||||
*/
|
||||
setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;
|
||||
/**
|
||||
* fetch authority metadata entity from the platform cache
|
||||
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
|
||||
*/
|
||||
getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;
|
||||
/**
|
||||
* Get all authority metadata keys
|
||||
*/
|
||||
getAuthorityMetadataKeys(): Array<string>;
|
||||
/**
|
||||
* set authority metadata entity to the platform cache
|
||||
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
|
||||
* @param metadata - cache value to be set of type AuthorityMetadataEntity
|
||||
*/
|
||||
setAuthorityMetadata(key: string, metadata: AuthorityMetadataEntity): void;
|
||||
/**
|
||||
* fetch throttling entity from the platform cache
|
||||
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
|
||||
*/
|
||||
getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;
|
||||
/**
|
||||
* set throttling entity to the platform cache
|
||||
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
|
||||
* @param throttlingCache - cache value to be set of type ThrottlingEntity
|
||||
*/
|
||||
setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;
|
||||
/**
|
||||
* Removes the cache item from memory with the given key.
|
||||
* @param key - lookup key to remove a cache entity
|
||||
* @param inMemory - key value map of the cache
|
||||
*/
|
||||
removeItem(key: string): boolean;
|
||||
/**
|
||||
* Remove account entity from the platform cache if it's outdated
|
||||
* @param accountKey - lookup key to fetch cache type AccountEntity
|
||||
*/
|
||||
removeOutdatedAccount(accountKey: string): void;
|
||||
/**
|
||||
* Checks whether key is in cache.
|
||||
* @param key - look up key for a cache entity
|
||||
*/
|
||||
containsKey(key: string): boolean;
|
||||
/**
|
||||
* Gets all keys in window.
|
||||
*/
|
||||
getKeys(): string[];
|
||||
/**
|
||||
* Clears all cache entries created by MSAL (except tokens).
|
||||
*/
|
||||
clear(): void;
|
||||
/**
|
||||
* Initialize in memory cache from an exisiting cache vault
|
||||
* @param cache - blob formatted cache (JSON)
|
||||
*/
|
||||
static generateInMemoryCache(cache: string): InMemoryCache;
|
||||
/**
|
||||
* retrieves the final JSON
|
||||
* @param inMemoryCache - itemised cache read from the JSON
|
||||
*/
|
||||
static generateJsonCache(inMemoryCache: InMemoryCache): JsonCache;
|
||||
/**
|
||||
* Updates a credential's cache key if the current cache key is outdated
|
||||
*/
|
||||
updateCredentialCacheKey(currentCacheKey: string, credential: ValidCredentialType): string;
|
||||
}
|
||||
//# sourceMappingURL=NodeStorage.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/NodeStorage.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/NodeStorage.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NodeStorage.d.ts","sourceRoot":"","sources":["../../src/cache/NodeStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,SAAS,EACT,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EAChB,YAAY,EACZ,MAAM,EACN,cAAc,EACd,OAAO,EACP,uBAAuB,EACvB,mBAAmB,EACnB,sBAAsB,EAEzB,MAAM,yBAAyB,CAAC;AAIjC,OAAO,EACH,aAAa,EACb,SAAS,EACT,YAAY,EACf,MAAM,iCAAiC,CAAC;AAEzC;;;GAGG;AACH,qBAAa,WAAY,SAAQ,YAAY;IAEzC,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,cAAc,CAAuB;gBAGzC,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,OAAO,EACnB,sBAAsB,CAAC,EAAE,sBAAsB;IAMnD;;;OAGG;IACH,qBAAqB,CAAC,IAAI,EAAE,MAAM,IAAI,GAAG,IAAI;IAI7C;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;;OAGG;IACH,oBAAoB,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa;IAgCxD;;;OAGG;IACH,oBAAoB,CAAC,aAAa,EAAE,aAAa,GAAG,YAAY;IAiBhE;;OAEG;IACH,gBAAgB,IAAI,aAAa;IAQjC;;;OAGG;IACH,gBAAgB,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI;IAUpD;;OAEG;IACH,QAAQ,IAAI,YAAY;IAKxB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI;IAQnC;;;OAGG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc;IAQpC;;;;OAIG;IACH,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,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AAG,EAAE,MAAM,EAAE,QAAQ,EAAE,uBAAuB,GAAG,IAAI;IAI1E;;;OAGG;IACH,kBAAkB,CAAC,kBAAkB,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI;IAavE;;;;OAIG;IACH,kBAAkB,CACd,kBAAkB,EAAE,MAAM,EAC1B,eAAe,EAAE,gBAAgB,GAClC,IAAI;IAIP;;;;OAIG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAoBhC;;;OAGG;IACH,qBAAqB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAI/C;;;OAGG;IACH,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIjC;;OAEG;IACH,OAAO,IAAI,MAAM,EAAE;IAQnB;;OAEG;IACH,KAAK,IAAI,IAAI;IAab;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa;IAM1D;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,aAAa,EAAE,aAAa,GAAG,SAAS;IAIjE;;OAEG;IACH,wBAAwB,CACpB,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,mBAAmB,GAChC,MAAM;CAqBZ"}
|
||||
432
node_modules/@azure/msal-node/dist/cache/NodeStorage.mjs
generated
vendored
Normal file
432
node_modules/@azure/msal-node/dist/cache/NodeStorage.mjs
generated
vendored
Normal file
@@ -0,0 +1,432 @@
|
||||
/*! @azure/msal-node v2.16.2 2024-11-19 */
|
||||
'use strict';
|
||||
import { CacheManager, AccountEntity, CacheHelpers } from '@azure/msal-common/node';
|
||||
import { Deserializer } from './serializer/Deserializer.mjs';
|
||||
import { Serializer } from './serializer/Serializer.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/**
|
||||
* This class implements Storage for node, reading cache from user specified storage location or an extension library
|
||||
* @public
|
||||
*/
|
||||
class NodeStorage extends CacheManager {
|
||||
constructor(logger, clientId, cryptoImpl, staticAuthorityOptions) {
|
||||
super(clientId, cryptoImpl, logger, staticAuthorityOptions);
|
||||
this.cache = {};
|
||||
this.changeEmitters = [];
|
||||
this.logger = logger;
|
||||
}
|
||||
/**
|
||||
* Queue up callbacks
|
||||
* @param func - a callback function for cache change indication
|
||||
*/
|
||||
registerChangeEmitter(func) {
|
||||
this.changeEmitters.push(func);
|
||||
}
|
||||
/**
|
||||
* Invoke the callback when cache changes
|
||||
*/
|
||||
emitChange() {
|
||||
this.changeEmitters.forEach((func) => func.call(null));
|
||||
}
|
||||
/**
|
||||
* Converts cacheKVStore to InMemoryCache
|
||||
* @param cache - key value store
|
||||
*/
|
||||
cacheToInMemoryCache(cache) {
|
||||
const inMemoryCache = {
|
||||
accounts: {},
|
||||
idTokens: {},
|
||||
accessTokens: {},
|
||||
refreshTokens: {},
|
||||
appMetadata: {},
|
||||
};
|
||||
for (const key in cache) {
|
||||
const value = cache[key];
|
||||
if (typeof value !== "object") {
|
||||
continue;
|
||||
}
|
||||
if (value instanceof AccountEntity) {
|
||||
inMemoryCache.accounts[key] = value;
|
||||
}
|
||||
else if (CacheHelpers.isIdTokenEntity(value)) {
|
||||
inMemoryCache.idTokens[key] = value;
|
||||
}
|
||||
else if (CacheHelpers.isAccessTokenEntity(value)) {
|
||||
inMemoryCache.accessTokens[key] = value;
|
||||
}
|
||||
else if (CacheHelpers.isRefreshTokenEntity(value)) {
|
||||
inMemoryCache.refreshTokens[key] = value;
|
||||
}
|
||||
else if (CacheHelpers.isAppMetadataEntity(key, value)) {
|
||||
inMemoryCache.appMetadata[key] = value;
|
||||
}
|
||||
else {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
return inMemoryCache;
|
||||
}
|
||||
/**
|
||||
* converts inMemoryCache to CacheKVStore
|
||||
* @param inMemoryCache - kvstore map for inmemory
|
||||
*/
|
||||
inMemoryCacheToCache(inMemoryCache) {
|
||||
// convert in memory cache to a flat Key-Value map
|
||||
let cache = this.getCache();
|
||||
cache = {
|
||||
...cache,
|
||||
...inMemoryCache.accounts,
|
||||
...inMemoryCache.idTokens,
|
||||
...inMemoryCache.accessTokens,
|
||||
...inMemoryCache.refreshTokens,
|
||||
...inMemoryCache.appMetadata,
|
||||
};
|
||||
// convert in memory cache to a flat Key-Value map
|
||||
return cache;
|
||||
}
|
||||
/**
|
||||
* gets the current in memory cache for the client
|
||||
*/
|
||||
getInMemoryCache() {
|
||||
this.logger.trace("Getting in-memory cache");
|
||||
// convert the cache key value store to inMemoryCache
|
||||
const inMemoryCache = this.cacheToInMemoryCache(this.getCache());
|
||||
return inMemoryCache;
|
||||
}
|
||||
/**
|
||||
* sets the current in memory cache for the client
|
||||
* @param inMemoryCache - key value map in memory
|
||||
*/
|
||||
setInMemoryCache(inMemoryCache) {
|
||||
this.logger.trace("Setting in-memory cache");
|
||||
// convert and append the inMemoryCache to cacheKVStore
|
||||
const cache = this.inMemoryCacheToCache(inMemoryCache);
|
||||
this.setCache(cache);
|
||||
this.emitChange();
|
||||
}
|
||||
/**
|
||||
* get the current cache key-value store
|
||||
*/
|
||||
getCache() {
|
||||
this.logger.trace("Getting cache key-value store");
|
||||
return this.cache;
|
||||
}
|
||||
/**
|
||||
* sets the current cache (key value store)
|
||||
* @param cacheMap - key value map
|
||||
*/
|
||||
setCache(cache) {
|
||||
this.logger.trace("Setting cache key value store");
|
||||
this.cache = cache;
|
||||
// mark change in cache
|
||||
this.emitChange();
|
||||
}
|
||||
/**
|
||||
* Gets cache item with given key.
|
||||
* @param key - lookup key for the cache entry
|
||||
*/
|
||||
getItem(key) {
|
||||
this.logger.tracePii(`Item key: ${key}`);
|
||||
// read cache
|
||||
const cache = this.getCache();
|
||||
return cache[key];
|
||||
}
|
||||
/**
|
||||
* Gets cache item with given key-value
|
||||
* @param key - lookup key for the cache entry
|
||||
* @param value - value of the cache entry
|
||||
*/
|
||||
setItem(key, value) {
|
||||
this.logger.tracePii(`Item key: ${key}`);
|
||||
// read cache
|
||||
const cache = this.getCache();
|
||||
cache[key] = value;
|
||||
// write to cache
|
||||
this.setCache(cache);
|
||||
}
|
||||
getAccountKeys() {
|
||||
const inMemoryCache = this.getInMemoryCache();
|
||||
const accountKeys = Object.keys(inMemoryCache.accounts);
|
||||
return accountKeys;
|
||||
}
|
||||
getTokenKeys() {
|
||||
const inMemoryCache = this.getInMemoryCache();
|
||||
const tokenKeys = {
|
||||
idToken: Object.keys(inMemoryCache.idTokens),
|
||||
accessToken: Object.keys(inMemoryCache.accessTokens),
|
||||
refreshToken: Object.keys(inMemoryCache.refreshTokens),
|
||||
};
|
||||
return tokenKeys;
|
||||
}
|
||||
/**
|
||||
* fetch the account entity
|
||||
* @param accountKey - lookup key to fetch cache type AccountEntity
|
||||
*/
|
||||
getAccount(accountKey) {
|
||||
const accountEntity = this.getCachedAccountEntity(accountKey);
|
||||
if (accountEntity && AccountEntity.isAccountEntity(accountEntity)) {
|
||||
return this.updateOutdatedCachedAccount(accountKey, accountEntity);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Reads account from cache, builds it into an account entity and returns it.
|
||||
* @param accountKey - lookup key to fetch cache type AccountEntity
|
||||
* @returns
|
||||
*/
|
||||
getCachedAccountEntity(accountKey) {
|
||||
const cachedAccount = this.getItem(accountKey);
|
||||
return cachedAccount
|
||||
? Object.assign(new AccountEntity(), this.getItem(accountKey))
|
||||
: null;
|
||||
}
|
||||
/**
|
||||
* set account entity
|
||||
* @param account - cache value to be set of type AccountEntity
|
||||
*/
|
||||
setAccount(account) {
|
||||
const accountKey = account.generateAccountKey();
|
||||
this.setItem(accountKey, account);
|
||||
}
|
||||
/**
|
||||
* fetch the idToken credential
|
||||
* @param idTokenKey - lookup key to fetch cache type IdTokenEntity
|
||||
*/
|
||||
getIdTokenCredential(idTokenKey) {
|
||||
const idToken = this.getItem(idTokenKey);
|
||||
if (CacheHelpers.isIdTokenEntity(idToken)) {
|
||||
return idToken;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* set idToken credential
|
||||
* @param idToken - cache value to be set of type IdTokenEntity
|
||||
*/
|
||||
setIdTokenCredential(idToken) {
|
||||
const idTokenKey = CacheHelpers.generateCredentialKey(idToken);
|
||||
this.setItem(idTokenKey, idToken);
|
||||
}
|
||||
/**
|
||||
* fetch the accessToken credential
|
||||
* @param accessTokenKey - lookup key to fetch cache type AccessTokenEntity
|
||||
*/
|
||||
getAccessTokenCredential(accessTokenKey) {
|
||||
const accessToken = this.getItem(accessTokenKey);
|
||||
if (CacheHelpers.isAccessTokenEntity(accessToken)) {
|
||||
return accessToken;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* set accessToken credential
|
||||
* @param accessToken - cache value to be set of type AccessTokenEntity
|
||||
*/
|
||||
setAccessTokenCredential(accessToken) {
|
||||
const accessTokenKey = CacheHelpers.generateCredentialKey(accessToken);
|
||||
this.setItem(accessTokenKey, accessToken);
|
||||
}
|
||||
/**
|
||||
* fetch the refreshToken credential
|
||||
* @param refreshTokenKey - lookup key to fetch cache type RefreshTokenEntity
|
||||
*/
|
||||
getRefreshTokenCredential(refreshTokenKey) {
|
||||
const refreshToken = this.getItem(refreshTokenKey);
|
||||
if (CacheHelpers.isRefreshTokenEntity(refreshToken)) {
|
||||
return refreshToken;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* set refreshToken credential
|
||||
* @param refreshToken - cache value to be set of type RefreshTokenEntity
|
||||
*/
|
||||
setRefreshTokenCredential(refreshToken) {
|
||||
const refreshTokenKey = CacheHelpers.generateCredentialKey(refreshToken);
|
||||
this.setItem(refreshTokenKey, refreshToken);
|
||||
}
|
||||
/**
|
||||
* fetch appMetadata entity from the platform cache
|
||||
* @param appMetadataKey - lookup key to fetch cache type AppMetadataEntity
|
||||
*/
|
||||
getAppMetadata(appMetadataKey) {
|
||||
const appMetadata = this.getItem(appMetadataKey);
|
||||
if (CacheHelpers.isAppMetadataEntity(appMetadataKey, appMetadata)) {
|
||||
return appMetadata;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* set appMetadata entity to the platform cache
|
||||
* @param appMetadata - cache value to be set of type AppMetadataEntity
|
||||
*/
|
||||
setAppMetadata(appMetadata) {
|
||||
const appMetadataKey = CacheHelpers.generateAppMetadataKey(appMetadata);
|
||||
this.setItem(appMetadataKey, appMetadata);
|
||||
}
|
||||
/**
|
||||
* fetch server telemetry entity from the platform cache
|
||||
* @param serverTelemetrykey - lookup key to fetch cache type ServerTelemetryEntity
|
||||
*/
|
||||
getServerTelemetry(serverTelemetrykey) {
|
||||
const serverTelemetryEntity = this.getItem(serverTelemetrykey);
|
||||
if (serverTelemetryEntity &&
|
||||
CacheHelpers.isServerTelemetryEntity(serverTelemetrykey, serverTelemetryEntity)) {
|
||||
return serverTelemetryEntity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* set server telemetry entity to the platform cache
|
||||
* @param serverTelemetryKey - lookup key to fetch cache type ServerTelemetryEntity
|
||||
* @param serverTelemetry - cache value to be set of type ServerTelemetryEntity
|
||||
*/
|
||||
setServerTelemetry(serverTelemetryKey, serverTelemetry) {
|
||||
this.setItem(serverTelemetryKey, serverTelemetry);
|
||||
}
|
||||
/**
|
||||
* fetch authority metadata entity from the platform cache
|
||||
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
|
||||
*/
|
||||
getAuthorityMetadata(key) {
|
||||
const authorityMetadataEntity = this.getItem(key);
|
||||
if (authorityMetadataEntity &&
|
||||
CacheHelpers.isAuthorityMetadataEntity(key, authorityMetadataEntity)) {
|
||||
return authorityMetadataEntity;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Get all authority metadata keys
|
||||
*/
|
||||
getAuthorityMetadataKeys() {
|
||||
return this.getKeys().filter((key) => {
|
||||
return this.isAuthorityMetadata(key);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* set authority metadata entity to the platform cache
|
||||
* @param key - lookup key to fetch cache type AuthorityMetadataEntity
|
||||
* @param metadata - cache value to be set of type AuthorityMetadataEntity
|
||||
*/
|
||||
setAuthorityMetadata(key, metadata) {
|
||||
this.setItem(key, metadata);
|
||||
}
|
||||
/**
|
||||
* fetch throttling entity from the platform cache
|
||||
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
|
||||
*/
|
||||
getThrottlingCache(throttlingCacheKey) {
|
||||
const throttlingCache = this.getItem(throttlingCacheKey);
|
||||
if (throttlingCache &&
|
||||
CacheHelpers.isThrottlingEntity(throttlingCacheKey, throttlingCache)) {
|
||||
return throttlingCache;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* set throttling entity to the platform cache
|
||||
* @param throttlingCacheKey - lookup key to fetch cache type ThrottlingEntity
|
||||
* @param throttlingCache - cache value to be set of type ThrottlingEntity
|
||||
*/
|
||||
setThrottlingCache(throttlingCacheKey, throttlingCache) {
|
||||
this.setItem(throttlingCacheKey, throttlingCache);
|
||||
}
|
||||
/**
|
||||
* Removes the cache item from memory with the given key.
|
||||
* @param key - lookup key to remove a cache entity
|
||||
* @param inMemory - key value map of the cache
|
||||
*/
|
||||
removeItem(key) {
|
||||
this.logger.tracePii(`Item key: ${key}`);
|
||||
// read inMemoryCache
|
||||
let result = false;
|
||||
const cache = this.getCache();
|
||||
if (!!cache[key]) {
|
||||
delete cache[key];
|
||||
result = true;
|
||||
}
|
||||
// write to the cache after removal
|
||||
if (result) {
|
||||
this.setCache(cache);
|
||||
this.emitChange();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* Remove account entity from the platform cache if it's outdated
|
||||
* @param accountKey - lookup key to fetch cache type AccountEntity
|
||||
*/
|
||||
removeOutdatedAccount(accountKey) {
|
||||
this.removeItem(accountKey);
|
||||
}
|
||||
/**
|
||||
* Checks whether key is in cache.
|
||||
* @param key - look up key for a cache entity
|
||||
*/
|
||||
containsKey(key) {
|
||||
return this.getKeys().includes(key);
|
||||
}
|
||||
/**
|
||||
* Gets all keys in window.
|
||||
*/
|
||||
getKeys() {
|
||||
this.logger.trace("Retrieving all cache keys");
|
||||
// read cache
|
||||
const cache = this.getCache();
|
||||
return [...Object.keys(cache)];
|
||||
}
|
||||
/**
|
||||
* Clears all cache entries created by MSAL (except tokens).
|
||||
*/
|
||||
clear() {
|
||||
this.logger.trace("Clearing cache entries created by MSAL");
|
||||
// read inMemoryCache
|
||||
const cacheKeys = this.getKeys();
|
||||
// delete each element
|
||||
cacheKeys.forEach((key) => {
|
||||
this.removeItem(key);
|
||||
});
|
||||
this.emitChange();
|
||||
}
|
||||
/**
|
||||
* Initialize in memory cache from an exisiting cache vault
|
||||
* @param cache - blob formatted cache (JSON)
|
||||
*/
|
||||
static generateInMemoryCache(cache) {
|
||||
return Deserializer.deserializeAllCache(Deserializer.deserializeJSONBlob(cache));
|
||||
}
|
||||
/**
|
||||
* retrieves the final JSON
|
||||
* @param inMemoryCache - itemised cache read from the JSON
|
||||
*/
|
||||
static generateJsonCache(inMemoryCache) {
|
||||
return Serializer.serializeAllCache(inMemoryCache);
|
||||
}
|
||||
/**
|
||||
* Updates a credential's cache key if the current cache key is outdated
|
||||
*/
|
||||
updateCredentialCacheKey(currentCacheKey, credential) {
|
||||
const updatedCacheKey = CacheHelpers.generateCredentialKey(credential);
|
||||
if (currentCacheKey !== updatedCacheKey) {
|
||||
const cacheItem = this.getItem(currentCacheKey);
|
||||
if (cacheItem) {
|
||||
this.removeItem(currentCacheKey);
|
||||
this.setItem(updatedCacheKey, cacheItem);
|
||||
this.logger.verbose(`Updated an outdated ${credential.credentialType} cache key`);
|
||||
return updatedCacheKey;
|
||||
}
|
||||
else {
|
||||
this.logger.error(`Attempted to update an outdated ${credential.credentialType} cache key but no item matching the outdated key was found in storage`);
|
||||
}
|
||||
}
|
||||
return currentCacheKey;
|
||||
}
|
||||
}
|
||||
|
||||
export { NodeStorage };
|
||||
//# sourceMappingURL=NodeStorage.mjs.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/NodeStorage.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/NodeStorage.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
91
node_modules/@azure/msal-node/dist/cache/TokenCache.d.ts
generated
vendored
Normal file
91
node_modules/@azure/msal-node/dist/cache/TokenCache.d.ts
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
import { NodeStorage } from "./NodeStorage.js";
|
||||
import { AccountInfo, Logger, ISerializableTokenCache, ICachePlugin } from "@azure/msal-common/node";
|
||||
import { CacheKVStore } from "./serializer/SerializerTypes.js";
|
||||
import { ITokenCache } from "./ITokenCache.js";
|
||||
/**
|
||||
* In-memory token cache manager
|
||||
* @public
|
||||
*/
|
||||
export declare class TokenCache implements ISerializableTokenCache, ITokenCache {
|
||||
private storage;
|
||||
private cacheHasChanged;
|
||||
private cacheSnapshot;
|
||||
private readonly persistence;
|
||||
private logger;
|
||||
constructor(storage: NodeStorage, logger: Logger, cachePlugin?: ICachePlugin);
|
||||
/**
|
||||
* Set to true if cache state has changed since last time serialize or writeToPersistence was called
|
||||
*/
|
||||
hasChanged(): boolean;
|
||||
/**
|
||||
* Serializes in memory cache to JSON
|
||||
*/
|
||||
serialize(): string;
|
||||
/**
|
||||
* Deserializes JSON to in-memory cache. JSON should be in MSAL cache schema format
|
||||
* @param cache - blob formatted cache
|
||||
*/
|
||||
deserialize(cache: string): void;
|
||||
/**
|
||||
* Fetches the cache key-value map
|
||||
*/
|
||||
getKVStore(): CacheKVStore;
|
||||
/**
|
||||
* API that retrieves all accounts currently in cache to the user
|
||||
*/
|
||||
getAllAccounts(): Promise<AccountInfo[]>;
|
||||
/**
|
||||
* Returns the signed in account matching homeAccountId.
|
||||
* (the account object is created at the time of successful login)
|
||||
* or null when no matching account is found
|
||||
* @param homeAccountId - unique identifier for an account (uid.utid)
|
||||
*/
|
||||
getAccountByHomeId(homeAccountId: string): Promise<AccountInfo | null>;
|
||||
/**
|
||||
* Returns the signed in account matching localAccountId.
|
||||
* (the account object is created at the time of successful login)
|
||||
* or null when no matching account is found
|
||||
* @param localAccountId - unique identifier of an account (sub/obj when homeAccountId cannot be populated)
|
||||
*/
|
||||
getAccountByLocalId(localAccountId: string): Promise<AccountInfo | null>;
|
||||
/**
|
||||
* API to remove a specific account and the relevant data from cache
|
||||
* @param account - AccountInfo passed by the user
|
||||
*/
|
||||
removeAccount(account: AccountInfo): Promise<void>;
|
||||
/**
|
||||
* Called when the cache has changed state.
|
||||
*/
|
||||
private handleChangeEvent;
|
||||
/**
|
||||
* Merge in memory cache with the cache snapshot.
|
||||
* @param oldState - cache before changes
|
||||
* @param currentState - current cache state in the library
|
||||
*/
|
||||
private mergeState;
|
||||
/**
|
||||
* Deep update of oldState based on newState values
|
||||
* @param oldState - cache before changes
|
||||
* @param newState - updated cache
|
||||
*/
|
||||
private mergeUpdates;
|
||||
/**
|
||||
* Removes entities in oldState that the were removed from newState. If there are any unknown values in root of
|
||||
* oldState that are not recognized, they are left untouched.
|
||||
* @param oldState - cache before changes
|
||||
* @param newState - updated cache
|
||||
*/
|
||||
private mergeRemovals;
|
||||
/**
|
||||
* Helper to merge new cache with the old one
|
||||
* @param oldState - cache before changes
|
||||
* @param newState - updated cache
|
||||
*/
|
||||
private mergeRemovalsDict;
|
||||
/**
|
||||
* Helper to overlay as a part of cache merge
|
||||
* @param passedInCache - cache read from the blob
|
||||
*/
|
||||
private overlayDefaults;
|
||||
}
|
||||
//# sourceMappingURL=TokenCache.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/TokenCache.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/TokenCache.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"TokenCache.d.ts","sourceRoot":"","sources":["../../src/cache/TokenCache.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAEH,WAAW,EACX,MAAM,EACN,uBAAuB,EAC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node/dist/cache/TokenCache.mjs
generated
vendored
Normal file
274
node_modules/@azure/msal-node/dist/cache/TokenCache.mjs
generated
vendored
Normal file
@@ -0,0 +1,274 @@
|
||||
/*! @azure/msal-node v2.16.2 2024-11-19 */
|
||||
'use strict';
|
||||
import { TokenCacheContext, AccountEntity } from '@azure/msal-common/node';
|
||||
import { Deserializer } from './serializer/Deserializer.mjs';
|
||||
import { Serializer } from './serializer/Serializer.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
const defaultSerializedCache = {
|
||||
Account: {},
|
||||
IdToken: {},
|
||||
AccessToken: {},
|
||||
RefreshToken: {},
|
||||
AppMetadata: {},
|
||||
};
|
||||
/**
|
||||
* In-memory token cache manager
|
||||
* @public
|
||||
*/
|
||||
class TokenCache {
|
||||
constructor(storage, logger, cachePlugin) {
|
||||
this.cacheHasChanged = false;
|
||||
this.storage = storage;
|
||||
this.storage.registerChangeEmitter(this.handleChangeEvent.bind(this));
|
||||
if (cachePlugin) {
|
||||
this.persistence = cachePlugin;
|
||||
}
|
||||
this.logger = logger;
|
||||
}
|
||||
/**
|
||||
* Set to true if cache state has changed since last time serialize or writeToPersistence was called
|
||||
*/
|
||||
hasChanged() {
|
||||
return this.cacheHasChanged;
|
||||
}
|
||||
/**
|
||||
* Serializes in memory cache to JSON
|
||||
*/
|
||||
serialize() {
|
||||
this.logger.trace("Serializing in-memory cache");
|
||||
let finalState = Serializer.serializeAllCache(this.storage.getInMemoryCache());
|
||||
// if cacheSnapshot not null or empty, merge
|
||||
if (this.cacheSnapshot) {
|
||||
this.logger.trace("Reading cache snapshot from disk");
|
||||
finalState = this.mergeState(JSON.parse(this.cacheSnapshot), finalState);
|
||||
}
|
||||
else {
|
||||
this.logger.trace("No cache snapshot to merge");
|
||||
}
|
||||
this.cacheHasChanged = false;
|
||||
return JSON.stringify(finalState);
|
||||
}
|
||||
/**
|
||||
* Deserializes JSON to in-memory cache. JSON should be in MSAL cache schema format
|
||||
* @param cache - blob formatted cache
|
||||
*/
|
||||
deserialize(cache) {
|
||||
this.logger.trace("Deserializing JSON to in-memory cache");
|
||||
this.cacheSnapshot = cache;
|
||||
if (this.cacheSnapshot) {
|
||||
this.logger.trace("Reading cache snapshot from disk");
|
||||
const deserializedCache = Deserializer.deserializeAllCache(this.overlayDefaults(JSON.parse(this.cacheSnapshot)));
|
||||
this.storage.setInMemoryCache(deserializedCache);
|
||||
}
|
||||
else {
|
||||
this.logger.trace("No cache snapshot to deserialize");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Fetches the cache key-value map
|
||||
*/
|
||||
getKVStore() {
|
||||
return this.storage.getCache();
|
||||
}
|
||||
/**
|
||||
* API that retrieves all accounts currently in cache to the user
|
||||
*/
|
||||
async getAllAccounts() {
|
||||
this.logger.trace("getAllAccounts called");
|
||||
let cacheContext;
|
||||
try {
|
||||
if (this.persistence) {
|
||||
cacheContext = new TokenCacheContext(this, false);
|
||||
await this.persistence.beforeCacheAccess(cacheContext);
|
||||
}
|
||||
return this.storage.getAllAccounts();
|
||||
}
|
||||
finally {
|
||||
if (this.persistence && cacheContext) {
|
||||
await this.persistence.afterCacheAccess(cacheContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the signed in account matching homeAccountId.
|
||||
* (the account object is created at the time of successful login)
|
||||
* or null when no matching account is found
|
||||
* @param homeAccountId - unique identifier for an account (uid.utid)
|
||||
*/
|
||||
async getAccountByHomeId(homeAccountId) {
|
||||
const allAccounts = await this.getAllAccounts();
|
||||
if (homeAccountId && allAccounts && allAccounts.length) {
|
||||
return (allAccounts.filter((accountObj) => accountObj.homeAccountId === homeAccountId)[0] || null);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Returns the signed in account matching localAccountId.
|
||||
* (the account object is created at the time of successful login)
|
||||
* or null when no matching account is found
|
||||
* @param localAccountId - unique identifier of an account (sub/obj when homeAccountId cannot be populated)
|
||||
*/
|
||||
async getAccountByLocalId(localAccountId) {
|
||||
const allAccounts = await this.getAllAccounts();
|
||||
if (localAccountId && allAccounts && allAccounts.length) {
|
||||
return (allAccounts.filter((accountObj) => accountObj.localAccountId === localAccountId)[0] || null);
|
||||
}
|
||||
else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* API to remove a specific account and the relevant data from cache
|
||||
* @param account - AccountInfo passed by the user
|
||||
*/
|
||||
async removeAccount(account) {
|
||||
this.logger.trace("removeAccount called");
|
||||
let cacheContext;
|
||||
try {
|
||||
if (this.persistence) {
|
||||
cacheContext = new TokenCacheContext(this, true);
|
||||
await this.persistence.beforeCacheAccess(cacheContext);
|
||||
}
|
||||
await this.storage.removeAccount(AccountEntity.generateAccountCacheKey(account));
|
||||
}
|
||||
finally {
|
||||
if (this.persistence && cacheContext) {
|
||||
await this.persistence.afterCacheAccess(cacheContext);
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Called when the cache has changed state.
|
||||
*/
|
||||
handleChangeEvent() {
|
||||
this.cacheHasChanged = true;
|
||||
}
|
||||
/**
|
||||
* Merge in memory cache with the cache snapshot.
|
||||
* @param oldState - cache before changes
|
||||
* @param currentState - current cache state in the library
|
||||
*/
|
||||
mergeState(oldState, currentState) {
|
||||
this.logger.trace("Merging in-memory cache with cache snapshot");
|
||||
const stateAfterRemoval = this.mergeRemovals(oldState, currentState);
|
||||
return this.mergeUpdates(stateAfterRemoval, currentState);
|
||||
}
|
||||
/**
|
||||
* Deep update of oldState based on newState values
|
||||
* @param oldState - cache before changes
|
||||
* @param newState - updated cache
|
||||
*/
|
||||
mergeUpdates(oldState, newState) {
|
||||
Object.keys(newState).forEach((newKey) => {
|
||||
const newValue = newState[newKey];
|
||||
// if oldState does not contain value but newValue does, add it
|
||||
if (!oldState.hasOwnProperty(newKey)) {
|
||||
if (newValue !== null) {
|
||||
oldState[newKey] = newValue;
|
||||
}
|
||||
}
|
||||
else {
|
||||
// both oldState and newState contain the key, do deep update
|
||||
const newValueNotNull = newValue !== null;
|
||||
const newValueIsObject = typeof newValue === "object";
|
||||
const newValueIsNotArray = !Array.isArray(newValue);
|
||||
const oldStateNotUndefinedOrNull = typeof oldState[newKey] !== "undefined" &&
|
||||
oldState[newKey] !== null;
|
||||
if (newValueNotNull &&
|
||||
newValueIsObject &&
|
||||
newValueIsNotArray &&
|
||||
oldStateNotUndefinedOrNull) {
|
||||
this.mergeUpdates(oldState[newKey], newValue);
|
||||
}
|
||||
else {
|
||||
oldState[newKey] = newValue;
|
||||
}
|
||||
}
|
||||
});
|
||||
return oldState;
|
||||
}
|
||||
/**
|
||||
* Removes entities in oldState that the were removed from newState. If there are any unknown values in root of
|
||||
* oldState that are not recognized, they are left untouched.
|
||||
* @param oldState - cache before changes
|
||||
* @param newState - updated cache
|
||||
*/
|
||||
mergeRemovals(oldState, newState) {
|
||||
this.logger.trace("Remove updated entries in cache");
|
||||
const accounts = oldState.Account
|
||||
? this.mergeRemovalsDict(oldState.Account, newState.Account)
|
||||
: oldState.Account;
|
||||
const accessTokens = oldState.AccessToken
|
||||
? this.mergeRemovalsDict(oldState.AccessToken, newState.AccessToken)
|
||||
: oldState.AccessToken;
|
||||
const refreshTokens = oldState.RefreshToken
|
||||
? this.mergeRemovalsDict(oldState.RefreshToken, newState.RefreshToken)
|
||||
: oldState.RefreshToken;
|
||||
const idTokens = oldState.IdToken
|
||||
? this.mergeRemovalsDict(oldState.IdToken, newState.IdToken)
|
||||
: oldState.IdToken;
|
||||
const appMetadata = oldState.AppMetadata
|
||||
? this.mergeRemovalsDict(oldState.AppMetadata, newState.AppMetadata)
|
||||
: oldState.AppMetadata;
|
||||
return {
|
||||
...oldState,
|
||||
Account: accounts,
|
||||
AccessToken: accessTokens,
|
||||
RefreshToken: refreshTokens,
|
||||
IdToken: idTokens,
|
||||
AppMetadata: appMetadata,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Helper to merge new cache with the old one
|
||||
* @param oldState - cache before changes
|
||||
* @param newState - updated cache
|
||||
*/
|
||||
mergeRemovalsDict(oldState, newState) {
|
||||
const finalState = { ...oldState };
|
||||
Object.keys(oldState).forEach((oldKey) => {
|
||||
if (!newState || !newState.hasOwnProperty(oldKey)) {
|
||||
delete finalState[oldKey];
|
||||
}
|
||||
});
|
||||
return finalState;
|
||||
}
|
||||
/**
|
||||
* Helper to overlay as a part of cache merge
|
||||
* @param passedInCache - cache read from the blob
|
||||
*/
|
||||
overlayDefaults(passedInCache) {
|
||||
this.logger.trace("Overlaying input cache with the default cache");
|
||||
return {
|
||||
Account: {
|
||||
...defaultSerializedCache.Account,
|
||||
...passedInCache.Account,
|
||||
},
|
||||
IdToken: {
|
||||
...defaultSerializedCache.IdToken,
|
||||
...passedInCache.IdToken,
|
||||
},
|
||||
AccessToken: {
|
||||
...defaultSerializedCache.AccessToken,
|
||||
...passedInCache.AccessToken,
|
||||
},
|
||||
RefreshToken: {
|
||||
...defaultSerializedCache.RefreshToken,
|
||||
...passedInCache.RefreshToken,
|
||||
},
|
||||
AppMetadata: {
|
||||
...defaultSerializedCache.AppMetadata,
|
||||
...passedInCache.AppMetadata,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export { TokenCache };
|
||||
//# sourceMappingURL=TokenCache.mjs.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/TokenCache.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/TokenCache.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
23
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.d.ts
generated
vendored
Normal file
23
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.d.ts
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
import { ICachePlugin, TokenCacheContext } from "@azure/msal-common/node";
|
||||
import { IPartitionManager } from "./IPartitionManager.js";
|
||||
import { ICacheClient } from "./ICacheClient.js";
|
||||
/**
|
||||
* Cache plugin that serializes data to the cache and deserializes data from the cache
|
||||
* @public
|
||||
*/
|
||||
export declare class DistributedCachePlugin implements ICachePlugin {
|
||||
private client;
|
||||
private partitionManager;
|
||||
constructor(client: ICacheClient, partitionManager: IPartitionManager);
|
||||
/**
|
||||
* Deserializes the cache before accessing it
|
||||
* @param cacheContext - TokenCacheContext
|
||||
*/
|
||||
beforeCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
|
||||
/**
|
||||
* Serializes the cache after accessing it
|
||||
* @param cacheContext - TokenCacheContext
|
||||
*/
|
||||
afterCacheAccess(cacheContext: TokenCacheContext): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=DistributedCachePlugin.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DistributedCachePlugin.d.ts","sourceRoot":"","sources":["../../../src/cache/distributed/DistributedCachePlugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,YAAY,EACZ,iBAAiB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD;;;GAGG;AACH,qBAAa,sBAAuB,YAAW,YAAY;IACvD,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,gBAAgB,CAAoB;gBAEhC,MAAM,EAAE,YAAY,EAAE,gBAAgB,EAAE,iBAAiB;IAKrE;;;OAGG;IACU,iBAAiB,CAC1B,YAAY,EAAE,iBAAiB,GAChC,OAAO,CAAC,IAAI,CAAC;IAMhB;;;OAGG;IACU,gBAAgB,CACzB,YAAY,EAAE,iBAAiB,GAChC,OAAO,CAAC,IAAI,CAAC;CAyBnB"}
|
||||
49
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.mjs
generated
vendored
Normal file
49
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.mjs
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
/*! @azure/msal-node v2.16.2 2024-11-19 */
|
||||
'use strict';
|
||||
import { AccountEntity } from '@azure/msal-common/node';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/**
|
||||
* Cache plugin that serializes data to the cache and deserializes data from the cache
|
||||
* @public
|
||||
*/
|
||||
class DistributedCachePlugin {
|
||||
constructor(client, partitionManager) {
|
||||
this.client = client;
|
||||
this.partitionManager = partitionManager;
|
||||
}
|
||||
/**
|
||||
* Deserializes the cache before accessing it
|
||||
* @param cacheContext - TokenCacheContext
|
||||
*/
|
||||
async beforeCacheAccess(cacheContext) {
|
||||
const partitionKey = await this.partitionManager.getKey();
|
||||
const cacheData = await this.client.get(partitionKey);
|
||||
cacheContext.tokenCache.deserialize(cacheData);
|
||||
}
|
||||
/**
|
||||
* Serializes the cache after accessing it
|
||||
* @param cacheContext - TokenCacheContext
|
||||
*/
|
||||
async afterCacheAccess(cacheContext) {
|
||||
if (cacheContext.cacheHasChanged) {
|
||||
const kvStore = cacheContext.tokenCache.getKVStore();
|
||||
const accountEntities = Object.values(kvStore).filter((value) => AccountEntity.isAccountEntity(value));
|
||||
let partitionKey;
|
||||
if (accountEntities.length > 0) {
|
||||
const accountEntity = accountEntities[0];
|
||||
partitionKey = await this.partitionManager.extractKey(accountEntity);
|
||||
}
|
||||
else {
|
||||
partitionKey = await this.partitionManager.getKey();
|
||||
}
|
||||
await this.client.set(partitionKey, cacheContext.tokenCache.serialize());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { DistributedCachePlugin };
|
||||
//# sourceMappingURL=DistributedCachePlugin.mjs.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/distributed/DistributedCachePlugin.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"DistributedCachePlugin.mjs","sources":["../../../src/cache/distributed/DistributedCachePlugin.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAWH;;;AAGG;MACU,sBAAsB,CAAA;IAI/B,WAAY,CAAA,MAAoB,EAAE,gBAAmC,EAAA;AACjE,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QAAA,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC;KAC5C;AAED;;;AAGG;IACI,MAAM,iBAAiB,CAC1B,YAA+B,EAAA;QAE/B,MAAM,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;QAC1D,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AACtD,QAAA,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC;KAClD;AAED;;;AAGG;IACI,MAAM,gBAAgB,CACzB,YAA+B,EAAA;QAE/B,IAAI,YAAY,CAAC,eAAe,EAAE;YAC9B,MAAM,OAAO,GACT,YAAY,CAAC,UAChB,CAAC,UAAU,EAAE,CAAC;YACf,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,KACxD,aAAa,CAAC,eAAe,CAAC,KAAe,CAAC,CACjD,CAAC;AAEF,YAAA,IAAI,YAAoB,CAAC;AACzB,YAAA,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;AAC5B,gBAAA,MAAM,aAAa,GAAG,eAAe,CAAC,CAAC,CAAkB,CAAC;gBAC1D,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,UAAU,CACjD,aAAa,CAChB,CAAC;AACL,aAAA;AAAM,iBAAA;gBACH,YAAY,GAAG,MAAM,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC;AACvD,aAAA;AAED,YAAA,MAAM,IAAI,CAAC,MAAM,CAAC,GAAG,CACjB,YAAY,EACZ,YAAY,CAAC,UAAU,CAAC,SAAS,EAAE,CACtC,CAAC;AACL,SAAA;KACJ;AACJ;;;;"}
|
||||
22
node_modules/@azure/msal-node/dist/cache/distributed/ICacheClient.d.ts
generated
vendored
Normal file
22
node_modules/@azure/msal-node/dist/cache/distributed/ICacheClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* Interface for the cache that defines a getter and setter
|
||||
* @public
|
||||
*/
|
||||
export interface ICacheClient {
|
||||
/**
|
||||
* Retrieve the value from the cache
|
||||
*
|
||||
* @param key - key of item in the cache
|
||||
* @returns Promise<string>
|
||||
*/
|
||||
get(key: string): Promise<string>;
|
||||
/**
|
||||
* Save the required value using the provided key to cache
|
||||
*
|
||||
* @param key - key of item in the cache
|
||||
* @param value - value of item to be saved in the cache
|
||||
* @returns Promise<string>
|
||||
*/
|
||||
set(key: string, value: string): Promise<string>;
|
||||
}
|
||||
//# sourceMappingURL=ICacheClient.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/distributed/ICacheClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/distributed/ICacheClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"ICacheClient.d.ts","sourceRoot":"","sources":["../../../src/cache/distributed/ICacheClient.ts"],"names":[],"mappings":"AAKA;;;GAGG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;OAKG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAElC;;;;;;OAMG;IACH,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACpD"}
|
||||
33
node_modules/@azure/msal-node/dist/cache/distributed/IPartitionManager.d.ts
generated
vendored
Normal file
33
node_modules/@azure/msal-node/dist/cache/distributed/IPartitionManager.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { AccountEntity } from "@azure/msal-common/node";
|
||||
/**
|
||||
* Interface that defines getter methods to get keys used to identity data in the cache
|
||||
* @public
|
||||
*/
|
||||
export interface IPartitionManager {
|
||||
/**
|
||||
* This function should return the correct key from which to read
|
||||
* the specific user's information from cache.
|
||||
*
|
||||
* Example: Your application may be partitioning the user's cache
|
||||
* information for each user using the homeAccountId and thus
|
||||
* this function would return the homeAccountId for
|
||||
* the user in question
|
||||
*
|
||||
* @returns Promise<string>
|
||||
*/
|
||||
getKey(): Promise<string>;
|
||||
/**
|
||||
* This function should return the correct key being used to save each
|
||||
* user's cache information to cache - given an AccountEntity
|
||||
*
|
||||
* Example: Your application may be partitioning the user's cache
|
||||
* information for each user using the homeAccountId thus
|
||||
* this function would return the homeAccountId from
|
||||
* the provided AccountEntity
|
||||
*
|
||||
* @param accountEntity - AccountEntity
|
||||
* @returns Promise<string>
|
||||
*/
|
||||
extractKey(accountEntity: AccountEntity): Promise<string>;
|
||||
}
|
||||
//# sourceMappingURL=IPartitionManager.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/distributed/IPartitionManager.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/distributed/IPartitionManager.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"IPartitionManager.d.ts","sourceRoot":"","sources":["../../../src/cache/distributed/IPartitionManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;;;OAUG;IACH,MAAM,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1B;;;;;;;;;;;OAWG;IACH,UAAU,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC7D"}
|
||||
44
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.d.ts
generated
vendored
Normal file
44
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { AccountCache, IdTokenCache, AccessTokenCache, RefreshTokenCache, AppMetadataCache } from "@azure/msal-common/node";
|
||||
import { JsonCache, InMemoryCache, SerializedAccountEntity, SerializedIdTokenEntity, SerializedAccessTokenEntity, SerializedRefreshTokenEntity, SerializedAppMetadataEntity } from "./SerializerTypes.js";
|
||||
/**
|
||||
* This class deserializes cache entities read from the file into in-memory object types defined internally
|
||||
* @internal
|
||||
*/
|
||||
export declare class Deserializer {
|
||||
/**
|
||||
* Parse the JSON blob in memory and deserialize the content
|
||||
* @param cachedJson - JSON blob cache
|
||||
*/
|
||||
static deserializeJSONBlob(jsonFile: string): JsonCache;
|
||||
/**
|
||||
* Deserializes accounts to AccountEntity objects
|
||||
* @param accounts - accounts of type SerializedAccountEntity
|
||||
*/
|
||||
static deserializeAccounts(accounts: Record<string, SerializedAccountEntity>): AccountCache;
|
||||
/**
|
||||
* Deserializes id tokens to IdTokenEntity objects
|
||||
* @param idTokens - credentials of type SerializedIdTokenEntity
|
||||
*/
|
||||
static deserializeIdTokens(idTokens: Record<string, SerializedIdTokenEntity>): IdTokenCache;
|
||||
/**
|
||||
* Deserializes access tokens to AccessTokenEntity objects
|
||||
* @param accessTokens - access tokens of type SerializedAccessTokenEntity
|
||||
*/
|
||||
static deserializeAccessTokens(accessTokens: Record<string, SerializedAccessTokenEntity>): AccessTokenCache;
|
||||
/**
|
||||
* Deserializes refresh tokens to RefreshTokenEntity objects
|
||||
* @param refreshTokens - refresh tokens of type SerializedRefreshTokenEntity
|
||||
*/
|
||||
static deserializeRefreshTokens(refreshTokens: Record<string, SerializedRefreshTokenEntity>): RefreshTokenCache;
|
||||
/**
|
||||
* Deserializes appMetadata to AppMetaData objects
|
||||
* @param appMetadata - app metadata of type SerializedAppMetadataEntity
|
||||
*/
|
||||
static deserializeAppMetadata(appMetadata: Record<string, SerializedAppMetadataEntity>): AppMetadataCache;
|
||||
/**
|
||||
* Deserialize an inMemory Cache
|
||||
* @param jsonCache - JSON blob cache
|
||||
*/
|
||||
static deserializeAllCache(jsonCache: JsonCache): InMemoryCache;
|
||||
}
|
||||
//# sourceMappingURL=Deserializer.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Deserializer.d.ts","sourceRoot":"","sources":["../../../src/cache/serializer/Deserializer.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAQnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,SAAS,EACT,aAAa,EACb,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC9B,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,qBAAa,YAAY;IACrB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,SAAS;IAKvD;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAClD,YAAY;IA+Bf;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CACtB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,GAClD,YAAY;IAoBf;;;OAGG;IACH,MAAM,CAAC,uBAAuB,CAC1B,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GAC1D,gBAAgB;IA+BnB;;;OAGG;IACH,MAAM,CAAC,wBAAwB,CAC3B,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,GAC5D,iBAAiB;IAuBpB;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CACzB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,GACzD,gBAAgB;IAgBnB;;;OAGG;IACH,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,aAAa;CAmBlE"}
|
||||
175
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.mjs
generated
vendored
Normal file
175
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.mjs
generated
vendored
Normal file
@@ -0,0 +1,175 @@
|
||||
/*! @azure/msal-node v2.16.2 2024-11-19 */
|
||||
'use strict';
|
||||
import { AccountEntity, CacheManager } from '@azure/msal-common/node';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/**
|
||||
* This class deserializes cache entities read from the file into in-memory object types defined internally
|
||||
* @internal
|
||||
*/
|
||||
class Deserializer {
|
||||
/**
|
||||
* Parse the JSON blob in memory and deserialize the content
|
||||
* @param cachedJson - JSON blob cache
|
||||
*/
|
||||
static deserializeJSONBlob(jsonFile) {
|
||||
const deserializedCache = !jsonFile ? {} : JSON.parse(jsonFile);
|
||||
return deserializedCache;
|
||||
}
|
||||
/**
|
||||
* Deserializes accounts to AccountEntity objects
|
||||
* @param accounts - accounts of type SerializedAccountEntity
|
||||
*/
|
||||
static deserializeAccounts(accounts) {
|
||||
const accountObjects = {};
|
||||
if (accounts) {
|
||||
Object.keys(accounts).map(function (key) {
|
||||
const serializedAcc = accounts[key];
|
||||
const mappedAcc = {
|
||||
homeAccountId: serializedAcc.home_account_id,
|
||||
environment: serializedAcc.environment,
|
||||
realm: serializedAcc.realm,
|
||||
localAccountId: serializedAcc.local_account_id,
|
||||
username: serializedAcc.username,
|
||||
authorityType: serializedAcc.authority_type,
|
||||
name: serializedAcc.name,
|
||||
clientInfo: serializedAcc.client_info,
|
||||
lastModificationTime: serializedAcc.last_modification_time,
|
||||
lastModificationApp: serializedAcc.last_modification_app,
|
||||
tenantProfiles: serializedAcc.tenantProfiles?.map((serializedTenantProfile) => {
|
||||
return JSON.parse(serializedTenantProfile);
|
||||
}),
|
||||
};
|
||||
const account = new AccountEntity();
|
||||
CacheManager.toObject(account, mappedAcc);
|
||||
accountObjects[key] = account;
|
||||
});
|
||||
}
|
||||
return accountObjects;
|
||||
}
|
||||
/**
|
||||
* Deserializes id tokens to IdTokenEntity objects
|
||||
* @param idTokens - credentials of type SerializedIdTokenEntity
|
||||
*/
|
||||
static deserializeIdTokens(idTokens) {
|
||||
const idObjects = {};
|
||||
if (idTokens) {
|
||||
Object.keys(idTokens).map(function (key) {
|
||||
const serializedIdT = idTokens[key];
|
||||
const idToken = {
|
||||
homeAccountId: serializedIdT.home_account_id,
|
||||
environment: serializedIdT.environment,
|
||||
credentialType: serializedIdT.credential_type,
|
||||
clientId: serializedIdT.client_id,
|
||||
secret: serializedIdT.secret,
|
||||
realm: serializedIdT.realm,
|
||||
};
|
||||
idObjects[key] = idToken;
|
||||
});
|
||||
}
|
||||
return idObjects;
|
||||
}
|
||||
/**
|
||||
* Deserializes access tokens to AccessTokenEntity objects
|
||||
* @param accessTokens - access tokens of type SerializedAccessTokenEntity
|
||||
*/
|
||||
static deserializeAccessTokens(accessTokens) {
|
||||
const atObjects = {};
|
||||
if (accessTokens) {
|
||||
Object.keys(accessTokens).map(function (key) {
|
||||
const serializedAT = accessTokens[key];
|
||||
const accessToken = {
|
||||
homeAccountId: serializedAT.home_account_id,
|
||||
environment: serializedAT.environment,
|
||||
credentialType: serializedAT.credential_type,
|
||||
clientId: serializedAT.client_id,
|
||||
secret: serializedAT.secret,
|
||||
realm: serializedAT.realm,
|
||||
target: serializedAT.target,
|
||||
cachedAt: serializedAT.cached_at,
|
||||
expiresOn: serializedAT.expires_on,
|
||||
extendedExpiresOn: serializedAT.extended_expires_on,
|
||||
refreshOn: serializedAT.refresh_on,
|
||||
keyId: serializedAT.key_id,
|
||||
tokenType: serializedAT.token_type,
|
||||
requestedClaims: serializedAT.requestedClaims,
|
||||
requestedClaimsHash: serializedAT.requestedClaimsHash,
|
||||
userAssertionHash: serializedAT.userAssertionHash,
|
||||
};
|
||||
atObjects[key] = accessToken;
|
||||
});
|
||||
}
|
||||
return atObjects;
|
||||
}
|
||||
/**
|
||||
* Deserializes refresh tokens to RefreshTokenEntity objects
|
||||
* @param refreshTokens - refresh tokens of type SerializedRefreshTokenEntity
|
||||
*/
|
||||
static deserializeRefreshTokens(refreshTokens) {
|
||||
const rtObjects = {};
|
||||
if (refreshTokens) {
|
||||
Object.keys(refreshTokens).map(function (key) {
|
||||
const serializedRT = refreshTokens[key];
|
||||
const refreshToken = {
|
||||
homeAccountId: serializedRT.home_account_id,
|
||||
environment: serializedRT.environment,
|
||||
credentialType: serializedRT.credential_type,
|
||||
clientId: serializedRT.client_id,
|
||||
secret: serializedRT.secret,
|
||||
familyId: serializedRT.family_id,
|
||||
target: serializedRT.target,
|
||||
realm: serializedRT.realm,
|
||||
};
|
||||
rtObjects[key] = refreshToken;
|
||||
});
|
||||
}
|
||||
return rtObjects;
|
||||
}
|
||||
/**
|
||||
* Deserializes appMetadata to AppMetaData objects
|
||||
* @param appMetadata - app metadata of type SerializedAppMetadataEntity
|
||||
*/
|
||||
static deserializeAppMetadata(appMetadata) {
|
||||
const appMetadataObjects = {};
|
||||
if (appMetadata) {
|
||||
Object.keys(appMetadata).map(function (key) {
|
||||
const serializedAmdt = appMetadata[key];
|
||||
appMetadataObjects[key] = {
|
||||
clientId: serializedAmdt.client_id,
|
||||
environment: serializedAmdt.environment,
|
||||
familyId: serializedAmdt.family_id,
|
||||
};
|
||||
});
|
||||
}
|
||||
return appMetadataObjects;
|
||||
}
|
||||
/**
|
||||
* Deserialize an inMemory Cache
|
||||
* @param jsonCache - JSON blob cache
|
||||
*/
|
||||
static deserializeAllCache(jsonCache) {
|
||||
return {
|
||||
accounts: jsonCache.Account
|
||||
? this.deserializeAccounts(jsonCache.Account)
|
||||
: {},
|
||||
idTokens: jsonCache.IdToken
|
||||
? this.deserializeIdTokens(jsonCache.IdToken)
|
||||
: {},
|
||||
accessTokens: jsonCache.AccessToken
|
||||
? this.deserializeAccessTokens(jsonCache.AccessToken)
|
||||
: {},
|
||||
refreshTokens: jsonCache.RefreshToken
|
||||
? this.deserializeRefreshTokens(jsonCache.RefreshToken)
|
||||
: {},
|
||||
appMetadata: jsonCache.AppMetadata
|
||||
? this.deserializeAppMetadata(jsonCache.AppMetadata)
|
||||
: {},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export { Deserializer };
|
||||
//# sourceMappingURL=Deserializer.mjs.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/serializer/Deserializer.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Deserializer.mjs","sources":["../../../src/cache/serializer/Deserializer.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AA0BH;;;AAGG;MACU,YAAY,CAAA;AACrB;;;AAGG;IACH,OAAO,mBAAmB,CAAC,QAAgB,EAAA;AACvC,QAAA,MAAM,iBAAiB,GAAG,CAAC,QAAQ,GAAG,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;AAChE,QAAA,OAAO,iBAAiB,CAAC;KAC5B;AAED;;;AAGG;IACH,OAAO,mBAAmB,CACtB,QAAiD,EAAA;QAEjD,MAAM,cAAc,GAAiB,EAAE,CAAC;AACxC,QAAA,IAAI,QAAQ,EAAE;YACV,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,EAAA;AACnC,gBA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WAAW,EAAE,cAAc,CAAC,WAAW;oBACvC,QAAQ,EAAE,cAAc,CAAC,SAAS;iBACrC,CAAC;AACN,aAAC,CAAC,CAAC;AACN,SAAA;AAED,QAAA,OAAO,kBAAkB,CAAC;KAC7B;AAED;;;AAGG;IACH,OAAO,mBAAmB,CAAC,SAAoB,EAAA;QAC3C,OAAO;YACH,QAAQ,EAAE,SAAS,CAAC,OAAO;kBACrB,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC;AAC7C,kBAAE,EAAE;YACR,QAAQ,EAAE,SAAS,CAAC,OAAO;kBACrB,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,OAAO,CAAC;AAC7C,kBAAE,EAAE;YACR,YAAY,EAAE,SAAS,CAAC,WAAW;kBAC7B,IAAI,CAAC,uBAAuB,CAAC,SAAS,CAAC,WAAW,CAAC;AACrD,kBAAE,EAAE;YACR,aAAa,EAAE,SAAS,CAAC,YAAY;kBAC/B,IAAI,CAAC,wBAAwB,CAAC,SAAS,CAAC,YAAY,CAAC;AACvD,kBAAE,EAAE;YACR,WAAW,EAAE,SAAS,CAAC,WAAW;kBAC5B,IAAI,CAAC,sBAAsB,CAAC,SAAS,CAAC,WAAW,CAAC;AACpD,kBAAE,EAAE;SACX,CAAC;KACL;AACJ;;;;"}
|
||||
44
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.d.ts
generated
vendored
Normal file
44
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.d.ts
generated
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
import { AccountCache, IdTokenCache, AccessTokenCache, RefreshTokenCache, AppMetadataCache } from "@azure/msal-common/node";
|
||||
import { InMemoryCache, JsonCache, SerializedAccountEntity, SerializedIdTokenEntity, SerializedAccessTokenEntity, SerializedRefreshTokenEntity, SerializedAppMetadataEntity } from "./SerializerTypes.js";
|
||||
/**
|
||||
* This class serializes cache entities to be saved into in-memory object types defined internally
|
||||
* @internal
|
||||
*/
|
||||
export declare class Serializer {
|
||||
/**
|
||||
* serialize the JSON blob
|
||||
* @param data - JSON blob cache
|
||||
*/
|
||||
static serializeJSONBlob(data: JsonCache): string;
|
||||
/**
|
||||
* Serialize Accounts
|
||||
* @param accCache - cache of accounts
|
||||
*/
|
||||
static serializeAccounts(accCache: AccountCache): Record<string, SerializedAccountEntity>;
|
||||
/**
|
||||
* Serialize IdTokens
|
||||
* @param idTCache - cache of ID tokens
|
||||
*/
|
||||
static serializeIdTokens(idTCache: IdTokenCache): Record<string, SerializedIdTokenEntity>;
|
||||
/**
|
||||
* Serializes AccessTokens
|
||||
* @param atCache - cache of access tokens
|
||||
*/
|
||||
static serializeAccessTokens(atCache: AccessTokenCache): Record<string, SerializedAccessTokenEntity>;
|
||||
/**
|
||||
* Serialize refreshTokens
|
||||
* @param rtCache - cache of refresh tokens
|
||||
*/
|
||||
static serializeRefreshTokens(rtCache: RefreshTokenCache): Record<string, SerializedRefreshTokenEntity>;
|
||||
/**
|
||||
* Serialize amdtCache
|
||||
* @param amdtCache - cache of app metadata
|
||||
*/
|
||||
static serializeAppMetadata(amdtCache: AppMetadataCache): Record<string, SerializedAppMetadataEntity>;
|
||||
/**
|
||||
* Serialize the cache
|
||||
* @param inMemCache - itemised cache read from the JSON
|
||||
*/
|
||||
static serializeAllCache(inMemCache: InMemoryCache): JsonCache;
|
||||
}
|
||||
//# sourceMappingURL=Serializer.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Serializer.d.ts","sourceRoot":"","sources":["../../../src/cache/serializer/Serializer.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,aAAa,EACb,SAAS,EACT,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,4BAA4B,EAC5B,2BAA2B,EAC9B,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,qBAAa,UAAU;IACnB;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM;IAIjD;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CACpB,QAAQ,EAAE,YAAY,GACvB,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC;IA0B1C;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CACpB,QAAQ,EAAE,YAAY,GACvB,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC;IAiB1C;;;OAGG;IACH,MAAM,CAAC,qBAAqB,CACxB,OAAO,EAAE,gBAAgB,GAC1B,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC;IA2B9C;;;OAGG;IACH,MAAM,CAAC,sBAAsB,CACzB,OAAO,EAAE,iBAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC;IAmB/C;;;OAGG;IACH,MAAM,CAAC,oBAAoB,CACvB,SAAS,EAAE,gBAAgB,GAC5B,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC;IAc9C;;;OAGG;IACH,MAAM,CAAC,iBAAiB,CAAC,UAAU,EAAE,aAAa,GAAG,SAAS;CASjE"}
|
||||
146
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.mjs
generated
vendored
Normal file
146
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.mjs
generated
vendored
Normal file
@@ -0,0 +1,146 @@
|
||||
/*! @azure/msal-node v2.16.2 2024-11-19 */
|
||||
'use strict';
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/**
|
||||
* This class serializes cache entities to be saved into in-memory object types defined internally
|
||||
* @internal
|
||||
*/
|
||||
class Serializer {
|
||||
/**
|
||||
* serialize the JSON blob
|
||||
* @param data - JSON blob cache
|
||||
*/
|
||||
static serializeJSONBlob(data) {
|
||||
return JSON.stringify(data);
|
||||
}
|
||||
/**
|
||||
* Serialize Accounts
|
||||
* @param accCache - cache of accounts
|
||||
*/
|
||||
static serializeAccounts(accCache) {
|
||||
const accounts = {};
|
||||
Object.keys(accCache).map(function (key) {
|
||||
const accountEntity = accCache[key];
|
||||
accounts[key] = {
|
||||
home_account_id: accountEntity.homeAccountId,
|
||||
environment: accountEntity.environment,
|
||||
realm: accountEntity.realm,
|
||||
local_account_id: accountEntity.localAccountId,
|
||||
username: accountEntity.username,
|
||||
authority_type: accountEntity.authorityType,
|
||||
name: accountEntity.name,
|
||||
client_info: accountEntity.clientInfo,
|
||||
last_modification_time: accountEntity.lastModificationTime,
|
||||
last_modification_app: accountEntity.lastModificationApp,
|
||||
tenantProfiles: accountEntity.tenantProfiles?.map((tenantProfile) => {
|
||||
return JSON.stringify(tenantProfile);
|
||||
}),
|
||||
};
|
||||
});
|
||||
return accounts;
|
||||
}
|
||||
/**
|
||||
* Serialize IdTokens
|
||||
* @param idTCache - cache of ID tokens
|
||||
*/
|
||||
static serializeIdTokens(idTCache) {
|
||||
const idTokens = {};
|
||||
Object.keys(idTCache).map(function (key) {
|
||||
const idTEntity = idTCache[key];
|
||||
idTokens[key] = {
|
||||
home_account_id: idTEntity.homeAccountId,
|
||||
environment: idTEntity.environment,
|
||||
credential_type: idTEntity.credentialType,
|
||||
client_id: idTEntity.clientId,
|
||||
secret: idTEntity.secret,
|
||||
realm: idTEntity.realm,
|
||||
};
|
||||
});
|
||||
return idTokens;
|
||||
}
|
||||
/**
|
||||
* Serializes AccessTokens
|
||||
* @param atCache - cache of access tokens
|
||||
*/
|
||||
static serializeAccessTokens(atCache) {
|
||||
const accessTokens = {};
|
||||
Object.keys(atCache).map(function (key) {
|
||||
const atEntity = atCache[key];
|
||||
accessTokens[key] = {
|
||||
home_account_id: atEntity.homeAccountId,
|
||||
environment: atEntity.environment,
|
||||
credential_type: atEntity.credentialType,
|
||||
client_id: atEntity.clientId,
|
||||
secret: atEntity.secret,
|
||||
realm: atEntity.realm,
|
||||
target: atEntity.target,
|
||||
cached_at: atEntity.cachedAt,
|
||||
expires_on: atEntity.expiresOn,
|
||||
extended_expires_on: atEntity.extendedExpiresOn,
|
||||
refresh_on: atEntity.refreshOn,
|
||||
key_id: atEntity.keyId,
|
||||
token_type: atEntity.tokenType,
|
||||
requestedClaims: atEntity.requestedClaims,
|
||||
requestedClaimsHash: atEntity.requestedClaimsHash,
|
||||
userAssertionHash: atEntity.userAssertionHash,
|
||||
};
|
||||
});
|
||||
return accessTokens;
|
||||
}
|
||||
/**
|
||||
* Serialize refreshTokens
|
||||
* @param rtCache - cache of refresh tokens
|
||||
*/
|
||||
static serializeRefreshTokens(rtCache) {
|
||||
const refreshTokens = {};
|
||||
Object.keys(rtCache).map(function (key) {
|
||||
const rtEntity = rtCache[key];
|
||||
refreshTokens[key] = {
|
||||
home_account_id: rtEntity.homeAccountId,
|
||||
environment: rtEntity.environment,
|
||||
credential_type: rtEntity.credentialType,
|
||||
client_id: rtEntity.clientId,
|
||||
secret: rtEntity.secret,
|
||||
family_id: rtEntity.familyId,
|
||||
target: rtEntity.target,
|
||||
realm: rtEntity.realm,
|
||||
};
|
||||
});
|
||||
return refreshTokens;
|
||||
}
|
||||
/**
|
||||
* Serialize amdtCache
|
||||
* @param amdtCache - cache of app metadata
|
||||
*/
|
||||
static serializeAppMetadata(amdtCache) {
|
||||
const appMetadata = {};
|
||||
Object.keys(amdtCache).map(function (key) {
|
||||
const amdtEntity = amdtCache[key];
|
||||
appMetadata[key] = {
|
||||
client_id: amdtEntity.clientId,
|
||||
environment: amdtEntity.environment,
|
||||
family_id: amdtEntity.familyId,
|
||||
};
|
||||
});
|
||||
return appMetadata;
|
||||
}
|
||||
/**
|
||||
* Serialize the cache
|
||||
* @param inMemCache - itemised cache read from the JSON
|
||||
*/
|
||||
static serializeAllCache(inMemCache) {
|
||||
return {
|
||||
Account: this.serializeAccounts(inMemCache.accounts),
|
||||
IdToken: this.serializeIdTokens(inMemCache.idTokens),
|
||||
AccessToken: this.serializeAccessTokens(inMemCache.accessTokens),
|
||||
RefreshToken: this.serializeRefreshTokens(inMemCache.refreshTokens),
|
||||
AppMetadata: this.serializeAppMetadata(inMemCache.appMetadata),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export { Serializer };
|
||||
//# sourceMappingURL=Serializer.mjs.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/serializer/Serializer.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"Serializer.mjs","sources":["../../../src/cache/serializer/Serializer.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;AAGG;AAmBH;;;AAGG;MACU,UAAU,CAAA;AACnB;;;AAGG;IACH,OAAO,iBAAiB,CAAC,IAAe,EAAA;AACpC,QAAA,OAAO,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;KAC/B;AAED;;;AAGG;IACH,OAAO,iBAAiB,CACpB,QAAsB,EAAA;QAEtB,MAAM,QAAQ,GAA4C,EAAE,CAAC;QAC7D,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,EAAA;AACnC,YAAA,MAAM,aAAa,GAAG,QAAQ,CAAC,GAAG,CAAC,CAAC;YACpC,QAAQ,CAAC,GAAG,CAAC,GAAG;gBACZ,eAAe,EAAE,aAAa,CAAC,aAAa;gBAC5C,WAAW,EAAE,aAAa,CAAC,WAAW;gBACtC,KAAK,EAAE,aAAa,CAAC,KAAK;gBAC1B,gBAAgB,EAAE,aAAa,CAAC,cAAc;gBAC9C,QAAQ,EAAE,aAAa,CAAC,QAAQ;gBAChC,cAAc,EAAE,aAAa,CAAC,aAAa;gBAC3C,IAAI,EAAE,aAAa,CAAC,IAAI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,CAAC,KAAK;aACxB,CAAC;AACN,SAAC,CAAC,CAAC;AAEH,QAAA,OAAO,aAAa,CAAC;KACxB;AAED;;;AAGG;IACH,OAAO,oBAAoB,CACvB,SAA2B,EAAA;QAE3B,MAAM,WAAW,GAAgD,EAAE,CAAC;QACpE,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,UAAU,GAAG,EAAA;AACpC,YAAA,MAAM,UAAU,GAAG,SAAS,CAAC,GAAG,CAAC,CAAC;YAClC,WAAW,CAAC,GAAG,CAAC,GAAG;gBACf,SAAS,EAAE,UAAU,CAAC,QAAQ;gBAC9B,WAAW,EAAE,UAAU,CAAC,WAAW;gBACnC,SAAS,EAAE,UAAU,CAAC,QAAQ;aACjC,CAAC;AACN,SAAC,CAAC,CAAC;AAEH,QAAA,OAAO,WAAW,CAAC;KACtB;AAED;;;AAGG;IACH,OAAO,iBAAiB,CAAC,UAAyB,EAAA;QAC9C,OAAO;YACH,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC;YACpD,OAAO,EAAE,IAAI,CAAC,iBAAiB,CAAC,UAAU,CAAC,QAAQ,CAAC;YACpD,WAAW,EAAE,IAAI,CAAC,qBAAqB,CAAC,UAAU,CAAC,YAAY,CAAC;YAChE,YAAY,EAAE,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,aAAa,CAAC;YACnE,WAAW,EAAE,IAAI,CAAC,oBAAoB,CAAC,UAAU,CAAC,WAAW,CAAC;SACjE,CAAC;KACL;AACJ;;;;"}
|
||||
103
node_modules/@azure/msal-node/dist/cache/serializer/SerializerTypes.d.ts
generated
vendored
Normal file
103
node_modules/@azure/msal-node/dist/cache/serializer/SerializerTypes.d.ts
generated
vendored
Normal file
@@ -0,0 +1,103 @@
|
||||
import { AccountCache, IdTokenCache, AccessTokenCache, RefreshTokenCache, AppMetadataCache, ValidCacheType } from "@azure/msal-common/node";
|
||||
/**
|
||||
* Key value store for in-memory cache
|
||||
* @public
|
||||
*/
|
||||
export type CacheKVStore = Record<string, ValidCacheType>;
|
||||
/**
|
||||
* Cache format read from the cache blob provided to the configuration during app instantiation
|
||||
* @public
|
||||
*/
|
||||
export type JsonCache = {
|
||||
Account: Record<string, SerializedAccountEntity>;
|
||||
IdToken: Record<string, SerializedIdTokenEntity>;
|
||||
AccessToken: Record<string, SerializedAccessTokenEntity>;
|
||||
RefreshToken: Record<string, SerializedRefreshTokenEntity>;
|
||||
AppMetadata: Record<string, SerializedAppMetadataEntity>;
|
||||
};
|
||||
/**
|
||||
* Intermittent type to handle in-memory data objects with defined types
|
||||
* @public
|
||||
*/
|
||||
export type InMemoryCache = {
|
||||
accounts: AccountCache;
|
||||
idTokens: IdTokenCache;
|
||||
accessTokens: AccessTokenCache;
|
||||
refreshTokens: RefreshTokenCache;
|
||||
appMetadata: AppMetadataCache;
|
||||
};
|
||||
/**
|
||||
* Account type
|
||||
* @public
|
||||
*/
|
||||
export type SerializedAccountEntity = {
|
||||
home_account_id: string;
|
||||
environment: string;
|
||||
realm: string;
|
||||
local_account_id: string;
|
||||
username: string;
|
||||
authority_type: string;
|
||||
name?: string;
|
||||
client_info?: string;
|
||||
last_modification_time?: string;
|
||||
last_modification_app?: string;
|
||||
tenantProfiles?: string[];
|
||||
};
|
||||
/**
|
||||
* Idtoken credential type
|
||||
* @public
|
||||
*/
|
||||
export type SerializedIdTokenEntity = {
|
||||
home_account_id: string;
|
||||
environment: string;
|
||||
credential_type: string;
|
||||
client_id: string;
|
||||
secret: string;
|
||||
realm: string;
|
||||
};
|
||||
/**
|
||||
* Access token credential type
|
||||
* @public
|
||||
*/
|
||||
export type SerializedAccessTokenEntity = {
|
||||
home_account_id: string;
|
||||
environment: string;
|
||||
credential_type: string;
|
||||
client_id: string;
|
||||
secret: string;
|
||||
realm: string;
|
||||
target: string;
|
||||
cached_at: string;
|
||||
expires_on: string;
|
||||
extended_expires_on?: string;
|
||||
refresh_on?: string;
|
||||
key_id?: string;
|
||||
token_type?: string;
|
||||
requestedClaims?: string;
|
||||
requestedClaimsHash?: string;
|
||||
userAssertionHash?: string;
|
||||
};
|
||||
/**
|
||||
* Refresh token credential type
|
||||
* @public
|
||||
*/
|
||||
export type SerializedRefreshTokenEntity = {
|
||||
home_account_id: string;
|
||||
environment: string;
|
||||
credential_type: string;
|
||||
client_id: string;
|
||||
secret: string;
|
||||
family_id?: string;
|
||||
target?: string;
|
||||
realm?: string;
|
||||
};
|
||||
/**
|
||||
* AppMetadata type
|
||||
* @public
|
||||
*/
|
||||
export type SerializedAppMetadataEntity = {
|
||||
client_id: string;
|
||||
environment: string;
|
||||
family_id?: string;
|
||||
};
|
||||
//# sourceMappingURL=SerializerTypes.d.ts.map
|
||||
1
node_modules/@azure/msal-node/dist/cache/serializer/SerializerTypes.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-node/dist/cache/serializer/SerializerTypes.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SerializerTypes.d.ts","sourceRoot":"","sources":["../../../src/cache/serializer/SerializerTypes.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,YAAY,EACZ,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,cAAc,EACjB,MAAM,yBAAyB,CAAC;AAEjC;;;GAGG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;AAE1D;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IACjD,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,2BAA2B,CAAC,CAAC;IACzD,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;IAC3D,WAAW,EAAE,MAAM,CAAC,MAAM,E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