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.22.1 to 2.23.0

dist/telemetry/BrowserPerformanceClient.d.ts

2

dist/_virtual/_tslib.js

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

import { AccountInfo, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto } from "@azure/msal-common";
import { AccountInfo, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto, PerformanceCallbackFunction, IPerformanceClient, BaseAuthRequest } from "@azure/msal-common";
import { BrowserCacheManager } from "../cache/BrowserCacheManager";

@@ -27,2 +27,3 @@ import { BrowserConfiguration, Configuration } from "../config/Configuration";

private hybridAuthCodeResponses;
protected performanceClient: IPerformanceClient;
/**

@@ -201,2 +202,16 @@ * @constructor

/**
* Registers a callback to receive performance events.
*
* @param {PerformanceCallbackFunction} callback
* @returns {string}
*/
addPerformanceCallback(callback: PerformanceCallbackFunction): string;
/**
* Removes a callback registered with addPerformanceCallback.
*
* @param {string} callbackId
* @returns {boolean}
*/
removePerformanceCallback(callbackId: string): boolean;
/**
* Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window

@@ -237,3 +252,11 @@ */

getConfiguration(): BrowserConfiguration;
/**
* Generates a correlation id for a request if none is provided.
*
* @protected
* @param {?Partial<BaseAuthRequest>} [request]
* @returns {string}
*/
protected getRequestCorrelationId(request?: Partial<BaseAuthRequest>): string;
}
//# sourceMappingURL=ClientApplication.d.ts.map

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

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

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

import { BrowserAuthError } from '../error/BrowserAuthError.js';
import { BrowserPerformanceClient } from '../telemetry/BrowserPerformanceClient.js';

@@ -68,4 +69,8 @@ /*

this.hybridAuthCodeResponses = new Map();
// Initialize performance client
this.performanceClient = this.isBrowserEnvironment ?
new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application) :
new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);
// Initialize the crypto class.
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger) : DEFAULT_CRYPTO_IMPLEMENTATION;
this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger, this.performanceClient) : DEFAULT_CRYPTO_IMPLEMENTATION;
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);

@@ -100,4 +105,4 @@ // Initialize the browser storage class.

this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || "";
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, correlationId);
correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
response = redirectClient.handleRedirectPromise(hash)

@@ -154,7 +159,7 @@ .then(function (result) {

return __awaiter(this, void 0, void 0, function () {
var isLoggedIn, redirectClient;
var correlationId, isLoggedIn, redirectClient;
var _this = this;
return __generator(this, function (_a) {
// Preflight request
this.logger.verbose("acquireTokenRedirect called");
correlationId = this.getRequestCorrelationId(request);
this.logger.verbose("acquireTokenRedirect called", correlationId);
this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);

@@ -168,4 +173,4 @@ isLoggedIn = this.getAllAccounts().length > 0;

}
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
return [2 /*return*/, redirectClient.acquireToken(request).catch(function (e) {
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
return [2 /*return*/, redirectClient.acquireToken(__assign(__assign({}, request), { correlationId: correlationId })).catch(function (e) {
// If logged in, emit acquire token events

@@ -194,4 +199,5 @@ if (isLoggedIn) {

var _this = this;
var correlationId = this.getRequestCorrelationId(request);
try {
this.logger.verbose("acquireTokenPopup called", request.correlationId);
this.logger.verbose("acquireTokenPopup called", correlationId);
this.preflightBrowserEnvironmentCheck(InteractionType.Popup);

@@ -211,4 +217,4 @@ }

}
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
return popupClient.acquireToken(request).then(function (result) {
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
return popupClient.acquireToken(__assign(__assign({}, request), { correlationId: correlationId })).then(function (result) {
// If logged in, emit acquire token events

@@ -253,8 +259,10 @@ var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;

return __awaiter(this, void 0, void 0, function () {
var silentIframeClient, silentTokenResult, e_1;
var correlationId, ssoSilentMeasurement, silentIframeClient, silentTokenResult, e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
correlationId = this.getRequestCorrelationId(request);
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
this.logger.verbose("ssoSilent called", request.correlationId);
ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);
this.logger.verbose("ssoSilent called", correlationId);
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, InteractionType.Silent, request);

@@ -264,7 +272,11 @@ _a.label = 1;

_a.trys.push([1, 3, , 4]);
silentIframeClient = new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, request.correlationId);
return [4 /*yield*/, silentIframeClient.acquireToken(request)];
silentIframeClient = new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, correlationId);
return [4 /*yield*/, silentIframeClient.acquireToken(__assign(__assign({}, request), { correlationId: correlationId }))];
case 2:
silentTokenResult = _a.sent();
this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, silentTokenResult);
ssoSilentMeasurement.endMeasurement({
success: true
});
ssoSilentMeasurement.flushMeasurement();
return [2 /*return*/, silentTokenResult];

@@ -274,2 +286,6 @@ case 3:

this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, InteractionType.Silent, null, e_1);
ssoSilentMeasurement.endMeasurement({
success: false
});
ssoSilentMeasurement.flushMeasurement();
throw e_1;

@@ -293,8 +309,10 @@ case 4: return [2 /*return*/];

return __awaiter(this, void 0, void 0, function () {
var response;
var correlationId, atbcMeasurement, response;
var _this = this;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(request);
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
this.logger.trace("acquireTokenByCode called", request.correlationId);
this.logger.trace("acquireTokenByCode called", correlationId);
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, InteractionType.Silent, request);
atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, request.correlationId);
try {

@@ -306,7 +324,11 @@ if (!request.code) {

if (!response) {
this.logger.verbose("Initiating new acquireTokenByCode request", request.correlationId);
response = this.acquireTokenByCodeAsync(request)
this.logger.verbose("Initiating new acquireTokenByCode request", correlationId);
response = this.acquireTokenByCodeAsync(__assign(__assign({}, request), { correlationId: correlationId }))
.then(function (result) {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, InteractionType.Silent, result);
_this.hybridAuthCodeResponses.delete(request.code);
atbcMeasurement.endMeasurement({
success: true
});
atbcMeasurement.flushMeasurement();
return result;

@@ -316,2 +338,7 @@ })

_this.hybridAuthCodeResponses.delete(request.code);
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, error);
atbcMeasurement.endMeasurement({
success: false
});
atbcMeasurement.flushMeasurement();
throw error;

@@ -323,2 +350,6 @@ });

this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
atbcMeasurement.endMeasurement({
success: true
});
atbcMeasurement.discardMeasurement();
}

@@ -329,2 +360,5 @@ return [2 /*return*/, response];

this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, e);
atbcMeasurement.endMeasurement({
success: false
});
throw e;

@@ -348,3 +382,3 @@ }

this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, request.correlationId);
silentAuthCodeClient = new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, request.correlationId);
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)];

@@ -371,10 +405,19 @@ case 1:

