Socket
Socket
Sign inDemoInstall

@azure/msal-browser

Package Overview
Dependencies
Maintainers
3
Versions
119
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@azure/msal-browser - npm Package Compare versions

Comparing version 2.34.0 to 2.35.0

2

dist/_virtual/_tslib.js

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

@@ -177,6 +177,6 @@ import { AccountInfo, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto, PerformanceCallbackFunction, IPerformanceClient, BaseAuthRequest } from "@azure/msal-common";

* This API is provided for convenience but getAccountById should be used for best reliability
* @param userName
* @param username
* @returns The account object stored in MSAL
*/
getAccountByUsername(userName: string): AccountInfo | null;
getAccountByUsername(username: string): AccountInfo | null;
/**

@@ -183,0 +183,0 @@ * Returns the signed in account matching homeAccountId.

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';
import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { CryptoOps } from '../crypto/CryptoOps.js';
import { PerformanceEvents, Constants, InteractionRequiredAuthError, AuthError, ClientAuthError, StringUtils, PromptValue, Logger, StubPerformanceClient, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
import { PerformanceEvents, Constants, InteractionRequiredAuthError, AuthError, ClientAuthError, PromptValue, Logger, StubPerformanceClient, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
import { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER } from '../cache/BrowserCacheManager.js';

@@ -88,3 +88,4 @@ import { buildConfiguration } from '../config/Configuration.js';

storeAuthStateInCookie: false,
secureCookies: false
secureCookies: false,
cacheMigrationEnabled: false
};

@@ -722,12 +723,17 @@ this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);

* This API is provided for convenience but getAccountById should be used for best reliability
* @param userName
* @param username
* @returns The account object stored in MSAL
*/
ClientApplication.prototype.getAccountByUsername = function (userName) {
var allAccounts = this.getAllAccounts();
if (!StringUtils.isEmpty(userName) && allAccounts && allAccounts.length) {
this.logger.verbose("Account matching username found, returning");
this.logger.verbosePii("Returning signed-in accounts matching username: " + userName);
return allAccounts.filter(function (accountObj) { return accountObj.username.toLowerCase() === userName.toLowerCase(); })[0] || null;
ClientApplication.prototype.getAccountByUsername = function (username) {
this.logger.trace("getAccountByUsername called");
if (!username) {
this.logger.warning("getAccountByUsername: No username provided");
return null;
}
var account = this.browserStorage.getAccountInfoFilteredBy({ username: username });
if (account) {
this.logger.verbose("getAccountByUsername: Account matching username found, returning");
this.logger.verbosePii("getAccountByUsername: Returning signed-in accounts matching username: " + username);
return account;
}
else {

@@ -746,8 +752,13 @@ this.logger.verbose("getAccountByUsername: No matching account found, returning null");

ClientApplication.prototype.getAccountByHomeId = function (homeAccountId) {
var allAccounts = this.getAllAccounts();
if (!StringUtils.isEmpty(homeAccountId) && allAccounts && allAccounts.length) {
this.logger.verbose("Account matching homeAccountId found, returning");
this.logger.verbosePii("Returning signed-in accounts matching homeAccountId: " + homeAccountId);
return allAccounts.filter(function (accountObj) { return accountObj.homeAccountId === homeAccountId; })[0] || null;
this.logger.trace("getAccountByHomeId called");
if (!homeAccountId) {
this.logger.warning("getAccountByHomeId: No homeAccountId provided");
return null;
}
var account = this.browserStorage.getAccountInfoFilteredBy({ homeAccountId: homeAccountId });
if (account) {
this.logger.verbose("getAccountByHomeId: Account matching homeAccountId found, returning");
this.logger.verbosePii("getAccountByHomeId: Returning signed-in accounts matching homeAccountId: " + homeAccountId);
return account;
}
else {

@@ -766,8 +777,13 @@ this.logger.verbose("getAccountByHomeId: No matching account found, returning null");

ClientApplication.prototype.getAccountByLocalId = function (localAccountId) {
var allAccounts = this.getAllAccounts();
if (!StringUtils.isEmpty(localAccountId) && allAccounts && allAccounts.length) {
this.logger.verbose("Account matching localAccountId found, returning");
this.logger.verbosePii("Returning signed-in accounts matching localAccountId: " + localAccountId);
return allAccounts.filter(function (accountObj) { return accountObj.localAccountId === localAccountId; })[0] || null;
this.logger.trace("getAccountByLocalId called");
if (!localAccountId) {
this.logger.warning("getAccountByLocalId: No localAccountId provided");
return null;
}
var account = this.browserStorage.getAccountInfoFilteredBy({ localAccountId: localAccountId });
if (account) {
this.logger.verbose("getAccountByLocalId: Account matching localAccountId found, returning");
this.logger.verbosePii("getAccountByLocalId: Returning signed-in accounts matching localAccountId: " + localAccountId);
return account;
}
else {

@@ -774,0 +790,0 @@ this.logger.verbose("getAccountByLocalId: No matching account found, returning null");

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo, ValidCredentialType } from "@azure/msal-common";
import { CommonAuthorizationCodeRequest, ICrypto, AccountEntity, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, CacheManager, ServerTelemetryEntity, ThrottlingEntity, Logger, AuthorityMetadataEntity, AccountInfo, ValidCredentialType, TokenKeys, CredentialType } from "@azure/msal-common";
import { CacheOptions } from "../config/Configuration";

@@ -43,2 +43,8 @@ import { BrowserCacheLocation, InteractionType } from "../utils/BrowserConstants";

/**
* Searches all cache entries for MSAL accounts and creates the account key map
* This is used to migrate users from older versions of MSAL which did not create the map.
* @returns
*/
private createKeyMaps;
/**
* Parses passed value as JSON object, JSON.parse() will throw an error.

@@ -71,2 +77,54 @@ * @param input

/**
* Returns the array of account keys currently cached
* @returns
*/
getAccountKeys(): Array<string>;
/**
* Add a new account to the key map
* @param key
*/
addAccountKeyToMap(key: string): void;
/**
* Remove an account from the key map
* @param key
*/
removeAccountKeyFromMap(key: string): void;
/**
* Extends inherited removeAccount function to include removal of the account key from the map
* @param key
*/
removeAccount(key: string): Promise<void>;
/**
* Removes given idToken from the cache and from the key map
* @param key
*/
removeIdToken(key: string): void;
/**
* Removes given accessToken from the cache and from the key map
* @param key
*/
removeAccessToken(key: string): Promise<void>;
/**
* Removes given refreshToken from the cache and from the key map
* @param key
*/
removeRefreshToken(key: string): void;
/**
* Gets the keys for the cached tokens associated with this clientId
* @returns
*/
getTokenKeys(): TokenKeys;
/**
* Adds the given key to the token key map
* @param key
* @param type
*/
addTokenKey(key: string, type: CredentialType): void;
/**
* Removes the given key from the token key map
* @param key
* @param type
*/
removeTokenKey(key: string, type: CredentialType): void;
/**
* generates idToken entity from a string

@@ -195,3 +253,3 @@ * @param idTokenKey

*/
removeItem(key: string): boolean;
removeItem(key: string): void;
/**

@@ -198,0 +256,0 @@ * Checks whether key is in cache.

@@ -1,7 +0,7 @@

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';
import { __extends, __spread, __awaiter, __generator } from '../_virtual/_tslib.js';
import { AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, Constants, PersistentCacheKeys, ClientAuthError, ThrottlingEntity, StringUtils, ProtocolUtils, CcsCredentialType, IdToken, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
import { __extends, __awaiter, __generator, __spread } from '../_virtual/_tslib.js';
import { CredentialType, RefreshTokenEntity, CacheManager, AccessTokenEntity, IdTokenEntity, AccountEntity, ClientAuthError, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, Constants, PersistentCacheKeys, ThrottlingEntity, StringUtils, ProtocolUtils, CcsCredentialType, IdToken, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
import { BrowserAuthError } from '../error/BrowserAuthError.js';
import { BrowserCacheLocation, InMemoryCacheKeys, TemporaryCacheKeys } from '../utils/BrowserConstants.js';
import { BrowserCacheLocation, StaticCacheKeys, InMemoryCacheKeys, TemporaryCacheKeys } from '../utils/BrowserConstants.js';
import { BrowserStorage } from './BrowserStorage.js';

@@ -23,3 +23,3 @@ import { MemoryStorage } from './MemoryStorage.js';

function BrowserCacheManager(clientId, cacheConfig, cryptoImpl, logger) {
var _this = _super.call(this, clientId, cryptoImpl) || this;
var _this = _super.call(this, clientId, cryptoImpl, logger) || this;
// Cookie life calculation (hours * minutes * seconds * ms)

@@ -32,4 +32,7 @@ _this.COOKIE_LIFE_MULTIPLIER = 24 * 60 * 60 * 1000;

_this.temporaryCacheStorage = _this.setupTemporaryCacheStorage(_this.cacheConfig.cacheLocation);
// Migrate any cache entries from older versions of MSAL.
_this.migrateCacheEntries();
// Migrate cache entries from older versions of MSAL.
if (cacheConfig.cacheMigrationEnabled) {
_this.migrateCacheEntries();
_this.createKeyMaps();
}
return _this;

@@ -108,2 +111,87 @@ }

/**
* Searches all cache entries for MSAL accounts and creates the account key map
* This is used to migrate users from older versions of MSAL which did not create the map.
* @returns
*/
BrowserCacheManager.prototype.createKeyMaps = function () {
var _this = this;
this.logger.trace("BrowserCacheManager - createKeyMaps called.");
var accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);
var tokenKeys = this.getItem(StaticCacheKeys.TOKEN_KEYS + "." + this.clientId);
if (accountKeys && tokenKeys) {
this.logger.verbose("BrowserCacheManager:createKeyMaps - account and token key maps already exist, skipping migration.");
// Key maps already exist, no need to iterate through cache
return;
}
var allKeys = this.browserStorage.getKeys();
allKeys.forEach(function (key) {
if (_this.isCredentialKey(key)) {
// Get item, parse, validate and write key to map
var value = _this.getItem(key);
if (value) {
var credObj = _this.validateAndParseJson(value);
if (credObj && credObj.hasOwnProperty("credentialType")) {
switch (credObj["credentialType"]) {
case CredentialType.ID_TOKEN:
if (IdTokenEntity.isIdTokenEntity(credObj)) {
_this.logger.trace("BrowserCacheManager:createKeyMaps - idToken found, saving key to token key map");
_this.logger.tracePii("BrowserCacheManager:createKeyMaps - idToken with key: " + key + " found, saving key to token key map");
var idTokenEntity = CacheManager.toObject(new IdTokenEntity(), credObj);
var newKey = _this.updateCredentialCacheKey(key, idTokenEntity);
_this.addTokenKey(newKey, CredentialType.ID_TOKEN);
return;
}
else {
_this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching idToken schema with value containing idToken credentialType field but value failed IdTokenEntity validation, skipping.");
_this.logger.tracePii("BrowserCacheManager:createKeyMaps - failed idToken validation on key: " + key);
}
break;
case CredentialType.ACCESS_TOKEN:
case CredentialType.ACCESS_TOKEN_WITH_AUTH_SCHEME:
if (AccessTokenEntity.isAccessTokenEntity(credObj)) {
_this.logger.trace("BrowserCacheManager:createKeyMaps - accessToken found, saving key to token key map");
_this.logger.tracePii("BrowserCacheManager:createKeyMaps - accessToken with key: " + key + " found, saving key to token key map");
var accessTokenEntity = CacheManager.toObject(new AccessTokenEntity(), credObj);
var newKey = _this.updateCredentialCacheKey(key, accessTokenEntity);
_this.addTokenKey(newKey, CredentialType.ACCESS_TOKEN);
return;
}
else {
_this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching accessToken schema with value containing accessToken credentialType field but value failed AccessTokenEntity validation, skipping.");
_this.logger.tracePii("BrowserCacheManager:createKeyMaps - failed accessToken validation on key: " + key);
}
break;
case CredentialType.REFRESH_TOKEN:
if (RefreshTokenEntity.isRefreshTokenEntity(credObj)) {
_this.logger.trace("BrowserCacheManager:createKeyMaps - refreshToken found, saving key to token key map");
_this.logger.tracePii("BrowserCacheManager:createKeyMaps - refreshToken with key: " + key + " found, saving key to token key map");
var refreshTokenEntity = CacheManager.toObject(new RefreshTokenEntity(), credObj);
var newKey = _this.updateCredentialCacheKey(key, refreshTokenEntity);
_this.addTokenKey(newKey, CredentialType.REFRESH_TOKEN);
return;
}
else {
_this.logger.trace("BrowserCacheManager:createKeyMaps - key found matching refreshToken schema with value containing refreshToken credentialType field but value failed RefreshTokenEntity validation, skipping.");
_this.logger.tracePii("BrowserCacheManager:createKeyMaps - failed refreshToken validation on key: " + key);
}
break;
// If credentialType isn't one of our predefined ones, it may not be an MSAL cache value. Ignore.
}
}
}
}
if (_this.isAccountKey(key)) {
var value = _this.getItem(key);
if (value) {
var accountObj = _this.validateAndParseJson(value);
if (accountObj && AccountEntity.isAccountEntity(accountObj)) {
_this.logger.trace("BrowserCacheManager:createKeyMaps - account found, saving key to account key map");
_this.logger.tracePii("BrowserCacheManager:createKeyMaps - account with key: " + key + " found, saving key to account key map");
_this.addAccountKeyToMap(key);
}
}
}
});
};
/**
* Parses passed value as JSON object, JSON.parse() will throw an error.

@@ -147,4 +235,6 @@ * @param input

BrowserCacheManager.prototype.getAccount = function (accountKey) {
this.logger.trace("BrowserCacheManager.getAccount called");
var account = this.getItem(accountKey);
if (!account) {
this.removeAccountKeyFromMap(accountKey);
return null;

@@ -154,2 +244,3 @@ }

if (!parsedAccount || !AccountEntity.isAccountEntity(parsedAccount)) {
this.removeAccountKeyFromMap(accountKey);
return null;

@@ -168,4 +259,205 @@ }

this.setItem(key, JSON.stringify(account));
this.addAccountKeyToMap(key);
};
/**
* Returns the array of account keys currently cached
* @returns
*/
BrowserCacheManager.prototype.getAccountKeys = function () {
this.logger.trace("BrowserCacheManager.getAccountKeys called");
var accountKeys = this.getItem(StaticCacheKeys.ACCOUNT_KEYS);
if (accountKeys) {
return JSON.parse(accountKeys);
}
this.logger.verbose("BrowserCacheManager.getAccountKeys - No account keys found");
return [];
};
/**
* Add a new account to the key map
* @param key
*/
BrowserCacheManager.prototype.addAccountKeyToMap = function (key) {
this.logger.trace("BrowserCacheManager.addAccountKeyToMap called");
this.logger.tracePii("BrowserCacheManager.addAccountKeyToMap called with key: " + key);
var accountKeys = this.getAccountKeys();
if (accountKeys.indexOf(key) === -1) {
// Only add key if it does not already exist in the map
accountKeys.push(key);
this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key added");
}
else {
this.logger.verbose("BrowserCacheManager.addAccountKeyToMap account key already exists in map");
}
};
/**
* Remove an account from the key map
* @param key
*/
BrowserCacheManager.prototype.removeAccountKeyFromMap = function (key) {
this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap called");
this.logger.tracePii("BrowserCacheManager.removeAccountKeyFromMap called with key: " + key);
var accountKeys = this.getAccountKeys();
var removalIndex = accountKeys.indexOf(key);
if (removalIndex > -1) {
accountKeys.splice(removalIndex, 1);
this.setItem(StaticCacheKeys.ACCOUNT_KEYS, JSON.stringify(accountKeys));
this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap account key removed");
}
else {
this.logger.trace("BrowserCacheManager.removeAccountKeyFromMap key not found in existing map");
}
};
/**
* Extends inherited removeAccount function to include removal of the account key from the map
* @param key
*/
BrowserCacheManager.prototype.removeAccount = function (key) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
_super.prototype.removeAccount.call(this, key);
this.removeAccountKeyFromMap(key);
return [2 /*return*/];
});
});
};
/**
* Removes given idToken from the cache and from the key map
* @param key
*/
BrowserCacheManager.prototype.removeIdToken = function (key) {
_super.prototype.removeIdToken.call(this, key);
this.removeTokenKey(key, CredentialType.ID_TOKEN);
};
/**
* Removes given accessToken from the cache and from the key map
* @param key
*/
BrowserCacheManager.prototype.removeAccessToken = function (key) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
_super.prototype.removeAccessToken.call(this, key);
this.removeTokenKey(key, CredentialType.ACCESS_TOKEN);
return [2 /*return*/];
});
});
};
/**
* Removes given refreshToken from the cache and from the key map
* @param key
*/
BrowserCacheManager.prototype.removeRefreshToken = function (key) {
_super.prototype.removeRefreshToken.call(this, key);
this.removeTokenKey(key, CredentialType.REFRESH_TOKEN);
};
/**
* Gets the keys for the cached tokens associated with this clientId
* @returns
*/
BrowserCacheManager.prototype.getTokenKeys = function () {
this.logger.trace("BrowserCacheManager.getTokenKeys called");
var item = this.getItem(StaticCacheKeys.TOKEN_KEYS + "." + this.clientId);
if (item) {
var tokenKeys = this.validateAndParseJson(item);
if (tokenKeys &&
tokenKeys.hasOwnProperty("idToken") &&
tokenKeys.hasOwnProperty("accessToken") &&
tokenKeys.hasOwnProperty("refreshToken")) {
return tokenKeys;
}
else {
this.logger.error("BrowserCacheManager.getTokenKeys - Token keys found but in an unknown format. Returning empty key map.");
}
}
else {
this.logger.verbose("BrowserCacheManager.getTokenKeys - No token keys found");
}
return {
idToken: [],
accessToken: [],
refreshToken: []
};
};
/**
* Adds the given key to the token key map
* @param key
* @param type
*/
BrowserCacheManager.prototype.addTokenKey = function (key, type) {
this.logger.trace("BrowserCacheManager addTokenKey called");
var tokenKeys = this.getTokenKeys();
switch (type) {
case CredentialType.ID_TOKEN:
if (tokenKeys.idToken.indexOf(key) === -1) {
this.logger.info("BrowserCacheManager: addTokenKey - idToken added to map");
tokenKeys.idToken.push(key);
}
break;
case CredentialType.ACCESS_TOKEN:
if (tokenKeys.accessToken.indexOf(key) === -1) {
this.logger.info("BrowserCacheManager: addTokenKey - accessToken added to map");
tokenKeys.accessToken.push(key);
}
break;
case CredentialType.REFRESH_TOKEN:
if (tokenKeys.refreshToken.indexOf(key) === -1) {
this.logger.info("BrowserCacheManager: addTokenKey - refreshToken added to map");
tokenKeys.refreshToken.push(key);
}
break;
default:
this.logger.error("BrowserCacheManager:addTokenKey - CredentialType provided invalid. CredentialType: " + type);
ClientAuthError.createUnexpectedCredentialTypeError();
}
this.setItem(StaticCacheKeys.TOKEN_KEYS + "." + this.clientId, JSON.stringify(tokenKeys));
};
/**
* Removes the given key from the token key map
* @param key
* @param type
*/
BrowserCacheManager.prototype.removeTokenKey = function (key, type) {
this.logger.trace("BrowserCacheManager removeTokenKey called");
var tokenKeys = this.getTokenKeys();
switch (type) {
case CredentialType.ID_TOKEN:
this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove idToken with key: " + key + " from map");
var idRemoval = tokenKeys.idToken.indexOf(key);
if (idRemoval > -1) {
this.logger.info("BrowserCacheManager: removeTokenKey - idToken removed from map");
tokenKeys.idToken.splice(idRemoval, 1);
}
else {
this.logger.info("BrowserCacheManager: removeTokenKey - idToken does not exist in map. Either it was previously removed or it was never added.");
}
break;
case CredentialType.ACCESS_TOKEN:
this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove accessToken with key: " + key + " from map");
var accessRemoval = tokenKeys.accessToken.indexOf(key);
if (accessRemoval > -1) {
this.logger.info("BrowserCacheManager: removeTokenKey - accessToken removed from map");
tokenKeys.idToken.splice(accessRemoval, 1);
}
else {
this.logger.info("BrowserCacheManager: removeTokenKey - accessToken does not exist in map. Either it was previously removed or it was never added.");
}
break;
case CredentialType.REFRESH_TOKEN:
this.logger.infoPii("BrowserCacheManager: removeTokenKey - attempting to remove refreshToken with key: " + key + " from map");
var refreshRemoval = tokenKeys.refreshToken.indexOf(key);
if (refreshRemoval > -1) {
this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken removed from map");
tokenKeys.idToken.splice(refreshRemoval, 1);
}
else {
this.logger.info("BrowserCacheManager: removeTokenKey - refreshToken does not exist in map. Either it was previously removed or it was never added.");
}
break;
default:
this.logger.error("BrowserCacheManager:removeTokenKey - CredentialType provided invalid. CredentialType: " + type);
ClientAuthError.createUnexpectedCredentialTypeError();
}
this.setItem(StaticCacheKeys.TOKEN_KEYS + "." + this.clientId, JSON.stringify(tokenKeys));
};
/**
* generates idToken entity from a string

@@ -178,2 +470,3 @@ * @param idTokenKey

this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit");
this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);
return null;

@@ -184,2 +477,3 @@ }

this.logger.trace("BrowserCacheManager.getIdTokenCredential: called, no cache hit");
this.removeTokenKey(idTokenKey, CredentialType.ID_TOKEN);
return null;

@@ -198,2 +492,3 @@ }

this.setItem(idTokenKey, JSON.stringify(idToken));
this.addTokenKey(idTokenKey, CredentialType.ID_TOKEN);
};

@@ -208,2 +503,3 @@ /**

this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit");
this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
return null;

@@ -214,2 +510,3 @@ }

this.logger.trace("BrowserCacheManager.getAccessTokenCredential: called, no cache hit");
this.removeTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
return null;

@@ -228,2 +525,3 @@ }

this.setItem(accessTokenKey, JSON.stringify(accessToken));
this.addTokenKey(accessTokenKey, CredentialType.ACCESS_TOKEN);
};

@@ -238,2 +536,3 @@ /**

this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit");
this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
return null;

@@ -244,2 +543,3 @@ }

this.logger.trace("BrowserCacheManager.getRefreshTokenCredential: called, no cache hit");
this.removeTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
return null;

@@ -258,2 +558,3 @@ }

this.setItem(refreshTokenKey, JSON.stringify(refreshToken));
this.addTokenKey(refreshTokenKey, CredentialType.REFRESH_TOKEN);
};

@@ -556,3 +857,2 @@ /**

}
return true;
};

@@ -985,3 +1285,4 @@ /**

storeAuthStateInCookie: false,
secureCookies: false
secureCookies: false,
cacheMigrationEnabled: false
};

@@ -988,0 +1289,0 @@ return new BrowserCacheManager(clientId, cacheOptions, DEFAULT_CRYPTO_IMPLEMENTATION, logger);

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { AuthToken, CacheRecord, Authority, AccountEntity, IdTokenEntity, ScopeSet, AccessTokenEntity, RefreshTokenEntity, Constants } from '@azure/msal-common';

@@ -77,2 +77,6 @@ import { SystemOptions, LoggerOptions, INetworkModule, ProtocolMode, AzureCloudOptions, ApplicationTelemetry } from "@azure/msal-common";

secureCookies?: boolean;
/**
* If set, MSAL will attempt to migrate cache entries from older versions on initialization. By default this flag is set to true if cacheLocation is localStorage, otherwise false.
*/
cacheMigrationEnabled?: boolean;
};

