Commit iniziale
This commit is contained in:
95
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.d.ts
generated
vendored
Normal file
95
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.d.ts
generated
vendored
Normal file
@@ -0,0 +1,95 @@
|
||||
import { CloudDiscoveryMetadata } from "../../authority/CloudDiscoveryMetadata.js";
|
||||
import { OpenIdConfigResponse } from "../../authority/OpenIdConfigResponse.js";
|
||||
import { AuthenticationScheme } from "../../utils/Constants.js";
|
||||
import { AccessTokenEntity } from "../entities/AccessTokenEntity.js";
|
||||
import { AppMetadataEntity } from "../entities/AppMetadataEntity.js";
|
||||
import { AuthorityMetadataEntity } from "../entities/AuthorityMetadataEntity.js";
|
||||
import { CredentialEntity } from "../entities/CredentialEntity.js";
|
||||
import { IdTokenEntity } from "../entities/IdTokenEntity.js";
|
||||
import { RefreshTokenEntity } from "../entities/RefreshTokenEntity.js";
|
||||
/**
|
||||
* Cache Key: <home_account_id>-<environment>-<credential_type>-<client_id or familyId>-<realm>-<scopes>-<claims hash>-<scheme>
|
||||
* IdToken Example: uid.utid-login.microsoftonline.com-idtoken-app_client_id-contoso.com
|
||||
* AccessToken Example: uid.utid-login.microsoftonline.com-accesstoken-app_client_id-contoso.com-scope1 scope2--pop
|
||||
* RefreshToken Example: uid.utid-login.microsoftonline.com-refreshtoken-1-contoso.com
|
||||
* @param credentialEntity
|
||||
* @returns
|
||||
*/
|
||||
export declare function generateCredentialKey(credentialEntity: CredentialEntity): string;
|
||||
/**
|
||||
* Create IdTokenEntity
|
||||
* @param homeAccountId
|
||||
* @param authenticationResult
|
||||
* @param clientId
|
||||
* @param authority
|
||||
*/
|
||||
export declare function createIdTokenEntity(homeAccountId: string, environment: string, idToken: string, clientId: string, tenantId: string): IdTokenEntity;
|
||||
/**
|
||||
* Create AccessTokenEntity
|
||||
* @param homeAccountId
|
||||
* @param environment
|
||||
* @param accessToken
|
||||
* @param clientId
|
||||
* @param tenantId
|
||||
* @param scopes
|
||||
* @param expiresOn
|
||||
* @param extExpiresOn
|
||||
*/
|
||||
export declare function createAccessTokenEntity(homeAccountId: string, environment: string, accessToken: string, clientId: string, tenantId: string, scopes: string, expiresOn: number, extExpiresOn: number, base64Decode: (input: string) => string, refreshOn?: number, tokenType?: AuthenticationScheme, userAssertionHash?: string, keyId?: string, requestedClaims?: string, requestedClaimsHash?: string): AccessTokenEntity;
|
||||
/**
|
||||
* Create RefreshTokenEntity
|
||||
* @param homeAccountId
|
||||
* @param authenticationResult
|
||||
* @param clientId
|
||||
* @param authority
|
||||
*/
|
||||
export declare function createRefreshTokenEntity(homeAccountId: string, environment: string, refreshToken: string, clientId: string, familyId?: string, userAssertionHash?: string, expiresOn?: number): RefreshTokenEntity;
|
||||
export declare function isCredentialEntity(entity: object): boolean;
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
export declare function isAccessTokenEntity(entity: object): boolean;
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
export declare function isIdTokenEntity(entity: object): boolean;
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
export declare function isRefreshTokenEntity(entity: object): boolean;
|
||||
/**
|
||||
* validates if a given cache entry is "Telemetry", parses <key,value>
|
||||
* @param key
|
||||
* @param entity
|
||||
*/
|
||||
export declare function isServerTelemetryEntity(key: string, entity?: object): boolean;
|
||||
/**
|
||||
* validates if a given cache entry is "Throttling", parses <key,value>
|
||||
* @param key
|
||||
* @param entity
|
||||
*/
|
||||
export declare function isThrottlingEntity(key: string, entity?: object): boolean;
|
||||
/**
|
||||
* Generate AppMetadata Cache Key as per the schema: appmetadata-<environment>-<client_id>
|
||||
*/
|
||||
export declare function generateAppMetadataKey({ environment, clientId, }: AppMetadataEntity): string;
|
||||
export declare function isAppMetadataEntity(key: string, entity: object): boolean;
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
export declare function isAuthorityMetadataEntity(key: string, entity: object): boolean;
|
||||
/**
|
||||
* Reset the exiresAt value
|
||||
*/
|
||||
export declare function generateAuthorityMetadataExpiresAt(): number;
|
||||
export declare function updateAuthorityEndpointMetadata(authorityMetadata: AuthorityMetadataEntity, updatedValues: OpenIdConfigResponse, fromNetwork: boolean): void;
|
||||
export declare function updateCloudDiscoveryMetadata(authorityMetadata: AuthorityMetadataEntity, updatedValues: CloudDiscoveryMetadata, fromNetwork: boolean): void;
|
||||
/**
|
||||
* Returns whether or not the data needs to be refreshed
|
||||
*/
|
||||
export declare function isAuthorityMetadataExpired(metadata: AuthorityMetadataEntity): boolean;
|
||||
//# sourceMappingURL=CacheHelpers.d.ts.map
|
||||
1
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CacheHelpers.d.ts","sourceRoot":"","sources":["../../../src/cache/utils/CacheHelpers.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAK/E,OAAO,EAGH,oBAAoB,EAKvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,gBAAgB,EAAE,g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E,MAAM,GAAG,OAAO,CAS5D;AA2DD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAa7E;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAYxE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACnC,WAAW,EACX,QAAQ,GACX,EAAE,iBAAiB,GAAG,MAAM,CAS5B;AAMD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAUxE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACf,OAAO,CAmBT;AAED;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,MAAM,CAK3D;AAED,wBAAgB,+BAA+B,CAC3C,iBAAiB,EAAE,uBAAuB,EAC1C,aAAa,EAAE,oBAAoB,EACnC,WAAW,EAAE,OAAO,GACrB,IAAI,CAQN;AAED,wBAAgB,4BAA4B,CACxC,iBAAiB,EAAE,uBAAuB,EAC1C,aAAa,EAAE,sBAAsB,EACrC,WAAW,EAAE,OAAO,GACrB,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACtC,QAAQ,EAAE,uBAAuB,GAClC,OAAO,CAET"}
|
||||
335
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs
generated
vendored
Normal file
335
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs
generated
vendored
Normal file
@@ -0,0 +1,335 @@
|
||||
/*! @azure/msal-common v15.1.1 2025-02-05 */
|
||||
'use strict';
|
||||
import { extractTokenClaims } from '../../account/AuthToken.mjs';
|
||||
import { createClientAuthError } from '../../error/ClientAuthError.mjs';
|
||||
import { Separators, CredentialType, AuthenticationScheme, SERVER_TELEM_CONSTANTS, ThrottlingConstants, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../../utils/Constants.mjs';
|
||||
import { nowSeconds } from '../../utils/TimeUtils.mjs';
|
||||
import { tokenClaimsCnfRequiredForSignedJwt } from '../../error/ClientAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/**
|
||||
* Cache Key: <home_account_id>-<environment>-<credential_type>-<client_id or familyId>-<realm>-<scopes>-<claims hash>-<scheme>
|
||||
* IdToken Example: uid.utid-login.microsoftonline.com-idtoken-app_client_id-contoso.com
|
||||
* AccessToken Example: uid.utid-login.microsoftonline.com-accesstoken-app_client_id-contoso.com-scope1 scope2--pop
|
||||
* RefreshToken Example: uid.utid-login.microsoftonline.com-refreshtoken-1-contoso.com
|
||||
* @param credentialEntity
|
||||
* @returns
|
||||
*/
|
||||
function generateCredentialKey(credentialEntity) {
|
||||
const credentialKey = [
|
||||
generateAccountId(credentialEntity),
|
||||
generateCredentialId(credentialEntity),
|
||||
generateTarget(credentialEntity),
|
||||
generateClaimsHash(credentialEntity),
|
||||
generateScheme(credentialEntity),
|
||||
];
|
||||
return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
||||
}
|
||||
/**
|
||||
* Create IdTokenEntity
|
||||
* @param homeAccountId
|
||||
* @param authenticationResult
|
||||
* @param clientId
|
||||
* @param authority
|
||||
*/
|
||||
function createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {
|
||||
const idTokenEntity = {
|
||||
credentialType: CredentialType.ID_TOKEN,
|
||||
homeAccountId: homeAccountId,
|
||||
environment: environment,
|
||||
clientId: clientId,
|
||||
secret: idToken,
|
||||
realm: tenantId,
|
||||
};
|
||||
return idTokenEntity;
|
||||
}
|
||||
/**
|
||||
* Create AccessTokenEntity
|
||||
* @param homeAccountId
|
||||
* @param environment
|
||||
* @param accessToken
|
||||
* @param clientId
|
||||
* @param tenantId
|
||||
* @param scopes
|
||||
* @param expiresOn
|
||||
* @param extExpiresOn
|
||||
*/
|
||||
function createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, refreshOn, tokenType, userAssertionHash, keyId, requestedClaims, requestedClaimsHash) {
|
||||
const atEntity = {
|
||||
homeAccountId: homeAccountId,
|
||||
credentialType: CredentialType.ACCESS_TOKEN,
|
||||
secret: accessToken,
|
||||
cachedAt: nowSeconds().toString(),
|
||||
expiresOn: expiresOn.toString(),
|
||||
extendedExpiresOn: extExpiresOn.toString(),
|
||||
environment: environment,
|
||||
clientId: clientId,
|
||||
realm: tenantId,
|
||||
target: scopes,
|
||||
tokenType: tokenType || AuthenticationScheme.BEARER,
|
||||
};
|
||||
if (userAssertionHash) {
|
||||
atEntity.userAssertionHash = userAssertionHash;
|
||||
}
|
||||
if (refreshOn) {
|
||||
atEntity.refreshOn = refreshOn.toString();
|
||||
}
|
||||
if (requestedClaims) {
|
||||
atEntity.requestedClaims = requestedClaims;
|
||||
atEntity.requestedClaimsHash = requestedClaimsHash;
|
||||
}
|
||||
/*
|
||||
* Create Access Token With Auth Scheme instead of regular access token
|
||||
* Cast to lower to handle "bearer" from ADFS
|
||||
*/
|
||||
if (atEntity.tokenType?.toLowerCase() !==
|
||||
AuthenticationScheme.BEARER.toLowerCase()) {
|
||||
atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;
|
||||
switch (atEntity.tokenType) {
|
||||
case AuthenticationScheme.POP:
|
||||
// Make sure keyId is present and add it to credential
|
||||
const tokenClaims = extractTokenClaims(accessToken, base64Decode);
|
||||
if (!tokenClaims?.cnf?.kid) {
|
||||
throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt);
|
||||
}
|
||||
atEntity.keyId = tokenClaims.cnf.kid;
|
||||
break;
|
||||
case AuthenticationScheme.SSH:
|
||||
atEntity.keyId = keyId;
|
||||
}
|
||||
}
|
||||
return atEntity;
|
||||
}
|
||||
/**
|
||||
* Create RefreshTokenEntity
|
||||
* @param homeAccountId
|
||||
* @param authenticationResult
|
||||
* @param clientId
|
||||
* @param authority
|
||||
*/
|
||||
function createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash, expiresOn) {
|
||||
const rtEntity = {
|
||||
credentialType: CredentialType.REFRESH_TOKEN,
|
||||
homeAccountId: homeAccountId,
|
||||
environment: environment,
|
||||
clientId: clientId,
|
||||
secret: refreshToken,
|
||||
};
|
||||
if (userAssertionHash) {
|
||||
rtEntity.userAssertionHash = userAssertionHash;
|
||||
}
|
||||
if (familyId) {
|
||||
rtEntity.familyId = familyId;
|
||||
}
|
||||
if (expiresOn) {
|
||||
rtEntity.expiresOn = expiresOn.toString();
|
||||
}
|
||||
return rtEntity;
|
||||
}
|
||||
function isCredentialEntity(entity) {
|
||||
return (entity.hasOwnProperty("homeAccountId") &&
|
||||
entity.hasOwnProperty("environment") &&
|
||||
entity.hasOwnProperty("credentialType") &&
|
||||
entity.hasOwnProperty("clientId") &&
|
||||
entity.hasOwnProperty("secret"));
|
||||
}
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
function isAccessTokenEntity(entity) {
|
||||
if (!entity) {
|
||||
return false;
|
||||
}
|
||||
return (isCredentialEntity(entity) &&
|
||||
entity.hasOwnProperty("realm") &&
|
||||
entity.hasOwnProperty("target") &&
|
||||
(entity["credentialType"] === CredentialType.ACCESS_TOKEN ||
|
||||
entity["credentialType"] ===
|
||||
CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));
|
||||
}
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
function isIdTokenEntity(entity) {
|
||||
if (!entity) {
|
||||
return false;
|
||||
}
|
||||
return (isCredentialEntity(entity) &&
|
||||
entity.hasOwnProperty("realm") &&
|
||||
entity["credentialType"] === CredentialType.ID_TOKEN);
|
||||
}
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
function isRefreshTokenEntity(entity) {
|
||||
if (!entity) {
|
||||
return false;
|
||||
}
|
||||
return (isCredentialEntity(entity) &&
|
||||
entity["credentialType"] === CredentialType.REFRESH_TOKEN);
|
||||
}
|
||||
/**
|
||||
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
|
||||
*/
|
||||
function generateAccountId(credentialEntity) {
|
||||
const accountId = [
|
||||
credentialEntity.homeAccountId,
|
||||
credentialEntity.environment,
|
||||
];
|
||||
return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
||||
}
|
||||
/**
|
||||
* Generate Credential Id key component as per the schema: <credential_type>-<client_id>-<realm>
|
||||
*/
|
||||
function generateCredentialId(credentialEntity) {
|
||||
const clientOrFamilyId = credentialEntity.credentialType === CredentialType.REFRESH_TOKEN
|
||||
? credentialEntity.familyId || credentialEntity.clientId
|
||||
: credentialEntity.clientId;
|
||||
const credentialId = [
|
||||
credentialEntity.credentialType,
|
||||
clientOrFamilyId,
|
||||
credentialEntity.realm || "",
|
||||
];
|
||||
return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();
|
||||
}
|
||||
/**
|
||||
* Generate target key component as per schema: <target>
|
||||
*/
|
||||
function generateTarget(credentialEntity) {
|
||||
return (credentialEntity.target || "").toLowerCase();
|
||||
}
|
||||
/**
|
||||
* Generate requested claims key component as per schema: <requestedClaims>
|
||||
*/
|
||||
function generateClaimsHash(credentialEntity) {
|
||||
return (credentialEntity.requestedClaimsHash || "").toLowerCase();
|
||||
}
|
||||
/**
|
||||
* Generate scheme key componenet as per schema: <scheme>
|
||||
*/
|
||||
function generateScheme(credentialEntity) {
|
||||
/*
|
||||
* PoP Tokens and SSH certs include scheme in cache key
|
||||
* Cast to lowercase to handle "bearer" from ADFS
|
||||
*/
|
||||
return credentialEntity.tokenType &&
|
||||
credentialEntity.tokenType.toLowerCase() !==
|
||||
AuthenticationScheme.BEARER.toLowerCase()
|
||||
? credentialEntity.tokenType.toLowerCase()
|
||||
: "";
|
||||
}
|
||||
/**
|
||||
* validates if a given cache entry is "Telemetry", parses <key,value>
|
||||
* @param key
|
||||
* @param entity
|
||||
*/
|
||||
function isServerTelemetryEntity(key, entity) {
|
||||
const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;
|
||||
let validateEntity = true;
|
||||
if (entity) {
|
||||
validateEntity =
|
||||
entity.hasOwnProperty("failedRequests") &&
|
||||
entity.hasOwnProperty("errors") &&
|
||||
entity.hasOwnProperty("cacheHits");
|
||||
}
|
||||
return validateKey && validateEntity;
|
||||
}
|
||||
/**
|
||||
* validates if a given cache entry is "Throttling", parses <key,value>
|
||||
* @param key
|
||||
* @param entity
|
||||
*/
|
||||
function isThrottlingEntity(key, entity) {
|
||||
let validateKey = false;
|
||||
if (key) {
|
||||
validateKey = key.indexOf(ThrottlingConstants.THROTTLING_PREFIX) === 0;
|
||||
}
|
||||
let validateEntity = true;
|
||||
if (entity) {
|
||||
validateEntity = entity.hasOwnProperty("throttleTime");
|
||||
}
|
||||
return validateKey && validateEntity;
|
||||
}
|
||||
/**
|
||||
* Generate AppMetadata Cache Key as per the schema: appmetadata-<environment>-<client_id>
|
||||
*/
|
||||
function generateAppMetadataKey({ environment, clientId, }) {
|
||||
const appMetaDataKeyArray = [
|
||||
APP_METADATA,
|
||||
environment,
|
||||
clientId,
|
||||
];
|
||||
return appMetaDataKeyArray
|
||||
.join(Separators.CACHE_KEY_SEPARATOR)
|
||||
.toLowerCase();
|
||||
}
|
||||
/*
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
function isAppMetadataEntity(key, entity) {
|
||||
if (!entity) {
|
||||
return false;
|
||||
}
|
||||
return (key.indexOf(APP_METADATA) === 0 &&
|
||||
entity.hasOwnProperty("clientId") &&
|
||||
entity.hasOwnProperty("environment"));
|
||||
}
|
||||
/**
|
||||
* Validates an entity: checks for all expected params
|
||||
* @param entity
|
||||
*/
|
||||
function isAuthorityMetadataEntity(key, entity) {
|
||||
if (!entity) {
|
||||
return false;
|
||||
}
|
||||
return (key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) === 0 &&
|
||||
entity.hasOwnProperty("aliases") &&
|
||||
entity.hasOwnProperty("preferred_cache") &&
|
||||
entity.hasOwnProperty("preferred_network") &&
|
||||
entity.hasOwnProperty("canonical_authority") &&
|
||||
entity.hasOwnProperty("authorization_endpoint") &&
|
||||
entity.hasOwnProperty("token_endpoint") &&
|
||||
entity.hasOwnProperty("issuer") &&
|
||||
entity.hasOwnProperty("aliasesFromNetwork") &&
|
||||
entity.hasOwnProperty("endpointsFromNetwork") &&
|
||||
entity.hasOwnProperty("expiresAt") &&
|
||||
entity.hasOwnProperty("jwks_uri"));
|
||||
}
|
||||
/**
|
||||
* Reset the exiresAt value
|
||||
*/
|
||||
function generateAuthorityMetadataExpiresAt() {
|
||||
return (nowSeconds() +
|
||||
AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS);
|
||||
}
|
||||
function updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {
|
||||
authorityMetadata.authorization_endpoint =
|
||||
updatedValues.authorization_endpoint;
|
||||
authorityMetadata.token_endpoint = updatedValues.token_endpoint;
|
||||
authorityMetadata.end_session_endpoint = updatedValues.end_session_endpoint;
|
||||
authorityMetadata.issuer = updatedValues.issuer;
|
||||
authorityMetadata.endpointsFromNetwork = fromNetwork;
|
||||
authorityMetadata.jwks_uri = updatedValues.jwks_uri;
|
||||
}
|
||||
function updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetwork) {
|
||||
authorityMetadata.aliases = updatedValues.aliases;
|
||||
authorityMetadata.preferred_cache = updatedValues.preferred_cache;
|
||||
authorityMetadata.preferred_network = updatedValues.preferred_network;
|
||||
authorityMetadata.aliasesFromNetwork = fromNetwork;
|
||||
}
|
||||
/**
|
||||
* Returns whether or not the data needs to be refreshed
|
||||
*/
|
||||
function isAuthorityMetadataExpired(metadata) {
|
||||
return metadata.expiresAt <= nowSeconds();
|
||||
}
|
||||
|
||||
export { createAccessTokenEntity, createIdTokenEntity, createRefreshTokenEntity, generateAppMetadataKey, generateAuthorityMetadataExpiresAt, generateCredentialKey, isAccessTokenEntity, isAppMetadataEntity, isAuthorityMetadataEntity, isAuthorityMetadataExpired, isCredentialEntity, isIdTokenEntity, isRefreshTokenEntity, isServerTelemetryEntity, isThrottlingEntity, updateAuthorityEndpointMetadata, updateCloudDiscoveryMetadata };
|
||||
//# sourceMappingURL=CacheHelpers.mjs.map
|
||||
1
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
70
node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts
generated
vendored
Normal file
70
node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { AccountEntity } from "../entities/AccountEntity.js";
|
||||
import { IdTokenEntity } from "../entities/IdTokenEntity.js";
|
||||
import { AccessTokenEntity } from "../entities/AccessTokenEntity.js";
|
||||
import { RefreshTokenEntity } from "../entities/RefreshTokenEntity.js";
|
||||
import { AppMetadataEntity } from "../entities/AppMetadataEntity.js";
|
||||
import { ServerTelemetryEntity } from "../entities/ServerTelemetryEntity.js";
|
||||
import { ThrottlingEntity } from "../entities/ThrottlingEntity.js";
|
||||
import { AuthorityMetadataEntity } from "../entities/AuthorityMetadataEntity.js";
|
||||
import { AuthenticationScheme } from "../../utils/Constants.js";
|
||||
import { ScopeSet } from "../../request/ScopeSet.js";
|
||||
import { AccountInfo } from "../../account/AccountInfo.js";
|
||||
/** @internal */
|
||||
export type AccountCache = Record<string, AccountEntity>;
|
||||
/** @internal */
|
||||
export type IdTokenCache = Record<string, IdTokenEntity>;
|
||||
/** @internal */
|
||||
export type AccessTokenCache = Record<string, AccessTokenEntity>;
|
||||
/** @internal */
|
||||
export type RefreshTokenCache = Record<string, RefreshTokenEntity>;
|
||||
/** @internal */
|
||||
export type AppMetadataCache = Record<string, AppMetadataEntity>;
|
||||
/**
|
||||
* Object type of all accepted cache types
|
||||
* @internal
|
||||
*/
|
||||
export type ValidCacheType = AccountEntity | IdTokenEntity | AccessTokenEntity | RefreshTokenEntity | AppMetadataEntity | AuthorityMetadataEntity | ServerTelemetryEntity | ThrottlingEntity | string;
|
||||
/**
|
||||
* Object type of all credential types
|
||||
* @internal
|
||||
*/
|
||||
export type ValidCredentialType = IdTokenEntity | AccessTokenEntity | RefreshTokenEntity;
|
||||
/**
|
||||
* Account: <home_account_id>-<environment>-<realm*>
|
||||
*/
|
||||
export type AccountFilter = Omit<Partial<AccountInfo>, "idToken" | "idTokenClaims"> & {
|
||||
realm?: string;
|
||||
loginHint?: string;
|
||||
sid?: string;
|
||||
isHomeTenant?: boolean;
|
||||
};
|
||||
export type TenantProfileFilter = Pick<AccountFilter, "localAccountId" | "loginHint" | "name" | "sid" | "isHomeTenant" | "username">;
|
||||
/**
|
||||
* Credential: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<scheme*>
|
||||
*/
|
||||
export type CredentialFilter = {
|
||||
homeAccountId?: string;
|
||||
environment?: string;
|
||||
credentialType?: string;
|
||||
clientId?: string;
|
||||
familyId?: string;
|
||||
realm?: string;
|
||||
target?: ScopeSet;
|
||||
userAssertionHash?: string;
|
||||
tokenType?: AuthenticationScheme;
|
||||
keyId?: string;
|
||||
requestedClaimsHash?: string;
|
||||
};
|
||||
/**
|
||||
* AppMetadata: appmetadata-<environment>-<client_id>
|
||||
*/
|
||||
export type AppMetadataFilter = {
|
||||
environment?: string;
|
||||
clientId?: string;
|
||||
};
|
||||
export type TokenKeys = {
|
||||
idToken: string[];
|
||||
accessToken: string[];
|
||||
refreshToken: string[];
|
||||
};
|
||||
//# sourceMappingURL=CacheTypes.d.ts.map
|
||||
1
node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-common/dist/cache/utils/CacheTypes.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"CacheTypes.d.ts","sourceRoot":"","sources":["../../../src/cache/utils/CacheTypes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAE3D,gBAAgB;AAChB,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACzD,gBAAgB;AAChB,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AACzD,gBAAgB;AAChB,MAAM,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AACjE,gBAAgB;AAChB,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;AACnE,gBAAgB;A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