return __awaiter(this, void 0, void 0, function () {
var silentRefreshClient;
var atbrtMeasurement, silentRefreshClient;
var _this = this;
return __generator(this, function (_a) {
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, request);
// block the reload if it occurred inside a hidden iframe
BrowserUtils.blockReloadInHiddenIframes();
silentRefreshClient = new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
return [2 /*return*/, silentRefreshClient.acquireToken(request).catch(function (e) {
atbrtMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByRefreshToken, request.correlationId);
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, request);
silentRefreshClient = new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, request.correlationId);
return [2 /*return*/, silentRefreshClient.acquireToken(request)
.then(function (result) {
atbrtMeasurement.endMeasurement({
success: true,
fromCache: result.fromCache
});
return result;
})
.catch(function (e) {
var isServerError = e instanceof ServerError;

@@ -385,5 +428,21 @@ var isInteractionRequiredError = e instanceof InteractionRequiredAuthError;

_this.logger.verbose("Refresh token expired or invalid, attempting acquire token by iframe", request.correlationId);
var silentIframeClient = new SilentIframeClient(_this.config, _this.browserStorage, _this.browserCrypto, _this.logger, _this.eventHandler, _this.navigationClient, ApiId.acquireTokenSilent_authCode, request.correlationId);
return silentIframeClient.acquireToken(request);
var silentIframeClient = new SilentIframeClient(_this.config, _this.browserStorage, _this.browserCrypto, _this.logger, _this.eventHandler, _this.navigationClient, ApiId.acquireTokenSilent_authCode, _this.performanceClient, request.correlationId);
return silentIframeClient.acquireToken(request)
.then(function (result) {
atbrtMeasurement.endMeasurement({
success: true,
fromCache: result.fromCache
});
return result;
})
.catch(function (error) {
atbrtMeasurement.endMeasurement({
success: false
});
throw error;
});
}
atbrtMeasurement.endMeasurement({
success: false
});
throw e;

@@ -403,5 +462,7 @@ })];

return __awaiter(this, void 0, void 0, function () {
var correlationId;
return __generator(this, function (_a) {
this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.");
return [2 /*return*/, this.logoutRedirect(logoutRequest)];
correlationId = this.getRequestCorrelationId(logoutRequest);
this.logger.warning("logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.", correlationId);
return [2 /*return*/, this.logoutRedirect(__assign({ correlationId: correlationId }, logoutRequest))];
});

@@ -417,7 +478,8 @@ });

return __awaiter(this, void 0, void 0, function () {
var redirectClient;
var correlationId, redirectClient;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(logoutRequest);
this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.correlationId);
return [2 /*return*/, redirectClient.logout(logoutRequest)];
redirectClient = new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
return [2 /*return*/, redirectClient.logout(__assign({ correlationId: correlationId }, logoutRequest))];
});

@@ -432,5 +494,6 @@ });

try {
var correlationId = this.getRequestCorrelationId(logoutRequest);
this.preflightBrowserEnvironmentCheck(InteractionType.Popup);
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, logoutRequest === null || logoutRequest === void 0 ? void 0 : logoutRequest.correlationId);
return popupClient.logout(logoutRequest);
var popupClient = new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, correlationId);
return popupClient.logout(__assign({ correlationId: correlationId }, logoutRequest));
}

@@ -578,2 +641,20 @@ catch (e) {

/**
* Registers a callback to receive performance events.
*
* @param {PerformanceCallbackFunction} callback
* @returns {string}
*/
ClientApplication.prototype.addPerformanceCallback = function (callback) {
return this.performanceClient.addPerformanceCallback(callback);
};
/**
* Removes a callback registered with addPerformanceCallback.
*
* @param {string} callbackId
* @returns {boolean}
*/
ClientApplication.prototype.removePerformanceCallback = function (callbackId) {
return this.performanceClient.removePerformanceCallback(callbackId);
};
/**
* Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window

@@ -631,2 +712,22 @@ */

};
/**
* Generates a correlation id for a request if none is provided.
*
* @protected
* @param {?Partial<BaseAuthRequest>} [request]
* @returns {string}
*/
ClientApplication.prototype.getRequestCorrelationId = function (request) {
if (request === null || request === void 0 ? void 0 : request.correlationId) {
return request.correlationId;
}
if (this.isBrowserEnvironment) {
return this.browserCrypto.createNewGuid();
}
/*
* Included for fallback for non-browser environments,
* and to ensure this method always returns a string.
*/
return Constants.EMPTY_STRING;
};
return ClientApplication;

@@ -633,0 +734,0 @@ }());

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

import { AuthenticationResult, AccountInfo, Logger } from "@azure/msal-common";
import { AuthenticationResult, AccountInfo, Logger, PerformanceCallbackFunction } from "@azure/msal-common";
import { RedirectRequest } from "../request/RedirectRequest";

@@ -20,2 +20,4 @@ import { PopupRequest } from "../request/PopupRequest";

removeEventCallback(callbackId: string): void;
addPerformanceCallback(callback: PerformanceCallbackFunction): string;
removePerformanceCallback(callbackId: string): boolean;
enableAccountStorageEvents(): void;

@@ -22,0 +24,0 @@ disableAccountStorageEvents(): void;

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

@@ -61,2 +61,8 @@ import { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js';

},
addPerformanceCallback: function () {
return "";
},
removePerformanceCallback: function () {
return false;
},
enableAccountStorageEvents: function () {

@@ -63,0 +69,0 @@ return;

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { PerformanceEvents, Constants } from '@azure/msal-common';
import { DEFAULT_REQUEST, InteractionType } from '../utils/BrowserConstants.js';

@@ -57,5 +58,7 @@ import { ClientApplication } from './ClientApplication.js';

return __awaiter(this, void 0, void 0, function () {
var correlationId;
return __generator(this, function (_a) {
this.logger.verbose("loginRedirect called");
return [2 /*return*/, this.acquireTokenRedirect(request || DEFAULT_REQUEST)];
correlationId = this.getRequestCorrelationId(request);
this.logger.verbose("loginRedirect called", correlationId);
return [2 /*return*/, this.acquireTokenRedirect(__assign({ correlationId: correlationId }, (request || DEFAULT_REQUEST)))];
});

@@ -72,4 +75,5 @@ });

PublicClientApplication.prototype.loginPopup = function (request) {
this.logger.verbose("loginPopup called");
return this.acquireTokenPopup(request || DEFAULT_REQUEST);
var correlationId = this.getRequestCorrelationId(request);
this.logger.verbose("loginPopup called", correlationId);
return this.acquireTokenPopup(__assign({ correlationId: correlationId }, (request || DEFAULT_REQUEST)));
};

@@ -84,7 +88,9 @@ /**

return __awaiter(this, void 0, void 0, function () {
var account, thumbprint, silentRequestKey, cachedResponse, response;
var correlationId, atsMeasurement, account, thumbprint, silentRequestKey, cachedResponse, response;
var _this = this;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(request);
atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
this.logger.verbose("acquireTokenSilent called", request.correlationId);
this.logger.verbose("acquireTokenSilent called", correlationId);
account = request.account || this.getActiveAccount();

@@ -96,3 +102,3 @@ if (!account) {

clientId: this.config.auth.clientId,
authority: request.authority || "",
authority: request.authority || Constants.EMPTY_STRING,
scopes: request.scopes,

@@ -110,6 +116,11 @@ homeAccountIdentifier: account.homeAccountId,

if (typeof cachedResponse === "undefined") {
this.logger.verbose("acquireTokenSilent called for the first time, storing active request", request.correlationId);
response = this.acquireTokenSilentAsync(request, account)
this.logger.verbose("acquireTokenSilent called for the first time, storing active request", correlationId);
response = this.acquireTokenSilentAsync(__assign(__assign({}, request), { correlationId: correlationId }), account)
.then(function (result) {
_this.activeSilentTokenRequests.delete(silentRequestKey);
atsMeasurement.endMeasurement({
success: true,
fromCache: result.fromCache
});
atsMeasurement.flushMeasurement();
return result;

@@ -119,2 +130,6 @@ })

_this.activeSilentTokenRequests.delete(silentRequestKey);
atsMeasurement.endMeasurement({
success: false
});
atsMeasurement.flushMeasurement();
throw error;

@@ -126,3 +141,8 @@ });

else {
this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call", request.correlationId);
this.logger.verbose("acquireTokenSilent has been called previously, returning the result from the first call", correlationId);
atsMeasurement.endMeasurement({
success: true
});
// Discard measurements for memoized calls, as they are usually only a couple of ms and will artificially deflate metrics
atsMeasurement.discardMeasurement();
return [2 /*return*/, cachedResponse];