@@ -79,0 +83,0 @@ export declare type BrowserSystemOptions = SystemOptions & {

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

storeAuthStateInCookie: false,
secureCookies: false
secureCookies: false,
// Default cache migration to true if cache location is localStorage since entries are preserved across tabs/windows. Migration has little to no benefit in sessionStorage and memoryStorage
cacheMigrationEnabled: userInputCache && userInputCache.cacheLocation === BrowserCacheLocation.LocalStorage ? true : false
};

@@ -54,0 +56,0 @@ // Default logger options for browser

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { Constants } from '@azure/msal-common';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { Constants } from '@azure/msal-common';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { Constants } from '@azure/msal-common';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { AccountEntity, CacheManager } from '@azure/msal-common';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import * as internals from './internals.js';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -113,11 +113,14 @@ import { __extends, __awaiter, __generator, __rest, __assign } from '../_virtual/_tslib.js';

return __awaiter(this, void 0, void 0, function () {
var accountEntity, account, silentRequest, result, e_2;
var account, silentRequest, result, e_2;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
accountEntity = this.browserStorage.readAccountFromCacheWithNativeAccountId(nativeAccountId);
if (!accountEntity) {
if (!nativeAccountId) {
this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided");
throw ClientAuthError.createNoAccountFoundError();
}
account = accountEntity.getAccountInfo();
account = this.browserStorage.getAccountInfoFilteredBy({ nativeAccountId: nativeAccountId });
if (!account) {
throw ClientAuthError.createNoAccountFoundError();
}
_a.label = 1;

@@ -262,6 +265,2 @@ case 1:

}
if (response.account.id !== request.accountId) {
// User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync
throw NativeAuthError.createUserSwitchError();
}
return [4 /*yield*/, this.getDiscoveredAuthority(request.authority)];

@@ -268,0 +267,0 @@ case 1:

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ export { BrowserCacheManager } from './cache/BrowserCacheManager.js';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

export declare const name = "@azure/msal-browser";
export declare const version = "2.34.0";
export declare const version = "2.35.0";
//# sourceMappingURL=packageMetadata.d.ts.map

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';
/* eslint-disable header/header */
var name = "@azure/msal-browser";
var version = "2.34.0";
var version = "2.35.0";
export { name, version };
//# sourceMappingURL=packageMetadata.js.map

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

}
this.preQueueTimeByCorrelationId.set(eventName, { name: eventName, time: window.performance.now() });
this.preQueueTimeByCorrelationId.set(correlationId, { name: eventName, time: window.performance.now() });
};

