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AY,YACZC,EAAkB,2BAClBC,EAAgB,gBAChBC,EAAc,cACdC,EAAgB,gBAChBC,EAAmB,mBACnBC,EAAwB,wBACxBC,EAAa,aACbC,EAAU,UACVC,EAAgB,YAChBC,EAAsB,sBAItBC,EAAkB,kBAClBC,EAAgB,eAChBC,EAAc,cACdC,EAAM,MACNC,EAAa,aACbC,EAAc,cACdC,EAAqB","sources":["webpack://iadviser/./node_modules/@azure/msal-common/dist/cache/CacheManager.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/cache/entities/AccountEntity.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/cache/persistence/TokenCacheContext.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/cache/utils/CacheHelpers.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/client/AuthorizationCodeClient.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/client/BaseClient.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/client/RefreshTokenClient.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/client/SilentFlowClient.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/config/ClientConfiguration.mjs","webpack://iadviser/./node_modules/@azure/msal-common/dist/constants/AADServerParamKeys.mjs"],"sourcesContent":["/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { Separators, CredentialType, AuthenticationScheme, THE_FAMILY_ID, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../utils/Constants.mjs';\nimport { generateCredentialKey } from './utils/CacheHelpers.mjs';\nimport { ScopeSet } from '../request/ScopeSet.mjs';\nimport { AccountEntity } from './entities/AccountEntity.mjs';\nimport { createClientAuthError } from '../error/ClientAuthError.mjs';\nimport { updateAccountTenantProfileData, tenantIdMatchesHomeTenant } from '../account/AccountInfo.mjs';\nimport { extractTokenClaims } from '../account/AuthToken.mjs';\nimport { name, version } from '../packageMetadata.mjs';\nimport { getAliasesFromStaticSources } from '../authority/AuthorityMetadata.mjs';\nimport { CacheError } from '../error/CacheError.mjs';\nimport { invalidCacheRecord, bindingKeyNotRemoved, multipleMatchingAppMetadata, methodNotImplemented } from '../error/ClientAuthErrorCodes.mjs';\nimport { cacheQuotaExceededErrorCode, cacheUnknownErrorCode } from '../error/CacheErrorCodes.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.\r\n * @internal\r\n */\r\nclass CacheManager {\r\n constructor(clientId, cryptoImpl, logger, staticAuthorityOptions) {\r\n this.clientId = clientId;\r\n this.cryptoImpl = cryptoImpl;\r\n this.commonLogger = logger.clone(name, version);\r\n this.staticAuthorityOptions = staticAuthorityOptions;\r\n }\r\n /**\r\n * Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.\r\n * @param accountFilter - (Optional) filter to narrow down the accounts returned\r\n * @returns Array of AccountInfo objects in cache\r\n */\r\n getAllAccounts(accountFilter) {\r\n return this.buildTenantProfiles(this.getAccountsFilteredBy(accountFilter || {}), accountFilter);\r\n }\r\n /**\r\n * Gets first tenanted AccountInfo object found based on provided filters\r\n */\r\n getAccountInfoFilteredBy(accountFilter) {\r\n const allAccounts = this.getAllAccounts(accountFilter);\r\n if (allAccounts.length > 1) {\r\n // If one or more accounts are found, prioritize accounts that have an ID token\r\n const sortedAccounts = allAccounts.sort((account) => {\r\n return account.idTokenClaims ? -1 : 1;\r\n });\r\n return sortedAccounts[0];\r\n }\r\n else if (allAccounts.length === 1) {\r\n // If only one account is found, return it regardless of whether a matching ID token was found\r\n return allAccounts[0];\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n /**\r\n * Returns a single matching\r\n * @param accountFilter\r\n * @returns\r\n */\r\n getBaseAccountInfo(accountFilter) {\r\n const accountEntities = this.getAccountsFilteredBy(accountFilter);\r\n if (accountEntities.length > 0) {\r\n return accountEntities[0].getAccountInfo();\r\n }\r\n else {\r\n return null;\r\n }\r\n }\r\n /**\r\n * Matches filtered account entities with cached ID tokens that match the tenant profile-specific account filters\r\n * and builds the account info objects from the matching ID token's claims\r\n * @param cachedAccounts\r\n * @param accountFilter\r\n * @returns Array of AccountInfo objects that match account and tenant profile filters\r\n */\r\n buildTenantProfiles(cachedAccounts, accountFilter) {\r\n return cachedAccounts.flatMap((accountEntity) => {\r\n return this.getTenantProfilesFromAccountEntity(accountEntity, accountFilter?.tenantId, accountFilter);\r\n });\r\n }\r\n getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter) {\r\n let tenantedAccountInfo = null;\r\n let idTokenClaims;\r\n if (tenantProfileFilter) {\r\n if (!this.tenantProfileMatchesFilter(tenantProfile, tenantProfileFilter)) {\r\n return null;\r\n }\r\n }\r\n const idToken = this.getIdToken(accountInfo, tokenKeys, tenantProfile.tenantId);\r\n if (idToken) {\r\n idTokenClaims = extractTokenClaims(idToken.secret, this.cryptoImpl.base64Decode);\r\n if (!this.idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter)) {\r\n // ID token sourced claims don't match so this tenant profile is not a match\r\n return null;\r\n }\r\n }\r\n // Expand tenant profile into account info based on matching tenant profile and if available matching ID token claims\r\n tenantedAccountInfo = updateAccountTenantProfileData(accountInfo, tenantProfile, idTokenClaims, idToken?.secret);\r\n return tenantedAccountInfo;\r\n }\r\n getTenantProfilesFromAccountEntity(accountEntity, targetTenantId, tenantProfileFilter) {\r\n const accountInfo = accountEntity.getAccountInfo();\r\n let searchTenantProfiles = accountInfo.tenantProfiles || new Map();\r\n const tokenKeys = this.getTokenKeys();\r\n // If a tenant ID was provided, only return the tenant profile for that tenant ID if it exists\r\n if (targetTenantId) {\r\n const tenantProfile = searchTenantProfiles.get(targetTenantId);\r\n if (tenantProfile) {\r\n // Reduce search field to just this tenant profile\r\n searchTenantProfiles = new Map([\r\n [targetTenantId, tenantProfile],\r\n ]);\r\n }\r\n else {\r\n // No tenant profile for search tenant ID, return empty array\r\n return [];\r\n }\r\n }\r\n const matchingTenantProfiles = [];\r\n searchTenantProfiles.forEach((tenantProfile) => {\r\n const tenantedAccountInfo = this.getTenantedAccountInfoByFilter(accountInfo, tokenKeys, tenantProfile, tenantProfileFilter);\r\n if (tenantedAccountInfo) {\r\n matchingTenantProfiles.push(tenantedAccountInfo);\r\n }\r\n });\r\n return matchingTenantProfiles;\r\n }\r\n tenantProfileMatchesFilter(tenantProfile, tenantProfileFilter) {\r\n if (!!tenantProfileFilter.localAccountId &&\r\n !this.matchLocalAccountIdFromTenantProfile(tenantProfile, tenantProfileFilter.localAccountId)) {\r\n return false;\r\n }\r\n if (!!tenantProfileFilter.name &&\r\n !(tenantProfile.name === tenantProfileFilter.name)) {\r\n return false;\r\n }\r\n if (tenantProfileFilter.isHomeTenant !== undefined &&\r\n !(tenantProfile.isHomeTenant === tenantProfileFilter.isHomeTenant)) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n idTokenClaimsMatchTenantProfileFilter(idTokenClaims, tenantProfileFilter) {\r\n // Tenant Profile filtering\r\n if (tenantProfileFilter) {\r\n if (!!tenantProfileFilter.localAccountId &&\r\n !this.matchLocalAccountIdFromTokenClaims(idTokenClaims, tenantProfileFilter.localAccountId)) {\r\n return false;\r\n }\r\n if (!!tenantProfileFilter.loginHint &&\r\n !this.matchLoginHintFromTokenClaims(idTokenClaims, tenantProfileFilter.loginHint)) {\r\n return false;\r\n }\r\n if (!!tenantProfileFilter.username &&\r\n !this.matchUsername(idTokenClaims.preferred_username, tenantProfileFilter.username)) {\r\n return false;\r\n }\r\n if (!!tenantProfileFilter.name &&\r\n !this.matchName(idTokenClaims, tenantProfileFilter.name)) {\r\n return false;\r\n }\r\n if (!!tenantProfileFilter.sid &&\r\n !this.matchSid(idTokenClaims, tenantProfileFilter.sid)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * saves a cache record\r\n * @param cacheRecord {CacheRecord}\r\n * @param storeInCache {?StoreInCache}\r\n * @param correlationId {?string} correlation id\r\n */\r\n async saveCacheRecord(cacheRecord, storeInCache, correlationId) {\r\n if (!cacheRecord) {\r\n throw createClientAuthError(invalidCacheRecord);\r\n }\r\n try {\r\n if (!!cacheRecord.account) {\r\n this.setAccount(cacheRecord.account);\r\n }\r\n if (!!cacheRecord.idToken && storeInCache?.idToken !== false) {\r\n this.setIdTokenCredential(cacheRecord.idToken);\r\n }\r\n if (!!cacheRecord.accessToken &&\r\n storeInCache?.accessToken !== false) {\r\n await this.saveAccessToken(cacheRecord.accessToken);\r\n }\r\n if (!!cacheRecord.refreshToken &&\r\n storeInCache?.refreshToken !== false) {\r\n this.setRefreshTokenCredential(cacheRecord.refreshToken);\r\n }\r\n if (!!cacheRecord.appMetadata) {\r\n this.setAppMetadata(cacheRecord.appMetadata);\r\n }\r\n }\r\n catch (e) {\r\n this.commonLogger?.error(`CacheManager.saveCacheRecord: failed`);\r\n if (e instanceof Error) {\r\n this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e.message}`, correlationId);\r\n if (e.name === \"QuotaExceededError\" ||\r\n e.name === \"NS_ERROR_DOM_QUOTA_REACHED\" ||\r\n e.message.includes(\"exceeded the quota\")) {\r\n this.commonLogger?.error(`CacheManager.saveCacheRecord: exceeded storage quota`, correlationId);\r\n throw new CacheError(cacheQuotaExceededErrorCode);\r\n }\r\n else {\r\n throw new CacheError(e.name, e.message);\r\n }\r\n }\r\n else {\r\n this.commonLogger?.errorPii(`CacheManager.saveCacheRecord: ${e}`, correlationId);\r\n throw new CacheError(cacheUnknownErrorCode);\r\n }\r\n }\r\n }\r\n /**\r\n * saves access token credential\r\n * @param credential\r\n */\r\n async saveAccessToken(credential) {\r\n const accessTokenFilter = {\r\n clientId: credential.clientId,\r\n credentialType: credential.credentialType,\r\n environment: credential.environment,\r\n homeAccountId: credential.homeAccountId,\r\n realm: credential.realm,\r\n tokenType: credential.tokenType,\r\n requestedClaimsHash: credential.requestedClaimsHash,\r\n };\r\n const tokenKeys = this.getTokenKeys();\r\n const currentScopes = ScopeSet.fromString(credential.target);\r\n const removedAccessTokens = [];\r\n tokenKeys.accessToken.forEach((key) => {\r\n if (!this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {\r\n return;\r\n }\r\n const tokenEntity = this.getAccessTokenCredential(key);\r\n if (tokenEntity &&\r\n this.credentialMatchesFilter(tokenEntity, accessTokenFilter)) {\r\n const tokenScopeSet = ScopeSet.fromString(tokenEntity.target);\r\n if (tokenScopeSet.intersectingScopeSets(currentScopes)) {\r\n removedAccessTokens.push(this.removeAccessToken(key));\r\n }\r\n }\r\n });\r\n await Promise.all(removedAccessTokens);\r\n this.setAccessTokenCredential(credential);\r\n }\r\n /**\r\n * Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache\r\n * Not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared\r\n * @param accountFilter - An object containing Account properties to filter by\r\n */\r\n getAccountsFilteredBy(accountFilter) {\r\n const allAccountKeys = this.getAccountKeys();\r\n const matchingAccounts = [];\r\n allAccountKeys.forEach((cacheKey) => {\r\n if (!this.isAccountKey(cacheKey, accountFilter.homeAccountId)) {\r\n // Don't parse value if the key doesn't match the account filters\r\n return;\r\n }\r\n const entity = this.getAccount(cacheKey, this.commonLogger);\r\n // Match base account fields\r\n if (!entity) {\r\n return;\r\n }\r\n if (!!accountFilter.homeAccountId &&\r\n !this.matchHomeAccountId(entity, accountFilter.homeAccountId)) {\r\n return;\r\n }\r\n if (!!accountFilter.username &&\r\n !this.matchUsername(entity.username, accountFilter.username)) {\r\n return;\r\n }\r\n if (!!accountFilter.environment &&\r\n !this.matchEnvironment(entity, accountFilter.environment)) {\r\n return;\r\n }\r\n if (!!accountFilter.realm &&\r\n !this.matchRealm(entity, accountFilter.realm)) {\r\n return;\r\n }\r\n if (!!accountFilter.nativeAccountId &&\r\n !this.matchNativeAccountId(entity, accountFilter.nativeAccountId)) {\r\n return;\r\n }\r\n if (!!accountFilter.authorityType &&\r\n !this.matchAuthorityType(entity, accountFilter.authorityType)) {\r\n return;\r\n }\r\n // If at least one tenant profile matches the tenant profile filter, add the account to the list of matching accounts\r\n const tenantProfileFilter = {\r\n localAccountId: accountFilter?.localAccountId,\r\n name: accountFilter?.name,\r\n };\r\n const matchingTenantProfiles = entity.tenantProfiles?.filter((tenantProfile) => {\r\n return this.tenantProfileMatchesFilter(tenantProfile, tenantProfileFilter);\r\n });\r\n if (matchingTenantProfiles && matchingTenantProfiles.length === 0) {\r\n // No tenant profile for this account matches filter, don't add to list of matching accounts\r\n return;\r\n }\r\n matchingAccounts.push(entity);\r\n });\r\n return matchingAccounts;\r\n }\r\n /**\r\n * Returns true if the given key matches our account key schema. Also matches homeAccountId and/or tenantId if provided\r\n * @param key\r\n * @param homeAccountId\r\n * @param tenantId\r\n * @returns\r\n */\r\n isAccountKey(key, homeAccountId, tenantId) {\r\n if (key.split(Separators.CACHE_KEY_SEPARATOR).length < 3) {\r\n // Account cache keys contain 3 items separated by '-' (each item may also contain '-')\r\n return false;\r\n }\r\n if (homeAccountId &&\r\n !key.toLowerCase().includes(homeAccountId.toLowerCase())) {\r\n return false;\r\n }\r\n if (tenantId && !key.toLowerCase().includes(tenantId.toLowerCase())) {\r\n return false;\r\n }\r\n // Do not check environment as aliasing can cause false negatives\r\n return true;\r\n }\r\n /**\r\n * Returns true if the given key matches our credential key schema.\r\n * @param key\r\n */\r\n isCredentialKey(key) {\r\n if (key.split(Separators.CACHE_KEY_SEPARATOR).length < 6) {\r\n // Credential cache keys contain 6 items separated by '-' (each item may also contain '-')\r\n return false;\r\n }\r\n const lowerCaseKey = key.toLowerCase();\r\n // Credential keys must indicate what credential type they represent\r\n if (lowerCaseKey.indexOf(CredentialType.ID_TOKEN.toLowerCase()) ===\r\n -1 &&\r\n lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN.toLowerCase()) ===\r\n -1 &&\r\n lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) === -1 &&\r\n lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) ===\r\n -1) {\r\n return false;\r\n }\r\n if (lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) >\r\n -1) {\r\n // Refresh tokens must contain the client id or family id\r\n const clientIdValidation = `${CredentialType.REFRESH_TOKEN}${Separators.CACHE_KEY_SEPARATOR}${this.clientId}${Separators.CACHE_KEY_SEPARATOR}`;\r\n const familyIdValidation = `${CredentialType.REFRESH_TOKEN}${Separators.CACHE_KEY_SEPARATOR}${THE_FAMILY_ID}${Separators.CACHE_KEY_SEPARATOR}`;\r\n if (lowerCaseKey.indexOf(clientIdValidation.toLowerCase()) === -1 &&\r\n lowerCaseKey.indexOf(familyIdValidation.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n }\r\n else if (lowerCaseKey.indexOf(this.clientId.toLowerCase()) === -1) {\r\n // Tokens must contain the clientId\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Returns whether or not the given credential entity matches the filter\r\n * @param entity\r\n * @param filter\r\n * @returns\r\n */\r\n credentialMatchesFilter(entity, filter) {\r\n if (!!filter.clientId && !this.matchClientId(entity, filter.clientId)) {\r\n return false;\r\n }\r\n if (!!filter.userAssertionHash &&\r\n !this.matchUserAssertionHash(entity, filter.userAssertionHash)) {\r\n return false;\r\n }\r\n /*\r\n * homeAccountId can be undefined, and we want to filter out cached items that have a homeAccountId of \"\"\r\n * because we don't want a client_credential request to return a cached token that has a homeAccountId\r\n */\r\n if (typeof filter.homeAccountId === \"string\" &&\r\n !this.matchHomeAccountId(entity, filter.homeAccountId)) {\r\n return false;\r\n }\r\n if (!!filter.environment &&\r\n !this.matchEnvironment(entity, filter.environment)) {\r\n return false;\r\n }\r\n if (!!filter.realm && !this.matchRealm(entity, filter.realm)) {\r\n return false;\r\n }\r\n if (!!filter.credentialType &&\r\n !this.matchCredentialType(entity, filter.credentialType)) {\r\n return false;\r\n }\r\n if (!!filter.familyId && !this.matchFamilyId(entity, filter.familyId)) {\r\n return false;\r\n }\r\n /*\r\n * idTokens do not have \"target\", target specific refreshTokens do exist for some types of authentication\r\n * Resource specific refresh tokens case will be added when the support is deemed necessary\r\n */\r\n if (!!filter.target && !this.matchTarget(entity, filter.target)) {\r\n return false;\r\n }\r\n // If request OR cached entity has requested Claims Hash, check if they match\r\n if (filter.requestedClaimsHash || entity.requestedClaimsHash) {\r\n // Don't match if either is undefined or they are different\r\n if (entity.requestedClaimsHash !== filter.requestedClaimsHash) {\r\n return false;\r\n }\r\n }\r\n // Access Token with Auth Scheme specific matching\r\n if (entity.credentialType ===\r\n CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {\r\n if (!!filter.tokenType &&\r\n !this.matchTokenType(entity, filter.tokenType)) {\r\n return false;\r\n }\r\n // KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key\r\n if (filter.tokenType === AuthenticationScheme.SSH) {\r\n if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata\r\n * @param filter\r\n */\r\n getAppMetadataFilteredBy(filter) {\r\n const allCacheKeys = this.getKeys();\r\n const matchingAppMetadata = {};\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-appMetadata type cache entities\r\n if (!this.isAppMetadata(cacheKey)) {\r\n return;\r\n }\r\n // Attempt retrieval\r\n const entity = this.getAppMetadata(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n if (!!filter.environment &&\r\n !this.matchEnvironment(entity, filter.environment)) {\r\n return;\r\n }\r\n if (!!filter.clientId &&\r\n !this.matchClientId(entity, filter.clientId)) {\r\n return;\r\n }\r\n matchingAppMetadata[cacheKey] = entity;\r\n });\r\n return matchingAppMetadata;\r\n }\r\n /**\r\n * retrieve authorityMetadata that contains a matching alias\r\n * @param filter\r\n */\r\n getAuthorityMetadataByAlias(host) {\r\n const allCacheKeys = this.getAuthorityMetadataKeys();\r\n let matchedEntity = null;\r\n allCacheKeys.forEach((cacheKey) => {\r\n // don't parse any non-authorityMetadata type cache entities\r\n if (!this.isAuthorityMetadata(cacheKey) ||\r\n cacheKey.indexOf(this.clientId) === -1) {\r\n return;\r\n }\r\n // Attempt retrieval\r\n const entity = this.getAuthorityMetadata(cacheKey);\r\n if (!entity) {\r\n return;\r\n }\r\n if (entity.aliases.indexOf(host) === -1) {\r\n return;\r\n }\r\n matchedEntity = entity;\r\n });\r\n return matchedEntity;\r\n }\r\n /**\r\n * Removes all accounts and related tokens from cache.\r\n */\r\n async removeAllAccounts() {\r\n const allAccountKeys = this.getAccountKeys();\r\n const removedAccounts = [];\r\n allAccountKeys.forEach((cacheKey) => {\r\n removedAccounts.push(this.removeAccount(cacheKey));\r\n });\r\n await Promise.all(removedAccounts);\r\n }\r\n /**\r\n * Removes the account and related tokens for a given account key\r\n * @param account\r\n */\r\n async removeAccount(accountKey) {\r\n const account = this.getAccount(accountKey, this.commonLogger);\r\n if (!account) {\r\n return;\r\n }\r\n await this.removeAccountContext(account);\r\n this.removeItem(accountKey);\r\n }\r\n /**\r\n * Removes credentials associated with the provided account\r\n * @param account\r\n */\r\n async removeAccountContext(account) {\r\n const allTokenKeys = this.getTokenKeys();\r\n const accountId = account.generateAccountId();\r\n const removedCredentials = [];\r\n allTokenKeys.idToken.forEach((key) => {\r\n if (key.indexOf(accountId) === 0) {\r\n this.removeIdToken(key);\r\n }\r\n });\r\n allTokenKeys.accessToken.forEach((key) => {\r\n if (key.indexOf(accountId) === 0) {\r\n removedCredentials.push(this.removeAccessToken(key));\r\n }\r\n });\r\n allTokenKeys.refreshToken.forEach((key) => {\r\n if (key.indexOf(accountId) === 0) {\r\n this.removeRefreshToken(key);\r\n }\r\n });\r\n await Promise.all(removedCredentials);\r\n }\r\n /**\r\n * Migrates a single-tenant account and all it's associated alternate cross-tenant account objects in the\r\n * cache into a condensed multi-tenant account object with tenant profiles.\r\n * @param accountKey\r\n * @param accountEntity\r\n * @param logger\r\n * @returns\r\n */\r\n updateOutdatedCachedAccount(accountKey, accountEntity, logger) {\r\n // Only update if account entity is defined and has no tenantProfiles object (is outdated)\r\n if (accountEntity && accountEntity.isSingleTenant()) {\r\n this.commonLogger?.verbose(\"updateOutdatedCachedAccount: Found a single-tenant (outdated) account entity in the cache, migrating to multi-tenant account entity\");\r\n // Get keys of all accounts belonging to user\r\n const matchingAccountKeys = this.getAccountKeys().filter((key) => {\r\n return key.startsWith(accountEntity.homeAccountId);\r\n });\r\n // Get all account entities belonging to user\r\n const accountsToMerge = [];\r\n matchingAccountKeys.forEach((key) => {\r\n const account = this.getCachedAccountEntity(key);\r\n if (account) {\r\n accountsToMerge.push(account);\r\n }\r\n });\r\n // Set base account to home account if available, any account if not\r\n const baseAccount = accountsToMerge.find((account) => {\r\n return tenantIdMatchesHomeTenant(account.realm, account.homeAccountId);\r\n }) || accountsToMerge[0];\r\n // Populate tenant profiles built from each account entity belonging to the user\r\n baseAccount.tenantProfiles = accountsToMerge.map((account) => {\r\n return {\r\n tenantId: account.realm,\r\n localAccountId: account.localAccountId,\r\n name: account.name,\r\n isHomeTenant: tenantIdMatchesHomeTenant(account.realm, account.homeAccountId),\r\n };\r\n });\r\n const updatedAccount = CacheManager.toObject(new AccountEntity(), {\r\n ...baseAccount,\r\n });\r\n const newAccountKey = updatedAccount.generateAccountKey();\r\n // Clear cache of legacy account objects that have been collpsed into tenant profiles\r\n matchingAccountKeys.forEach((key) => {\r\n if (key !== newAccountKey) {\r\n this.removeOutdatedAccount(accountKey);\r\n }\r\n });\r\n // Cache updated account object\r\n this.setAccount(updatedAccount);\r\n logger?.verbose(\"Updated an outdated account entity in the cache\");\r\n return updatedAccount;\r\n }\r\n // No update is necessary\r\n return accountEntity;\r\n }\r\n /**\r\n * returns a boolean if the given credential is removed\r\n * @param credential\r\n */\r\n async removeAccessToken(key) {\r\n const credential = this.getAccessTokenCredential(key);\r\n if (!credential) {\r\n return;\r\n }\r\n // Remove Token Binding Key from key store for PoP Tokens Credentials\r\n if (credential.credentialType.toLowerCase() ===\r\n CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) {\r\n if (credential.tokenType === AuthenticationScheme.POP) {\r\n const accessTokenWithAuthSchemeEntity = credential;\r\n const kid = accessTokenWithAuthSchemeEntity.keyId;\r\n if (kid) {\r\n try {\r\n await this.cryptoImpl.removeTokenBindingKey(kid);\r\n }\r\n catch (error) {\r\n throw createClientAuthError(bindingKeyNotRemoved);\r\n }\r\n }\r\n }\r\n }\r\n return this.removeItem(key);\r\n }\r\n /**\r\n * Removes all app metadata objects from cache.\r\n */\r\n removeAppMetadata() {\r\n const allCacheKeys = this.getKeys();\r\n allCacheKeys.forEach((cacheKey) => {\r\n if (this.isAppMetadata(cacheKey)) {\r\n this.removeItem(cacheKey);\r\n }\r\n });\r\n return true;\r\n }\r\n /**\r\n * Retrieve AccountEntity from cache\r\n * @param account\r\n */\r\n readAccountFromCache(account) {\r\n const accountKey = AccountEntity.generateAccountCacheKey(account);\r\n return this.getAccount(accountKey, this.commonLogger);\r\n }\r\n /**\r\n * Retrieve IdTokenEntity from cache\r\n * @param account {AccountInfo}\r\n * @param tokenKeys {?TokenKeys}\r\n * @param targetRealm {?string}\r\n * @param performanceClient {?IPerformanceClient}\r\n * @param correlationId {?string}\r\n */\r\n getIdToken(account, tokenKeys, targetRealm, performanceClient, correlationId) {\r\n this.commonLogger.trace(\"CacheManager - getIdToken called\");\r\n const idTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.ID_TOKEN,\r\n clientId: this.clientId,\r\n realm: targetRealm,\r\n };\r\n const idTokenMap = this.getIdTokensByFilter(idTokenFilter, tokenKeys);\r\n const numIdTokens = idTokenMap.size;\r\n if (numIdTokens < 1) {\r\n this.commonLogger.info(\"CacheManager:getIdToken - No token found\");\r\n return null;\r\n }\r\n else if (numIdTokens > 1) {\r\n let tokensToBeRemoved = idTokenMap;\r\n // Multiple tenant profiles and no tenant specified, pick home account\r\n if (!targetRealm) {\r\n const homeIdTokenMap = new Map();\r\n idTokenMap.forEach((idToken, key) => {\r\n if (idToken.realm === account.tenantId) {\r\n homeIdTokenMap.set(key, idToken);\r\n }\r\n });\r\n const numHomeIdTokens = homeIdTokenMap.size;\r\n if (numHomeIdTokens < 1) {\r\n this.commonLogger.info(\"CacheManager:getIdToken - Multiple ID tokens found for account but none match account entity tenant id, returning first result\");\r\n return idTokenMap.values().next().value;\r\n }\r\n else if (numHomeIdTokens === 1) {\r\n this.commonLogger.info(\"CacheManager:getIdToken - Multiple ID tokens found for account, defaulting to home tenant profile\");\r\n return homeIdTokenMap.values().next().value;\r\n }\r\n else {\r\n // Multiple ID tokens for home tenant profile, remove all and return null\r\n tokensToBeRemoved = homeIdTokenMap;\r\n }\r\n }\r\n // Multiple tokens for a single tenant profile, remove all and return null\r\n this.commonLogger.info(\"CacheManager:getIdToken - Multiple matching ID tokens found, clearing them\");\r\n tokensToBeRemoved.forEach((idToken, key) => {\r\n this.removeIdToken(key);\r\n });\r\n if (performanceClient && correlationId) {\r\n performanceClient.addFields({ multiMatchedID: idTokenMap.size }, correlationId);\r\n }\r\n return null;\r\n }\r\n this.commonLogger.info(\"CacheManager:getIdToken - Returning ID token\");\r\n return idTokenMap.values().next().value;\r\n }\r\n /**\r\n * Gets all idTokens matching the given filter\r\n * @param filter\r\n * @returns\r\n */\r\n getIdTokensByFilter(filter, tokenKeys) {\r\n const idTokenKeys = (tokenKeys && tokenKeys.idToken) || this.getTokenKeys().idToken;\r\n const idTokens = new Map();\r\n idTokenKeys.forEach((key) => {\r\n if (!this.idTokenKeyMatchesFilter(key, {\r\n clientId: this.clientId,\r\n ...filter,\r\n })) {\r\n return;\r\n }\r\n const idToken = this.getIdTokenCredential(key);\r\n if (idToken && this.credentialMatchesFilter(idToken, filter)) {\r\n idTokens.set(key, idToken);\r\n }\r\n });\r\n return idTokens;\r\n }\r\n /**\r\n * Validate the cache key against filter before retrieving and parsing cache value\r\n * @param key\r\n * @param filter\r\n * @returns\r\n */\r\n idTokenKeyMatchesFilter(inputKey, filter) {\r\n const key = inputKey.toLowerCase();\r\n if (filter.clientId &&\r\n key.indexOf(filter.clientId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.homeAccountId &&\r\n key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Removes idToken from the cache\r\n * @param key\r\n */\r\n removeIdToken(key) {\r\n this.removeItem(key);\r\n }\r\n /**\r\n * Removes refresh token from the cache\r\n * @param key\r\n */\r\n removeRefreshToken(key) {\r\n this.removeItem(key);\r\n }\r\n /**\r\n * Retrieve AccessTokenEntity from cache\r\n * @param account {AccountInfo}\r\n * @param request {BaseAuthRequest}\r\n * @param tokenKeys {?TokenKeys}\r\n * @param performanceClient {?IPerformanceClient}\r\n * @param correlationId {?string}\r\n */\r\n getAccessToken(account, request, tokenKeys, targetRealm, performanceClient, correlationId) {\r\n this.commonLogger.trace(\"CacheManager - getAccessToken called\");\r\n const scopes = ScopeSet.createSearchScopes(request.scopes);\r\n const authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;\r\n /*\r\n * Distinguish between Bearer and PoP/SSH token cache types\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n const credentialType = authScheme &&\r\n authScheme.toLowerCase() !==\r\n AuthenticationScheme.BEARER.toLowerCase()\r\n ? CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME\r\n : CredentialType.ACCESS_TOKEN;\r\n const accessTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: credentialType,\r\n clientId: this.clientId,\r\n realm: targetRealm || account.tenantId,\r\n target: scopes,\r\n tokenType: authScheme,\r\n keyId: request.sshKid,\r\n requestedClaimsHash: request.requestedClaimsHash,\r\n };\r\n const accessTokenKeys = (tokenKeys && tokenKeys.accessToken) ||\r\n this.getTokenKeys().accessToken;\r\n const accessTokens = [];\r\n accessTokenKeys.forEach((key) => {\r\n // Validate key\r\n if (this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {\r\n const accessToken = this.getAccessTokenCredential(key);\r\n // Validate value\r\n if (accessToken &&\r\n this.credentialMatchesFilter(accessToken, accessTokenFilter)) {\r\n accessTokens.push(accessToken);\r\n }\r\n }\r\n });\r\n const numAccessTokens = accessTokens.length;\r\n if (numAccessTokens < 1) {\r\n this.commonLogger.info(\"CacheManager:getAccessToken - No token found\");\r\n return null;\r\n }\r\n else if (numAccessTokens > 1) {\r\n this.commonLogger.info(\"CacheManager:getAccessToken - Multiple access tokens found, clearing them\");\r\n accessTokens.forEach((accessToken) => {\r\n void this.removeAccessToken(generateCredentialKey(accessToken));\r\n });\r\n if (performanceClient && correlationId) {\r\n performanceClient.addFields({ multiMatchedAT: accessTokens.length }, correlationId);\r\n }\r\n return null;\r\n }\r\n this.commonLogger.info(\"CacheManager:getAccessToken - Returning access token\");\r\n return accessTokens[0];\r\n }\r\n /**\r\n * Validate the cache key against filter before retrieving and parsing cache value\r\n * @param key\r\n * @param filter\r\n * @param keyMustContainAllScopes\r\n * @returns\r\n */\r\n accessTokenKeyMatchesFilter(inputKey, filter, keyMustContainAllScopes) {\r\n const key = inputKey.toLowerCase();\r\n if (filter.clientId &&\r\n key.indexOf(filter.clientId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.homeAccountId &&\r\n key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.realm && key.indexOf(filter.realm.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.requestedClaimsHash &&\r\n key.indexOf(filter.requestedClaimsHash.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.target) {\r\n const scopes = filter.target.asArray();\r\n for (let i = 0; i < scopes.length; i++) {\r\n if (keyMustContainAllScopes &&\r\n !key.includes(scopes[i].toLowerCase())) {\r\n // When performing a cache lookup a missing scope would be a cache miss\r\n return false;\r\n }\r\n else if (!keyMustContainAllScopes &&\r\n key.includes(scopes[i].toLowerCase())) {\r\n // When performing a cache write, any token with a subset of requested scopes should be replaced\r\n return true;\r\n }\r\n }\r\n }\r\n return true;\r\n }\r\n /**\r\n * Gets all access tokens matching the filter\r\n * @param filter\r\n * @returns\r\n */\r\n getAccessTokensByFilter(filter) {\r\n const tokenKeys = this.getTokenKeys();\r\n const accessTokens = [];\r\n tokenKeys.accessToken.forEach((key) => {\r\n if (!this.accessTokenKeyMatchesFilter(key, filter, true)) {\r\n return;\r\n }\r\n const accessToken = this.getAccessTokenCredential(key);\r\n if (accessToken &&\r\n this.credentialMatchesFilter(accessToken, filter)) {\r\n accessTokens.push(accessToken);\r\n }\r\n });\r\n return accessTokens;\r\n }\r\n /**\r\n * Helper to retrieve the appropriate refresh token from cache\r\n * @param account {AccountInfo}\r\n * @param familyRT {boolean}\r\n * @param tokenKeys {?TokenKeys}\r\n * @param performanceClient {?IPerformanceClient}\r\n * @param correlationId {?string}\r\n */\r\n getRefreshToken(account, familyRT, tokenKeys, performanceClient, correlationId) {\r\n this.commonLogger.trace(\"CacheManager - getRefreshToken called\");\r\n const id = familyRT ? THE_FAMILY_ID : undefined;\r\n const refreshTokenFilter = {\r\n homeAccountId: account.homeAccountId,\r\n environment: account.environment,\r\n credentialType: CredentialType.REFRESH_TOKEN,\r\n clientId: this.clientId,\r\n familyId: id,\r\n };\r\n const refreshTokenKeys = (tokenKeys && tokenKeys.refreshToken) ||\r\n this.getTokenKeys().refreshToken;\r\n const refreshTokens = [];\r\n refreshTokenKeys.forEach((key) => {\r\n // Validate key\r\n if (this.refreshTokenKeyMatchesFilter(key, refreshTokenFilter)) {\r\n const refreshToken = this.getRefreshTokenCredential(key);\r\n // Validate value\r\n if (refreshToken &&\r\n this.credentialMatchesFilter(refreshToken, refreshTokenFilter)) {\r\n refreshTokens.push(refreshToken);\r\n }\r\n }\r\n });\r\n const numRefreshTokens = refreshTokens.length;\r\n if (numRefreshTokens < 1) {\r\n this.commonLogger.info(\"CacheManager:getRefreshToken - No refresh token found.\");\r\n return null;\r\n }\r\n // address the else case after remove functions address environment aliases\r\n if (numRefreshTokens > 1 && performanceClient && correlationId) {\r\n performanceClient.addFields({ multiMatchedRT: numRefreshTokens }, correlationId);\r\n }\r\n this.commonLogger.info(\"CacheManager:getRefreshToken - returning refresh token\");\r\n return refreshTokens[0];\r\n }\r\n /**\r\n * Validate the cache key against filter before retrieving and parsing cache value\r\n * @param key\r\n * @param filter\r\n */\r\n refreshTokenKeyMatchesFilter(inputKey, filter) {\r\n const key = inputKey.toLowerCase();\r\n if (filter.familyId &&\r\n key.indexOf(filter.familyId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n // If familyId is used, clientId is not in the key\r\n if (!filter.familyId &&\r\n filter.clientId &&\r\n key.indexOf(filter.clientId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n if (filter.homeAccountId &&\r\n key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n /**\r\n * Retrieve AppMetadataEntity from cache\r\n */\r\n readAppMetadataFromCache(environment) {\r\n const appMetadataFilter = {\r\n environment,\r\n clientId: this.clientId,\r\n };\r\n const appMetadata = this.getAppMetadataFilteredBy(appMetadataFilter);\r\n const appMetadataEntries = Object.keys(appMetadata).map((key) => appMetadata[key]);\r\n const numAppMetadata = appMetadataEntries.length;\r\n if (numAppMetadata < 1) {\r\n return null;\r\n }\r\n else if (numAppMetadata > 1) {\r\n throw createClientAuthError(multipleMatchingAppMetadata);\r\n }\r\n return appMetadataEntries[0];\r\n }\r\n /**\r\n * Return the family_id value associated with FOCI\r\n * @param environment\r\n * @param clientId\r\n */\r\n isAppMetadataFOCI(environment) {\r\n const appMetadata = this.readAppMetadataFromCache(environment);\r\n return !!(appMetadata && appMetadata.familyId === THE_FAMILY_ID);\r\n }\r\n /**\r\n * helper to match account ids\r\n * @param value\r\n * @param homeAccountId\r\n */\r\n matchHomeAccountId(entity, homeAccountId) {\r\n return !!(typeof entity.homeAccountId === \"string\" &&\r\n homeAccountId === entity.homeAccountId);\r\n }\r\n /**\r\n * helper to match account ids\r\n * @param entity\r\n * @param localAccountId\r\n * @returns\r\n */\r\n matchLocalAccountIdFromTokenClaims(tokenClaims, localAccountId) {\r\n const idTokenLocalAccountId = tokenClaims.oid || tokenClaims.sub;\r\n return localAccountId === idTokenLocalAccountId;\r\n }\r\n matchLocalAccountIdFromTenantProfile(tenantProfile, localAccountId) {\r\n return tenantProfile.localAccountId === localAccountId;\r\n }\r\n /**\r\n * helper to match names\r\n * @param entity\r\n * @param name\r\n * @returns true if the downcased name properties are present and match in the filter and the entity\r\n */\r\n matchName(claims, name) {\r\n return !!(name.toLowerCase() === claims.name?.toLowerCase());\r\n }\r\n /**\r\n * helper to match usernames\r\n * @param entity\r\n * @param username\r\n * @returns\r\n */\r\n matchUsername(cachedUsername, filterUsername) {\r\n return !!(cachedUsername &&\r\n typeof cachedUsername === \"string\" &&\r\n filterUsername?.toLowerCase() === cachedUsername.toLowerCase());\r\n }\r\n /**\r\n * helper to match assertion\r\n * @param value\r\n * @param oboAssertion\r\n */\r\n matchUserAssertionHash(entity, userAssertionHash) {\r\n return !!(entity.userAssertionHash &&\r\n userAssertionHash === entity.userAssertionHash);\r\n }\r\n /**\r\n * helper to match environment\r\n * @param value\r\n * @param environment\r\n */\r\n matchEnvironment(entity, environment) {\r\n // Check static authority options first for cases where authority metadata has not been resolved and cached yet\r\n if (this.staticAuthorityOptions) {\r\n const staticAliases = getAliasesFromStaticSources(this.staticAuthorityOptions, this.commonLogger);\r\n if (staticAliases.includes(environment) &&\r\n staticAliases.includes(entity.environment)) {\r\n return true;\r\n }\r\n }\r\n // Query metadata cache if no static authority configuration has aliases that match enviroment\r\n const cloudMetadata = this.getAuthorityMetadataByAlias(environment);\r\n if (cloudMetadata &&\r\n cloudMetadata.aliases.indexOf(entity.environment) > -1) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * helper to match credential type\r\n * @param entity\r\n * @param credentialType\r\n */\r\n matchCredentialType(entity, credentialType) {\r\n return (entity.credentialType &&\r\n credentialType.toLowerCase() === entity.credentialType.toLowerCase());\r\n }\r\n /**\r\n * helper to match client ids\r\n * @param entity\r\n * @param clientId\r\n */\r\n matchClientId(entity, clientId) {\r\n return !!(entity.clientId && clientId === entity.clientId);\r\n }\r\n /**\r\n * helper to match family ids\r\n * @param entity\r\n * @param familyId\r\n */\r\n matchFamilyId(entity, familyId) {\r\n return !!(entity.familyId && familyId === entity.familyId);\r\n }\r\n /**\r\n * helper to match realm\r\n * @param entity\r\n * @param realm\r\n */\r\n matchRealm(entity, realm) {\r\n return !!(entity.realm?.toLowerCase() === realm.toLowerCase());\r\n }\r\n /**\r\n * helper to match nativeAccountId\r\n * @param entity\r\n * @param nativeAccountId\r\n * @returns boolean indicating the match result\r\n */\r\n matchNativeAccountId(entity, nativeAccountId) {\r\n return !!(entity.nativeAccountId && nativeAccountId === entity.nativeAccountId);\r\n }\r\n /**\r\n * helper to match loginHint which can be either:\r\n * 1. login_hint ID token claim\r\n * 2. username in cached account object\r\n * 3. upn in ID token claims\r\n * @param entity\r\n * @param loginHint\r\n * @returns\r\n */\r\n matchLoginHintFromTokenClaims(tokenClaims, loginHint) {\r\n if (tokenClaims.login_hint === loginHint) {\r\n return true;\r\n }\r\n if (tokenClaims.preferred_username === loginHint) {\r\n return true;\r\n }\r\n if (tokenClaims.upn === loginHint) {\r\n return true;\r\n }\r\n return false;\r\n }\r\n /**\r\n * Helper to match sid\r\n * @param entity\r\n * @param sid\r\n * @returns true if the sid claim is present and matches the filter\r\n */\r\n matchSid(idTokenClaims, sid) {\r\n return idTokenClaims.sid === sid;\r\n }\r\n matchAuthorityType(entity, authorityType) {\r\n return !!(entity.authorityType &&\r\n authorityType.toLowerCase() === entity.authorityType.toLowerCase());\r\n }\r\n /**\r\n * Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.\r\n * @param entity\r\n * @param target\r\n */\r\n matchTarget(entity, target) {\r\n const isNotAccessTokenCredential = entity.credentialType !== CredentialType.ACCESS_TOKEN &&\r\n entity.credentialType !==\r\n CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;\r\n if (isNotAccessTokenCredential || !entity.target) {\r\n return false;\r\n }\r\n const entityScopeSet = ScopeSet.fromString(entity.target);\r\n return entityScopeSet.containsScopeSet(target);\r\n }\r\n /**\r\n * Returns true if the credential's tokenType or Authentication Scheme matches the one in the request, false otherwise\r\n * @param entity\r\n * @param tokenType\r\n */\r\n matchTokenType(entity, tokenType) {\r\n return !!(entity.tokenType && entity.tokenType === tokenType);\r\n }\r\n /**\r\n * Returns true if the credential's keyId matches the one in the request, false otherwise\r\n * @param entity\r\n * @param keyId\r\n */\r\n matchKeyId(entity, keyId) {\r\n return !!(entity.keyId && entity.keyId === keyId);\r\n }\r\n /**\r\n * returns if a given cache entity is of the type appmetadata\r\n * @param key\r\n */\r\n isAppMetadata(key) {\r\n return key.indexOf(APP_METADATA) !== -1;\r\n }\r\n /**\r\n * returns if a given cache entity is of the type authoritymetadata\r\n * @param key\r\n */\r\n isAuthorityMetadata(key) {\r\n return key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) !== -1;\r\n }\r\n /**\r\n * returns cache key used for cloud instance metadata\r\n */\r\n generateAuthorityMetadataCacheKey(authority) {\r\n return `${AUTHORITY_METADATA_CONSTANTS.CACHE_KEY}-${this.clientId}-${authority}`;\r\n }\r\n /**\r\n * Helper to convert serialized data to object\r\n * @param obj\r\n * @param json\r\n */\r\n static toObject(obj, json) {\r\n for (const propertyName in json) {\r\n obj[propertyName] = json[propertyName];\r\n }\r\n return obj;\r\n }\r\n}\r\n/** @internal */\r\nclass DefaultStorageClass extends CacheManager {\r\n setAccount() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getAccount() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getCachedAccountEntity() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n setIdTokenCredential() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getIdTokenCredential() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n setAccessTokenCredential() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getAccessTokenCredential() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n setRefreshTokenCredential() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getRefreshTokenCredential() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n setAppMetadata() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getAppMetadata() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n setServerTelemetry() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getServerTelemetry() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n setAuthorityMetadata() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getAuthorityMetadata() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getAuthorityMetadataKeys() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n setThrottlingCache() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getThrottlingCache() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n removeItem() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getKeys() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getAccountKeys() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n getTokenKeys() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n async clear() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n updateCredentialCacheKey() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n removeOutdatedAccount() {\r\n throw createClientAuthError(methodNotImplemented);\r\n }\r\n}\n\nexport { CacheManager, DefaultStorageClass };\n//# sourceMappingURL=CacheManager.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { Separators, CacheAccountType } from '../../utils/Constants.mjs';\nimport { buildClientInfo } from '../../account/ClientInfo.mjs';\nimport { buildTenantProfile } from '../../account/AccountInfo.mjs';\nimport { createClientAuthError } from '../../error/ClientAuthError.mjs';\nimport { AuthorityType } from '../../authority/AuthorityType.mjs';\nimport { getTenantIdFromIdTokenClaims } from '../../account/TokenClaims.mjs';\nimport { ProtocolMode } from '../../authority/ProtocolMode.mjs';\nimport { invalidCacheEnvironment } from '../../error/ClientAuthErrorCodes.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).\r\n *\r\n * Key : Value Schema\r\n *\r\n * Key: --\r\n *\r\n * Value Schema:\r\n * {\r\n * homeAccountId: home account identifier for the auth scheme,\r\n * environment: entity that issued the token, represented as a full host\r\n * realm: Full tenant or organizational identifier that the account belongs to\r\n * localAccountId: Original tenant-specific accountID, usually used for legacy cases\r\n * username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt\r\n * authorityType: Accounts authority type as a string\r\n * name: Full name for the account, including given name and family name,\r\n * lastModificationTime: last time this entity was modified in the cache\r\n * lastModificationApp:\r\n * nativeAccountId: Account identifier on the native device\r\n * tenantProfiles: Array of tenant profile objects for each tenant that the account has authenticated with in the browser\r\n * }\r\n * @internal\r\n */\r\nclass AccountEntity {\r\n /**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\n generateAccountId() {\r\n const accountId = [this.homeAccountId, this.environment];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n /**\r\n * Generate Account Cache Key as per the schema: --\r\n */\r\n generateAccountKey() {\r\n return AccountEntity.generateAccountCacheKey({\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId,\r\n });\r\n }\r\n /**\r\n * Returns the AccountInfo interface for this account.\r\n */\r\n getAccountInfo() {\r\n return {\r\n homeAccountId: this.homeAccountId,\r\n environment: this.environment,\r\n tenantId: this.realm,\r\n username: this.username,\r\n localAccountId: this.localAccountId,\r\n name: this.name,\r\n nativeAccountId: this.nativeAccountId,\r\n authorityType: this.authorityType,\r\n // Deserialize tenant profiles array into a Map\r\n tenantProfiles: new Map((this.tenantProfiles || []).map((tenantProfile) => {\r\n return [tenantProfile.tenantId, tenantProfile];\r\n })),\r\n };\r\n }\r\n /**\r\n * Returns true if the account entity is in single tenant format (outdated), false otherwise\r\n */\r\n isSingleTenant() {\r\n return !this.tenantProfiles;\r\n }\r\n /**\r\n * Generates account key from interface\r\n * @param accountInterface\r\n */\r\n static generateAccountCacheKey(accountInterface) {\r\n const homeTenantId = accountInterface.homeAccountId.split(\".\")[1];\r\n const accountKey = [\r\n accountInterface.homeAccountId,\r\n accountInterface.environment || \"\",\r\n homeTenantId || accountInterface.tenantId || \"\",\r\n ];\r\n return accountKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n }\r\n /**\r\n * Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.\r\n * @param accountDetails\r\n */\r\n static createAccount(accountDetails, authority, base64Decode) {\r\n const account = new AccountEntity();\r\n if (authority.authorityType === AuthorityType.Adfs) {\r\n account.authorityType = CacheAccountType.ADFS_ACCOUNT_TYPE;\r\n }\r\n else if (authority.protocolMode === ProtocolMode.AAD) {\r\n account.authorityType = CacheAccountType.MSSTS_ACCOUNT_TYPE;\r\n }\r\n else {\r\n account.authorityType = CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n }\r\n let clientInfo;\r\n if (accountDetails.clientInfo && base64Decode) {\r\n clientInfo = buildClientInfo(accountDetails.clientInfo, base64Decode);\r\n }\r\n account.clientInfo = accountDetails.clientInfo;\r\n account.homeAccountId = accountDetails.homeAccountId;\r\n account.nativeAccountId = accountDetails.nativeAccountId;\r\n const env = accountDetails.environment ||\r\n (authority && authority.getPreferredCache());\r\n if (!env) {\r\n throw createClientAuthError(invalidCacheEnvironment);\r\n }\r\n account.environment = env;\r\n // non AAD scenarios can have empty realm\r\n account.realm =\r\n clientInfo?.utid ||\r\n getTenantIdFromIdTokenClaims(accountDetails.idTokenClaims) ||\r\n \"\";\r\n // How do you account for MSA CID here?\r\n account.localAccountId =\r\n clientInfo?.uid ||\r\n accountDetails.idTokenClaims?.oid ||\r\n accountDetails.idTokenClaims?.sub ||\r\n \"\";\r\n /*\r\n * In B2C scenarios the emails claim is used instead of preferred_username and it is an array.\r\n * In most cases it will contain a single email. This field should not be relied upon if a custom\r\n * policy is configured to return more than 1 email.\r\n */\r\n const preferredUsername = accountDetails.idTokenClaims?.preferred_username ||\r\n accountDetails.idTokenClaims?.upn;\r\n const email = accountDetails.idTokenClaims?.emails\r\n ? accountDetails.idTokenClaims.emails[0]\r\n : null;\r\n account.username = preferredUsername || email || \"\";\r\n account.name = accountDetails.idTokenClaims?.name || \"\";\r\n account.cloudGraphHostName = accountDetails.cloudGraphHostName;\r\n account.msGraphHost = accountDetails.msGraphHost;\r\n if (accountDetails.tenantProfiles) {\r\n account.tenantProfiles = accountDetails.tenantProfiles;\r\n }\r\n else {\r\n const tenantProfile = buildTenantProfile(accountDetails.homeAccountId, account.localAccountId, account.realm, accountDetails.idTokenClaims);\r\n account.tenantProfiles = [tenantProfile];\r\n }\r\n return account;\r\n }\r\n /**\r\n * Creates an AccountEntity object from AccountInfo\r\n * @param accountInfo\r\n * @param cloudGraphHostName\r\n * @param msGraphHost\r\n * @returns\r\n */\r\n static createFromAccountInfo(accountInfo, cloudGraphHostName, msGraphHost) {\r\n const account = new AccountEntity();\r\n account.authorityType =\r\n accountInfo.authorityType || CacheAccountType.GENERIC_ACCOUNT_TYPE;\r\n account.homeAccountId = accountInfo.homeAccountId;\r\n account.localAccountId = accountInfo.localAccountId;\r\n account.nativeAccountId = accountInfo.nativeAccountId;\r\n account.realm = accountInfo.tenantId;\r\n account.environment = accountInfo.environment;\r\n account.username = accountInfo.username;\r\n account.name = accountInfo.name;\r\n account.cloudGraphHostName = cloudGraphHostName;\r\n account.msGraphHost = msGraphHost;\r\n // Serialize tenant profiles map into an array\r\n account.tenantProfiles = Array.from(accountInfo.tenantProfiles?.values() || []);\r\n return account;\r\n }\r\n /**\r\n * Generate HomeAccountId from server response\r\n * @param serverClientInfo\r\n * @param authType\r\n */\r\n static generateHomeAccountId(serverClientInfo, authType, logger, cryptoObj, idTokenClaims) {\r\n // since ADFS/DSTS do not have tid and does not set client_info\r\n if (!(authType === AuthorityType.Adfs ||\r\n authType === AuthorityType.Dsts)) {\r\n // for cases where there is clientInfo\r\n if (serverClientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(serverClientInfo, cryptoObj.base64Decode);\r\n if (clientInfo.uid && clientInfo.utid) {\r\n return `${clientInfo.uid}.${clientInfo.utid}`;\r\n }\r\n }\r\n catch (e) { }\r\n }\r\n logger.warning(\"No client info in response\");\r\n }\r\n // default to \"sub\" claim\r\n return idTokenClaims?.sub || \"\";\r\n }\r\n /**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\n static isAccountEntity(entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"localAccountId\") &&\r\n entity.hasOwnProperty(\"username\") &&\r\n entity.hasOwnProperty(\"authorityType\"));\r\n }\r\n /**\r\n * Helper function to determine whether 2 accountInfo objects represent the same account\r\n * @param accountA\r\n * @param accountB\r\n * @param compareClaims - If set to true idTokenClaims will also be compared to determine account equality\r\n */\r\n static accountInfoIsEqual(accountA, accountB, compareClaims) {\r\n if (!accountA || !accountB) {\r\n return false;\r\n }\r\n let claimsMatch = true; // default to true so as to not fail comparison below if compareClaims: false\r\n if (compareClaims) {\r\n const accountAClaims = (accountA.idTokenClaims ||\r\n {});\r\n const accountBClaims = (accountB.idTokenClaims ||\r\n {});\r\n // issued at timestamp and nonce are expected to change each time a new id token is acquired\r\n claimsMatch =\r\n accountAClaims.iat === accountBClaims.iat &&\r\n accountAClaims.nonce === accountBClaims.nonce;\r\n }\r\n return (accountA.homeAccountId === accountB.homeAccountId &&\r\n accountA.localAccountId === accountB.localAccountId &&\r\n accountA.username === accountB.username &&\r\n accountA.tenantId === accountB.tenantId &&\r\n accountA.environment === accountB.environment &&\r\n accountA.nativeAccountId === accountB.nativeAccountId &&\r\n claimsMatch);\r\n }\r\n}\n\nexport { AccountEntity };\n//# sourceMappingURL=AccountEntity.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * This class instance helps track the memory changes facilitating\r\n * decisions to read from and write to the persistent cache\r\n */ class TokenCacheContext {\r\n constructor(tokenCache, hasChanged) {\r\n this.cache = tokenCache;\r\n this.hasChanged = hasChanged;\r\n }\r\n /**\r\n * boolean which indicates the changes in cache\r\n */\r\n get cacheHasChanged() {\r\n return this.hasChanged;\r\n }\r\n /**\r\n * function to retrieve the token cache\r\n */\r\n get tokenCache() {\r\n return this.cache;\r\n }\r\n}\n\nexport { TokenCacheContext };\n//# sourceMappingURL=TokenCacheContext.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { extractTokenClaims } from '../../account/AuthToken.mjs';\nimport { createClientAuthError } from '../../error/ClientAuthError.mjs';\nimport { Separators, CredentialType, AuthenticationScheme, SERVER_TELEM_CONSTANTS, ThrottlingConstants, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../../utils/Constants.mjs';\nimport { nowSeconds } from '../../utils/TimeUtils.mjs';\nimport { tokenClaimsCnfRequiredForSignedJwt } from '../../error/ClientAuthErrorCodes.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Cache Key: -------\r\n * IdToken Example: uid.utid-login.microsoftonline.com-idtoken-app_client_id-contoso.com\r\n * AccessToken Example: uid.utid-login.microsoftonline.com-accesstoken-app_client_id-contoso.com-scope1 scope2--pop\r\n * RefreshToken Example: uid.utid-login.microsoftonline.com-refreshtoken-1-contoso.com\r\n * @param credentialEntity\r\n * @returns\r\n */\r\nfunction generateCredentialKey(credentialEntity) {\r\n const credentialKey = [\r\n generateAccountId(credentialEntity),\r\n generateCredentialId(credentialEntity),\r\n generateTarget(credentialEntity),\r\n generateClaimsHash(credentialEntity),\r\n generateScheme(credentialEntity),\r\n ];\r\n return credentialKey.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n}\r\n/**\r\n * Create IdTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\nfunction createIdTokenEntity(homeAccountId, environment, idToken, clientId, tenantId) {\r\n const idTokenEntity = {\r\n credentialType: CredentialType.ID_TOKEN,\r\n homeAccountId: homeAccountId,\r\n environment: environment,\r\n clientId: clientId,\r\n secret: idToken,\r\n realm: tenantId,\r\n };\r\n return idTokenEntity;\r\n}\r\n/**\r\n * Create AccessTokenEntity\r\n * @param homeAccountId\r\n * @param environment\r\n * @param accessToken\r\n * @param clientId\r\n * @param tenantId\r\n * @param scopes\r\n * @param expiresOn\r\n * @param extExpiresOn\r\n */\r\nfunction createAccessTokenEntity(homeAccountId, environment, accessToken, clientId, tenantId, scopes, expiresOn, extExpiresOn, base64Decode, refreshOn, tokenType, userAssertionHash, keyId, requestedClaims, requestedClaimsHash) {\r\n const atEntity = {\r\n homeAccountId: homeAccountId,\r\n credentialType: CredentialType.ACCESS_TOKEN,\r\n secret: accessToken,\r\n cachedAt: nowSeconds().toString(),\r\n expiresOn: expiresOn.toString(),\r\n extendedExpiresOn: extExpiresOn.toString(),\r\n environment: environment,\r\n clientId: clientId,\r\n realm: tenantId,\r\n target: scopes,\r\n tokenType: tokenType || AuthenticationScheme.BEARER,\r\n };\r\n if (userAssertionHash) {\r\n atEntity.userAssertionHash = userAssertionHash;\r\n }\r\n if (refreshOn) {\r\n atEntity.refreshOn = refreshOn.toString();\r\n }\r\n if (requestedClaims) {\r\n atEntity.requestedClaims = requestedClaims;\r\n atEntity.requestedClaimsHash = requestedClaimsHash;\r\n }\r\n /*\r\n * Create Access Token With Auth Scheme instead of regular access token\r\n * Cast to lower to handle \"bearer\" from ADFS\r\n */\r\n if (atEntity.tokenType?.toLowerCase() !==\r\n AuthenticationScheme.BEARER.toLowerCase()) {\r\n atEntity.credentialType = CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME;\r\n switch (atEntity.tokenType) {\r\n case AuthenticationScheme.POP:\r\n // Make sure keyId is present and add it to credential\r\n const tokenClaims = extractTokenClaims(accessToken, base64Decode);\r\n if (!tokenClaims?.cnf?.kid) {\r\n throw createClientAuthError(tokenClaimsCnfRequiredForSignedJwt);\r\n }\r\n atEntity.keyId = tokenClaims.cnf.kid;\r\n break;\r\n case AuthenticationScheme.SSH:\r\n atEntity.keyId = keyId;\r\n }\r\n }\r\n return atEntity;\r\n}\r\n/**\r\n * Create RefreshTokenEntity\r\n * @param homeAccountId\r\n * @param authenticationResult\r\n * @param clientId\r\n * @param authority\r\n */\r\nfunction createRefreshTokenEntity(homeAccountId, environment, refreshToken, clientId, familyId, userAssertionHash, expiresOn) {\r\n const rtEntity = {\r\n credentialType: CredentialType.REFRESH_TOKEN,\r\n homeAccountId: homeAccountId,\r\n environment: environment,\r\n clientId: clientId,\r\n secret: refreshToken,\r\n };\r\n if (userAssertionHash) {\r\n rtEntity.userAssertionHash = userAssertionHash;\r\n }\r\n if (familyId) {\r\n rtEntity.familyId = familyId;\r\n }\r\n if (expiresOn) {\r\n rtEntity.expiresOn = expiresOn.toString();\r\n }\r\n return rtEntity;\r\n}\r\nfunction isCredentialEntity(entity) {\r\n return (entity.hasOwnProperty(\"homeAccountId\") &&\r\n entity.hasOwnProperty(\"environment\") &&\r\n entity.hasOwnProperty(\"credentialType\") &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"secret\"));\r\n}\r\n/**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\nfunction isAccessTokenEntity(entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (isCredentialEntity(entity) &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity.hasOwnProperty(\"target\") &&\r\n (entity[\"credentialType\"] === CredentialType.ACCESS_TOKEN ||\r\n entity[\"credentialType\"] ===\r\n CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME));\r\n}\r\n/**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\nfunction isIdTokenEntity(entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (isCredentialEntity(entity) &&\r\n entity.hasOwnProperty(\"realm\") &&\r\n entity[\"credentialType\"] === CredentialType.ID_TOKEN);\r\n}\r\n/**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\nfunction isRefreshTokenEntity(entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (isCredentialEntity(entity) &&\r\n entity[\"credentialType\"] === CredentialType.REFRESH_TOKEN);\r\n}\r\n/**\r\n * Generate Account Id key component as per the schema: -\r\n */\r\nfunction generateAccountId(credentialEntity) {\r\n const accountId = [\r\n credentialEntity.homeAccountId,\r\n credentialEntity.environment,\r\n ];\r\n return accountId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n}\r\n/**\r\n * Generate Credential Id key component as per the schema: --\r\n */\r\nfunction generateCredentialId(credentialEntity) {\r\n const clientOrFamilyId = credentialEntity.credentialType === CredentialType.REFRESH_TOKEN\r\n ? credentialEntity.familyId || credentialEntity.clientId\r\n : credentialEntity.clientId;\r\n const credentialId = [\r\n credentialEntity.credentialType,\r\n clientOrFamilyId,\r\n credentialEntity.realm || \"\",\r\n ];\r\n return credentialId.join(Separators.CACHE_KEY_SEPARATOR).toLowerCase();\r\n}\r\n/**\r\n * Generate target key component as per schema: \r\n */\r\nfunction generateTarget(credentialEntity) {\r\n return (credentialEntity.target || \"\").toLowerCase();\r\n}\r\n/**\r\n * Generate requested claims key component as per schema: \r\n */\r\nfunction generateClaimsHash(credentialEntity) {\r\n return (credentialEntity.requestedClaimsHash || \"\").toLowerCase();\r\n}\r\n/**\r\n * Generate scheme key componenet as per schema: \r\n */\r\nfunction generateScheme(credentialEntity) {\r\n /*\r\n * PoP Tokens and SSH certs include scheme in cache key\r\n * Cast to lowercase to handle \"bearer\" from ADFS\r\n */\r\n return credentialEntity.tokenType &&\r\n credentialEntity.tokenType.toLowerCase() !==\r\n AuthenticationScheme.BEARER.toLowerCase()\r\n ? credentialEntity.tokenType.toLowerCase()\r\n : \"\";\r\n}\r\n/**\r\n * validates if a given cache entry is \"Telemetry\", parses \r\n * @param key\r\n * @param entity\r\n */\r\nfunction isServerTelemetryEntity(key, entity) {\r\n const validateKey = key.indexOf(SERVER_TELEM_CONSTANTS.CACHE_KEY) === 0;\r\n let validateEntity = true;\r\n if (entity) {\r\n validateEntity =\r\n entity.hasOwnProperty(\"failedRequests\") &&\r\n entity.hasOwnProperty(\"errors\") &&\r\n entity.hasOwnProperty(\"cacheHits\");\r\n }\r\n return validateKey && validateEntity;\r\n}\r\n/**\r\n * validates if a given cache entry is \"Throttling\", parses \r\n * @param key\r\n * @param entity\r\n */\r\nfunction isThrottlingEntity(key, entity) {\r\n let validateKey = false;\r\n if (key) {\r\n validateKey = key.indexOf(ThrottlingConstants.THROTTLING_PREFIX) === 0;\r\n }\r\n let validateEntity = true;\r\n if (entity) {\r\n validateEntity = entity.hasOwnProperty(\"throttleTime\");\r\n }\r\n return validateKey && validateEntity;\r\n}\r\n/**\r\n * Generate AppMetadata Cache Key as per the schema: appmetadata--\r\n */\r\nfunction generateAppMetadataKey({ environment, clientId, }) {\r\n const appMetaDataKeyArray = [\r\n APP_METADATA,\r\n environment,\r\n clientId,\r\n ];\r\n return appMetaDataKeyArray\r\n .join(Separators.CACHE_KEY_SEPARATOR)\r\n .toLowerCase();\r\n}\r\n/*\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\nfunction isAppMetadataEntity(key, entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (key.indexOf(APP_METADATA) === 0 &&\r\n entity.hasOwnProperty(\"clientId\") &&\r\n entity.hasOwnProperty(\"environment\"));\r\n}\r\n/**\r\n * Validates an entity: checks for all expected params\r\n * @param entity\r\n */\r\nfunction isAuthorityMetadataEntity(key, entity) {\r\n if (!entity) {\r\n return false;\r\n }\r\n return (key.indexOf(AUTHORITY_METADATA_CONSTANTS.CACHE_KEY) === 0 &&\r\n entity.hasOwnProperty(\"aliases\") &&\r\n entity.hasOwnProperty(\"preferred_cache\") &&\r\n entity.hasOwnProperty(\"preferred_network\") &&\r\n entity.hasOwnProperty(\"canonical_authority\") &&\r\n entity.hasOwnProperty(\"authorization_endpoint\") &&\r\n entity.hasOwnProperty(\"token_endpoint\") &&\r\n entity.hasOwnProperty(\"issuer\") &&\r\n entity.hasOwnProperty(\"aliasesFromNetwork\") &&\r\n entity.hasOwnProperty(\"endpointsFromNetwork\") &&\r\n entity.hasOwnProperty(\"expiresAt\") &&\r\n entity.hasOwnProperty(\"jwks_uri\"));\r\n}\r\n/**\r\n * Reset the exiresAt value\r\n */\r\nfunction generateAuthorityMetadataExpiresAt() {\r\n return (nowSeconds() +\r\n AUTHORITY_METADATA_CONSTANTS.REFRESH_TIME_SECONDS);\r\n}\r\nfunction updateAuthorityEndpointMetadata(authorityMetadata, updatedValues, fromNetwork) {\r\n authorityMetadata.authorization_endpoint =\r\n updatedValues.authorization_endpoint;\r\n authorityMetadata.token_endpoint = updatedValues.token_endpoint;\r\n authorityMetadata.end_session_endpoint = updatedValues.end_session_endpoint;\r\n authorityMetadata.issuer = updatedValues.issuer;\r\n authorityMetadata.endpointsFromNetwork = fromNetwork;\r\n authorityMetadata.jwks_uri = updatedValues.jwks_uri;\r\n}\r\nfunction updateCloudDiscoveryMetadata(authorityMetadata, updatedValues, fromNetwork) {\r\n authorityMetadata.aliases = updatedValues.aliases;\r\n authorityMetadata.preferred_cache = updatedValues.preferred_cache;\r\n authorityMetadata.preferred_network = updatedValues.preferred_network;\r\n authorityMetadata.aliasesFromNetwork = fromNetwork;\r\n}\r\n/**\r\n * Returns whether or not the data needs to be refreshed\r\n */\r\nfunction isAuthorityMetadataExpired(metadata) {\r\n return metadata.expiresAt <= nowSeconds();\r\n}\n\nexport { createAccessTokenEntity, createIdTokenEntity, createRefreshTokenEntity, generateAppMetadataKey, generateAuthorityMetadataExpiresAt, generateCredentialKey, isAccessTokenEntity, isAppMetadataEntity, isAuthorityMetadataEntity, isAuthorityMetadataExpired, isCredentialEntity, isIdTokenEntity, isRefreshTokenEntity, isServerTelemetryEntity, isThrottlingEntity, updateAuthorityEndpointMetadata, updateCloudDiscoveryMetadata };\n//# sourceMappingURL=CacheHelpers.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { BaseClient } from './BaseClient.mjs';\nimport { RequestParameterBuilder } from '../request/RequestParameterBuilder.mjs';\nimport { Separators, GrantType, AuthenticationScheme, PromptValue, HeaderNames } from '../utils/Constants.mjs';\nimport { CLIENT_ID, RETURN_SPA_CODE } from '../constants/AADServerParamKeys.mjs';\nimport { isOidcProtocolMode } from '../config/ClientConfiguration.mjs';\nimport { ResponseHandler } from '../response/ResponseHandler.mjs';\nimport { StringUtils } from '../utils/StringUtils.mjs';\nimport { createClientAuthError } from '../error/ClientAuthError.mjs';\nimport { UrlString } from '../url/UrlString.mjs';\nimport { PopTokenGenerator } from '../crypto/PopTokenGenerator.mjs';\nimport { nowSeconds } from '../utils/TimeUtils.mjs';\nimport { buildClientInfo, buildClientInfoFromHomeAccountId } from '../account/ClientInfo.mjs';\nimport { CcsCredentialType } from '../account/CcsCredential.mjs';\nimport { createClientConfigurationError } from '../error/ClientConfigurationError.mjs';\nimport { RequestValidator } from '../request/RequestValidator.mjs';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.mjs';\nimport { invokeAsync } from '../utils/FunctionWrappers.mjs';\nimport { getClientAssertion } from '../utils/ClientAssertionUtils.mjs';\nimport { requestCannotBeMade, authorizationCodeMissingFromServerResponse } from '../error/ClientAuthErrorCodes.mjs';\nimport { logoutRequestEmpty, missingSshJwk } from '../error/ClientConfigurationErrorCodes.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Oauth2.0 Authorization Code client\r\n * @internal\r\n */\r\nclass AuthorizationCodeClient extends BaseClient {\r\n constructor(configuration, performanceClient) {\r\n super(configuration, performanceClient);\r\n // Flag to indicate if client is for hybrid spa auth code redemption\r\n this.includeRedirectUri = true;\r\n this.oidcDefaultScopes =\r\n this.config.authOptions.authority.options.OIDCOptions?.defaultScopes;\r\n }\r\n /**\r\n * Creates the URL of the authorization request letting the user input credentials and consent to the\r\n * application. The URL target the /authorize endpoint of the authority configured in the\r\n * application object.\r\n *\r\n * Once the user inputs their credentials and consents, the authority will send a response to the redirect URI\r\n * sent in the request and should contain an authorization code, which can then be used to acquire tokens via\r\n * acquireToken(AuthorizationCodeRequest)\r\n * @param request\r\n */\r\n async getAuthCodeUrl(request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.GetAuthCodeUrl, request.correlationId);\r\n const queryString = await invokeAsync(this.createAuthCodeUrlQueryString.bind(this), PerformanceEvents.AuthClientCreateQueryString, this.logger, this.performanceClient, request.correlationId)(request);\r\n return UrlString.appendQueryString(this.authority.authorizationEndpoint, queryString);\r\n }\r\n /**\r\n * API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the\r\n * authorization_code_grant\r\n * @param request\r\n */\r\n async acquireToken(request, authCodePayload) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientAcquireToken, request.correlationId);\r\n if (!request.code) {\r\n throw createClientAuthError(requestCannotBeMade);\r\n }\r\n const reqTimestamp = nowSeconds();\r\n const response = await invokeAsync(this.executeTokenRequest.bind(this), PerformanceEvents.AuthClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(this.authority, request);\r\n // Retrieve requestId from response headers\r\n const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];\r\n const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin, this.performanceClient);\r\n // Validate response. This function throws a server error if an error is returned by the server.\r\n responseHandler.validateTokenResponse(response.body);\r\n return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), PerformanceEvents.HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, authCodePayload, undefined, undefined, undefined, requestId);\r\n }\r\n /**\r\n * Handles the hash fragment response from public client code request. Returns a code response used by\r\n * the client to exchange for a token in acquireToken.\r\n * @param hashFragment\r\n */\r\n handleFragmentResponse(serverParams, cachedState) {\r\n // Handle responses.\r\n const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, null, null);\r\n // Get code response\r\n responseHandler.validateServerAuthorizationCodeResponse(serverParams, cachedState);\r\n // throw when there is no auth code in the response\r\n if (!serverParams.code) {\r\n throw createClientAuthError(authorizationCodeMissingFromServerResponse);\r\n }\r\n return serverParams;\r\n }\r\n /**\r\n * Used to log out the current user, and redirect the user to the postLogoutRedirectUri.\r\n * Default behaviour is to redirect the user to `window.location.href`.\r\n * @param authorityUri\r\n */\r\n getLogoutUri(logoutRequest) {\r\n // Throw error if logoutRequest is null/undefined\r\n if (!logoutRequest) {\r\n throw createClientConfigurationError(logoutRequestEmpty);\r\n }\r\n const queryString = this.createLogoutUrlQueryString(logoutRequest);\r\n // Construct logout URI\r\n return UrlString.appendQueryString(this.authority.endSessionEndpoint, queryString);\r\n }\r\n /**\r\n * Executes POST request to token endpoint\r\n * @param authority\r\n * @param request\r\n */\r\n async executeTokenRequest(authority, request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientExecuteTokenRequest, request.correlationId);\r\n const queryParametersString = this.createTokenQueryParameters(request);\r\n const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);\r\n const requestBody = await invokeAsync(this.createTokenRequestBody.bind(this), PerformanceEvents.AuthClientCreateTokenRequestBody, this.logger, this.performanceClient, request.correlationId)(request);\r\n let ccsCredential = undefined;\r\n if (request.clientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils.base64Decode);\r\n ccsCredential = {\r\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID,\r\n };\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\r\n }\r\n }\r\n const headers = this.createTokenRequestHeaders(ccsCredential || request.ccsCredential);\r\n const thumbprint = {\r\n clientId: request.tokenBodyParameters?.clientId ||\r\n this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid,\r\n };\r\n return invokeAsync(this.executePostToTokenEndpoint.bind(this), PerformanceEvents.AuthorizationCodeClientExecutePostToTokenEndpoint, this.logger, this.performanceClient, request.correlationId)(endpoint, requestBody, headers, thumbprint, request.correlationId, PerformanceEvents.AuthorizationCodeClientExecutePostToTokenEndpoint);\r\n }\r\n /**\r\n * Generates a map for all the params to be sent to the service\r\n * @param request\r\n */\r\n async createTokenRequestBody(request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateTokenRequestBody, request.correlationId);\r\n const parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(request.tokenBodyParameters?.[CLIENT_ID] ||\r\n this.config.authOptions.clientId);\r\n /*\r\n * For hybrid spa flow, there will be a code but no verifier\r\n * In this scenario, don't include redirect uri as auth code will not be bound to redirect URI\r\n */\r\n if (!this.includeRedirectUri) {\r\n // Just validate\r\n RequestValidator.validateRedirectUri(request.redirectUri);\r\n }\r\n else {\r\n // Validate and include redirect uri\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n }\r\n // Add scope array, parameter builder will add default scopes and dedupe\r\n parameterBuilder.addScopes(request.scopes, true, this.oidcDefaultScopes);\r\n // add code: user set, not validated\r\n parameterBuilder.addAuthorizationCode(request.code);\r\n // Add library metadata\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n if (this.serverTelemetryManager && !isOidcProtocolMode(this.config)) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n // add code_verifier if passed\r\n if (request.codeVerifier) {\r\n parameterBuilder.addCodeVerifier(request.codeVerifier);\r\n }\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n parameterBuilder.addGrantType(GrantType.AUTHORIZATION_CODE_GRANT);\r\n parameterBuilder.addClientInfo();\r\n if (request.authenticationScheme === AuthenticationScheme.POP) {\r\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);\r\n let reqCnfData;\r\n if (!request.popKid) {\r\n const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);\r\n reqCnfData = generatedReqCnfData.reqCnfString;\r\n }\r\n else {\r\n reqCnfData = this.cryptoUtils.encodeKid(request.popKid);\r\n }\r\n // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)\r\n parameterBuilder.addPopToken(reqCnfData);\r\n }\r\n else if (request.authenticationScheme === AuthenticationScheme.SSH) {\r\n if (request.sshJwk) {\r\n parameterBuilder.addSshJwk(request.sshJwk);\r\n }\r\n else {\r\n throw createClientConfigurationError(missingSshJwk);\r\n }\r\n }\r\n const correlationId = request.correlationId ||\r\n this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n if (!StringUtils.isEmptyObj(request.claims) ||\r\n (this.config.authOptions.clientCapabilities &&\r\n this.config.authOptions.clientCapabilities.length > 0)) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n let ccsCred = undefined;\r\n if (request.clientInfo) {\r\n try {\r\n const clientInfo = buildClientInfo(request.clientInfo, this.cryptoUtils.base64Decode);\r\n ccsCred = {\r\n credential: `${clientInfo.uid}${Separators.CLIENT_INFO_SEPARATOR}${clientInfo.utid}`,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID,\r\n };\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse client info for CCS Header: \" + e);\r\n }\r\n }\r\n else {\r\n ccsCred = request.ccsCredential;\r\n }\r\n // Adds these as parameters in the request instead of headers to prevent CORS preflight request\r\n if (this.config.systemOptions.preventCorsPreflight && ccsCred) {\r\n switch (ccsCred.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" +\r\n e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n parameterBuilder.addCcsUpn(ccsCred.credential);\r\n break;\r\n }\r\n }\r\n if (request.tokenBodyParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);\r\n }\r\n // Add hybrid spa parameters if not already provided\r\n if (request.enableSpaAuthorizationCode &&\r\n (!request.tokenBodyParameters ||\r\n !request.tokenBodyParameters[RETURN_SPA_CODE])) {\r\n parameterBuilder.addExtraQueryParameters({\r\n [RETURN_SPA_CODE]: \"1\",\r\n });\r\n }\r\n return parameterBuilder.createQueryString();\r\n }\r\n /**\r\n * This API validates the `AuthorizationCodeUrlRequest` and creates a URL\r\n * @param request\r\n */\r\n async createAuthCodeUrlQueryString(request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.AuthClientCreateQueryString, request.correlationId);\r\n const parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(request.extraQueryParameters?.[CLIENT_ID] ||\r\n this.config.authOptions.clientId);\r\n const requestScopes = [\r\n ...(request.scopes || []),\r\n ...(request.extraScopesToConsent || []),\r\n ];\r\n parameterBuilder.addScopes(requestScopes, true, this.oidcDefaultScopes);\r\n // validate the redirectUri (to be a non null value)\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n // generate the correlationId if not set by the user and add\r\n const correlationId = request.correlationId ||\r\n this.config.cryptoInterface.createNewGuid();\r\n parameterBuilder.addCorrelationId(correlationId);\r\n // add response_mode. If not passed in it defaults to query.\r\n parameterBuilder.addResponseMode(request.responseMode);\r\n // add response_type = code\r\n parameterBuilder.addResponseTypeCode();\r\n // add library info parameters\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n if (!isOidcProtocolMode(this.config)) {\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n }\r\n // add client_info=1\r\n parameterBuilder.addClientInfo();\r\n if (request.codeChallenge && request.codeChallengeMethod) {\r\n parameterBuilder.addCodeChallengeParams(request.codeChallenge, request.codeChallengeMethod);\r\n }\r\n if (request.prompt) {\r\n parameterBuilder.addPrompt(request.prompt);\r\n }\r\n if (request.domainHint) {\r\n parameterBuilder.addDomainHint(request.domainHint);\r\n }\r\n // Add sid or loginHint with preference for login_hint claim (in request) -> sid -> loginHint (upn/email) -> username of AccountInfo object\r\n if (request.prompt !== PromptValue.SELECT_ACCOUNT) {\r\n // AAD will throw if prompt=select_account is passed with an account hint\r\n if (request.sid && request.prompt === PromptValue.NONE) {\r\n // SessionID is only used in silent calls\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from request\");\r\n parameterBuilder.addSid(request.sid);\r\n }\r\n else if (request.account) {\r\n const accountSid = this.extractAccountSid(request.account);\r\n let accountLoginHintClaim = this.extractLoginHint(request.account);\r\n if (accountLoginHintClaim && request.domainHint) {\r\n this.logger.warning(`AuthorizationCodeClient.createAuthCodeUrlQueryString: \"domainHint\" param is set, skipping opaque \"login_hint\" claim. Please consider not passing domainHint`);\r\n accountLoginHintClaim = null;\r\n }\r\n // If login_hint claim is present, use it over sid/username\r\n if (accountLoginHintClaim) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: login_hint claim present on account\");\r\n parameterBuilder.addLoginHint(accountLoginHintClaim);\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n }\r\n else if (accountSid && request.prompt === PromptValue.NONE) {\r\n /*\r\n * If account and loginHint are provided, we will check account first for sid before adding loginHint\r\n * SessionId is only used in silent calls\r\n */\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is none, adding sid from account\");\r\n parameterBuilder.addSid(accountSid);\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n }\r\n else if (request.loginHint) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from request\");\r\n parameterBuilder.addLoginHint(request.loginHint);\r\n parameterBuilder.addCcsUpn(request.loginHint);\r\n }\r\n else if (request.account.username) {\r\n // Fallback to account username if provided\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Adding login_hint from account\");\r\n parameterBuilder.addLoginHint(request.account.username);\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.account.homeAccountId);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Could not parse home account ID for CCS Header\");\r\n }\r\n }\r\n }\r\n else if (request.loginHint) {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: No account, adding login_hint from request\");\r\n parameterBuilder.addLoginHint(request.loginHint);\r\n parameterBuilder.addCcsUpn(request.loginHint);\r\n }\r\n }\r\n else {\r\n this.logger.verbose(\"createAuthCodeUrlQueryString: Prompt is select_account, ignoring account hints\");\r\n }\r\n if (request.nonce) {\r\n parameterBuilder.addNonce(request.nonce);\r\n }\r\n if (request.state) {\r\n parameterBuilder.addState(request.state);\r\n }\r\n if (request.claims ||\r\n (this.config.authOptions.clientCapabilities &&\r\n this.config.authOptions.clientCapabilities.length > 0)) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n if (request.extraQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\r\n }\r\n if (request.nativeBroker) {\r\n // signal ests that this is a WAM call\r\n parameterBuilder.addNativeBroker();\r\n // pass the req_cnf for POP\r\n if (request.authenticationScheme === AuthenticationScheme.POP) {\r\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils);\r\n // req_cnf is always sent as a string for SPAs\r\n let reqCnfData;\r\n if (!request.popKid) {\r\n const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);\r\n reqCnfData = generatedReqCnfData.reqCnfString;\r\n }\r\n else {\r\n reqCnfData = this.cryptoUtils.encodeKid(request.popKid);\r\n }\r\n parameterBuilder.addPopToken(reqCnfData);\r\n }\r\n }\r\n return parameterBuilder.createQueryString();\r\n }\r\n /**\r\n * This API validates the `EndSessionRequest` and creates a URL\r\n * @param request\r\n */\r\n createLogoutUrlQueryString(request) {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n if (request.postLogoutRedirectUri) {\r\n parameterBuilder.addPostLogoutRedirectUri(request.postLogoutRedirectUri);\r\n }\r\n if (request.correlationId) {\r\n parameterBuilder.addCorrelationId(request.correlationId);\r\n }\r\n if (request.idTokenHint) {\r\n parameterBuilder.addIdTokenHint(request.idTokenHint);\r\n }\r\n if (request.state) {\r\n parameterBuilder.addState(request.state);\r\n }\r\n if (request.logoutHint) {\r\n parameterBuilder.addLogoutHint(request.logoutHint);\r\n }\r\n if (request.extraQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.extraQueryParameters);\r\n }\r\n return parameterBuilder.createQueryString();\r\n }\r\n /**\r\n * Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.\r\n * @param account\r\n */\r\n extractAccountSid(account) {\r\n return account.idTokenClaims?.sid || null;\r\n }\r\n extractLoginHint(account) {\r\n return account.idTokenClaims?.login_hint || null;\r\n }\r\n}\n\nexport { AuthorizationCodeClient };\n//# sourceMappingURL=AuthorizationCodeClient.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { buildClientConfiguration } from '../config/ClientConfiguration.mjs';\nimport { NetworkManager } from '../network/NetworkManager.mjs';\nimport { Logger } from '../logger/Logger.mjs';\nimport { HeaderNames, Constants } from '../utils/Constants.mjs';\nimport { name, version } from '../packageMetadata.mjs';\nimport { CcsCredentialType } from '../account/CcsCredential.mjs';\nimport { buildClientInfoFromHomeAccountId } from '../account/ClientInfo.mjs';\nimport { RequestParameterBuilder } from '../request/RequestParameterBuilder.mjs';\nimport { createDiscoveredInstance } from '../authority/AuthorityFactory.mjs';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/**\r\n * Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.\r\n * @internal\r\n */\r\nclass BaseClient {\r\n constructor(configuration, performanceClient) {\r\n // Set the configuration\r\n this.config = buildClientConfiguration(configuration);\r\n // Initialize the logger\r\n this.logger = new Logger(this.config.loggerOptions, name, version);\r\n // Initialize crypto\r\n this.cryptoUtils = this.config.cryptoInterface;\r\n // Initialize storage interface\r\n this.cacheManager = this.config.storageInterface;\r\n // Set the network interface\r\n this.networkClient = this.config.networkInterface;\r\n // Set the NetworkManager\r\n this.networkManager = new NetworkManager(this.networkClient, this.cacheManager);\r\n // Set TelemetryManager\r\n this.serverTelemetryManager = this.config.serverTelemetryManager;\r\n // set Authority\r\n this.authority = this.config.authOptions.authority;\r\n // set performance telemetry client\r\n this.performanceClient = performanceClient;\r\n }\r\n /**\r\n * Creates default headers for requests to token endpoint\r\n */\r\n createTokenRequestHeaders(ccsCred) {\r\n const headers = {};\r\n headers[HeaderNames.CONTENT_TYPE] = Constants.URL_FORM_CONTENT_TYPE;\r\n if (!this.config.systemOptions.preventCorsPreflight && ccsCred) {\r\n switch (ccsCred.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(ccsCred.credential);\r\n headers[HeaderNames.CCS_HEADER] = `Oid:${clientInfo.uid}@${clientInfo.utid}`;\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" +\r\n e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n headers[HeaderNames.CCS_HEADER] = `UPN: ${ccsCred.credential}`;\r\n break;\r\n }\r\n }\r\n return headers;\r\n }\r\n /**\r\n * Http post to token endpoint\r\n * @param tokenEndpoint\r\n * @param queryString\r\n * @param headers\r\n * @param thumbprint\r\n */\r\n async executePostToTokenEndpoint(tokenEndpoint, queryString, headers, thumbprint, correlationId, queuedEvent) {\r\n if (queuedEvent) {\r\n this.performanceClient?.addQueueMeasurement(queuedEvent, correlationId);\r\n }\r\n const response = await this.networkManager.sendPostRequest(thumbprint, tokenEndpoint, { body: queryString, headers: headers });\r\n this.performanceClient?.addFields({\r\n refreshTokenSize: response.body.refresh_token?.length || 0,\r\n httpVerToken: response.headers?.[HeaderNames.X_MS_HTTP_VERSION] || \"\",\r\n }, correlationId);\r\n if (this.config.serverTelemetryManager &&\r\n response.status < 500 &&\r\n response.status !== 429) {\r\n // Telemetry data successfully logged by server, clear Telemetry cache\r\n this.config.serverTelemetryManager.clearTelemetryCache();\r\n }\r\n return response;\r\n }\r\n /**\r\n * Updates the authority object of the client. Endpoint discovery must be completed.\r\n * @param updatedAuthority\r\n */\r\n async updateAuthority(cloudInstanceHostname, correlationId) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.UpdateTokenEndpointAuthority, correlationId);\r\n const cloudInstanceAuthorityUri = `https://${cloudInstanceHostname}/${this.authority.tenant}/`;\r\n const cloudInstanceAuthority = await createDiscoveredInstance(cloudInstanceAuthorityUri, this.networkClient, this.cacheManager, this.authority.options, this.logger, correlationId, this.performanceClient);\r\n this.authority = cloudInstanceAuthority;\r\n }\r\n /**\r\n * Creates query string for the /token request\r\n * @param request\r\n */\r\n createTokenQueryParameters(request) {\r\n const parameterBuilder = new RequestParameterBuilder();\r\n if (request.tokenQueryParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenQueryParameters);\r\n }\r\n return parameterBuilder.createQueryString();\r\n }\r\n}\n\nexport { BaseClient };\n//# sourceMappingURL=BaseClient.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { isOidcProtocolMode } from '../config/ClientConfiguration.mjs';\nimport { BaseClient } from './BaseClient.mjs';\nimport { RequestParameterBuilder } from '../request/RequestParameterBuilder.mjs';\nimport { GrantType, AuthenticationScheme, HeaderNames, Errors } from '../utils/Constants.mjs';\nimport { CLIENT_ID } from '../constants/AADServerParamKeys.mjs';\nimport { ResponseHandler } from '../response/ResponseHandler.mjs';\nimport { PopTokenGenerator } from '../crypto/PopTokenGenerator.mjs';\nimport { StringUtils } from '../utils/StringUtils.mjs';\nimport { createClientConfigurationError } from '../error/ClientConfigurationError.mjs';\nimport { createClientAuthError } from '../error/ClientAuthError.mjs';\nimport { ServerError } from '../error/ServerError.mjs';\nimport { nowSeconds, isTokenExpired } from '../utils/TimeUtils.mjs';\nimport { UrlString } from '../url/UrlString.mjs';\nimport { CcsCredentialType } from '../account/CcsCredential.mjs';\nimport { buildClientInfoFromHomeAccountId } from '../account/ClientInfo.mjs';\nimport { createInteractionRequiredAuthError, InteractionRequiredAuthError } from '../error/InteractionRequiredAuthError.mjs';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.mjs';\nimport { invokeAsync, invoke } from '../utils/FunctionWrappers.mjs';\nimport { generateCredentialKey } from '../cache/utils/CacheHelpers.mjs';\nimport { getClientAssertion } from '../utils/ClientAssertionUtils.mjs';\nimport { tokenRequestEmpty, missingSshJwk } from '../error/ClientConfigurationErrorCodes.mjs';\nimport { noAccountInSilentRequest } from '../error/ClientAuthErrorCodes.mjs';\nimport { noTokensFound, refreshTokenExpired, badToken } from '../error/InteractionRequiredAuthErrorCodes.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nconst DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS = 300; // 5 Minutes\r\n/**\r\n * OAuth2.0 refresh token client\r\n * @internal\r\n */\r\nclass RefreshTokenClient extends BaseClient {\r\n constructor(configuration, performanceClient) {\r\n super(configuration, performanceClient);\r\n }\r\n async acquireToken(request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireToken, request.correlationId);\r\n const reqTimestamp = nowSeconds();\r\n const response = await invokeAsync(this.executeTokenRequest.bind(this), PerformanceEvents.RefreshTokenClientExecuteTokenRequest, this.logger, this.performanceClient, request.correlationId)(request, this.authority);\r\n // Retrieve requestId from response headers\r\n const requestId = response.headers?.[HeaderNames.X_MS_REQUEST_ID];\r\n const responseHandler = new ResponseHandler(this.config.authOptions.clientId, this.cacheManager, this.cryptoUtils, this.logger, this.config.serializableCache, this.config.persistencePlugin);\r\n responseHandler.validateTokenResponse(response.body);\r\n return invokeAsync(responseHandler.handleServerTokenResponse.bind(responseHandler), PerformanceEvents.HandleServerTokenResponse, this.logger, this.performanceClient, request.correlationId)(response.body, this.authority, reqTimestamp, request, undefined, undefined, true, request.forceCache, requestId);\r\n }\r\n /**\r\n * Gets cached refresh token and attaches to request, then calls acquireToken API\r\n * @param request\r\n */\r\n async acquireTokenByRefreshToken(request) {\r\n // Cannot renew token if no request object is given.\r\n if (!request) {\r\n throw createClientConfigurationError(tokenRequestEmpty);\r\n }\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, request.correlationId);\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw createClientAuthError(noAccountInSilentRequest);\r\n }\r\n // try checking if FOCI is enabled for the given application\r\n const isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment);\r\n // if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest\r\n if (isFOCI) {\r\n try {\r\n return await invokeAsync(this.acquireTokenWithCachedRefreshToken.bind(this), PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, this.logger, this.performanceClient, request.correlationId)(request, true);\r\n }\r\n catch (e) {\r\n const noFamilyRTInCache = e instanceof InteractionRequiredAuthError &&\r\n e.errorCode ===\r\n noTokensFound;\r\n const clientMismatchErrorWithFamilyRT = e instanceof ServerError &&\r\n e.errorCode === Errors.INVALID_GRANT_ERROR &&\r\n e.subError === Errors.CLIENT_MISMATCH_ERROR;\r\n // if family Refresh Token (FRT) cache acquisition fails or if client_mismatch error is seen with FRT, reattempt with application Refresh Token (ART)\r\n if (noFamilyRTInCache || clientMismatchErrorWithFamilyRT) {\r\n return invokeAsync(this.acquireTokenWithCachedRefreshToken.bind(this), PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, this.logger, this.performanceClient, request.correlationId)(request, false);\r\n // throw in all other cases\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n }\r\n // fall back to application refresh token acquisition\r\n return invokeAsync(this.acquireTokenWithCachedRefreshToken.bind(this), PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, this.logger, this.performanceClient, request.correlationId)(request, false);\r\n }\r\n /**\r\n * makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached\r\n * @param request\r\n */\r\n async acquireTokenWithCachedRefreshToken(request, foci) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientAcquireTokenWithCachedRefreshToken, request.correlationId);\r\n // fetches family RT or application RT based on FOCI value\r\n const refreshToken = invoke(this.cacheManager.getRefreshToken.bind(this.cacheManager), PerformanceEvents.CacheManagerGetRefreshToken, this.logger, this.performanceClient, request.correlationId)(request.account, foci, undefined, this.performanceClient, request.correlationId);\r\n if (!refreshToken) {\r\n throw createInteractionRequiredAuthError(noTokensFound);\r\n }\r\n if (refreshToken.expiresOn &&\r\n isTokenExpired(refreshToken.expiresOn, request.refreshTokenExpirationOffsetSeconds ||\r\n DEFAULT_REFRESH_TOKEN_EXPIRATION_OFFSET_SECONDS)) {\r\n throw createInteractionRequiredAuthError(refreshTokenExpired);\r\n }\r\n // attach cached RT size to the current measurement\r\n const refreshTokenRequest = {\r\n ...request,\r\n refreshToken: refreshToken.secret,\r\n authenticationScheme: request.authenticationScheme || AuthenticationScheme.BEARER,\r\n ccsCredential: {\r\n credential: request.account.homeAccountId,\r\n type: CcsCredentialType.HOME_ACCOUNT_ID,\r\n },\r\n };\r\n try {\r\n return await invokeAsync(this.acquireToken.bind(this), PerformanceEvents.RefreshTokenClientAcquireToken, this.logger, this.performanceClient, request.correlationId)(refreshTokenRequest);\r\n }\r\n catch (e) {\r\n if (e instanceof InteractionRequiredAuthError &&\r\n e.subError === badToken) {\r\n // Remove bad refresh token from cache\r\n this.logger.verbose(\"acquireTokenWithRefreshToken: bad refresh token, removing from cache\");\r\n const badRefreshTokenKey = generateCredentialKey(refreshToken);\r\n this.cacheManager.removeRefreshToken(badRefreshTokenKey);\r\n }\r\n throw e;\r\n }\r\n }\r\n /**\r\n * Constructs the network message and makes a NW call to the underlying secure token service\r\n * @param request\r\n * @param authority\r\n */\r\n async executeTokenRequest(request, authority) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientExecuteTokenRequest, request.correlationId);\r\n const queryParametersString = this.createTokenQueryParameters(request);\r\n const endpoint = UrlString.appendQueryString(authority.tokenEndpoint, queryParametersString);\r\n const requestBody = await invokeAsync(this.createTokenRequestBody.bind(this), PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, this.logger, this.performanceClient, request.correlationId)(request);\r\n const headers = this.createTokenRequestHeaders(request.ccsCredential);\r\n const thumbprint = {\r\n clientId: request.tokenBodyParameters?.clientId ||\r\n this.config.authOptions.clientId,\r\n authority: authority.canonicalAuthority,\r\n scopes: request.scopes,\r\n claims: request.claims,\r\n authenticationScheme: request.authenticationScheme,\r\n resourceRequestMethod: request.resourceRequestMethod,\r\n resourceRequestUri: request.resourceRequestUri,\r\n shrClaims: request.shrClaims,\r\n sshKid: request.sshKid,\r\n };\r\n return invokeAsync(this.executePostToTokenEndpoint.bind(this), PerformanceEvents.RefreshTokenClientExecutePostToTokenEndpoint, this.logger, this.performanceClient, request.correlationId)(endpoint, requestBody, headers, thumbprint, request.correlationId, PerformanceEvents.RefreshTokenClientExecutePostToTokenEndpoint);\r\n }\r\n /**\r\n * Helper function to create the token request body\r\n * @param request\r\n */\r\n async createTokenRequestBody(request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.RefreshTokenClientCreateTokenRequestBody, request.correlationId);\r\n const correlationId = request.correlationId;\r\n const parameterBuilder = new RequestParameterBuilder();\r\n parameterBuilder.addClientId(request.tokenBodyParameters?.[CLIENT_ID] ||\r\n this.config.authOptions.clientId);\r\n if (request.redirectUri) {\r\n parameterBuilder.addRedirectUri(request.redirectUri);\r\n }\r\n parameterBuilder.addScopes(request.scopes, true, this.config.authOptions.authority.options.OIDCOptions?.defaultScopes);\r\n parameterBuilder.addGrantType(GrantType.REFRESH_TOKEN_GRANT);\r\n parameterBuilder.addClientInfo();\r\n parameterBuilder.addLibraryInfo(this.config.libraryInfo);\r\n parameterBuilder.addApplicationTelemetry(this.config.telemetry.application);\r\n parameterBuilder.addThrottling();\r\n if (this.serverTelemetryManager && !isOidcProtocolMode(this.config)) {\r\n parameterBuilder.addServerTelemetry(this.serverTelemetryManager);\r\n }\r\n parameterBuilder.addCorrelationId(correlationId);\r\n parameterBuilder.addRefreshToken(request.refreshToken);\r\n if (this.config.clientCredentials.clientSecret) {\r\n parameterBuilder.addClientSecret(this.config.clientCredentials.clientSecret);\r\n }\r\n if (this.config.clientCredentials.clientAssertion) {\r\n const clientAssertion = this.config.clientCredentials.clientAssertion;\r\n parameterBuilder.addClientAssertion(await getClientAssertion(clientAssertion.assertion, this.config.authOptions.clientId, request.resourceRequestUri));\r\n parameterBuilder.addClientAssertionType(clientAssertion.assertionType);\r\n }\r\n if (request.authenticationScheme === AuthenticationScheme.POP) {\r\n const popTokenGenerator = new PopTokenGenerator(this.cryptoUtils, this.performanceClient);\r\n let reqCnfData;\r\n if (!request.popKid) {\r\n const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(request, this.logger);\r\n reqCnfData = generatedReqCnfData.reqCnfString;\r\n }\r\n else {\r\n reqCnfData = this.cryptoUtils.encodeKid(request.popKid);\r\n }\r\n // SPA PoP requires full Base64Url encoded req_cnf string (unhashed)\r\n parameterBuilder.addPopToken(reqCnfData);\r\n }\r\n else if (request.authenticationScheme === AuthenticationScheme.SSH) {\r\n if (request.sshJwk) {\r\n parameterBuilder.addSshJwk(request.sshJwk);\r\n }\r\n else {\r\n throw createClientConfigurationError(missingSshJwk);\r\n }\r\n }\r\n if (!StringUtils.isEmptyObj(request.claims) ||\r\n (this.config.authOptions.clientCapabilities &&\r\n this.config.authOptions.clientCapabilities.length > 0)) {\r\n parameterBuilder.addClaims(request.claims, this.config.authOptions.clientCapabilities);\r\n }\r\n if (this.config.systemOptions.preventCorsPreflight &&\r\n request.ccsCredential) {\r\n switch (request.ccsCredential.type) {\r\n case CcsCredentialType.HOME_ACCOUNT_ID:\r\n try {\r\n const clientInfo = buildClientInfoFromHomeAccountId(request.ccsCredential.credential);\r\n parameterBuilder.addCcsOid(clientInfo);\r\n }\r\n catch (e) {\r\n this.logger.verbose(\"Could not parse home account ID for CCS Header: \" +\r\n e);\r\n }\r\n break;\r\n case CcsCredentialType.UPN:\r\n parameterBuilder.addCcsUpn(request.ccsCredential.credential);\r\n break;\r\n }\r\n }\r\n if (request.tokenBodyParameters) {\r\n parameterBuilder.addExtraQueryParameters(request.tokenBodyParameters);\r\n }\r\n return parameterBuilder.createQueryString();\r\n }\r\n}\n\nexport { RefreshTokenClient };\n//# sourceMappingURL=RefreshTokenClient.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { BaseClient } from './BaseClient.mjs';\nimport { wasClockTurnedBack, isTokenExpired } from '../utils/TimeUtils.mjs';\nimport { RefreshTokenClient } from './RefreshTokenClient.mjs';\nimport { ClientAuthError, createClientAuthError } from '../error/ClientAuthError.mjs';\nimport { ResponseHandler } from '../response/ResponseHandler.mjs';\nimport { OIDC_DEFAULT_SCOPES, CacheOutcome } from '../utils/Constants.mjs';\nimport { StringUtils } from '../utils/StringUtils.mjs';\nimport { extractTokenClaims, checkMaxAge } from '../account/AuthToken.mjs';\nimport { PerformanceEvents } from '../telemetry/performance/PerformanceEvent.mjs';\nimport { invokeAsync } from '../utils/FunctionWrappers.mjs';\nimport { getTenantFromAuthorityString } from '../authority/Authority.mjs';\nimport { tokenRefreshRequired, noAccountInSilentRequest, authTimeNotFound } from '../error/ClientAuthErrorCodes.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\n/** @internal */\r\nclass SilentFlowClient extends BaseClient {\r\n constructor(configuration, performanceClient) {\r\n super(configuration, performanceClient);\r\n }\r\n /**\r\n * Retrieves a token from cache if it is still valid, or uses the cached refresh token to renew\r\n * the given token and returns the renewed token\r\n * @param request\r\n */\r\n async acquireToken(request) {\r\n try {\r\n const [authResponse, cacheOutcome] = await this.acquireCachedToken({\r\n ...request,\r\n scopes: request.scopes?.length\r\n ? request.scopes\r\n : [...OIDC_DEFAULT_SCOPES],\r\n });\r\n // if the token is not expired but must be refreshed; get a new one in the background\r\n if (cacheOutcome === CacheOutcome.PROACTIVELY_REFRESHED) {\r\n this.logger.info(\"SilentFlowClient:acquireCachedToken - Cached access token's refreshOn property has been exceeded'. It's not expired, but must be refreshed.\");\r\n // refresh the access token in the background\r\n const refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);\r\n refreshTokenClient\r\n .acquireTokenByRefreshToken(request)\r\n .catch(() => {\r\n // do nothing, this is running in the background and no action is to be taken upon success or failure\r\n });\r\n }\r\n // return the cached token\r\n return authResponse;\r\n }\r\n catch (e) {\r\n if (e instanceof ClientAuthError &&\r\n e.errorCode === tokenRefreshRequired) {\r\n const refreshTokenClient = new RefreshTokenClient(this.config, this.performanceClient);\r\n return refreshTokenClient.acquireTokenByRefreshToken(request);\r\n }\r\n else {\r\n throw e;\r\n }\r\n }\r\n }\r\n /**\r\n * Retrieves token from cache or throws an error if it must be refreshed.\r\n * @param request\r\n */\r\n async acquireCachedToken(request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.SilentFlowClientAcquireCachedToken, request.correlationId);\r\n let lastCacheOutcome = CacheOutcome.NOT_APPLICABLE;\r\n if (request.forceRefresh ||\r\n (!this.config.cacheOptions.claimsBasedCachingEnabled &&\r\n !StringUtils.isEmptyObj(request.claims))) {\r\n // Must refresh due to present force_refresh flag.\r\n this.setCacheOutcome(CacheOutcome.FORCE_REFRESH_OR_CLAIMS, request.correlationId);\r\n throw createClientAuthError(tokenRefreshRequired);\r\n }\r\n // We currently do not support silent flow for account === null use cases; This will be revisited for confidential flow usecases\r\n if (!request.account) {\r\n throw createClientAuthError(noAccountInSilentRequest);\r\n }\r\n const requestTenantId = request.account.tenantId ||\r\n getTenantFromAuthorityString(request.authority);\r\n const tokenKeys = this.cacheManager.getTokenKeys();\r\n const cachedAccessToken = this.cacheManager.getAccessToken(request.account, request, tokenKeys, requestTenantId, this.performanceClient, request.correlationId);\r\n if (!cachedAccessToken) {\r\n // must refresh due to non-existent access_token\r\n this.setCacheOutcome(CacheOutcome.NO_CACHED_ACCESS_TOKEN, request.correlationId);\r\n throw createClientAuthError(tokenRefreshRequired);\r\n }\r\n else if (wasClockTurnedBack(cachedAccessToken.cachedAt) ||\r\n isTokenExpired(cachedAccessToken.expiresOn, this.config.systemOptions.tokenRenewalOffsetSeconds)) {\r\n // must refresh due to the expires_in value\r\n this.setCacheOutcome(CacheOutcome.CACHED_ACCESS_TOKEN_EXPIRED, request.correlationId);\r\n throw createClientAuthError(tokenRefreshRequired);\r\n }\r\n else if (cachedAccessToken.refreshOn &&\r\n isTokenExpired(cachedAccessToken.refreshOn, 0)) {\r\n // must refresh (in the background) due to the refresh_in value\r\n lastCacheOutcome = CacheOutcome.PROACTIVELY_REFRESHED;\r\n // don't throw ClientAuthError.createRefreshRequiredError(), return cached token instead\r\n }\r\n const environment = request.authority || this.authority.getPreferredCache();\r\n const cacheRecord = {\r\n account: this.cacheManager.readAccountFromCache(request.account),\r\n accessToken: cachedAccessToken,\r\n idToken: this.cacheManager.getIdToken(request.account, tokenKeys, requestTenantId, this.performanceClient, request.correlationId),\r\n refreshToken: null,\r\n appMetadata: this.cacheManager.readAppMetadataFromCache(environment),\r\n };\r\n this.setCacheOutcome(lastCacheOutcome, request.correlationId);\r\n if (this.config.serverTelemetryManager) {\r\n this.config.serverTelemetryManager.incrementCacheHits();\r\n }\r\n return [\r\n await invokeAsync(this.generateResultFromCacheRecord.bind(this), PerformanceEvents.SilentFlowClientGenerateResultFromCacheRecord, this.logger, this.performanceClient, request.correlationId)(cacheRecord, request),\r\n lastCacheOutcome,\r\n ];\r\n }\r\n setCacheOutcome(cacheOutcome, correlationId) {\r\n this.serverTelemetryManager?.setCacheOutcome(cacheOutcome);\r\n this.performanceClient?.addFields({\r\n cacheOutcome: cacheOutcome,\r\n }, correlationId);\r\n if (cacheOutcome !== CacheOutcome.NOT_APPLICABLE) {\r\n this.logger.info(`Token refresh is required due to cache outcome: ${cacheOutcome}`);\r\n }\r\n }\r\n /**\r\n * Helper function to build response object from the CacheRecord\r\n * @param cacheRecord\r\n */\r\n async generateResultFromCacheRecord(cacheRecord, request) {\r\n this.performanceClient?.addQueueMeasurement(PerformanceEvents.SilentFlowClientGenerateResultFromCacheRecord, request.correlationId);\r\n let idTokenClaims;\r\n if (cacheRecord.idToken) {\r\n idTokenClaims = extractTokenClaims(cacheRecord.idToken.secret, this.config.cryptoInterface.base64Decode);\r\n }\r\n // token max_age check\r\n if (request.maxAge || request.maxAge === 0) {\r\n const authTime = idTokenClaims?.auth_time;\r\n if (!authTime) {\r\n throw createClientAuthError(authTimeNotFound);\r\n }\r\n checkMaxAge(authTime, request.maxAge);\r\n }\r\n return ResponseHandler.generateAuthenticationResult(this.cryptoUtils, this.authority, cacheRecord, true, request, idTokenClaims);\r\n }\r\n}\n\nexport { SilentFlowClient };\n//# sourceMappingURL=SilentFlowClient.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\nimport { DEFAULT_CRYPTO_IMPLEMENTATION } from '../crypto/ICrypto.mjs';\nimport { Logger, LogLevel } from '../logger/Logger.mjs';\nimport { DEFAULT_TOKEN_RENEWAL_OFFSET_SEC, Constants } from '../utils/Constants.mjs';\nimport { version } from '../packageMetadata.mjs';\nimport { AzureCloudInstance } from '../authority/AuthorityOptions.mjs';\nimport { DefaultStorageClass } from '../cache/CacheManager.mjs';\nimport { ProtocolMode } from '../authority/ProtocolMode.mjs';\nimport { createClientAuthError } from '../error/ClientAuthError.mjs';\nimport { methodNotImplemented } from '../error/ClientAuthErrorCodes.mjs';\n\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nconst DEFAULT_SYSTEM_OPTIONS = {\r\n tokenRenewalOffsetSeconds: DEFAULT_TOKEN_RENEWAL_OFFSET_SEC,\r\n preventCorsPreflight: false,\r\n};\r\nconst DEFAULT_LOGGER_IMPLEMENTATION = {\r\n loggerCallback: () => {\r\n // allow users to not set loggerCallback\r\n },\r\n piiLoggingEnabled: false,\r\n logLevel: LogLevel.Info,\r\n correlationId: Constants.EMPTY_STRING,\r\n};\r\nconst DEFAULT_CACHE_OPTIONS = {\r\n claimsBasedCachingEnabled: false,\r\n};\r\nconst DEFAULT_NETWORK_IMPLEMENTATION = {\r\n async sendGetRequestAsync() {\r\n throw createClientAuthError(methodNotImplemented);\r\n },\r\n async sendPostRequestAsync() {\r\n throw createClientAuthError(methodNotImplemented);\r\n },\r\n};\r\nconst DEFAULT_LIBRARY_INFO = {\r\n sku: Constants.SKU,\r\n version: version,\r\n cpu: Constants.EMPTY_STRING,\r\n os: Constants.EMPTY_STRING,\r\n};\r\nconst DEFAULT_CLIENT_CREDENTIALS = {\r\n clientSecret: Constants.EMPTY_STRING,\r\n clientAssertion: undefined,\r\n};\r\nconst DEFAULT_AZURE_CLOUD_OPTIONS = {\r\n azureCloudInstance: AzureCloudInstance.None,\r\n tenant: `${Constants.DEFAULT_COMMON_TENANT}`,\r\n};\r\nconst DEFAULT_TELEMETRY_OPTIONS = {\r\n application: {\r\n appName: \"\",\r\n appVersion: \"\",\r\n },\r\n};\r\n/**\r\n * Function that sets the default options when not explicitly configured from app developer\r\n *\r\n * @param Configuration\r\n *\r\n * @returns Configuration\r\n */\r\nfunction buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, cacheOptions: userCacheOptions, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }) {\r\n const loggerOptions = {\r\n ...DEFAULT_LOGGER_IMPLEMENTATION,\r\n ...userLoggerOption,\r\n };\r\n return {\r\n authOptions: buildAuthOptions(userAuthOptions),\r\n systemOptions: { ...DEFAULT_SYSTEM_OPTIONS, ...userSystemOptions },\r\n loggerOptions: loggerOptions,\r\n cacheOptions: { ...DEFAULT_CACHE_OPTIONS, ...userCacheOptions },\r\n storageInterface: storageImplementation ||\r\n new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions)),\r\n networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,\r\n cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,\r\n clientCredentials: clientCredentials || DEFAULT_CLIENT_CREDENTIALS,\r\n libraryInfo: { ...DEFAULT_LIBRARY_INFO, ...libraryInfo },\r\n telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },\r\n serverTelemetryManager: serverTelemetryManager || null,\r\n persistencePlugin: persistencePlugin || null,\r\n serializableCache: serializableCache || null,\r\n };\r\n}\r\n/**\r\n * Construct authoptions from the client and platform passed values\r\n * @param authOptions\r\n */\r\nfunction buildAuthOptions(authOptions) {\r\n return {\r\n clientCapabilities: [],\r\n azureCloudOptions: DEFAULT_AZURE_CLOUD_OPTIONS,\r\n skipAuthorityMetadataCache: false,\r\n ...authOptions,\r\n };\r\n}\r\n/**\r\n * Returns true if config has protocolMode set to ProtocolMode.OIDC, false otherwise\r\n * @param ClientConfiguration\r\n */\r\nfunction isOidcProtocolMode(config) {\r\n return (config.authOptions.authority.options.protocolMode === ProtocolMode.OIDC);\r\n}\n\nexport { DEFAULT_SYSTEM_OPTIONS, buildClientConfiguration, isOidcProtocolMode };\n//# sourceMappingURL=ClientConfiguration.mjs.map\n","/*! @azure/msal-common v14.14.2 2024-08-28 */\n'use strict';\n/*\r\n * Copyright (c) Microsoft Corporation. All rights reserved.\r\n * Licensed under the MIT License.\r\n */\r\nconst CLIENT_ID = \"client_id\";\r\nconst REDIRECT_URI = \"redirect_uri\";\r\nconst RESPONSE_TYPE = \"response_type\";\r\nconst RESPONSE_MODE = \"response_mode\";\r\nconst GRANT_TYPE = \"grant_type\";\r\nconst CLAIMS = \"claims\";\r\nconst SCOPE = \"scope\";\r\nconst ERROR = \"error\";\r\nconst ERROR_DESCRIPTION = \"error_description\";\r\nconst ACCESS_TOKEN = \"access_token\";\r\nconst ID_TOKEN = \"id_token\";\r\nconst REFRESH_TOKEN = \"refresh_token\";\r\nconst EXPIRES_IN = \"expires_in\";\r\nconst REFRESH_TOKEN_EXPIRES_IN = \"refresh_token_expires_in\";\r\nconst STATE = \"state\";\r\nconst NONCE = \"nonce\";\r\nconst PROMPT = \"prompt\";\r\nconst SESSION_STATE = \"session_state\";\r\nconst CLIENT_INFO = \"client_info\";\r\nconst CODE = \"code\";\r\nconst CODE_CHALLENGE = \"code_challenge\";\r\nconst CODE_CHALLENGE_METHOD = \"code_challenge_method\";\r\nconst CODE_VERIFIER = \"code_verifier\";\r\nconst CLIENT_REQUEST_ID = \"client-request-id\";\r\nconst X_CLIENT_SKU = \"x-client-SKU\";\r\nconst X_CLIENT_VER = \"x-client-VER\";\r\nconst X_CLIENT_OS = \"x-client-OS\";\r\nconst X_CLIENT_CPU = \"x-client-CPU\";\r\nconst X_CLIENT_CURR_TELEM = \"x-client-current-telemetry\";\r\nconst X_CLIENT_LAST_TELEM = \"x-client-last-telemetry\";\r\nconst X_MS_LIB_CAPABILITY = \"x-ms-lib-capability\";\r\nconst X_APP_NAME = \"x-app-name\";\r\nconst X_APP_VER = \"x-app-ver\";\r\nconst POST_LOGOUT_URI = \"post_logout_redirect_uri\";\r\nconst ID_TOKEN_HINT = \"id_token_hint\";\r\nconst DEVICE_CODE = \"device_code\";\r\nconst CLIENT_SECRET = \"client_secret\";\r\nconst CLIENT_ASSERTION = \"client_assertion\";\r\nconst CLIENT_ASSERTION_TYPE = \"client_assertion_type\";\r\nconst TOKEN_TYPE = \"token_type\";\r\nconst REQ_CNF = \"req_cnf\";\r\nconst OBO_ASSERTION = \"assertion\";\r\nconst REQUESTED_TOKEN_USE = \"requested_token_use\";\r\nconst ON_BEHALF_OF = \"on_behalf_of\";\r\nconst FOCI = \"foci\";\r\nconst CCS_HEADER = \"X-AnchorMailbox\";\r\nconst RETURN_SPA_CODE = \"return_spa_code\";\r\nconst NATIVE_BROKER = \"nativebroker\";\r\nconst LOGOUT_HINT = \"logout_hint\";\r\nconst SID = \"sid\";\r\nconst LOGIN_HINT = \"login_hint\";\r\nconst DOMAIN_HINT = \"domain_hint\";\r\nconst X_CLIENT_EXTRA_SKU = \"x-client-xtra-sku\";\n\nexport { ACCESS_TOKEN, CCS_HEADER, CLAIMS, CLIENT_ASSERTION, CLIENT_ASSERTION_TYPE, CLIENT_ID, CLIENT_INFO, CLIENT_REQUEST_ID, CLIENT_SECRET, CODE, CODE_CHALLENGE, CODE_CHALLENGE_METHOD, CODE_VERIFIER, DEVICE_CODE, DOMAIN_HINT, ERROR, ERROR_DESCRIPTION, EXPIRES_IN, FOCI, GRANT_TYPE, ID_TOKEN, ID_TOKEN_HINT, LOGIN_HINT, LOGOUT_HINT, NATIVE_BROKER, NONCE, OBO_ASSERTION, ON_BEHALF_OF, POST_LOGOUT_URI, PROMPT, REDIRECT_URI, REFRESH_TOKEN, REFRESH_TOKEN_EXPIRES_IN, REQUESTED_TOKEN_USE, REQ_CNF, RESPONSE_MODE, RESPONSE_TYPE, RETURN_SPA_CODE, SCOPE, SESSION_STATE, SID, STATE, TOKEN_TYPE, X_APP_NAME, X_APP_VER, X_CLIENT_CPU, X_CLIENT_CURR_TELEM, X_CLIENT_EXTRA_SKU, X_CLIENT_LAST_TELEM, X_CLIENT_OS, X_CLIENT_SKU, X_CLIENT_VER, X_MS_LIB_CAPABILITY };\n//# sourceMappingURL=AADServerParamKeys.mjs.map\n"],"names":["CacheManager","constructor","clientId","cryptoImpl","logger","staticAuthorityOptions","this","commonLogger","clone","getAllAccounts","accountFilter","buildTenantProfiles","getAccountsFilteredBy","getAccountInfoFilteredBy","allAccounts","length","sort","account","idTokenClaims","getBaseAccountInfo","accountEntities","getAccountInfo","cachedAccounts","flatMap","accountEntity","getTenantProfilesFromAccountEntity","tenantId","getTenantedAccountInfoByFilter","accountInfo","tokenKeys","tenantProfile","tenantProfileFilter","tenantedAccountInfo","tenantProfileMatchesFilter","idToken","getIdToken","secret","base64Decode","idTokenClaimsMatchTenantProfileFilter","targetTenantId","searchTenantProfiles","tenantProfiles","Map","getTokenKeys","get","matchingTenantProfiles","forEach","push","localAccountId","matchLocalAccountIdFromTenantProfile","name","undefined","isHomeTenant","matchLocalAccountIdFromTokenClaims","loginHint","matchLoginHintFromTokenClaims","username","matchUsername","preferred_username","matchName","sid","matchSid","async","cacheRecord","storeInCache","correlationId","setAccount","setIdTokenCredential","accessToken","saveAccessToken","refreshToken","setRefreshTokenCredential","appMetadata","setAppMetadata","e","error","Error","errorPii","message","includes","credential","accessTokenFilter","credentialType","environment","homeAccountId","realm","tokenType","requestedClaimsHash","currentScopes","target","removedAccessTokens","key","accessTokenKeyMatchesFilter","tokenEntity","getAccessTokenCredential","credentialMatchesFilter","intersectingScopeSets","removeAccessToken","Promise","all","setAccessTokenCredential","allAccountKeys","getAccountKeys","matchingAccounts","cacheKey","isAccountKey","entity","getAccount","matchHomeAccountId","matchEnvironment","matchRealm","nativeAccountId","matchNativeAccountId","authorityType","matchAuthorityType","filter","split","toLowerCase","isCredentialKey","lowerCaseKey","indexOf","clientIdValidation","familyIdValidation","matchClientId","userAssertionHash","matchUserAssertionHash","matchCredentialType","familyId","matchFamilyId","matchTarget","matchTokenType","keyId","matchKeyId","getAppMetadataFilteredBy","allCacheKeys","getKeys","matchingAppMetadata","isAppMetadata","getAppMetadata","getAuthorityMetadataByAlias","host","getAuthorityMetadataKeys","matchedEntity","isAuthorityMetadata","getAuthorityMetadata","aliases","removedAccounts","removeAccount","accountKey","removeAccountContext","removeItem","allTokenKeys","accountId","generateAccountId","removedCredentials","removeIdToken","removeRefreshToken","updateOutdatedCachedAccount","isSingleTenant","verbose","matchingAccountKeys","startsWith","accountsToMerge","getCachedAccountEntity","baseAccount","find","map","updatedAccount","toObject","newAccountKey","generateAccountKey","removeOutdatedAccount","kid","removeTokenBindingKey","removeAppMetadata","readAccountFromCache","targetRealm","performanceClient","trace","idTokenFilter","idTokenMap","getIdTokensByFilter","numIdTokens","size","info","tokensToBeRemoved","homeIdTokenMap","set","numHomeIdTokens","values","next","value","addFields","multiMatchedID","idTokenKeys","idTokens","idTokenKeyMatchesFilter","getIdTokenCredential","inputKey","getAccessToken","request","scopes","authScheme","authenticationScheme","sshKid","accessTokenKeys","accessTokens","numAccessTokens","multiMatchedAT","keyMustContainAllScopes","asArray","i","getAccessTokensByFilter","getRefreshToken","familyRT","id","refreshTokenFilter","refreshTokenKeys","refreshTokens","refreshTokenKeyMatchesFilter","getRefreshTokenCredential","numRefreshTokens","multiMatchedRT","readAppMetadataFromCache","appMetadataFilter","appMetadataEntries","Object","keys","numAppMetadata","isAppMetadataFOCI","tokenClaims","oid","sub","claims","cachedUsername","filterUsername","staticAliases","cloudMetadata","login_hint","upn","containsScopeSet","generateAuthorityMetadataCacheKey","authority","static","obj","json","propertyName","DefaultStorageClass","setServerTelemetry","getServerTelemetry","setAuthorityMetadata","setThrottlingCache","getThrottlingCache","updateCredentialCacheKey","AccountEntity","join","generateAccountCacheKey","accountInterface","homeTenantId","accountDetails","clientInfo","protocolMode","env","getPreferredCache","utid","uid","preferredUsername","email","emails","cloudGraphHostName","msGraphHost","Array","from","serverClientInfo","authType","cryptoObj","warning","hasOwnProperty","accountA","accountB","compareClaims","claimsMatch","accountAClaims","accountBClaims","iat","nonce","TokenCacheContext","tokenCache","hasChanged","cache","cacheHasChanged","generateCredentialKey","credentialEntity","generateCredentialId","generateTarget","generateClaimsHash","generateScheme","createIdTokenEntity","createAccessTokenEntity","expiresOn","extExpiresOn","refreshOn","requestedClaims","atEntity","cachedAt","toString","extendedExpiresOn","cnf","createRefreshTokenEntity","rtEntity","isCredentialEntity","isAccessTokenEntity","isIdTokenEntity","isRefreshTokenEntity","clientOrFamilyId","isServerTelemetryEntity","validateKey","validateEntity","isThrottlingEntity","generateAppMetadataKey","isAppMetadataEntity","isAuthorityMetadataEntity","generateAuthorityMetadataExpiresAt","updateAuthorityEndpointMetadata","authorityMetadata","updatedValues","fromNetwork","authorization_endpoint","token_endpoint","end_session_endpoint","issuer","endpointsFromNetwork","jwks_uri","updateCloudDiscoveryMetadata","preferred_cache","preferred_network","aliasesFromNetwork","isAuthorityMetadataExpired","metadata","expiresAt","AuthorizationCodeClient","configuration","super","includeRedirectUri","oidcDefaultScopes","config","authOptions","options","OIDCOptions","defaultScopes","addQueueMeasurement","queryString","createAuthCodeUrlQueryString","bind","authorizationEndpoint","authCodePayload","code","reqTimestamp","response","executeTokenRequest","requestId","headers","responseHandler","cacheManager","cryptoUtils","serializableCache","persistencePlugin","validateTokenResponse","body","handleServerTokenResponse","handleFragmentResponse","serverParams","cachedState","validateServerAuthorizationCodeResponse","getLogoutUri","logoutRequest","createLogoutUrlQueryString","endSessionEndpoint","queryParametersString","createTokenQueryParameters","endpoint","tokenEndpoint","requestBody","createTokenRequestBody","ccsCredential","type","createTokenRequestHeaders","thumbprint","tokenBodyParameters","canonicalAuthority","resourceRequestMethod","resourceRequestUri","shrClaims","executePostToTokenEndpoint","parameterBuilder","addClientId","addRedirectUri","redirectUri","addScopes","addAuthorizationCode","addLibraryInfo","libraryInfo","addApplicationTelemetry","telemetry","application","addThrottling","serverTelemetryManager","addServerTelemetry","codeVerifier","addCodeVerifier","clientCredentials","clientSecret","addClientSecret","clientAssertion","addClientAssertion","assertion","addClientAssertionType","assertionType","addGrantType","addClientInfo","popTokenGenerator","reqCnfData","popKid","encodeKid","generateCnf","reqCnfString","addPopToken","sshJwk","addSshJwk","cryptoInterface","createNewGuid","ccsCred","addCorrelationId","clientCapabilities","addClaims","systemOptions","preventCorsPreflight","addCcsOid","addCcsUpn","addExtraQueryParameters","enableSpaAuthorizationCode","createQueryString","extraQueryParameters","requestScopes","extraScopesToConsent","addResponseMode","responseMode","addResponseTypeCode","codeChallenge","codeChallengeMethod","addCodeChallengeParams","prompt","addPrompt","domainHint","addDomainHint","addSid","accountSid","extractAccountSid","accountLoginHintClaim","extractLoginHint","addLoginHint","addNonce","state","addState","nativeBroker","addNativeBroker","postLogoutRedirectUri","addPostLogoutRedirectUri","idTokenHint","addIdTokenHint","logoutHint","addLogoutHint","BaseClient","loggerOptions","storageInterface","networkClient","networkInterface","networkManager","queuedEvent","sendPostRequest","refreshTokenSize","refresh_token","httpVerToken","status","clearTelemetryCache","cloudInstanceHostname","cloudInstanceAuthorityUri","tenant","cloudInstanceAuthority","tokenQueryParameters","RefreshTokenClient","forceCache","acquireTokenWithCachedRefreshToken","noFamilyRTInCache","errorCode","clientMismatchErrorWithFamilyRT","subError","foci","refreshTokenExpirationOffsetSeconds","refreshTokenRequest","acquireToken","badRefreshTokenKey","addRefreshToken","SilentFlowClient","authResponse","cacheOutcome","acquireCachedToken","acquireTokenByRefreshToken","catch","lastCacheOutcome","forceRefresh","cacheOptions","claimsBasedCachingEnabled","setCacheOutcome","requestTenantId","cachedAccessToken","tokenRenewalOffsetSeconds","incrementCacheHits","generateResultFromCacheRecord","maxAge","authTime","auth_time","DEFAULT_SYSTEM_OPTIONS","DEFAULT_LOGGER_IMPLEMENTATION","loggerCallback","piiLoggingEnabled","logLevel","DEFAULT_CACHE_OPTIONS","DEFAULT_NETWORK_IMPLEMENTATION","DEFAULT_LIBRARY_INFO","sku","version","cpu","os","DEFAULT_CLIENT_CREDENTIALS","DEFAULT_AZURE_CLOUD_OPTIONS","azureCloudInstance","DEFAULT_TELEMETRY_OPTIONS","appName","appVersion","buildClientConfiguration","userAuthOptions","userSystemOptions","userLoggerOption","userCacheOptions","storageImplementation","networkImplementation","cryptoImplementation","azureCloudOptions","skipAuthorityMetadataCache","isOidcProtocolMode","CLIENT_ID","REDIRECT_URI","RESPONSE_TYPE","RESPONSE_MODE","GRANT_TYPE","CLAIMS","SCOPE","REFRESH_TOKEN","STATE","NONCE","PROMPT","CODE","CODE_CHALLENGE","CODE_CHALLENGE_METHOD","CODE_VERIFIER","CLIENT_REQUEST_ID","X_CLIENT_SKU","X_CLIENT_VER","X_CLIENT_OS","X_CLIENT_CPU","X_CLIENT_CURR_TELEM","X_CLIENT_LAST_TELEM","X_MS_LIB_CAPABILITY","X_APP_NAME","X_APP_VER","POST_LOGOUT_URI","ID_TOKEN_HINT","DEVICE_CODE","CLIENT_SECRET","CLIENT_ASSERTION","CLIENT_ASSERTION_TYPE","TOKEN_TYPE","REQ_CNF","OBO_ASSERTION","REQUESTED_TOKEN_USE","RETURN_SPA_CODE","NATIVE_BROKER","LOGOUT_HINT","SID","LOGIN_HINT","DOMAIN_HINT","X_CLIENT_EXTRA_SKU"],"sourceRoot":""}