@@ -141,3 +161,3 @@ }

return __awaiter(this, void 0, void 0, function () {
var silentCacheClient, silentRequest;
var astsAsyncMeasurement, silentCacheClient, silentRequest;
var _this = this;

@@ -147,3 +167,4 @@ return __generator(this, function (_a) {

case 0:
silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, request.correlationId);
astsAsyncMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
silentCacheClient = new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, request.correlationId);
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];

@@ -153,3 +174,11 @@ case 1:

this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);
return [2 /*return*/, silentCacheClient.acquireToken(silentRequest).catch(function () { return __awaiter(_this, void 0, void 0, function () {
return [2 /*return*/, silentCacheClient.acquireToken(silentRequest)
.then(function (result) {
astsAsyncMeasurement.endMeasurement({
success: true,
fromCache: result.fromCache
});
return result;
})
.catch(function () { return __awaiter(_this, void 0, void 0, function () {
var tokenRenewalResult, tokenRenewalError_1;

@@ -164,2 +193,6 @@ return __generator(this, function (_a) {

this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, tokenRenewalResult);
astsAsyncMeasurement.endMeasurement({
success: true,
fromCache: tokenRenewalResult.fromCache
});
return [2 /*return*/, tokenRenewalResult];

@@ -169,2 +202,5 @@ case 2:

this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError_1);
astsAsyncMeasurement.endMeasurement({
success: false
});
throw tokenRenewalError_1;

@@ -171,0 +207,0 @@ case 3: return [2 /*return*/];

@@ -11,3 +11,4 @@ import { Logger } from "@azure/msal-common";

private logger;
constructor(logger: Logger);
private storeName;
constructor(logger: Logger, storeName: string);
private handleDatabaseAccessError;

@@ -45,4 +46,4 @@ /**

*/
clear(): Promise<void>;
clear(): Promise<boolean>;
}
//# sourceMappingURL=AsyncMemoryStorage.d.ts.map

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

var AsyncMemoryStorage = /** @class */ (function () {
function AsyncMemoryStorage(logger) {
function AsyncMemoryStorage(logger, storeName) {
this.inMemoryCache = new MemoryStorage();
this.indexedDBCache = new DatabaseStorage();
this.logger = logger;
this.storeName = storeName;
}

@@ -27,2 +28,5 @@ AsyncMemoryStorage.prototype.handleDatabaseAccessError = function (error) {

}
else {
throw error;
}
};

@@ -172,7 +176,11 @@ /**

return __awaiter(this, void 0, void 0, function () {
var e_6;
var dbDeleted, e_6;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
// InMemory cache is a Map instance, clear is straightforward
this.logger.verbose("Deleting in-memory keystore " + this.storeName);
this.inMemoryCache.clear();
this.logger.verbose("In-memory keystore " + this.storeName + " deleted");
this.logger.verbose("Deleting persistent keystore " + this.storeName);
_a.label = 1;

@@ -183,8 +191,11 @@ case 1:

case 2:
_a.sent();
return [3 /*break*/, 4];
dbDeleted = _a.sent();
if (dbDeleted) {
this.logger.verbose("Persistent keystore " + this.storeName + " deleted");
}
return [2 /*return*/, dbDeleted];
case 3:
e_6 = _a.sent();
this.handleDatabaseAccessError(e_6);
return [3 /*break*/, 4];
return [2 /*return*/, false];
case 4: return [2 /*return*/];

@@ -191,0 +202,0 @@ }

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __spread, __awaiter, __generator } from '../_virtual/_tslib.js';
import { AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, PersistentCacheKeys, ThrottlingEntity, StringUtils, Constants, ProtocolUtils, CcsCredentialType, IdToken, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
import { AccountEntity, CacheManager, IdTokenEntity, AccessTokenEntity, RefreshTokenEntity, AppMetadataEntity, ServerTelemetryEntity, AuthorityMetadataEntity, Constants, PersistentCacheKeys, ThrottlingEntity, StringUtils, ProtocolUtils, CcsCredentialType, IdToken, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
import { BrowserAuthError } from '../error/BrowserAuthError.js';

@@ -338,4 +338,4 @@ import { BrowserCacheLocation, InMemoryCacheKeys, TemporaryCacheKeys } from '../utils/BrowserConstants.js';

BrowserCacheManager.prototype.getWrapperMetadata = function () {
var sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) || "";
var version = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_VER) || "";
var sku = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_SKU) || Constants.EMPTY_STRING;
var version = this.internalStorage.getItem(InMemoryCacheKeys.WRAPPER_VER) || Constants.EMPTY_STRING;
return [sku, version];

@@ -562,3 +562,3 @@ };

}
return "";
return Constants.EMPTY_STRING;
};

@@ -588,3 +588,3 @@ /**

BrowserCacheManager.prototype.clearItemCookie = function (cookieName) {
this.setItemCookie(cookieName, "", -1);
this.setItemCookie(cookieName, Constants.EMPTY_STRING, -1);
};

@@ -734,3 +734,3 @@ /**

this.logger.infoPii("BrowserCacheManager.cleanRequestByState: Removing temporary cache items for state: " + cachedState);
this.resetRequestCache(cachedState || "");
this.resetRequestCache(cachedState || Constants.EMPTY_STRING);
}

@@ -737,0 +737,0 @@ this.clearMsalCookies();

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

@@ -17,2 +17,7 @@ import { IAsyncStorage } from "./IAsyncMemoryStorage";

/**
* Closes the connection to IndexedDB database when all pending transactions
* complete.
*/
closeConnection(): void;
/**
* Opens database if it's not already open

@@ -19,0 +24,0 @@ */

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

@@ -46,2 +46,13 @@ import { __awaiter, __generator } from '../_virtual/_tslib.js';

/**
* Closes the connection to IndexedDB database when all pending transactions
* complete.
*/
DatabaseStorage.prototype.closeConnection = function () {
var db = this.db;
if (db && this.dbOpen) {
db.close();
this.dbOpen = false;
}
};
/**
* Opens database if it's not already open

@@ -84,5 +95,9 @@ */

var event = e;
_this.closeConnection();
resolve(event.target.result);
});
dbGet.addEventListener("error", function (e) { return reject(e); });
dbGet.addEventListener("error", function (e) {
_this.closeConnection();
reject(e);
});
})];

@@ -114,4 +129,10 @@ }

var dbPut = objectStore.put(payload, key);
dbPut.addEventListener("success", function () { return resolve(); });
dbPut.addEventListener("error", function (e) { return reject(e); });
dbPut.addEventListener("success", function () {
_this.closeConnection();
resolve();
});
dbPut.addEventListener("error", function (e) {
_this.closeConnection();
reject(e);
});
})];

@@ -141,4 +162,10 @@ }

