Socket
Socket
Sign inDemoInstall

@azure/msal-common

Package Overview
Dependencies
Maintainers
3
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/msal-common - npm Package Compare versions

Comparing version 11.0.0 to 12.0.0

2

dist/_virtual/_tslib.js

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*! *****************************************************************************

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { ClientAuthError } from '../error/ClientAuthError.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { ClientAuthError } from '../error/ClientAuthError.js';

@@ -60,3 +60,8 @@ /**

auth_time?: number;
/**
* Region of the resource tenant
*/
tenant_region_scope?: string;
tenant_region_sub_scope?: string;
};
//# sourceMappingURL=TokenClaims.d.ts.map

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -1,4 +0,3 @@

import { AccountCache, AccountFilter, CredentialFilter, CredentialCache, ValidCredentialType, AppMetadataFilter, AppMetadataCache } from "./utils/CacheTypes";
import { AccountFilter, CredentialFilter, ValidCredentialType, AppMetadataFilter, AppMetadataCache, TokenKeys } from "./utils/CacheTypes";
import { CacheRecord } from "./entities/CacheRecord";
import { CredentialEntity } from "./entities/CredentialEntity";
import { AccountEntity } from "./entities/AccountEntity";

@@ -16,2 +15,3 @@ import { AccessTokenEntity } from "./entities/AccessTokenEntity";

import { BaseAuthRequest } from "../request/BaseAuthRequest";
import { Logger } from "../logger/Logger";
/**

@@ -23,3 +23,4 @@ * Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.

protected cryptoImpl: ICrypto;
constructor(clientId: string, cryptoImpl: ICrypto);
private commonLogger;
constructor(clientId: string, cryptoImpl: ICrypto, logger: Logger);
/**

@@ -116,3 +117,3 @@ * fetch the account entity from the platform cache

*/
abstract removeItem(key: string, type?: string): boolean;
abstract removeItem(key: string): void;
/**

@@ -128,2 +129,10 @@ * Function which returns boolean whether cache contains a specific key.

/**
* Function which retrieves all account keys from the cache
*/
abstract getAccountKeys(): string[];
/**
* Function which retrieves all token keys from the cache
*/
abstract getTokenKeys(): TokenKeys;
/**
* Function which clears cache.

@@ -141,2 +150,7 @@ */