@@ -100,0 +100,0 @@ /**

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

@@ -79,2 +79,6 @@ import { PopupRequest } from "../request/PopupRequest";

}
export declare enum StaticCacheKeys {
ACCOUNT_KEYS = "msal.account.keys",
TOKEN_KEYS = "msal.token.keys"
}
/**

@@ -81,0 +85,0 @@ * Cache keys stored in-memory

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -89,2 +89,7 @@ import { OIDC_DEFAULT_SCOPES } from '@azure/msal-common';

})(TemporaryCacheKeys || (TemporaryCacheKeys = {}));
var StaticCacheKeys;
(function (StaticCacheKeys) {
StaticCacheKeys["ACCOUNT_KEYS"] = "msal.account.keys";
StaticCacheKeys["TOKEN_KEYS"] = "msal.token.keys";
})(StaticCacheKeys || (StaticCacheKeys = {}));
/**

@@ -216,3 +221,3 @@ * Cache keys stored in-memory

export { ApiId, BrowserCacheLocation, BrowserConstants, CacheLookupPolicy, DB_NAME, DB_TABLE_NAME, DB_VERSION, DEFAULT_REQUEST, HTTP_REQUEST_TYPE, InMemoryCacheKeys, InteractionStatus, InteractionType, KEY_FORMAT_JWK, NativeConstants, NativeExtensionMethod, TemporaryCacheKeys, WrapperSKU };
export { ApiId, BrowserCacheLocation, BrowserConstants, CacheLookupPolicy, DB_NAME, DB_TABLE_NAME, DB_VERSION, DEFAULT_REQUEST, HTTP_REQUEST_TYPE, InMemoryCacheKeys, InteractionStatus, InteractionType, KEY_FORMAT_JWK, NativeConstants, NativeExtensionMethod, StaticCacheKeys, TemporaryCacheKeys, WrapperSKU };
//# sourceMappingURL=BrowserConstants.js.map

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { StringUtils, ProtocolUtils, ClientAuthError, UrlString } from '@azure/msal-common';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { Constants } from '@azure/msal-common';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

@@ -3,0 +3,0 @@ import { Constants, UrlString } from '@azure/msal-common';

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

/*! @azure/msal-browser v2.34.0 2023-03-07 */
/*! @azure/msal-browser v2.35.0 2023-04-03 */
'use strict';

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

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

},
"version": "2.34.0",
"version": "2.35.0",
"description": "Microsoft Authentication Library for js",

@@ -94,4 +94,4 @@ "keywords": [

"dependencies": {
"@azure/msal-common": "^11.0.0"
"@azure/msal-common": "^12.0.0"
}
}

@@ -62,3 +62,3 @@ # Microsoft Authentication Library for JavaScript (MSAL.js) 2.0 for Browser-Based Single-Page Applications

```html
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.33.0/js/msal-browser.min.js"></script>
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.34.0/js/msal-browser.min.js"></script>
```

@@ -65,0 +65,0 @@

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 too big to display

Sorry, the diff of this file is not supported yet

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

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