var dbDelete = objectStore.delete(key);
dbDelete.addEventListener("success", function () { return resolve(); });
dbDelete.addEventListener("error", function (e) { return reject(e); });
dbDelete.addEventListener("success", function () {
_this.closeConnection();
resolve();
});
dbDelete.addEventListener("error", function (e) {
_this.closeConnection();
reject(e);
});
})];

@@ -169,5 +196,9 @@ }

var event = e;
_this.closeConnection();
resolve(event.target.result);
});
dbGetKeys.addEventListener("error", function (e) { return reject(e); });
dbGetKeys.addEventListener("error", function (e) {
_this.closeConnection();
reject(e);
});
})];

@@ -199,5 +230,9 @@ }

var event = e;
_this.closeConnection();
resolve(event.target.result === 1);
});
dbContainsKey.addEventListener("error", function (e) { return reject(e); });
dbContainsKey.addEventListener("error", function (e) {
_this.closeConnection();
reject(e);
});
})];

@@ -215,8 +250,25 @@ }

return __awaiter(this, void 0, void 0, function () {
var existingDatabases, database;
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
deleteDbRequest.addEventListener("success", function () { return resolve(true); });
deleteDbRequest.addEventListener("error", function () { return reject(false); });
})];
switch (_a.label) {
case 0:
// Check if database being deleted exists
if (this.db && this.dbOpen) {
this.closeConnection();
}
return [4 /*yield*/, window.indexedDB.databases()];
case 1:
existingDatabases = _a.sent();
database = existingDatabases.find(function (database) { return database.name === DB_NAME; });
// If database exists, delete it
if (database) {
return [2 /*return*/, new Promise(function (resolve, reject) {
var deleteDbRequest = window.indexedDB.deleteDatabase(DB_NAME);
deleteDbRequest.addEventListener("success", function () { return resolve(true); });
deleteDbRequest.addEventListener("error", function () { return reject(false); });
})];
}
// Database doesn't exist, return true
return [2 /*return*/, true];
}
});

@@ -223,0 +275,0 @@ });

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

import { SystemOptions, LoggerOptions, INetworkModule, ProtocolMode, AzureCloudOptions } from "@azure/msal-common";
import { SystemOptions, LoggerOptions, INetworkModule, ProtocolMode, AzureCloudOptions, ApplicationTelemetry } from "@azure/msal-common";
import { BrowserCacheLocation } from "../utils/BrowserConstants";

@@ -72,2 +72,11 @@ import { INavigationClient } from "../navigation/INavigationClient";

/**
* Telemetry Options
* - application: Telemetry information sent on request
* - appName: Unique string name of an application
* - appVersion: Version of the application using MSAL
*/
export declare type BrowserTelemetryOptions = {
application?: ApplicationTelemetry;
};
/**
* Use the configuration object to configure MSAL and initialize the UserAgentApplication.

@@ -79,2 +88,3 @@ *

* - system: this is where you can configure the network client, logger, token renewal offset
* - telemetry: this is where you can configure telemetry data and options
*/

@@ -85,2 +95,3 @@ export declare type Configuration = {

system?: BrowserSystemOptions;
telemetry?: BrowserTelemetryOptions;
};

@@ -91,2 +102,3 @@ export declare type BrowserConfiguration = {

system: Required<BrowserSystemOptions>;
telemetry: Required<BrowserTelemetryOptions>;
};

@@ -102,3 +114,3 @@ /**

*/
export declare function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration;
export declare function buildConfiguration({ auth: userInputAuth, cache: userInputCache, system: userInputSystem, telemetry: userInputTelemetry }: Configuration, isBrowserEnvironment: boolean): BrowserConfiguration;
//# sourceMappingURL=Configuration.d.ts.map

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

function buildConfiguration(_a, isBrowserEnvironment) {
var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system;
var userInputAuth = _a.auth, userInputCache = _a.cache, userInputSystem = _a.system, userInputTelemetry = _a.telemetry;
// Default auth options for browser
var DEFAULT_AUTH_OPTIONS = {
clientId: "",
clientId: Constants.EMPTY_STRING,
authority: "" + Constants.DEFAULT_AUTHORITY,
knownAuthorities: [],
cloudDiscoveryMetadata: "",
authorityMetadata: "",
redirectUri: "",
postLogoutRedirectUri: "",
cloudDiscoveryMetadata: Constants.EMPTY_STRING,
authorityMetadata: Constants.EMPTY_STRING,
redirectUri: Constants.EMPTY_STRING,
postLogoutRedirectUri: Constants.EMPTY_STRING,
navigateToLoginRequestUrl: true,

@@ -43,3 +43,3 @@ clientCapabilities: [],

azureCloudInstance: AzureCloudInstance.None,
tenant: ""
tenant: Constants.EMPTY_STRING
},

@@ -64,6 +64,13 @@ };

windowHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_POPUP_TIMEOUT_MS, iframeHashTimeout: (userInputSystem && userInputSystem.loadFrameTimeout) || DEFAULT_IFRAME_TIMEOUT_MS, navigateFrameWait: isBrowserEnvironment && BrowserUtils.detectIEOrEdge() ? 500 : 0, redirectNavigationTimeout: DEFAULT_REDIRECT_TIMEOUT_MS, asyncPopups: false, allowRedirectInIframe: false });
var DEFAULT_TELEMETRY_OPTIONS = {
application: {
appName: Constants.EMPTY_STRING,
appVersion: Constants.EMPTY_STRING
}
};
var overlayedConfig = {
auth: __assign(__assign({}, DEFAULT_AUTH_OPTIONS), userInputAuth),
cache: __assign(__assign({}, DEFAULT_CACHE_OPTIONS), userInputCache),
system: __assign(__assign({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), userInputSystem)
system: __assign(__assign({}, DEFAULT_BROWSER_SYSTEM_OPTIONS), userInputSystem),
telemetry: __assign(__assign({}, DEFAULT_TELEMETRY_OPTIONS), userInputTelemetry)
};

@@ -70,0 +77,0 @@ return overlayedConfig;

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

import { KEY_FORMAT_JWK } from '../utils/BrowserConstants.js';
import { Constants } from '@azure/msal-common';

@@ -208,7 +209,7 @@ /*

var resultString = BrowserStringUtils.utf8ArrToString(new Uint8Array(resultBuffer))
.replace(/\r/g, "")
.replace(/\n/g, "")
.replace(/\t/g, "")
.split(" ").join("")
.replace("\u0000", "");
.replace(/\r/g, Constants.EMPTY_STRING)
.replace(/\n/g, Constants.EMPTY_STRING)
.replace(/\t/g, Constants.EMPTY_STRING)
.split(" ").join(Constants.EMPTY_STRING)
.replace("\u0000", Constants.EMPTY_STRING);
try {

@@ -215,0 +216,0 @@ resolve(JSON.parse(resultString));

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

import { ICrypto, Logger, PkceCodes, SignedHttpRequest, SignedHttpRequestParameters } from "@azure/msal-common";
import { ICrypto, IPerformanceClient, Logger, PkceCodes, SignedHttpRequest, SignedHttpRequestParameters } from "@azure/msal-common";
import { AsyncMemoryStorage } from "../cache/AsyncMemoryStorage";

@@ -16,2 +16,6 @@ export declare type CachedKeyPair = {

};
export declare enum CryptoKeyStoreNames {
asymmetricKeys = "asymmetricKeys",
symmetricKeys = "symmetricKeys"
}
/**

@@ -28,6 +32,11 @@ * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and

private logger;
/**
* CryptoOps can be used in contexts outside a PCA instance,
* meaning there won't be a performance manager available.
*/
private performanceClient;
private static POP_KEY_USAGES;
private static EXTRACTABLE;
private cache;
constructor(logger: Logger);
constructor(logger: Logger, performanceClient?: IPerformanceClient);
/**

@@ -71,3 +80,3 @@ * Creates a new random GUID - used to populate state and nonce.

*/
signJwt(payload: SignedHttpRequest, kid: string): Promise<string>;
signJwt(payload: SignedHttpRequest, kid: string, correlationId?: string): Promise<string>;
/**

@@ -74,0 +83,0 @@ * Returns the SHA-256 hash of an input string

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __awaiter, __generator } from '../_virtual/_tslib.js';
import { PerformanceEvents } from '@azure/msal-common';
import { GuidGenerator } from './GuidGenerator.js';

@@ -18,2 +19,7 @@ import { Base64Encode } from '../encode/Base64Encode.js';

*/
var CryptoKeyStoreNames;
(function (CryptoKeyStoreNames) {
CryptoKeyStoreNames["asymmetricKeys"] = "asymmetricKeys";
CryptoKeyStoreNames["symmetricKeys"] = "symmetricKeys";
})(CryptoKeyStoreNames || (CryptoKeyStoreNames = {}));
/**

@@ -24,3 +30,3 @@ * This class implements MSAL's crypto interface, which allows it to perform base64 encoding and decoding, generating cryptographically random GUIDs and

var CryptoOps = /** @class */ (function () {
function CryptoOps(logger) {
function CryptoOps(logger, performanceClient) {
this.logger = logger;

@@ -34,5 +40,6 @@ // Browser crypto needs to be validated first before any other classes can be set.

this.cache = {
asymmetricKeys: new AsyncMemoryStorage(this.logger),
symmetricKeys: new AsyncMemoryStorage(this.logger)
asymmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.asymmetricKeys),
symmetricKeys: new AsyncMemoryStorage(this.logger, CryptoKeyStoreNames.symmetricKeys)
};
this.performanceClient = performanceClient;
}

@@ -75,12 +82,15 @@ /**

CryptoOps.prototype.getPublicKeyThumbprint = function (request) {
var _a;
return __awaiter(this, void 0, void 0, function () {
var keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];
var publicKeyThumbMeasurement, keyPair, publicKeyJwk, pubKeyThumprintObj, publicJwkString, publicJwkHash, privateKeyJwk, unextractablePrivateKey;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
publicKeyThumbMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(PerformanceEvents.CryptoOptsGetPublicKeyThumbprint, request.correlationId);
return [4 /*yield*/, this.browserCrypto.generateKeyPair(CryptoOps.EXTRACTABLE, CryptoOps.POP_KEY_USAGES)];
case 1:
keyPair = _a.sent();
keyPair = _b.sent();
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.publicKey)];
case 2:
publicKeyJwk = _a.sent();
publicKeyJwk = _b.sent();
pubKeyThumprintObj = {

@@ -94,9 +104,9 @@ e: publicKeyJwk.e,

case 3:
publicJwkHash = _a.sent();
publicJwkHash = _b.sent();
return [4 /*yield*/, this.browserCrypto.exportJwk(keyPair.privateKey)];
case 4:
privateKeyJwk = _a.sent();
privateKeyJwk = _b.sent();
return [4 /*yield*/, this.browserCrypto.importJwk(privateKeyJwk, false, ["sign"])];
case 5:
unextractablePrivateKey = _a.sent();
unextractablePrivateKey = _b.sent();
// Store Keypair data in keystore

@@ -111,3 +121,8 @@ return [4 /*yield*/, this.cache.asymmetricKeys.setItem(publicJwkHash, {

// Store Keypair data in keystore
_a.sent();
_b.sent();
if (publicKeyThumbMeasurement) {
publicKeyThumbMeasurement.endMeasurement({
success: true
});
}
return [2 /*return*/, publicJwkHash];

@@ -143,17 +158,28 @@ }

return __awaiter(this, void 0, void 0, function () {
var dataStoreNames, databaseStorage, _a;
return __generator(this, function (_b) {
switch (_b.label) {
var e_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
dataStoreNames = Object.keys(this.cache);
databaseStorage = this.cache[dataStoreNames[0]];
if (!databaseStorage) return [3 /*break*/, 2];
return [4 /*yield*/, databaseStorage.deleteDatabase()];
_a.trys.push([0, 3, , 4]);
this.logger.verbose("Deleting in-memory and persistent asymmetric key stores");
return [4 /*yield*/, this.cache.asymmetricKeys.clear()];
case 1:
_a = _b.sent();
return [3 /*break*/, 3];
_a.sent();
this.logger.verbose("Successfully deleted asymmetric key stores");
this.logger.verbose("Deleting in-memory and persistent symmetric key stores");
return [4 /*yield*/, this.cache.symmetricKeys.clear()];
case 2:
_a = false;
_b.label = 3;
case 3: return [2 /*return*/, _a];
_a.sent();
this.logger.verbose("Successfully deleted symmetric key stores");
return [2 /*return*/, true];
case 3:
e_1 = _a.sent();
if (e_1 instanceof Error) {
this.logger.error("Clearing keystore failed with error: " + e_1.message);
}
else {
this.logger.error("Clearing keystore failed with unknown error");
}
return [2 /*return*/, false];
case 4: return [2 /*return*/];
}

@@ -168,10 +194,13 @@ });

*/
CryptoOps.prototype.signJwt = function (payload, kid) {
CryptoOps.prototype.signJwt = function (payload, kid, correlationId) {
var _a;
return __awaiter(this, void 0, void 0, function () {
var cachedKeyPair, publicKeyJwk, publicKeyJwkString, header, encodedHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.cache.asymmetricKeys.getItem(kid)];
var signJwtMeasurement, cachedKeyPair, publicKeyJwk, publicKeyJwkString, header, encodedHeader, encodedPayload, tokenString, tokenBuffer, signatureBuffer, encodedSignature, signedJwt;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
signJwtMeasurement = (_a = this.performanceClient) === null || _a === void 0 ? void 0 : _a.startMeasurement(PerformanceEvents.CryptoOptsSignJwt, correlationId);
return [4 /*yield*/, this.cache.asymmetricKeys.getItem(kid)];
case 1:
cachedKeyPair = _a.sent();
cachedKeyPair = _b.sent();
if (!cachedKeyPair) {

@@ -182,3 +211,3 @@ throw BrowserAuthError.createSigningKeyNotFoundInStorageError(kid);

case 2:
publicKeyJwk = _a.sent();
publicKeyJwk = _b.sent();
publicKeyJwkString = BrowserCrypto.getJwkString(publicKeyJwk);

@@ -199,5 +228,11 @@ header = {

case 3:
signatureBuffer = _a.sent();
signatureBuffer = _b.sent();
encodedSignature = this.b64Encode.urlEncodeArr(new Uint8Array(signatureBuffer));
return [2 /*return*/, tokenString + "." + encodedSignature];
signedJwt = tokenString + "." + encodedSignature;
if (signJwtMeasurement) {
signJwtMeasurement.endMeasurement({
success: true
});
}
return [2 /*return*/, signedJwt];
}

@@ -230,3 +265,3 @@ });

export { CryptoOps };
export { CryptoKeyStoreNames, CryptoOps };
//# sourceMappingURL=CryptoOps.js.map

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

import { IGuidGenerator } from "@azure/msal-common";
import { BrowserCrypto } from "./BrowserCrypto";
export declare class GuidGenerator {
export declare class GuidGenerator implements IGuidGenerator {
private cryptoObj;

@@ -10,4 +11,4 @@ constructor(cryptoObj: BrowserCrypto);

*/
static isGuid(guid: string): boolean;
isGuid(guid: string): boolean;
}
//# sourceMappingURL=GuidGenerator.d.ts.map

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { Constants } from '@azure/msal-common';
import { MathUtils } from '../utils/MathUtils.js';

@@ -58,3 +59,3 @@

var r = 0;
var guidResponse = "";
var guidResponse = Constants.EMPTY_STRING;
for (var i = 0; i < 36; i++) {

@@ -85,3 +86,3 @@ if (guidHolder[i] !== "-" && guidHolder[i] !== "4") {

*/
GuidGenerator.isGuid = function (guid) {
GuidGenerator.prototype.isGuid = function (guid) {
var regexGuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;

@@ -88,0 +89,0 @@ return regexGuid.test(guid);

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { Constants } from '@azure/msal-common';
import { BrowserStringUtils } from '../utils/BrowserStringUtils.js';

@@ -43,3 +44,3 @@

Base64Decode.prototype.base64DecToArr = function (base64String, nBlockSize) {
var sB64Enc = base64String.replace(/[^A-Za-z0-9\+\/]/g, "");
var sB64Enc = base64String.replace(/[^A-Za-z0-9\+\/]/g, Constants.EMPTY_STRING);
var nInLen = sB64Enc.length;

@@ -46,0 +47,0 @@ var nOutLen = nBlockSize ? Math.ceil((nInLen * 3 + 1 >>> 2) / nBlockSize) * nBlockSize : nInLen * 3 + 1 >>> 2;

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { Constants } from '@azure/msal-common';
import { BrowserStringUtils } from '../utils/BrowserStringUtils.js';

@@ -22,3 +23,3 @@

return encodeURIComponent(this.encode(input)
.replace(/=/g, "")
.replace(/=/g, Constants.EMPTY_STRING)
.replace(/\+/g, "-")

@@ -33,3 +34,3 @@ .replace(/\//g, "_"));

return this.base64EncArr(inputArr)
.replace(/=/g, "")
.replace(/=/g, Constants.EMPTY_STRING)
.replace(/\+/g, "-")

@@ -52,3 +53,3 @@ .replace(/\//g, "_");

var eqLen = (3 - (aBytes.length % 3)) % 3;
var sB64Enc = "";
var sB64Enc = Constants.EMPTY_STRING;
for (var nMod3 = void 0, nLen = aBytes.length, nUint24 = 0, nIdx = 0; nIdx < nLen; nIdx++) {

@@ -55,0 +56,0 @@ nMod3 = nIdx % 3;

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

@@ -39,4 +39,5 @@ /**

export { PopupUtils } from "./utils/PopupUtils";
export { AuthenticationScheme, AccountInfo, AccountEntity, AuthenticationResult, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkResponse, NetworkRequestOptions, ILoggerCallback, Logger, LogLevel, ProtocolMode, ExternalTokenResponse, StringUtils, UrlString, AzureCloudInstance, AzureCloudOptions, AuthenticationHeaderParser, OIDC_DEFAULT_SCOPES } from "@azure/msal-common";
export { BrowserPerformanceClient } from "./telemetry/BrowserPerformanceClient";
export { AuthenticationScheme, AccountInfo, AccountEntity, AuthenticationResult, AuthError, AuthErrorMessage, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, ServerError, INetworkModule, NetworkResponse, NetworkRequestOptions, ILoggerCallback, Logger, LogLevel, ProtocolMode, ExternalTokenResponse, StringUtils, UrlString, AzureCloudInstance, AzureCloudOptions, AuthenticationHeaderParser, OIDC_DEFAULT_SCOPES, PerformanceCallbackFunction, PerformanceEvent, PerformanceEvents } from "@azure/msal-common";
export { version } from "./packageMetadata";
//# sourceMappingURL=index.d.ts.map

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

@@ -24,4 +24,5 @@ export { PublicClientApplication } from './app/PublicClientApplication.js';

export { PopupUtils } from './utils/PopupUtils.js';
export { AccountEntity, AuthError, AuthErrorMessage, AuthenticationHeaderParser, AuthenticationScheme, AzureCloudInstance, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, LogLevel, Logger, OIDC_DEFAULT_SCOPES, ProtocolMode, ServerError, StringUtils, UrlString } from '@azure/msal-common';
export { BrowserPerformanceClient } from './telemetry/BrowserPerformanceClient.js';
export { AccountEntity, AuthError, AuthErrorMessage, AuthenticationHeaderParser, AuthenticationScheme, AzureCloudInstance, ClientAuthError, ClientAuthErrorMessage, ClientConfigurationError, ClientConfigurationErrorMessage, InteractionRequiredAuthError, InteractionRequiredAuthErrorMessage, LogLevel, Logger, OIDC_DEFAULT_SCOPES, PerformanceEvents, ProtocolMode, ServerError, StringUtils, UrlString } from '@azure/msal-common';
export { version } from './packageMetadata.js';
//# sourceMappingURL=index.js.map

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

import { ICrypto, INetworkModule, Logger, AuthenticationResult, AccountInfo, BaseAuthRequest, ServerTelemetryManager } from "@azure/msal-common";
import { ICrypto, INetworkModule, Logger, AuthenticationResult, AccountInfo, BaseAuthRequest, ServerTelemetryManager, IPerformanceClient } from "@azure/msal-common";
import { BrowserConfiguration } from "../config/Configuration";

@@ -17,3 +17,4 @@ import { BrowserCacheManager } from "../cache/BrowserCacheManager";

protected correlationId: string;
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, correlationId?: string);
protected performanceClient: IPerformanceClient;
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, performanceClient: IPerformanceClient, correlationId?: string);
abstract acquireToken(request: RedirectRequest | PopupRequest | SsoSilentRequest): Promise<AuthenticationResult | void>;

@@ -20,0 +21,0 @@ abstract logout(request: EndSessionRequest): Promise<void>;

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

var BaseInteractionClient = /** @class */ (function () {
function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, correlationId) {
function BaseInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, performanceClient, correlationId) {
this.config = config;

@@ -23,2 +23,3 @@ this.browserStorage = storageImpl;

this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);
this.performanceClient = performanceClient;
}

@@ -50,2 +51,3 @@ BaseInteractionClient.prototype.clearCacheOnLogout = function (account) {

_a.trys.push([5, 8, , 9]);
this.logger.verbose("No account provided in logout request, clearing all cache items.", this.correlationId);
// Clear all accounts and tokens

@@ -61,3 +63,2 @@ return [4 /*yield*/, this.browserStorage.clear()];

_a.sent();
this.logger.verbose("No account provided in logout request, clearing all cache items.");
return [3 /*break*/, 9];

@@ -64,0 +65,0 @@ case 8:

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
import { OIDC_DEFAULT_SCOPES, AuthError, ThrottlingUtils, UrlString } from '@azure/msal-common';
import { OIDC_DEFAULT_SCOPES, AuthError, ThrottlingUtils, Constants, UrlString } from '@azure/msal-common';
import { StandardInteractionClient } from './StandardInteractionClient.js';

@@ -96,3 +96,3 @@ import { PopupUtils } from '../utils/PopupUtils.js';

validRequest = _a.sent();
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
_a.label = 2;

@@ -99,0 +99,0 @@ case 2:

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator } from '../_virtual/_tslib.js';
import { UrlString, AuthError } from '@azure/msal-common';
import { UrlString, AuthError, Constants } from '@azure/msal-common';
import { StandardInteractionClient } from './StandardInteractionClient.js';

@@ -34,3 +34,3 @@ import { TemporaryCacheKeys, ApiId, InteractionType } from '../utils/BrowserConstants.js';

validRequest = _a.sent();
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || Constants.EMPTY_STRING, validRequest.account || null);
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenRedirect);

@@ -122,3 +122,3 @@ handleBackButton = function (event) {

}
loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || "";
loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || Constants.EMPTY_STRING;
loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);

@@ -125,0 +125,0 @@ currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);

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

import { AuthenticationResult, ICrypto, Logger } from "@azure/msal-common";
import { AuthenticationResult, ICrypto, Logger, IPerformanceClient } from "@azure/msal-common";
import { StandardInteractionClient } from "./StandardInteractionClient";

@@ -11,3 +11,3 @@ import { BrowserConfiguration } from "../config/Configuration";

private apiId;
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, correlationId?: string);
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, correlationId?: string);
/**

@@ -14,0 +14,0 @@ * Acquires a token silently by redeeming an authorization code against the /token endpoint

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { AuthError } from '@azure/msal-common';
import { AuthError, Constants } from '@azure/msal-common';
import { StandardInteractionClient } from './StandardInteractionClient.js';

@@ -17,4 +17,4 @@ import { BrowserAuthError } from '../error/BrowserAuthError.js';

__extends(SilentAuthCodeClient, _super);
function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) || this;
function SilentAuthCodeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId) {
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId) || this;
_this.apiId = apiId;

@@ -41,3 +41,3 @@ return _this;

silentRequest = _a.sent();
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);

@@ -44,0 +44,0 @@ _a.label = 2;

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { StandardInteractionClient } from './StandardInteractionClient.js';
import { SilentFlowClient } from '@azure/msal-common';
import { PerformanceEvents, SilentFlowClient } from '@azure/msal-common';
import { EventType } from '../event/EventType.js';

@@ -25,6 +25,7 @@ import { InteractionType, ApiId } from '../utils/BrowserConstants.js';

return __awaiter(this, void 0, void 0, function () {
var serverTelemetryManager, silentAuthClient, cachedToken, error_1;
var acquireTokenMeasurement, serverTelemetryManager, silentAuthClient, cachedToken, error_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);

@@ -42,2 +43,6 @@ return [4 /*yield*/, this.createSilentFlowClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];

this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, cachedToken);
acquireTokenMeasurement.endMeasurement({
success: true,
fromCache: true
});
return [2 /*return*/, cachedToken];

@@ -49,2 +54,5 @@ case 4:

}
acquireTokenMeasurement.endMeasurement({
success: false
});
throw error_1;

@@ -51,0 +59,0 @@ case 5: return [2 /*return*/];

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

import { AuthenticationResult, ICrypto, Logger, CommonAuthorizationCodeRequest, AuthorizationCodeClient } from "@azure/msal-common";
import { AuthenticationResult, ICrypto, Logger, CommonAuthorizationCodeRequest, AuthorizationCodeClient, IPerformanceClient } from "@azure/msal-common";
import { StandardInteractionClient } from "./StandardInteractionClient";

@@ -11,3 +11,3 @@ import { BrowserConfiguration } from "../config/Configuration";

protected apiId: ApiId;
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, correlationId?: string);
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, correlationId?: string);
/**

@@ -14,0 +14,0 @@ * Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { AuthError, StringUtils, PromptValue } from '@azure/msal-common';
import { AuthError, Constants, PerformanceEvents, StringUtils, PromptValue } from '@azure/msal-common';
import { StandardInteractionClient } from './StandardInteractionClient.js';

@@ -16,4 +16,4 @@ import { BrowserAuthError } from '../error/BrowserAuthError.js';

__extends(SilentIframeClient, _super);
function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, correlationId) {
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) || this;
function SilentIframeClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, correlationId) {
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId) || this;
_this.apiId = apiId;

@@ -28,3 +28,3 @@ return _this;

return __awaiter(this, void 0, void 0, function () {
var silentRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, e_1;
var acquireTokenMeasurement, silentRequest, serverTelemetryManager, authCodeRequest, authClient, navigateUrl, e_1;
return __generator(this, function (_a) {

@@ -34,2 +34,3 @@ switch (_a.label) {

this.logger.verbose("acquireTokenByIframe called");
acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
// Check that we have some SSO data

@@ -41,2 +42,5 @@ if (StringUtils.isEmpty(request.loginHint) && StringUtils.isEmpty(request.sid) && (!request.account || StringUtils.isEmpty(request.account.username))) {

if (request.prompt && request.prompt !== PromptValue.NONE) {
acquireTokenMeasurement.endMeasurement({
success: false
});
throw BrowserAuthError.createSilentPromptValueError(request.prompt);

@@ -47,3 +51,3 @@ }

silentRequest = _a.sent();
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || "", silentRequest.account || null);
this.browserStorage.updateCacheEntries(silentRequest.state, silentRequest.nonce, silentRequest.authority, silentRequest.loginHint || Constants.EMPTY_STRING, silentRequest.account || null);
serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);

@@ -63,3 +67,10 @@ _a.label = 2;

navigateUrl = _a.sent();
return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient, this.logger)];
return [4 /*yield*/, this.silentTokenHelper(navigateUrl, authCodeRequest, authClient, this.logger)
.then(function (result) {
acquireTokenMeasurement.endMeasurement({
success: true,
fromCache: false
});
return result;
})];
case 6: return [2 /*return*/, _a.sent()];

@@ -73,2 +84,5 @@ case 7:

this.browserStorage.cleanRequestByState(silentRequest.state);
acquireTokenMeasurement.endMeasurement({
success: false
});
throw e_1;

@@ -75,0 +89,0 @@ case 8: return [2 /*return*/];

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { StandardInteractionClient } from './StandardInteractionClient.js';
import { AuthError, RefreshTokenClient } from '@azure/msal-common';
import { AuthError, PerformanceEvents, RefreshTokenClient } from '@azure/msal-common';
import { ApiId } from '../utils/BrowserConstants.js';

@@ -24,3 +24,3 @@ import { BrowserAuthError } from '../error/BrowserAuthError.js';

return __awaiter(this, void 0, void 0, function () {
var silentRequest, _a, serverTelemetryManager, refreshTokenClient;
var silentRequest, _a, acquireTokenMeasurement, serverTelemetryManager, refreshTokenClient;
var _this = this;

@@ -34,2 +34,3 @@ return __generator(this, function (_b) {

silentRequest = __assign.apply(void 0, _a.concat([_b.sent()]));
acquireTokenMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, silentRequest.correlationId);
serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);

@@ -41,3 +42,11 @@ return [4 /*yield*/, this.createRefreshTokenClient(serverTelemetryManager, silentRequest.authority, silentRequest.azureCloudOptions)];

// Send request to renew token. Auth module will throw errors if token cannot be renewed.
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest).catch(function (e) {
return [2 /*return*/, refreshTokenClient.acquireTokenByRefreshToken(silentRequest)
.then(function (result) {
acquireTokenMeasurement.endMeasurement({
success: true,
fromCache: result.fromCache
});
return result;
})
.catch(function (e) {
if (e instanceof AuthError) {

@@ -47,2 +56,5 @@ e.setCorrelationId(_this.correlationId);

serverTelemetryManager.cacheFailedRequest(e);
acquireTokenMeasurement.endMeasurement({
success: false
});
throw e;

@@ -49,0 +61,0 @@ })];

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

import { ICrypto, Logger, ServerTelemetryManager, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ClientConfiguration, Authority, CommonEndSessionRequest, AccountInfo, AzureCloudOptions } from "@azure/msal-common";
import { ICrypto, Logger, ServerTelemetryManager, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ClientConfiguration, Authority, CommonEndSessionRequest, AccountInfo, AzureCloudOptions, IPerformanceClient } from "@azure/msal-common";
import { BaseInteractionClient } from "./BaseInteractionClient";

@@ -18,3 +18,3 @@ import { BrowserConfiguration } from "../config/Configuration";

protected navigationClient: INavigationClient;
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, correlationId?: string);
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, correlationId?: string);
/**

@@ -21,0 +21,0 @@ * Generates an auth code request tied to the url request.

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { UrlString, Constants, AuthorizationCodeClient, Authority, AuthorityFactory, ResponseMode, StringUtils, ProtocolUtils } from '@azure/msal-common';
import { UrlString, Constants, AuthorizationCodeClient, PerformanceEvents, Authority, AuthorityFactory, ResponseMode, StringUtils, ProtocolUtils } from '@azure/msal-common';
import { BaseInteractionClient } from './BaseInteractionClient.js';

@@ -21,4 +21,4 @@ import { BrowserConstants } from '../utils/BrowserConstants.js';

__extends(StandardInteractionClient, _super);
function StandardInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, correlationId) {
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, correlationId) || this;
function StandardInteractionClient(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, correlationId) {
var _this = _super.call(this, config, storageImpl, browserCrypto, logger, eventHandler, performanceClient, correlationId) || this;
_this.navigationClient = navigationClient;

@@ -41,3 +41,3 @@ return _this;

generatedPkceParams = _a.sent();
authCodeRequest = __assign(__assign({}, request), { redirectUri: request.redirectUri, code: "", codeVerifier: generatedPkceParams.verifier });
authCodeRequest = __assign(__assign({}, request), { redirectUri: request.redirectUri, code: Constants.EMPTY_STRING, codeVerifier: generatedPkceParams.verifier });
request.codeChallenge = generatedPkceParams.challenge;

@@ -158,3 +158,3 @@ request.codeChallengeMethod = Constants.S256_CODE_CHALLENGE_METHOD;

case 0:
this.logger.verbose("getClientConfiguration called");
this.logger.verbose("getClientConfiguration called", this.correlationId);
return [4 /*yield*/, this.getDiscoveredAuthority(requestAuthority, requestAzureCloudOptions)];

@@ -186,5 +186,6 @@ case 1:

version: version,
cpu: "",
os: ""
}
cpu: Constants.EMPTY_STRING,
os: Constants.EMPTY_STRING
},
telemetry: this.config.telemetry
}];

@@ -223,7 +224,8 @@ }

return __awaiter(this, void 0, void 0, function () {
var authorityOptions, userAuthority, builtAuthority;
var getAuthorityMeasurement, authorityOptions, userAuthority, builtAuthority;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.logger.verbose("getDiscoveredAuthority called");
this.logger.verbose("getDiscoveredAuthority called", this.correlationId);
getAuthorityMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
authorityOptions = {

@@ -237,4 +239,16 @@ protocolMode: this.config.auth.protocolMode,

builtAuthority = Authority.generateAuthority(userAuthority, requestAzureCloudOptions || this.config.auth.azureCloudOptions);
this.logger.verbose("Creating discovered authority with configured authority");
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)];
this.logger.verbose("Creating discovered authority with configured authority", this.correlationId);
return [4 /*yield*/, AuthorityFactory.createDiscoveredInstance(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions)
.then(function (result) {
getAuthorityMeasurement.endMeasurement({
success: true
});
return result;
})
.catch(function (error) {
getAuthorityMeasurement.endMeasurement({
success: false
});
throw error;
})];
case 1: return [2 /*return*/, _a.sent()];

@@ -256,3 +270,3 @@ }

case 0:
this.logger.verbose("initializeAuthorizationRequest called");
this.logger.verbose("initializeAuthorizationRequest called", this.correlationId);
redirectUri = this.getRedirectUri(request.redirectUri);

@@ -269,4 +283,4 @@ browserState = {

if (account) {
this.logger.verbose("Setting validated request account");
this.logger.verbosePii("Setting validated request account: " + account);
this.logger.verbose("Setting validated request account", this.correlationId);
this.logger.verbosePii("Setting validated request account: " + account.homeAccountId, this.correlationId);
validatedRequest.account = account;

@@ -273,0 +287,0 @@ }

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { __awaiter, __generator } from '../_virtual/_tslib.js';
import { Constants } from '@azure/msal-common';
import { BrowserAuthError } from '../error/BrowserAuthError.js';

@@ -74,3 +75,3 @@ import { HTTP_REQUEST_TYPE } from '../utils/BrowserConstants.js';

case 0:
reqBody = (options && options.body) || "";
reqBody = (options && options.body) || Constants.EMPTY_STRING;
_b.label = 1;

@@ -77,0 +78,0 @@ case 1:

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'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.22.1";
export declare const version = "2.23.0";
//# sourceMappingURL=packageMetadata.d.ts.map

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
/* eslint-disable header/header */
var name = "@azure/msal-browser";
var version = "2.22.1";
var version = "2.23.0";
export { name, version };
//# sourceMappingURL=packageMetadata.js.map

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

@@ -1,3 +0,5 @@

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';
import { Constants } from '@azure/msal-common';
/*

@@ -90,3 +92,3 @@ * Copyright (c) Microsoft Corporation. All rights reserved.

BrowserStringUtils.utf8ArrToString = function (aBytes) {
var sView = "";
var sView = Constants.EMPTY_STRING;
for (var nPart = void 0, nLen = aBytes.length, nIdx = 0; nIdx < nLen; nIdx++) {

@@ -93,0 +95,0 @@ nPart = aBytes[nIdx];

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

urlParts.shift(); // Remove part before the hash
window.location.hash = urlParts.length > 0 ? urlParts.join("#") : "";
window.location.hash = urlParts.length > 0 ? urlParts.join("#") : Constants.EMPTY_STRING;
};

@@ -40,0 +40,0 @@ /**

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

/*! @azure/msal-browser v2.22.1 2022-03-07 */
/*! @azure/msal-browser v2.23.0 2022-04-04 */
'use strict';

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

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

},
"version": "2.22.1",
"version": "2.23.0",
"description": "Microsoft Authentication Library for js",

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

"dependencies": {
"@azure/msal-common": "^6.1.0"
"@azure/msal-common": "^6.2.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.22.1/js/msal-browser.min.js"></script>
<script type="text/javascript" src="https://alcdn.msauth.net/browser/2.23.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 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 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

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 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