/**
* Gets accountInfo object based on provided filters
*/
getAccountInfoFilteredBy(accountFilter: AccountFilter): AccountInfo | null;
private getAccountInfoFromEntity;
/**
* saves a cache record

@@ -158,33 +172,23 @@ * @param cacheRecord

*/
getAccountsFilteredBy(accountFilter?: AccountFilter): AccountCache;
getAccountsFilteredBy(accountFilter: AccountFilter): AccountEntity[];
/**
* retrieve accounts matching all provided filters; if no filter is set, get all accounts
* not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared
* Returns true if the given key matches our account key schema. Also matches homeAccountId and/or tenantId if provided
* @param key
* @param homeAccountId
* @param environment
* @param realm
* @param tenantId
* @returns
*/
private getAccountsFilteredByInternal;
isAccountKey(key: string, homeAccountId?: string, tenantId?: string): boolean;
/**
* retrieve credentails matching all provided filters; if no filter is set, get all credentials
* @param homeAccountId
* @param environment
* @param credentialType
* @param clientId
* @param realm
* @param target
* Returns true if the given key matches our credential key schema.
* @param key
*/
getCredentialsFilteredBy(filter: CredentialFilter): CredentialCache;
isCredentialKey(key: string): boolean;
/**
* Support function to help match credentials
* @param homeAccountId
* @param environment
* @param credentialType
* @param clientId
* @param realm
* @param target
* @param userAssertionHash
* @param tokenType
* Returns whether or not the given credential entity matches the filter
* @param entity
* @param filter
* @returns
*/
private getCredentialsFilteredByInternal;
credentialMatchesFilter(entity: ValidCredentialType, filter: CredentialFilter): boolean;
/**

@@ -209,8 +213,8 @@ * retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata

*/
removeAllAccounts(): Promise<boolean>;
removeAllAccounts(): Promise<void>;
/**
* returns a boolean if the given account is removed
* Removes the account and related tokens for a given account key
* @param account
*/
removeAccount(accountKey: string): Promise<boolean>;
removeAccount(accountKey: string): Promise<void>;
/**

@@ -220,3 +224,3 @@ * Removes credentials associated with the provided account

*/
removeAccountContext(account: AccountEntity): Promise<boolean>;
removeAccountContext(account: AccountEntity): Promise<void>;
/**

@@ -226,3 +230,3 @@ * returns a boolean if the given credential is removed

*/
removeCredential(credential: CredentialEntity): Promise<boolean>;
removeAccessToken(key: string): Promise<void>;
/**

@@ -240,3 +244,3 @@ * Removes all app metadata objects from cache.

*/
readCacheRecord(account: AccountInfo, clientId: string, request: BaseAuthRequest, environment: string): CacheRecord;
readCacheRecord(account: AccountInfo, request: BaseAuthRequest, environment: string): CacheRecord;
/**

@@ -248,8 +252,2 @@ * Retrieve AccountEntity from cache

/**
* Retrieve AccountEntity from cache
* @param nativeAccountId
* @returns AccountEntity or Null
*/
readAccountFromCacheWithNativeAccountId(nativeAccountId: string): AccountEntity | null;
/**
* Retrieve IdTokenEntity from cache

@@ -260,4 +258,27 @@ * @param clientId

*/
readIdTokenFromCache(clientId: string, account: AccountInfo): IdTokenEntity | null;
getIdToken(account: AccountInfo, tokenKeys?: TokenKeys): IdTokenEntity | null;
/**
* Gets all idTokens matching the given filter
* @param filter
* @returns
*/
getIdTokensByFilter(filter: CredentialFilter, tokenKeys?: TokenKeys): IdTokenEntity[];
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
* @returns
*/
idTokenKeyMatchesFilter(inputKey: string, filter: CredentialFilter): boolean;
/**
* Removes idToken from the cache
* @param key
*/
removeIdToken(key: string): void;
/**
* Removes refresh token from the cache
* @param key
*/
removeRefreshToken(key: string): void;
/**
* Retrieve AccessTokenEntity from cache

@@ -269,4 +290,18 @@ * @param clientId

*/
readAccessTokenFromCache(clientId: string, account: AccountInfo, request: BaseAuthRequest): AccessTokenEntity | null;
getAccessToken(account: AccountInfo, request: BaseAuthRequest, tokenKeys?: TokenKeys): AccessTokenEntity | null;
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
* @param keyMustContainAllScopes
* @returns
*/
accessTokenKeyMatchesFilter(inputKey: string, filter: CredentialFilter, keyMustContainAllScopes: boolean): boolean;
/**
* Gets all access tokens matching the filter
* @param filter
* @returns
*/
getAccessTokensByFilter(filter: CredentialFilter): AccessTokenEntity[];
/**
* Helper to retrieve the appropriate refresh token from cache

@@ -277,7 +312,13 @@ * @param clientId

*/
readRefreshTokenFromCache(clientId: string, account: AccountInfo, familyRT: boolean): RefreshTokenEntity | null;
getRefreshToken(account: AccountInfo, familyRT: boolean, tokenKeys?: TokenKeys): RefreshTokenEntity | null;
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
*/
refreshTokenKeyMatchesFilter(inputKey: string, filter: CredentialFilter): boolean;
/**
* Retrieve AppMetadataEntity from cache
*/
readAppMetadataFromCache(environment: string, clientId: string): AppMetadataEntity | null;
readAppMetadataFromCache(environment: string): AppMetadataEntity | null;
/**

@@ -288,3 +329,3 @@ * Return the family_id value associated with FOCI

*/
isAppMetadataFOCI(environment: string, clientId: string): boolean;
isAppMetadataFOCI(environment: string): boolean;
/**

@@ -297,2 +338,16 @@ * helper to match account ids

/**
* helper to match account ids
* @param entity
* @param localAccountId
* @returns
*/
private matchLocalAccountId;
/**
* helper to match usernames
* @param entity
* @param username
* @returns
*/
private matchUsername;
/**
* helper to match assertion

@@ -373,8 +428,2 @@ * @param value

/**
* Returns the specific credential (IdToken/AccessToken/RefreshToken) from the cache
* @param key
* @param credType
*/
private getSpecificCredential;
/**
* Helper to convert serialized data to object

@@ -407,2 +456,4 @@ * @param obj

getKeys(): string[];
getAccountKeys(): string[];
getTokenKeys(): TokenKeys;
clear(): Promise<void>;

@@ -409,0 +460,0 @@ updateCredentialCacheKey(): string;

@@ -1,6 +0,5 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';
import { __awaiter, __generator, __extends } from '../_virtual/_tslib.js';
import { Constants, CredentialType, AuthenticationScheme, CacheSchemaType, THE_FAMILY_ID, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../utils/Constants.js';
import { CredentialEntity } from './entities/CredentialEntity.js';
import { __awaiter, __generator, __assign, __extends } from '../_virtual/_tslib.js';
import { Separators, CredentialType, AuthenticationScheme, THE_FAMILY_ID, APP_METADATA, AUTHORITY_METADATA_CONSTANTS } from '../utils/Constants.js';
import { ScopeSet } from '../request/ScopeSet.js';

@@ -11,2 +10,3 @@ import { AccountEntity } from './entities/AccountEntity.js';

import { AuthToken } from '../account/AuthToken.js';
import { name, version } from '../packageMetadata.js';

@@ -21,5 +21,6 @@ /*

var CacheManager = /** @class */ (function () {
function CacheManager(clientId, cryptoImpl) {
function CacheManager(clientId, cryptoImpl, logger) {
this.clientId = clientId;
this.cryptoImpl = cryptoImpl;
this.commonLogger = logger.clone(name, version);
}

@@ -31,18 +32,20 @@ /**

var _this = this;
var currentAccounts = this.getAccountsFilteredBy();
var accountValues = Object.keys(currentAccounts).map(function (accountKey) { return currentAccounts[accountKey]; });
var numAccounts = accountValues.length;
if (numAccounts < 1) {
var allAccountKeys = this.getAccountKeys();
if (allAccountKeys.length < 1) {
return [];
}
var accountEntities = allAccountKeys.reduce(function (accounts, key) {
var entity = _this.getAccount(key);
if (!entity) {
return accounts;
}
accounts.push(entity);
return accounts;
}, []);
if (accountEntities.length < 1) {
return [];
}
else {
var allAccounts = accountValues.map(function (value) {
var accountEntity = CacheManager.toObject(new AccountEntity(), value);
var accountInfo = accountEntity.getAccountInfo();
var idToken = _this.readIdTokenFromCache(_this.clientId, accountInfo);
if (idToken && !accountInfo.idTokenClaims) {
accountInfo.idToken = idToken.secret;
accountInfo.idTokenClaims = new AuthToken(idToken.secret, _this.cryptoImpl).claims;
}
return accountInfo;
var allAccounts = accountEntities.map(function (accountEntity) {
return _this.getAccountInfoFromEntity(accountEntity);
});

@@ -53,2 +56,23 @@ return allAccounts;

/**
* Gets accountInfo object based on provided filters
*/
CacheManager.prototype.getAccountInfoFilteredBy = function (accountFilter) {
var allAccounts = this.getAccountsFilteredBy(accountFilter);
if (allAccounts.length > 0) {
return this.getAccountInfoFromEntity(allAccounts[0]);
}
else {
return null;
}
};
CacheManager.prototype.getAccountInfoFromEntity = function (accountEntity) {
var accountInfo = accountEntity.getAccountInfo();
var idToken = this.getIdToken(accountInfo);
if (idToken) {
accountInfo.idToken = idToken.secret;
accountInfo.idTokenClaims = new AuthToken(idToken.secret, this.cryptoImpl).claims;
}
return accountInfo;
};
/**
* saves a cache record

@@ -94,3 +118,3 @@ * @param cacheRecord

return __awaiter(this, void 0, void 0, function () {
var currentTokenCache, currentScopes, currentAccessTokens, removedAccessTokens_1;
var accessTokenFilter, tokenKeys, currentScopes, removedAccessTokens;
var _this = this;

@@ -100,3 +124,3 @@ return __generator(this, function (_a) {

case 0:
currentTokenCache = this.getCredentialsFilteredBy({
accessTokenFilter = {
clientId: credential.clientId,

@@ -109,18 +133,21 @@ credentialType: credential.credentialType,

requestedClaimsHash: credential.requestedClaimsHash
});
};
tokenKeys = this.getTokenKeys();
currentScopes = ScopeSet.fromString(credential.target);
currentAccessTokens = Object.keys(currentTokenCache.accessTokens).map(function (key) { return currentTokenCache.accessTokens[key]; });
if (!currentAccessTokens) return [3 /*break*/, 2];
removedAccessTokens_1 = [];
currentAccessTokens.forEach(function (tokenEntity) {
var tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
removedAccessTokens_1.push(_this.removeCredential(tokenEntity));
removedAccessTokens = [];
tokenKeys.accessToken.forEach(function (key) {
if (!_this.accessTokenKeyMatchesFilter(key, accessTokenFilter, false)) {
return;
}
var tokenEntity = _this.getAccessTokenCredential(key);
if (tokenEntity && _this.credentialMatchesFilter(tokenEntity, accessTokenFilter)) {
var tokenScopeSet = ScopeSet.fromString(tokenEntity.target);
if (tokenScopeSet.intersectingScopeSets(currentScopes)) {
removedAccessTokens.push(_this.removeAccessToken(key));
}
}
});
return [4 /*yield*/, Promise.all(removedAccessTokens_1)];
return [4 /*yield*/, Promise.all(removedAccessTokens)];
case 1:
_a.sent();
_a.label = 2;
case 2:
this.setAccessTokenCredential(credential);

@@ -140,16 +167,10 @@ return [2 /*return*/];

CacheManager.prototype.getAccountsFilteredBy = function (accountFilter) {
return this.getAccountsFilteredByInternal(accountFilter ? accountFilter.homeAccountId : Constants.EMPTY_STRING, accountFilter ? accountFilter.environment : Constants.EMPTY_STRING, accountFilter ? accountFilter.realm : Constants.EMPTY_STRING, accountFilter ? accountFilter.nativeAccountId : Constants.EMPTY_STRING);
};
/**
* retrieve accounts matching all provided filters; if no filter is set, get all accounts
* not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared
* @param homeAccountId
* @param environment
* @param realm
*/
CacheManager.prototype.getAccountsFilteredByInternal = function (homeAccountId, environment, realm, nativeAccountId) {
var _this = this;
var allCacheKeys = this.getKeys();
var matchingAccounts = {};
allCacheKeys.forEach(function (cacheKey) {
var allAccountKeys = this.getAccountKeys();
var matchingAccounts = [];
allAccountKeys.forEach(function (cacheKey) {
if (!_this.isAccountKey(cacheKey, accountFilter.homeAccountId, accountFilter.realm)) {
// Don't parse value if the key doesn't match the account filters
return;
}
var entity = _this.getAccount(cacheKey);

@@ -159,15 +180,21 @@ if (!entity) {

}
if (!!homeAccountId && !_this.matchHomeAccountId(entity, homeAccountId)) {
if (!!accountFilter.homeAccountId && !_this.matchHomeAccountId(entity, accountFilter.homeAccountId)) {
return;
}
if (!!environment && !_this.matchEnvironment(entity, environment)) {
if (!!accountFilter.localAccountId && !_this.matchLocalAccountId(entity, accountFilter.localAccountId)) {
return;
}
if (!!realm && !_this.matchRealm(entity, realm)) {
if (!!accountFilter.username && !_this.matchUsername(entity, accountFilter.username)) {
return;
}
if (!!nativeAccountId && !_this.matchNativeAccountId(entity, nativeAccountId)) {
if (!!accountFilter.environment && !_this.matchEnvironment(entity, accountFilter.environment)) {
return;
}
matchingAccounts[cacheKey] = entity;
if (!!accountFilter.realm && !_this.matchRealm(entity, accountFilter.realm)) {
return;
}
if (!!accountFilter.nativeAccountId && !_this.matchNativeAccountId(entity, accountFilter.nativeAccountId)) {
return;
}
matchingAccounts.push(entity);
});

@@ -177,110 +204,112 @@ return matchingAccounts;

/**
* retrieve credentails matching all provided filters; if no filter is set, get all credentials
* Returns true if the given key matches our account key schema. Also matches homeAccountId and/or tenantId if provided
* @param key
* @param homeAccountId
* @param environment
* @param credentialType
* @param clientId
* @param realm
* @param target
* @param tenantId
* @returns
*/
CacheManager.prototype.getCredentialsFilteredBy = function (filter) {
return this.getCredentialsFilteredByInternal(filter.homeAccountId, filter.environment, filter.credentialType, filter.clientId, filter.familyId, filter.realm, filter.target, filter.userAssertionHash, filter.tokenType, filter.keyId, filter.requestedClaimsHash);
CacheManager.prototype.isAccountKey = function (key, homeAccountId, tenantId) {
if (key.split(Separators.CACHE_KEY_SEPARATOR).length < 3) {
// Account cache keys contain 3 items separated by '-' (each item may also contain '-')
return false;
}
if (homeAccountId && !key.toLowerCase().includes(homeAccountId.toLowerCase())) {
return false;
}
if (tenantId && !key.toLowerCase().includes(tenantId.toLowerCase())) {
return false;
}
// Do not check environment as aliasing can cause false negatives
return true;
};
/**
* Support function to help match credentials
* @param homeAccountId
* @param environment
* @param credentialType
* @param clientId
* @param realm
* @param target
* @param userAssertionHash
* @param tokenType
* Returns true if the given key matches our credential key schema.
* @param key
*/
CacheManager.prototype.getCredentialsFilteredByInternal = function (homeAccountId, environment, credentialType, clientId, familyId, realm, target, userAssertionHash, tokenType, keyId, requestedClaimsHash) {
var _this = this;
var allCacheKeys = this.getKeys();
var matchingCredentials = {
idTokens: {},
accessTokens: {},
refreshTokens: {},
};
allCacheKeys.forEach(function (cacheKey) {
// don't parse any non-credential type cache entities
var credType = CredentialEntity.getCredentialType(cacheKey);
if (credType === Constants.NOT_DEFINED) {
return;
CacheManager.prototype.isCredentialKey = function (key) {
if (key.split(Separators.CACHE_KEY_SEPARATOR).length < 6) {
// Credential cache keys contain 6 items separated by '-' (each item may also contain '-')
return false;
}
var lowerCaseKey = key.toLowerCase();
// Credential keys must indicate what credential type they represent
if (lowerCaseKey.indexOf(CredentialType.ID_TOKEN.toLowerCase()) === -1 &&
lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN.toLowerCase()) === -1 &&
lowerCaseKey.indexOf(CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase()) === -1 &&
lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) === -1) {
return false;
}
if (lowerCaseKey.indexOf(CredentialType.REFRESH_TOKEN.toLowerCase()) > -1) {
// Refresh tokens must contain the client id or family id
var clientIdValidation = "" + CredentialType.REFRESH_TOKEN + Separators.CACHE_KEY_SEPARATOR + this.clientId + Separators.CACHE_KEY_SEPARATOR;
var familyIdValidation = "" + CredentialType.REFRESH_TOKEN + Separators.CACHE_KEY_SEPARATOR + THE_FAMILY_ID + Separators.CACHE_KEY_SEPARATOR;
if (lowerCaseKey.indexOf(clientIdValidation.toLowerCase()) === -1 && lowerCaseKey.indexOf(familyIdValidation.toLowerCase()) === -1) {
return false;
}
// Attempt retrieval
var entity = _this.getSpecificCredential(cacheKey, credType);
if (!entity) {
return;
}
else if (lowerCaseKey.indexOf(this.clientId.toLowerCase()) === -1) {
// Tokens must contain the clientId
return false;
}
return true;
};
/**
* Returns whether or not the given credential entity matches the filter
* @param entity
* @param filter
* @returns
*/
CacheManager.prototype.credentialMatchesFilter = function (entity, filter) {
if (!!filter.clientId && !this.matchClientId(entity, filter.clientId)) {
return false;
}
if (!!filter.userAssertionHash && !this.matchUserAssertionHash(entity, filter.userAssertionHash)) {
return false;
}
/*
* homeAccountId can be undefined, and we want to filter out cached items that have a homeAccountId of ""
* because we don't want a client_credential request to return a cached token that has a homeAccountId
*/
if ((typeof filter.homeAccountId === "string") && !this.matchHomeAccountId(entity, filter.homeAccountId)) {
return false;
}
if (!!filter.environment && !this.matchEnvironment(entity, filter.environment)) {
return false;
}
if (!!filter.realm && !this.matchRealm(entity, filter.realm)) {
return false;
}
if (!!filter.credentialType && !this.matchCredentialType(entity, filter.credentialType)) {
return false;
}
if (!!filter.familyId && !this.matchFamilyId(entity, filter.familyId)) {
return false;
}
/*
* idTokens do not have "target", target specific refreshTokens do exist for some types of authentication
* Resource specific refresh tokens case will be added when the support is deemed necessary
*/
if (!!filter.target && !this.matchTarget(entity, filter.target)) {
return false;
}
// If request OR cached entity has requested Claims Hash, check if they match
if (filter.requestedClaimsHash || entity.requestedClaimsHash) {
// Don't match if either is undefined or they are different
if (entity.requestedClaimsHash !== filter.requestedClaimsHash) {
return false;
}
if (!!userAssertionHash && !_this.matchUserAssertionHash(entity, userAssertionHash)) {
return;
}
// Access Token with Auth Scheme specific matching
if (entity.credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
if (!!filter.tokenType && !this.matchTokenType(entity, filter.tokenType)) {
return false;
}
/*
* homeAccountId can undefined, and we want to filter out cached items that have a homeAccountId of ""
* because we don't want a client_credential request to return a cached token that has a homeAccountId
*/
if ((typeof homeAccountId === "string") && !_this.matchHomeAccountId(entity, homeAccountId)) {
return;
}
if (!!environment && !_this.matchEnvironment(entity, environment)) {
return;
}
if (!!realm && !_this.matchRealm(entity, realm)) {
return;
}
if (!!credentialType && !_this.matchCredentialType(entity, credentialType)) {
return;
}
if (!!clientId && !_this.matchClientId(entity, clientId)) {
return;
}
if (!!familyId && !_this.matchFamilyId(entity, familyId)) {
return;
}
/*
* idTokens do not have "target", target specific refreshTokens do exist for some types of authentication
* Resource specific refresh tokens case will be added when the support is deemed necessary
*/
if (!!target && !_this.matchTarget(entity, target)) {
return;
}
// If request OR cached entity has requested Claims Hash, check if they match
if (requestedClaimsHash || entity.requestedClaimsHash) {
// Don't match if either is undefined or they are different
if (entity.requestedClaimsHash !== requestedClaimsHash) {
return;
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
if (filter.tokenType === AuthenticationScheme.SSH) {
if (filter.keyId && !this.matchKeyId(entity, filter.keyId)) {
return false;
}
}
// Access Token with Auth Scheme specific matching
if (credentialType === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME) {
if (!!tokenType && !_this.matchTokenType(entity, tokenType)) {
return;
}
// KeyId (sshKid) in request must match cached SSH certificate keyId because SSH cert is bound to a specific key
if (tokenType === AuthenticationScheme.SSH) {
if (keyId && !_this.matchKeyId(entity, keyId)) {
return;
}
}
}
// At this point, the entity matches the request, update cache key if key schema has changed
var updatedCacheKey = _this.updateCredentialCacheKey(cacheKey, entity);
switch (credType) {
case CredentialType.ID_TOKEN:
matchingCredentials.idTokens[updatedCacheKey] = entity;
break;
case CredentialType.ACCESS_TOKEN:
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
matchingCredentials.accessTokens[updatedCacheKey] = entity;
break;
case CredentialType.REFRESH_TOKEN:
matchingCredentials.refreshTokens[updatedCacheKey] = entity;
break;
}
});
return matchingCredentials;
}
return true;
};

@@ -353,3 +382,3 @@ /**

return __awaiter(this, void 0, void 0, function () {
var allCacheKeys, removedAccounts;
var allAccountKeys, removedAccounts;
var _this = this;

@@ -359,9 +388,5 @@ return __generator(this, function (_a) {

case 0:
allCacheKeys = this.getKeys();
allAccountKeys = this.getAccountKeys();
removedAccounts = [];
allCacheKeys.forEach(function (cacheKey) {
var entity = _this.getAccount(cacheKey);
if (!entity) {
return;
}
allAccountKeys.forEach(function (cacheKey) {
removedAccounts.push(_this.removeAccount(cacheKey));

@@ -372,3 +397,3 @@ });

_a.sent();
return [2 /*return*/, true];
return [2 /*return*/];
}

@@ -379,3 +404,3 @@ });

/**
* returns a boolean if the given account is removed
* Removes the account and related tokens for a given account key
* @param account

@@ -394,3 +419,6 @@ */

return [4 /*yield*/, this.removeAccountContext(account)];
case 1: return [2 /*return*/, ((_a.sent()) && this.removeItem(accountKey, CacheSchemaType.ACCOUNT))];
case 1:
_a.sent();
this.removeItem(accountKey);
return [2 /*return*/];
}

@@ -406,3 +434,3 @@ });

return __awaiter(this, void 0, void 0, function () {
var allCacheKeys, accountId, removedCredentials;
var allTokenKeys, accountId, removedCredentials;
var _this = this;

@@ -412,20 +440,24 @@ return __generator(this, function (_a) {

case 0:
allCacheKeys = this.getKeys();
allTokenKeys = this.getTokenKeys();
accountId = account.generateAccountId();
removedCredentials = [];
allCacheKeys.forEach(function (cacheKey) {
// don't parse any non-credential type cache entities
var credType = CredentialEntity.getCredentialType(cacheKey);
if (credType === Constants.NOT_DEFINED) {
return;
allTokenKeys.idToken.forEach(function (key) {
if (key.indexOf(accountId) === 0) {
_this.removeIdToken(key);
}
var cacheEntity = _this.getSpecificCredential(cacheKey, credType);
if (!!cacheEntity && accountId === cacheEntity.generateAccountId()) {
removedCredentials.push(_this.removeCredential(cacheEntity));
});
allTokenKeys.accessToken.forEach(function (key) {
if (key.indexOf(accountId) === 0) {
removedCredentials.push(_this.removeAccessToken(key));
}
});
allTokenKeys.refreshToken.forEach(function (key) {
if (key.indexOf(accountId) === 0) {
_this.removeRefreshToken(key);
}
});
return [4 /*yield*/, Promise.all(removedCredentials)];
case 1:
_a.sent();
return [2 /*return*/, true];
return [2 /*return*/];
}

@@ -439,9 +471,12 @@ });

*/
CacheManager.prototype.removeCredential = function (credential) {
CacheManager.prototype.removeAccessToken = function (key) {
return __awaiter(this, void 0, void 0, function () {
var key, accessTokenWithAuthSchemeEntity, kid;
var credential, accessTokenWithAuthSchemeEntity, kid;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
key = credential.generateCredentialKey();
credential = this.getAccessTokenCredential(key);
if (!credential) {
return [2 /*return*/];
}
if (!(credential.credentialType.toLowerCase() === CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME.toLowerCase())) return [3 /*break*/, 4];

@@ -462,3 +497,3 @@ if (!(credential.tokenType === AuthenticationScheme.POP)) return [3 /*break*/, 4];

throw ClientAuthError.createBindingKeyNotRemovedError();
case 4: return [2 /*return*/, this.removeItem(key, CacheSchemaType.CREDENTIAL)];
case 4: return [2 /*return*/, this.removeItem(key)];
}

@@ -476,3 +511,3 @@ });

if (_this.isAppMetadata(cacheKey)) {
_this.removeItem(cacheKey, CacheSchemaType.APP_METADATA);
_this.removeItem(cacheKey);
}

@@ -490,8 +525,9 @@ });

*/
CacheManager.prototype.readCacheRecord = function (account, clientId, request, environment) {
CacheManager.prototype.readCacheRecord = function (account, request, environment) {
var tokenKeys = this.getTokenKeys();
var cachedAccount = this.readAccountFromCache(account);
var cachedIdToken = this.readIdTokenFromCache(clientId, account);
var cachedAccessToken = this.readAccessTokenFromCache(clientId, account, request);
var cachedRefreshToken = this.readRefreshTokenFromCache(clientId, account, false);
var cachedAppMetadata = this.readAppMetadataFromCache(environment, clientId);
var cachedIdToken = this.getIdToken(account, tokenKeys);
var cachedAccessToken = this.getAccessToken(account, request, tokenKeys);
var cachedRefreshToken = this.getRefreshToken(account, false, tokenKeys);
var cachedAppMetadata = this.readAppMetadataFromCache(environment);
if (cachedAccount && cachedIdToken) {

@@ -517,22 +553,2 @@ cachedAccount.idTokenClaims = new AuthToken(cachedIdToken.secret, this.cryptoImpl).claims;

/**
* Retrieve AccountEntity from cache
* @param nativeAccountId
* @returns AccountEntity or Null
*/
CacheManager.prototype.readAccountFromCacheWithNativeAccountId = function (nativeAccountId) {
// fetch account from memory
var accountFilter = {
nativeAccountId: nativeAccountId
};
var accountCache = this.getAccountsFilteredBy(accountFilter);
var accounts = Object.keys(accountCache).map(function (key) { return accountCache[key]; });
if (accounts.length < 1) {
return null;
}
else if (accounts.length > 1) {
throw ClientAuthError.createMultipleMatchingAccountsInCacheError();
}
return accounts[0];
};
/**
* Retrieve IdTokenEntity from cache

@@ -543,3 +559,4 @@ * @param clientId

*/
CacheManager.prototype.readIdTokenFromCache = function (clientId, account) {
CacheManager.prototype.getIdToken = function (account, tokenKeys) {
this.commonLogger.trace("CacheManager - getIdToken called");
var idTokenFilter = {

@@ -549,9 +566,9 @@ homeAccountId: account.homeAccountId,

credentialType: CredentialType.ID_TOKEN,
clientId: clientId,
clientId: this.clientId,
realm: account.tenantId,
};
var credentialCache = this.getCredentialsFilteredBy(idTokenFilter);
var idTokens = Object.keys(credentialCache.idTokens).map(function (key) { return credentialCache.idTokens[key]; });
var idTokens = this.getIdTokensByFilter(idTokenFilter, tokenKeys);
var numIdTokens = idTokens.length;
if (numIdTokens < 1) {
this.commonLogger.info("CacheManager:getIdToken - No token found");
return null;

@@ -562,5 +579,56 @@ }

}
this.commonLogger.info("CacheManager:getIdToken - Returning id token");
return idTokens[0];
};
/**
* Gets all idTokens matching the given filter
* @param filter
* @returns
*/
CacheManager.prototype.getIdTokensByFilter = function (filter, tokenKeys) {
var _this = this;
var idTokenKeys = tokenKeys && tokenKeys.idToken || this.getTokenKeys().idToken;
var idTokens = [];
idTokenKeys.forEach(function (key) {
if (!_this.idTokenKeyMatchesFilter(key, __assign({ clientId: _this.clientId }, filter))) {
return;
}
var idToken = _this.getIdTokenCredential(key);
if (idToken && _this.credentialMatchesFilter(idToken, filter)) {
idTokens.push(idToken);
}
});
return idTokens;
};
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
* @returns
*/
CacheManager.prototype.idTokenKeyMatchesFilter = function (inputKey, filter) {
var key = inputKey.toLowerCase();
if (filter.clientId && key.indexOf(filter.clientId.toLowerCase()) === -1) {
return false;
}
if (filter.homeAccountId && key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {
return false;
}
return true;
};
/**
* Removes idToken from the cache
* @param key
*/
CacheManager.prototype.removeIdToken = function (key) {
this.removeItem(key);
};
/**
* Removes refresh token from the cache
* @param key
*/
CacheManager.prototype.removeRefreshToken = function (key) {
this.removeItem(key);
};
/**
* Retrieve AccessTokenEntity from cache

@@ -572,4 +640,6 @@ * @param clientId

*/
CacheManager.prototype.readAccessTokenFromCache = function (clientId, account, request) {
var scopes = new ScopeSet(request.scopes || []);
CacheManager.prototype.getAccessToken = function (account, request, tokenKeys) {
var _this = this;
this.commonLogger.trace("CacheManager - getAccessToken called");
var scopes = ScopeSet.createSearchScopes(request.scopes);
var authScheme = request.authenticationScheme || AuthenticationScheme.BEARER;

@@ -585,5 +655,5 @@ /*

credentialType: credentialType,
clientId: clientId,
clientId: this.clientId,
realm: account.tenantId,
target: scopes.printScopesLowerCase(),
target: scopes,
tokenType: authScheme,

@@ -593,6 +663,17 @@ keyId: request.sshKid,

};
var credentialCache = this.getCredentialsFilteredBy(accessTokenFilter);
var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
var accessTokenKeys = tokenKeys && tokenKeys.accessToken || this.getTokenKeys().accessToken;
var accessTokens = [];
accessTokenKeys.forEach(function (key) {
// Validate key
if (_this.accessTokenKeyMatchesFilter(key, accessTokenFilter, true)) {
var accessToken = _this.getAccessTokenCredential(key);
// Validate value
if (accessToken && _this.credentialMatchesFilter(accessToken, accessTokenFilter)) {
accessTokens.push(accessToken);
}
}
});
var numAccessTokens = accessTokens.length;
if (numAccessTokens < 1) {
this.commonLogger.info("CacheManager:getAccessToken - No token found");
return null;

@@ -603,5 +684,62 @@ }

}
this.commonLogger.info("CacheManager:getAccessToken - Returning access token");
return accessTokens[0];
};
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
* @param keyMustContainAllScopes
* @returns
*/
CacheManager.prototype.accessTokenKeyMatchesFilter = function (inputKey, filter, keyMustContainAllScopes) {
var key = inputKey.toLowerCase();
if (filter.clientId && key.indexOf(filter.clientId.toLowerCase()) === -1) {
return false;
}
if (filter.homeAccountId && key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {
return false;
}
if (filter.realm && key.indexOf(filter.realm.toLowerCase()) === -1) {
return false;
}
if (filter.requestedClaimsHash && key.indexOf(filter.requestedClaimsHash.toLowerCase()) === -1) {
return false;
}
if (filter.target) {
var scopes = filter.target.asArray();
for (var i = 0; i < scopes.length; i++) {
if (keyMustContainAllScopes && !key.includes(scopes[i].toLowerCase())) {
// When performing a cache lookup a missing scope would be a cache miss
return false;
}
else if (!keyMustContainAllScopes && key.includes(scopes[i].toLowerCase())) {
// When performing a cache write, any token with a subset of requested scopes should be replaced
return true;
}
}
}
return true;
};
/**
* Gets all access tokens matching the filter
* @param filter
* @returns
*/
CacheManager.prototype.getAccessTokensByFilter = function (filter) {
var _this = this;
var tokenKeys = this.getTokenKeys();
var accessTokens = [];
tokenKeys.accessToken.forEach(function (key) {
if (!_this.accessTokenKeyMatchesFilter(key, filter, true)) {
return;
}
var accessToken = _this.getAccessTokenCredential(key);
if (accessToken && _this.credentialMatchesFilter(accessToken, filter)) {
accessTokens.push(accessToken);
}
});
return accessTokens;
};
/**
* Helper to retrieve the appropriate refresh token from cache

@@ -612,3 +750,5 @@ * @param clientId

*/
CacheManager.prototype.readRefreshTokenFromCache = function (clientId, account, familyRT) {
CacheManager.prototype.getRefreshToken = function (account, familyRT, tokenKeys) {
var _this = this;
this.commonLogger.trace("CacheManager - getRefreshToken called");
var id = familyRT ? THE_FAMILY_ID : undefined;

@@ -619,21 +759,52 @@ var refreshTokenFilter = {

credentialType: CredentialType.REFRESH_TOKEN,
clientId: clientId,
clientId: this.clientId,
familyId: id,
};
var credentialCache = this.getCredentialsFilteredBy(refreshTokenFilter);
var refreshTokens = Object.keys(credentialCache.refreshTokens).map(function (key) { return credentialCache.refreshTokens[key]; });
var refreshTokenKeys = tokenKeys && tokenKeys.refreshToken || this.getTokenKeys().refreshToken;
var refreshTokens = [];
refreshTokenKeys.forEach(function (key) {
// Validate key
if (_this.refreshTokenKeyMatchesFilter(key, refreshTokenFilter)) {
var refreshToken = _this.getRefreshTokenCredential(key);
// Validate value
if (refreshToken && _this.credentialMatchesFilter(refreshToken, refreshTokenFilter)) {
refreshTokens.push(refreshToken);
}
}
});
var numRefreshTokens = refreshTokens.length;
if (numRefreshTokens < 1) {
this.commonLogger.info("CacheManager:getRefreshToken - No refresh token found.");
return null;
}
// address the else case after remove functions address environment aliases
this.commonLogger.info("CacheManager:getRefreshToken - returning refresh token");
return refreshTokens[0];
};
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
*/
CacheManager.prototype.refreshTokenKeyMatchesFilter = function (inputKey, filter) {
var key = inputKey.toLowerCase();
if (filter.familyId && key.indexOf(filter.familyId.toLowerCase()) === -1) {
return false;
}
// If familyId is used, clientId is not in the key
if (!filter.familyId && filter.clientId && key.indexOf(filter.clientId.toLowerCase()) === -1) {
return false;
}
if (filter.homeAccountId && key.indexOf(filter.homeAccountId.toLowerCase()) === -1) {
return false;
}
return true;
};
/**
* Retrieve AppMetadataEntity from cache
*/
CacheManager.prototype.readAppMetadataFromCache = function (environment, clientId) {
CacheManager.prototype.readAppMetadataFromCache = function (environment) {
var appMetadataFilter = {
environment: environment,
clientId: clientId,
clientId: this.clientId,
};

@@ -656,4 +827,4 @@ var appMetadata = this.getAppMetadataFilteredBy(appMetadataFilter);

*/
CacheManager.prototype.isAppMetadataFOCI = function (environment, clientId) {
var appMetadata = this.readAppMetadataFromCache(environment, clientId);
CacheManager.prototype.isAppMetadataFOCI = function (environment) {
var appMetadata = this.readAppMetadataFromCache(environment);
return !!(appMetadata && appMetadata.familyId === THE_FAMILY_ID);

@@ -670,2 +841,20 @@ };

/**
* helper to match account ids
* @param entity
* @param localAccountId
* @returns
*/
CacheManager.prototype.matchLocalAccountId = function (entity, localAccountId) {
return !!((typeof entity.localAccountId === "string") && (localAccountId === entity.localAccountId));
};
/**
* helper to match usernames
* @param entity
* @param username
* @returns
*/
CacheManager.prototype.matchUsername = function (entity, username) {
return !!((typeof entity.username === "string") && (username.toLowerCase() === entity.username.toLowerCase()));
};
/**
* helper to match assertion

@@ -742,10 +931,3 @@ * @param value

var entityScopeSet = ScopeSet.fromString(entity.target);
var requestTargetScopeSet = ScopeSet.fromString(target);
if (!requestTargetScopeSet.containsOnlyOIDCScopes()) {
requestTargetScopeSet.removeOIDCScopes(); // ignore OIDC scopes
}
else {
requestTargetScopeSet.removeScope(Constants.OFFLINE_ACCESS_SCOPE);
}
return entityScopeSet.containsScopeSet(requestTargetScopeSet);
return entityScopeSet.containsScopeSet(target);
};

@@ -789,23 +971,2 @@ /**

/**
* Returns the specific credential (IdToken/AccessToken/RefreshToken) from the cache
* @param key
* @param credType
*/
CacheManager.prototype.getSpecificCredential = function (key, credType) {
switch (credType) {
case CredentialType.ID_TOKEN: {
return this.getIdTokenCredential(key);
}
case CredentialType.ACCESS_TOKEN:
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME: {
return this.getAccessTokenCredential(key);
}
case CredentialType.REFRESH_TOKEN: {
return this.getRefreshTokenCredential(key);
}
default:
return null;
}
};
/**
* Helper to convert serialized data to object

@@ -908,2 +1069,10 @@ * @param obj

};
DefaultStorageClass.prototype.getAccountKeys = function () {
var notImplErr = "Storage interface - getAccountKeys() has not been implemented for the cacheStorage interface.";
throw AuthError.createUnexpectedError(notImplErr);
};
DefaultStorageClass.prototype.getTokenKeys = function () {
var notImplErr = "Storage interface - getTokenKeys() has not been implemented for the cacheStorage interface.";
throw AuthError.createUnexpectedError(notImplErr);
};
DefaultStorageClass.prototype.clear = function () {

@@ -910,0 +1079,0 @@ return __awaiter(this, void 0, void 0, function () {

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { Separators, CacheAccountType, CacheType, Constants } from '../../utils/Constants.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { Separators, APP_METADATA } from '../../utils/Constants.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { AUTHORITY_METADATA_CONSTANTS } from '../../utils/Constants.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -37,9 +37,3 @@ import { CredentialType, AuthenticationScheme } from "../../utils/Constants";

requestedClaimsHash?: string;
private static credentialDomainRegex;
private static credentialRegexMap;
/**
* Initializes a map with credential {CredentialType} regular expressions.
*/
static _initRegex(): void;
/**
* Generate Account Id key component as per the schema: <home_account_id>-<environment>

@@ -65,7 +59,2 @@ */

/**
* helper function to return `CredentialType`
* @param key
*/
static getCredentialType(key: string): string;
/**
* generates credential key

@@ -72,0 +61,0 @@ * <home_account_id*>-\<environment>-<credential_type>-<client_id>-<realm\*>-<target\*>-<scheme\*>

@@ -1,4 +0,4 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';
import { CredentialType, CacheType, Constants, Separators, AuthenticationScheme } from '../../utils/Constants.js';
import { CredentialType, CacheType, Separators, Constants, AuthenticationScheme } from '../../utils/Constants.js';
import { ClientAuthError } from '../../error/ClientAuthError.js';

@@ -36,21 +36,2 @@

/**
* Initializes a map with credential {CredentialType} regular expressions.
*/
CredentialEntity._initRegex = function () {
var separator = Separators.CACHE_KEY_SEPARATOR;
CredentialEntity.credentialRegexMap = new Map();
for (var _i = 0, _a = Object.keys(CredentialType); _i < _a.length; _i++) {
var credKey = _a[_i];
var credVal = CredentialType[credKey].toLowerCase();
try {
// Verify credential type is preceded by a valid host name (environment) using lookbehind
CredentialEntity.credentialRegexMap.set(CredentialType[credKey], new RegExp("(?<=" + separator + CredentialEntity.credentialDomainRegex + ")" + separator + credVal + separator));
}
catch (err) {
// Lookbehind is not supported (Safari or older versions of IE) - removing it
CredentialEntity.credentialRegexMap.set(CredentialType[credKey], new RegExp("" + separator + CredentialEntity.credentialDomainRegex + separator + credVal + separator));
}
}
};
/**
* Generate Account Id key component as per the schema: <home_account_id>-<environment>

@@ -97,16 +78,2 @@ */

/**
* helper function to return `CredentialType`
* @param key
*/
CredentialEntity.getCredentialType = function (key) {
var _a;
for (var _i = 0, _b = Object.keys(CredentialType); _i < _b.length; _i++) {
var credKey = _b[_i];
if ((_a = this.credentialRegexMap.get(CredentialType[credKey])) === null || _a === void 0 ? void 0 : _a.test(key.toLowerCase())) {
return CredentialType[credKey];
}
}
return Constants.NOT_DEFINED;
};
/**
* generates credential key

@@ -174,12 +141,6 @@ * <home_account_id*>-\<environment>-<credential_type>-<client_id>-<realm\*>-<target\*>-<scheme\*>

};
/*
* Match host names like "login.microsoftonline.com", "https://accounts.google.com:4000", https://localhost:5000,
* "login.microsoftonline.com/common", "login.microsoftonline.com:4000/common", etc
*/
CredentialEntity.credentialDomainRegex = "(https?:\\/\\/)?((([\\w-]+\\.)*([\\w-]{1,63})(\\.(\\w{2,63})))|(localhost))(\\:[0-9]{4,5})?(\\/[\\w-]+)?";
return CredentialEntity;
}());
CredentialEntity._initRegex();
export { CredentialEntity };
//# sourceMappingURL=CredentialEntity.js.map

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { SERVER_TELEM_CONSTANTS } from '../../utils/Constants.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { ThrottlingConstants } from '../../utils/Constants.js';

@@ -1,3 +0,2 @@

import { CredentialEntity } from "../entities/CredentialEntity";
import { AccountCache, CredentialCache, AccountFilter, CredentialFilter } from "../utils/CacheTypes";
import { AccountFilter } from "../utils/CacheTypes";
import { CacheRecord } from "../entities/CacheRecord";

@@ -25,2 +24,10 @@ import { AccountEntity } from "../entities/AccountEntity";

/**
* Returns true if the given key matches our account key schema. Also matches homeAccountId and/or tenantId if provided
* @param key
* @param homeAccountId
* @param tenantId
* @returns
*/
isAccountKey(key: string, homeAccountId?: string, tenantId?: string): boolean;
/**
* fetch the idToken entity from the platform cache

@@ -127,17 +134,12 @@ * @param idTokenKey

*/
getAccountsFilteredBy(filter: AccountFilter): AccountCache;
getAccountsFilteredBy(filter: AccountFilter): AccountEntity[];
/**
* retrieve credentials matching all provided filters; if no filter is set, get all credentials
* @param homeAccountId
* @param environment
* @param credentialType
* @param clientId
* @param realm
* @param target
* Get AccountInfo object based on provided filters
* @param filter
*/
getCredentialsFilteredBy(filter: CredentialFilter): CredentialCache;
getAccountInfoFilteredBy(filter: AccountFilter): AccountInfo | null;
/**
* Removes all accounts and related tokens from cache.
*/
removeAllAccounts(): Promise<boolean>;
removeAllAccounts(): Promise<void>;
/**

@@ -147,3 +149,3 @@ * returns a boolean if the given account is removed

*/
removeAccount(accountKey: string): Promise<boolean>;
removeAccount(accountKey: string): Promise<void>;
/**

@@ -153,9 +155,16 @@ * returns a boolean if the given account is removed

*/
removeAccountContext(account: AccountEntity): Promise<boolean>;
removeAccountContext(account: AccountEntity): Promise<void>;
/**
* returns a boolean if the given credential is removed
* @param credential
* @param key
*/
removeCredential(credential: CredentialEntity): Promise<boolean>;
removeIdToken(key: string): void;
/**
* @param key
*/
removeAccessToken(key: string): Promise<void>;
/**
* @param key
*/
removeRefreshToken(key: string): void;
}
//# sourceMappingURL=ICacheManager.d.ts.map

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -10,2 +10,3 @@ import { AccountEntity } from "../entities/AccountEntity";

import { AuthenticationScheme } from "../../utils/Constants";
import { ScopeSet } from "../../request/ScopeSet";
export declare type AccountCache = Record<string, AccountEntity>;

@@ -16,7 +17,2 @@ export declare type IdTokenCache = Record<string, IdTokenEntity>;

export declare type AppMetadataCache = Record<string, AppMetadataEntity>;
export declare type CredentialCache = {
idTokens: IdTokenCache;
accessTokens: AccessTokenCache;
refreshTokens: RefreshTokenCache;
};
/**

@@ -35,2 +31,4 @@ * Object type of all accepted cache types

homeAccountId?: string;
localAccountId?: string;
username?: string;
environment?: string;

@@ -50,3 +48,3 @@ realm?: string;

realm?: string;
target?: string;
target?: ScopeSet;
userAssertionHash?: string;

@@ -64,2 +62,7 @@ tokenType?: AuthenticationScheme;

};
export declare type TokenKeys = {
idToken: string[];
accessToken: string[];
refreshToken: string[];
};
//# sourceMappingURL=CacheTypes.d.ts.map

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends, __awaiter, __generator, __assign, __spreadArrays } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -24,3 +24,2 @@ import { ClientConfiguration } from "../config/ClientConfiguration";

* Reads access token from the cache
* TODO: Move this call to cacheManager instead
*/

@@ -27,0 +26,0 @@ private readAccessTokenFromCache;

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -86,3 +86,2 @@ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';

* Reads access token from the cache
* TODO: Move this call to cacheManager instead
*/

@@ -96,6 +95,5 @@ ClientCredentialClient.prototype.readAccessTokenFromCache = function () {

realm: this.authority.tenant,
target: this.scopeSet.printScopesLowerCase()
target: ScopeSet.createSearchScopes(this.scopeSet.asArray())
};
var credentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);
var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
var accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter);
if (accessTokens.length < 1) {

@@ -102,0 +100,0 @@ return null;

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -89,3 +89,3 @@ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';

}
cachedIdToken = this.readIdTokenFromCacheForOBO(request, cachedAccessToken.homeAccountId);
cachedIdToken = this.readIdTokenFromCacheForOBO(cachedAccessToken.homeAccountId);
cachedAccount = null;

@@ -125,3 +125,3 @@ if (cachedIdToken) {

*/
OnBehalfOfClient.prototype.readIdTokenFromCacheForOBO = function (request, atHomeAccountId) {
OnBehalfOfClient.prototype.readIdTokenFromCacheForOBO = function (atHomeAccountId) {
var idTokenFilter = {

@@ -134,4 +134,3 @@ homeAccountId: atHomeAccountId,

};
var credentialCache = this.cacheManager.getCredentialsFilteredBy(idTokenFilter);
var idTokens = Object.keys(credentialCache.idTokens).map(function (key) { return credentialCache.idTokens[key]; });
var idTokens = this.cacheManager.getIdTokensByFilter(idTokenFilter);
// When acquiring a token on behalf of an application, there might not be an id token in the cache

@@ -159,3 +158,3 @@ if (idTokens.length < 1) {

clientId: clientId,
target: this.scopeSet.printScopesLowerCase(),
target: ScopeSet.createSearchScopes(this.scopeSet.asArray()),
tokenType: authScheme,

@@ -166,4 +165,3 @@ keyId: request.sshKid,

};
var credentialCache = this.cacheManager.getCredentialsFilteredBy(accessTokenFilter);
var accessTokens = Object.keys(credentialCache.accessTokens).map(function (key) { return credentialCache.accessTokens[key]; });
var accessTokens = this.cacheManager.getAccessTokensByFilter(accessTokenFilter);
var numAccessTokens = accessTokens.length;

@@ -170,0 +168,0 @@ if (numAccessTokens < 1) {

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -98,3 +98,3 @@ import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';

}
isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment, this.config.authOptions.clientId);
isFOCI = this.cacheManager.isAppMetadataFOCI(request.account.environment);
// if the app is part of the family, retrive a Family refresh token if present and make a refreshTokenRequest

@@ -138,3 +138,3 @@ if (isFOCI) {

this.logger.verbose("RefreshTokenClientAcquireTokenWithCachedRefreshToken called", request.correlationId);
refreshToken = this.cacheManager.readRefreshTokenFromCache(this.config.authOptions.clientId, request.account, foci);
refreshToken = this.cacheManager.getRefreshToken(request.account, foci);
if (!refreshToken) {

@@ -141,0 +141,0 @@ atsMeasurement === null || atsMeasurement === void 0 ? void 0 : atsMeasurement.discardMeasurement();

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -76,3 +76,3 @@ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';

environment = request.authority || this.authority.getPreferredCache();
cacheRecord = this.cacheManager.readCacheRecord(request.account, this.config.authOptions.clientId, request, environment);
cacheRecord = this.cacheManager.readCacheRecord(request.account, request, environment);
if (!cacheRecord.accessToken) {

@@ -79,0 +79,0 @@ // Must refresh due to non-existent access_token.

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -6,3 +6,3 @@ import { __assign, __awaiter, __generator } from '../_virtual/_tslib.js';

import { AuthError } from '../error/AuthError.js';
import { LogLevel } from '../logger/Logger.js';
import { Logger, LogLevel } from '../logger/Logger.js';
import { Constants } from '../utils/Constants.js';

@@ -85,3 +85,3 @@ import { version } from '../packageMetadata.js';

loggerOptions: loggerOptions,
storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION),
storageInterface: storageImplementation || new DefaultStorageClass(userAuthOptions.clientId, DEFAULT_CRYPTO_IMPLEMENTATION, new Logger(loggerOptions)),
networkInterface: networkImplementation || DEFAULT_NETWORK_IMPLEMENTATION,

@@ -88,0 +88,0 @@ cryptoInterface: cryptoImplementation || DEFAULT_CRYPTO_IMPLEMENTATION,

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { JoseHeaderError } from '../error/JoseHeaderError.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../_virtual/_tslib.js';

@@ -29,3 +29,3 @@ /**

export { CacheManager, DefaultStorageClass } from "./cache/CacheManager";
export { AccountCache, AccessTokenCache, IdTokenCache, RefreshTokenCache, AppMetadataCache, ValidCacheType, ValidCredentialType } from "./cache/utils/CacheTypes";
export { AccountCache, AccessTokenCache, IdTokenCache, RefreshTokenCache, AppMetadataCache, ValidCacheType, ValidCredentialType, TokenKeys } from "./cache/utils/CacheTypes";
export { CacheRecord } from "./cache/entities/CacheRecord";

@@ -82,3 +82,3 @@ export { CredentialEntity } from "./cache/entities/CredentialEntity";

export { ClientConfigurationError, ClientConfigurationErrorMessage } from "./error/ClientConfigurationError";
export { Constants, OIDC_DEFAULT_SCOPES, PromptValue, PersistentCacheKeys, ResponseMode, CacheSchemaType, CredentialType, CacheType, CacheAccountType, AuthenticationScheme, CodeChallengeMethodValues, SSOTypes, PasswordGrantConstants, ThrottlingConstants, ClaimsRequestKeys, HeaderNames, AADServerParamKeys, Errors, THE_FAMILY_ID, ONE_DAY_IN_MS } from "./utils/Constants";
export { Constants, OIDC_DEFAULT_SCOPES, PromptValue, PersistentCacheKeys, ResponseMode, CredentialType, CacheType, CacheAccountType, AuthenticationScheme, CodeChallengeMethodValues, SSOTypes, PasswordGrantConstants, ThrottlingConstants, ClaimsRequestKeys, HeaderNames, AADServerParamKeys, Errors, THE_FAMILY_ID, ONE_DAY_IN_MS } from "./utils/Constants";
export { StringUtils } from "./utils/StringUtils";

@@ -85,0 +85,0 @@ export { StringDict } from "./utils/MsalTypes";

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -45,3 +45,3 @@ export { AuthorizationCodeClient } from './client/AuthorizationCodeClient.js';

export { ClientConfigurationError, ClientConfigurationErrorMessage } from './error/ClientConfigurationError.js';
export { AADServerParamKeys, AuthenticationScheme, CacheAccountType, CacheSchemaType, CacheType, ClaimsRequestKeys, CodeChallengeMethodValues, Constants, CredentialType, Errors, HeaderNames, OIDC_DEFAULT_SCOPES, ONE_DAY_IN_MS, PasswordGrantConstants, PersistentCacheKeys, PromptValue, ResponseMode, SSOTypes, THE_FAMILY_ID, ThrottlingConstants } from './utils/Constants.js';
export { AADServerParamKeys, AuthenticationScheme, CacheAccountType, CacheType, ClaimsRequestKeys, CodeChallengeMethodValues, Constants, CredentialType, Errors, HeaderNames, OIDC_DEFAULT_SCOPES, ONE_DAY_IN_MS, PasswordGrantConstants, PersistentCacheKeys, PromptValue, ResponseMode, SSOTypes, THE_FAMILY_ID, ThrottlingConstants } from './utils/Constants.js';
export { StringUtils } from './utils/StringUtils.js';

@@ -48,0 +48,0 @@ export { ProtocolUtils } from './utils/ProtocolUtils.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { StringUtils } from '../utils/StringUtils.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { AuthError } from '../error/AuthError.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -40,4 +40,4 @@ import { NetworkResponse } from "./NetworkManager";

static calculateThrottleTime(throttleTime: number): number;
static removeThrottle(cacheManager: CacheManager, clientId: string, request: BaseAuthRequest, homeAccountIdentifier?: string): boolean;
static removeThrottle(cacheManager: CacheManager, clientId: string, request: BaseAuthRequest, homeAccountIdentifier?: string): void;
}
//# sourceMappingURL=ThrottlingUtils.d.ts.map

@@ -1,4 +0,4 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';
import { ThrottlingConstants, CacheSchemaType, Constants, HeaderNames } from '../utils/Constants.js';
import { ThrottlingConstants, Constants, HeaderNames } from '../utils/Constants.js';
import { ServerError } from '../error/ServerError.js';

@@ -31,3 +31,3 @@

if (value.throttleTime < Date.now()) {
cacheManager.removeItem(key, CacheSchemaType.THROTTLING);
cacheManager.removeItem(key);
return;

@@ -96,3 +96,3 @@ }

var key = this.generateThrottlingStorageKey(thumbprint);
return cacheManager.removeItem(key, CacheSchemaType.THROTTLING);
cacheManager.removeItem(key);
};

@@ -99,0 +99,0 @@ return ThrottlingUtils;

export declare const name = "@azure/msal-common";
export declare const version = "11.0.0";
export declare const version = "12.0.0";
//# sourceMappingURL=packageMetadata.d.ts.map

@@ -1,8 +0,8 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';
/* eslint-disable header/header */
var name = "@azure/msal-common";
var version = "11.0.0";
var version = "12.0.0";
export { name, version };
//# sourceMappingURL=packageMetadata.js.map

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __spreadArrays } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { StringUtils } from '../utils/StringUtils.js';

@@ -17,2 +17,8 @@ /**

/**
* Creates the set of scopes to search for in cache lookups
* @param inputScopeString
* @returns
*/
static createSearchScopes(inputScopeString: Array<string>): ScopeSet;
/**
* Used to validate the scopes input parameter requested by the developer.

@@ -19,0 +25,0 @@ * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -7,3 +7,3 @@ import { __spreadArrays } from '../_virtual/_tslib.js';

import { ClientAuthError } from '../error/ClientAuthError.js';
import { OIDC_SCOPES, Constants } from '../utils/Constants.js';
import { Constants, OIDC_SCOPES } from '../utils/Constants.js';

@@ -42,2 +42,17 @@ /*

/**
* Creates the set of scopes to search for in cache lookups
* @param inputScopeString
* @returns
*/
ScopeSet.createSearchScopes = function (inputScopeString) {
var scopeSet = new ScopeSet(inputScopeString);
if (!scopeSet.containsOnlyOIDCScopes()) {
scopeSet.removeOIDCScopes();
}
else {
scopeSet.removeScope(Constants.OFFLINE_ACCESS_SCOPE);
}
return scopeSet;
};
/**
* Used to validate the scopes input parameter requested by the developer.

@@ -44,0 +59,0 @@ * @param {Array<string>} inputScopes - Developer requested permissions. Not all scopes are guaranteed to be included in the access token returned.

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __assign } from '../../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { __extends } from '../../_virtual/_tslib.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { SERVER_TELEM_CONSTANTS, CacheOutcome, Constants, Separators } from '../../utils/Constants.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { ClientConfigurationError } from '../error/ClientConfigurationError.js';

@@ -226,17 +226,2 @@ export declare const Constants: {

/**
* Credential Type stored in the cache
*/
export declare enum CacheSchemaType {
ACCOUNT = "Account",
CREDENTIAL = "Credential",
ID_TOKEN = "IdToken",
ACCESS_TOKEN = "AccessToken",
REFRESH_TOKEN = "RefreshToken",
APP_METADATA = "AppMetadata",
TEMPORARY = "TempCache",
TELEMETRY = "Telemetry",
UNDEFINED = "Undefined",
THROTTLING = "Throttling"
}
/**
* Combine all cache types

@@ -243,0 +228,0 @@ */

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -251,18 +251,2 @@ import { __spreadArrays } from '../_virtual/_tslib.js';

/**
* Credential Type stored in the cache
*/
var CacheSchemaType;
(function (CacheSchemaType) {
CacheSchemaType["ACCOUNT"] = "Account";
CacheSchemaType["CREDENTIAL"] = "Credential";
CacheSchemaType["ID_TOKEN"] = "IdToken";
CacheSchemaType["ACCESS_TOKEN"] = "AccessToken";
CacheSchemaType["REFRESH_TOKEN"] = "RefreshToken";
CacheSchemaType["APP_METADATA"] = "AppMetadata";
CacheSchemaType["TEMPORARY"] = "TempCache";
CacheSchemaType["TELEMETRY"] = "Telemetry";
CacheSchemaType["UNDEFINED"] = "Undefined";
CacheSchemaType["THROTTLING"] = "Throttling";
})(CacheSchemaType || (CacheSchemaType = {}));
/**
* Combine all cache types

@@ -390,3 +374,3 @@ */

export { AADAuthorityConstants, AADServerParamKeys, APP_METADATA, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme, AuthorityMetadataSource, CLIENT_INFO, CacheAccountType, CacheOutcome, CacheSchemaType, CacheType, ClaimsRequestKeys, CodeChallengeMethodValues, Constants, CredentialType, Errors, GrantType, HeaderNames, JsonTypes, OIDC_DEFAULT_SCOPES, OIDC_SCOPES, ONE_DAY_IN_MS, PasswordGrantConstants, PersistentCacheKeys, PromptValue, RegionDiscoveryOutcomes, RegionDiscoverySources, ResponseCodes, ResponseMode, SERVER_TELEM_CONSTANTS, SSOTypes, Separators, THE_FAMILY_ID, ThrottlingConstants };
export { AADAuthorityConstants, AADServerParamKeys, APP_METADATA, AUTHORITY_METADATA_CONSTANTS, AuthenticationScheme, AuthorityMetadataSource, CLIENT_INFO, CacheAccountType, CacheOutcome, CacheType, ClaimsRequestKeys, CodeChallengeMethodValues, Constants, CredentialType, Errors, GrantType, HeaderNames, JsonTypes, OIDC_DEFAULT_SCOPES, OIDC_SCOPES, ONE_DAY_IN_MS, PasswordGrantConstants, PersistentCacheKeys, PromptValue, RegionDiscoveryOutcomes, RegionDiscoverySources, ResponseCodes, ResponseMode, SERVER_TELEM_CONSTANTS, SSOTypes, Separators, THE_FAMILY_ID, ThrottlingConstants };
//# sourceMappingURL=Constants.js.map

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { StringUtils } from './StringUtils.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { ClientAuthError } from '../error/ClientAuthError.js';

@@ -1,2 +0,2 @@

/*! @azure/msal-common v11.0.0 2023-03-07 */
/*! @azure/msal-common v12.0.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ /*

@@ -13,3 +13,3 @@ {

},
"version": "11.0.0",
"version": "12.0.0",
"description": "Microsoft Authentication Library for js",

@@ -16,0 +16,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc