Commit 3a84cbd5 authored by Ahmet Turan Koçak's avatar Ahmet Turan Koçak
Browse files

Initial commit

parents
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var __assign = function() {
__assign = Object.assign || function __assign(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
function __rest(s, e) {
var t = {};
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
}
return t;
}
function __awaiter(thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function __read(o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
}
function __spread() {
for (var ar = [], i = 0; i < arguments.length; i++)
ar = ar.concat(__read(arguments[i]));
return ar;
}
export { __assign, __awaiter, __extends, __generator, __read, __rest, __spread };
//# sourceMappingURL=_tslib.js.map
{"version":3,"file":"_tslib.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
\ No newline at end of file
import { AccountInfo, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto, PerformanceCallbackFunction, IPerformanceClient, BaseAuthRequest } from "@azure/msal-common";
import { BrowserCacheManager } from "../cache/BrowserCacheManager";
import { BrowserConfiguration, Configuration } from "../config/Configuration";
import { InteractionType, ApiId, WrapperSKU } from "../utils/BrowserConstants";
import { RedirectRequest } from "../request/RedirectRequest";
import { PopupRequest } from "../request/PopupRequest";
import { SsoSilentRequest } from "../request/SsoSilentRequest";
import { EventCallbackFunction } from "../event/EventMessage";
import { EndSessionRequest } from "../request/EndSessionRequest";
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
import { INavigationClient } from "../navigation/INavigationClient";
import { EventHandler } from "../event/EventHandler";
import { PopupClient } from "../interaction_client/PopupClient";
import { RedirectClient } from "../interaction_client/RedirectClient";
import { SilentIframeClient } from "../interaction_client/SilentIframeClient";
import { SilentRefreshClient } from "../interaction_client/SilentRefreshClient";
import { ITokenCache } from "../cache/ITokenCache";
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler";
import { SilentRequest } from "../request/SilentRequest";
import { SilentCacheClient } from "../interaction_client/SilentCacheClient";
import { SilentAuthCodeClient } from "../interaction_client/SilentAuthCodeClient";
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
export declare abstract class ClientApplication {
protected readonly browserCrypto: ICrypto;
protected readonly browserStorage: BrowserCacheManager;
protected readonly nativeInternalStorage: BrowserCacheManager;
protected readonly networkClient: INetworkModule;
protected navigationClient: INavigationClient;
protected config: BrowserConfiguration;
private tokenCache;
protected logger: Logger;
protected isBrowserEnvironment: boolean;
protected eventHandler: EventHandler;
protected redirectResponse: Map<string, Promise<AuthenticationResult | null>>;
protected nativeExtensionProvider: NativeMessageHandler | undefined;
private hybridAuthCodeResponses;
protected performanceClient: IPerformanceClient;
protected initialized: boolean;
/**
* @constructor
* Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object
*
* Important attributes in the Configuration object for auth are:
* - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview
* - authority: the authority URL for your application.
* - redirect_uri: the uri of your application registered in the portal.
*
* In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.
* It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}
* If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
* If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
* If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
* To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
*
* In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/
* Full B2C functionality will be available in this library in future versions.
*
* @param configuration Object for the MSAL PublicClientApplication instance
*/
constructor(configuration: Configuration);
/**
* Initializer function to perform async startup tasks such as connecting to WAM extension
*/
initialize(): Promise<void>;
/**
* Event handler function which allows users to fire events after the PublicClientApplication object
* has loaded during redirect flows. This should be invoked on all page loads involved in redirect
* auth flows.
* @param hash Hash to process. Defaults to the current value of window.location.hash. Only needs to be provided explicitly if the response to be handled is not contained in the current value.
* @returns Token response or null. If the return value is null, then no auth redirect was detected.
*/
handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;
/**
* Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects
* the page, so any code that follows this function will not execute.
*
* IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current
* browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
*
* @param request
*/
acquireTokenRedirect(request: RedirectRequest): Promise<void>;
/**
* Use when you want to obtain an access_token for your API via opening a popup window in the user's browser
*
* @param request
*
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
*/
acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
/**
* This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:
* - Any browser using a form of Intelligent Tracking Prevention
* - If there is not an established session with the service
*
* In these cases, the request must be done inside a popup or full frame redirect.
*
* For the cases where interaction is required, you cannot send a request with prompt=none.
*
* If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as
* you session on the server still exists.
* @param request {@link SsoSilentRequest}
*
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
*/
ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;
/**
* This function redeems an authorization code (passed as code) from the eSTS token endpoint.
* This authorization code should be acquired server-side using a confidential client to acquire a spa_code.
* This API is not indended for normal authorization code acquisition and redemption.
*
* Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.
*
* @param request {@link AuthorizationCodeRequest}
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
*/
acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
/**
* Creates a SilentAuthCodeClient to redeem an authorization code.
* @param request
* @returns Result of the operation to redeem the authorization code
*/
private acquireTokenByCodeAsync;
/**
* Attempt to acquire an access token from the cache
* @param silentCacheClient SilentCacheClient
* @param commonRequest CommonSilentFlowRequest
* @param silentRequest SilentRequest
* @returns A promise that, when resolved, returns the access token
*/
protected acquireTokenFromCache(silentCacheClient: SilentCacheClient, commonRequest: CommonSilentFlowRequest, silentRequest: SilentRequest): Promise<AuthenticationResult>;
/**
* Attempt to acquire an access token via a refresh token
* @param commonRequest CommonSilentFlowRequest
* @param silentRequest SilentRequest
* @returns A promise that, when resolved, returns the access token
*/
protected acquireTokenByRefreshToken(commonRequest: CommonSilentFlowRequest, silentRequest: SilentRequest): Promise<AuthenticationResult>;
/**
* Attempt to acquire an access token via an iframe
* @param request CommonSilentFlowRequest
* @returns A promise that, when resolved, returns the access token
*/
protected acquireTokenBySilentIframe(request: CommonSilentFlowRequest): Promise<AuthenticationResult>;
/**
* Deprecated logout function. Use logoutRedirect or logoutPopup instead
* @param logoutRequest
* @deprecated
*/
logout(logoutRequest?: EndSessionRequest): Promise<void>;
/**
* Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
* Default behaviour is to redirect the user to `window.location.href`.
* @param logoutRequest
*/
logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;
/**
* Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
* @param logoutRequest
*/
logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void>;
/**
* Returns all accounts that MSAL currently has data for.
* (the account object is created at the time of successful login)
* or empty array when no accounts are found
* @returns Array of account objects in cache
*/
getAllAccounts(): AccountInfo[];
/**
* Returns the signed in account matching username.
* (the account object is created at the time of successful login)
* or null when no matching account is found.
* This API is provided for convenience but getAccountById should be used for best reliability
* @param userName
* @returns The account object stored in MSAL
*/
getAccountByUsername(userName: string): AccountInfo | null;
/**
* Returns the signed in account matching homeAccountId.
* (the account object is created at the time of successful login)
* or null when no matching account is found
* @param homeAccountId
* @returns The account object stored in MSAL
*/
getAccountByHomeId(homeAccountId: string): AccountInfo | null;
/**
* Returns the signed in account matching localAccountId.
* (the account object is created at the time of successful login)
* or null when no matching account is found
* @param localAccountId
* @returns The account object stored in MSAL
*/
getAccountByLocalId(localAccountId: string): AccountInfo | null;
/**
* Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
* @param account
*/
setActiveAccount(account: AccountInfo | null): void;
/**
* Gets the currently active account
*/
getActiveAccount(): AccountInfo | null;
/**
* Helper to validate app environment before making an auth request
*
* @protected
* @param {InteractionType} interactionType What kind of interaction is being used
* @param {boolean} [setInteractionInProgress=true] Whether to set interaction in progress temp cache flag
*/
protected preflightBrowserEnvironmentCheck(interactionType: InteractionType, setInteractionInProgress?: boolean): void;
/**
* Preflight check for interactive requests
*
* @protected
* @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag
*/
protected preflightInteractiveRequest(setInteractionInProgress: boolean): void;
/**
* Acquire a token from native device (e.g. WAM)
* @param request
*/
protected acquireTokenNative(request: PopupRequest | SilentRequest | SsoSilentRequest, apiId: ApiId, accountId?: string): Promise<AuthenticationResult>;
/**
* Returns boolean indicating if this request can use the native broker
* @param request
*/
protected canUseNative(request: RedirectRequest | PopupRequest | SsoSilentRequest, accountId?: string): boolean;
/**
* Get the native accountId from the account
* @param request
* @returns
*/
protected getNativeAccountId(request: RedirectRequest | PopupRequest | SsoSilentRequest): string;
/**
* Returns new instance of the Popup Interaction Client
* @param correlationId
*/
protected createPopupClient(correlationId?: string): PopupClient;
/**
* Returns new instance of the Redirect Interaction Client
* @param correlationId
*/
protected createRedirectClient(correlationId?: string): RedirectClient;
/**
* Returns new instance of the Silent Iframe Interaction Client
* @param correlationId
*/
protected createSilentIframeClient(correlationId?: string): SilentIframeClient;
/**
* Returns new instance of the Silent Cache Interaction Client
*/
protected createSilentCacheClient(correlationId?: string): SilentCacheClient;
/**
* Returns new instance of the Silent Refresh Interaction Client
*/
protected createSilentRefreshClient(correlationId?: string): SilentRefreshClient;
/**
* Returns new instance of the Silent AuthCode Interaction Client
*/
protected createSilentAuthCodeClient(correlationId?: string): SilentAuthCodeClient;
/**
* Adds event callbacks to array
* @param callback
*/
addEventCallback(callback: EventCallbackFunction): string | null;
/**
* Removes callback with provided id from callback array
* @param callbackId
*/
removeEventCallback(callbackId: string): void;
/**
* 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
*/
enableAccountStorageEvents(): void;
/**
* Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
*/
disableAccountStorageEvents(): void;
/**
* Gets the token cache for the application.
*/
getTokenCache(): ITokenCache;
/**
* Returns the logger instance
*/
getLogger(): Logger;
/**
* Replaces the default logger set in configurations with new Logger with new configurations
* @param logger Logger instance
*/
setLogger(logger: Logger): void;
/**
* Called by wrapper libraries (Angular & React) to set SKU and Version passed down to telemetry, logger, etc.
* @param sku
* @param version
*/
initializeWrapperLibrary(sku: WrapperSKU, version: string): void;
/**
* Sets navigation client
* @param navigationClient
*/
setNavigationClient(navigationClient: INavigationClient): void;
/**
* Returns the configuration object
*/
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
\ No newline at end of file
{"version":3,"file":"ClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/ClientApplication.ts"],"names":[],"mappings":"AAMA,OAAO,EAA6C,WAAW,EAAa,cAAc,EAAE,oBAAoB,EAAE,MAAM,EAAE,uBAAuB,EAAE,OAAO,EAA+D,2BAA2B,EAAyB,kBAAkB,EAAE,eAAe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CAAC,QAAQ,EAAE,2BAA2B,GAAG,MAAM;IAIrE;;;;;OAKG;IACH,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO;IAItD;;OAEG;IACH,0BAA0B,IAAI,IAAI;IAIlC;;OAEG;IACH,2BAA2B,IAAI,IAAI;IAInC;;OAEG;IACH,aAAa,IAAI,WAAW;IAI5B;;OAEG;IACH,SAAS,IAAI,MAAM;IAInB;;;OAGG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAI/B;;;;OAIG;IACH,wBAAwB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI;IAKhE;;;OAGG;IACH,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,IAAI;IAI9D;;OAEG;IACH,gBAAgB,IAAI,oBAAoB;IAIxC;;;;;;OAMG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,MAAM;CAiBhF"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { CryptoOps } from '../crypto/CryptoOps.js';
import { Constants, InteractionRequiredAuthError, PerformanceEvents, AuthError, ClientAuthError, StringUtils, PromptValue, Logger, StubPerformanceClient, DEFAULT_CRYPTO_IMPLEMENTATION } from '@azure/msal-common';
import { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER } from '../cache/BrowserCacheManager.js';
import { buildConfiguration } from '../config/Configuration.js';
import { InteractionType, ApiId, TemporaryCacheKeys, CacheLookupPolicy, BrowserCacheLocation } from '../utils/BrowserConstants.js';
import { BrowserUtils } from '../utils/BrowserUtils.js';
import { name, version } from '../packageMetadata.js';
import { EventType } from '../event/EventType.js';
import { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js';
import { EventHandler } from '../event/EventHandler.js';
import { PopupClient } from '../interaction_client/PopupClient.js';
import { RedirectClient } from '../interaction_client/RedirectClient.js';
import { SilentIframeClient } from '../interaction_client/SilentIframeClient.js';
import { SilentRefreshClient } from '../interaction_client/SilentRefreshClient.js';
import { TokenCache } from '../cache/TokenCache.js';
import { NativeInteractionClient } from '../interaction_client/NativeInteractionClient.js';
import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';
import { NativeAuthError } from '../error/NativeAuthError.js';
import { SilentCacheClient } from '../interaction_client/SilentCacheClient.js';
import { SilentAuthCodeClient } from '../interaction_client/SilentAuthCodeClient.js';
import { BrowserAuthError } from '../error/BrowserAuthError.js';
import { BrowserPerformanceClient } from '../telemetry/BrowserPerformanceClient.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var ClientApplication = /** @class */ (function () {
/**
* @constructor
* Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object
*
* Important attributes in the Configuration object for auth are:
* - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview
* - authority: the authority URL for your application.
* - redirect_uri: the uri of your application registered in the portal.
*
* In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.
* It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}
* If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
* If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
* If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
* To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
*
* In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/
* Full B2C functionality will be available in this library in future versions.
*
* @param configuration Object for the MSAL PublicClientApplication instance
*/
function ClientApplication(configuration) {
/*
* If loaded in an environment where window is not available,
* set internal flag to false so that further requests fail.
* This is to support server-side rendering environments.
*/
this.isBrowserEnvironment = typeof window !== "undefined";
// Set the configuration.
this.config = buildConfiguration(configuration, this.isBrowserEnvironment);
this.initialized = false;
// Initialize logger
this.logger = new Logger(this.config.system.loggerOptions, name, version);
// Initialize the network module class.
this.networkClient = this.config.system.networkClient;
// Initialize the navigation client class.
this.navigationClient = this.config.system.navigationClient;
// Initialize redirectResponse Map
this.redirectResponse = new Map();
// Initial hybrid spa map
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, this.config.system.cryptoOptions) :
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, this.performanceClient, this.config.system.cryptoOptions) : DEFAULT_CRYPTO_IMPLEMENTATION;
this.eventHandler = new EventHandler(this.logger, this.browserCrypto);
// Initialize the browser storage class.
this.browserStorage = this.isBrowserEnvironment ?
new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger) :
DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);
// initialize in memory storage for native flows
var nativeCacheOptions = {
cacheLocation: BrowserCacheLocation.MemoryStorage,
storeAuthStateInCookie: false,
secureCookies: false
};
this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);
// Initialize the token cache
this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);
}
/**
* Initializer function to perform async startup tasks such as connecting to WAM extension
*/
ClientApplication.prototype.initialize = function () {
return __awaiter(this, void 0, void 0, function () {
var _a, e_1;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
this.logger.trace("initialize called");
if (this.initialized) {
this.logger.info("initialize has already been called, exiting early.");
return [2 /*return*/];
}
this.eventHandler.emitEvent(EventType.INITIALIZE_START);
if (!this.config.system.allowNativeBroker) return [3 /*break*/, 4];
_b.label = 1;
case 1:
_b.trys.push([1, 3, , 4]);
_a = this;
return [4 /*yield*/, NativeMessageHandler.createProvider(this.logger, this.config.system.nativeBrokerHandshakeTimeout)];
case 2:
_a.nativeExtensionProvider = _b.sent();
return [3 /*break*/, 4];
case 3:
e_1 = _b.sent();
this.logger.verbose(e_1);
return [3 /*break*/, 4];
case 4:
this.initialized = true;
this.eventHandler.emitEvent(EventType.INITIALIZE_END);
return [2 /*return*/];
}
});
});
};
// #region Redirect Flow
/**
* Event handler function which allows users to fire events after the PublicClientApplication object
* has loaded during redirect flows. This should be invoked on all page loads involved in redirect
* auth flows.
* @param hash Hash to process. Defaults to the current value of window.location.hash. Only needs to be provided explicitly if the response to be handled is not contained in the current value.
* @returns Token response or null. If the return value is null, then no auth redirect was detected.
*/
ClientApplication.prototype.handleRedirectPromise = function (hash) {
return __awaiter(this, void 0, void 0, function () {
var loggedInAccounts, redirectResponseKey, response, request, redirectResponse, nativeClient, correlationId, redirectClient;
var _this = this;
return __generator(this, function (_a) {
this.logger.verbose("handleRedirectPromise called");
// Block token acquisition before initialize has been called if native brokering is enabled
BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);
loggedInAccounts = this.getAllAccounts();
if (this.isBrowserEnvironment) {
redirectResponseKey = hash || Constants.EMPTY_STRING;
response = this.redirectResponse.get(redirectResponseKey);
if (typeof response === "undefined") {
this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, InteractionType.Redirect);
this.logger.verbose("handleRedirectPromise has been called for the first time, storing the promise");
request = this.browserStorage.getCachedNativeRequest();
redirectResponse = void 0;
if (request && NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) && this.nativeExtensionProvider && !hash) {
this.logger.trace("handleRedirectPromise - acquiring token from native platform");
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);
redirectResponse = nativeClient.handleRedirectPromise();
}
else {
this.logger.trace("handleRedirectPromise - acquiring token from web flow");
correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;
redirectClient = this.createRedirectClient(correlationId);
redirectResponse = redirectClient.handleRedirectPromise(hash);
}
response = redirectResponse.then(function (result) {
if (result) {
// Emit login event if number of accounts change
var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
if (isLoggingIn) {
_this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Redirect, result);
_this.logger.verbose("handleRedirectResponse returned result, login success");
}
else {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Redirect, result);
_this.logger.verbose("handleRedirectResponse returned result, acquire token success");
}
}
_this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);
return result;
}).catch(function (e) {
// Emit login event if there is an account
if (loggedInAccounts.length > 0) {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);
}
else {
_this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e);
}
_this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);
throw e;
});
this.redirectResponse.set(redirectResponseKey, response);
}
else {
this.logger.verbose("handleRedirectPromise has been called previously, returning the result from the first call");
}
return [2 /*return*/, response];
}
this.logger.verbose("handleRedirectPromise returns null, not browser environment");
return [2 /*return*/, null];
});
});
};
/**
* Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects
* the page, so any code that follows this function will not execute.
*
* IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current
* browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
*
* @param request
*/
ClientApplication.prototype.acquireTokenRedirect = function (request) {
return __awaiter(this, void 0, void 0, function () {
var correlationId, isLoggedIn, result, nativeClient, redirectClient;
var _this = this;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(request);
this.logger.verbose("acquireTokenRedirect called", correlationId);
this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);
isLoggedIn = this.getAllAccounts().length > 0;
if (isLoggedIn) {
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Redirect, request);
}
else {
this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Redirect, request);
}
if (this.nativeExtensionProvider && this.canUseNative(request)) {
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
result = nativeClient.acquireTokenRedirect(request).catch(function (e) {
if (e instanceof NativeAuthError && e.isFatal()) {
_this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
var redirectClient = _this.createRedirectClient(request.correlationId);
return redirectClient.acquireToken(request);
}
else if (e instanceof InteractionRequiredAuthError) {
_this.logger.verbose("acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow");
var redirectClient = _this.createRedirectClient(request.correlationId);
return redirectClient.acquireToken(request);
}
_this.browserStorage.setInteractionInProgress(false);
throw e;
});
}
else {
redirectClient = this.createRedirectClient(request.correlationId);
result = redirectClient.acquireToken(request);
}
return [2 /*return*/, result.catch(function (e) {
// If logged in, emit acquire token events
if (isLoggedIn) {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);
}
else {
_this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e);
}
throw e;
})];
});
});
};
// #endregion
// #region Popup Flow
/**
* Use when you want to obtain an access_token for your API via opening a popup window in the user's browser
*
* @param request
*
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
*/
ClientApplication.prototype.acquireTokenPopup = function (request) {
var _this = this;
var correlationId = this.getRequestCorrelationId(request);
var atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);
try {
this.logger.verbose("acquireTokenPopup called", correlationId);
this.preflightBrowserEnvironmentCheck(InteractionType.Popup);
}
catch (e) {
// Since this function is syncronous we need to reject
return Promise.reject(e);
}
// If logged in, emit acquire token events
var loggedInAccounts = this.getAllAccounts();
if (loggedInAccounts.length > 0) {
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Popup, request);
}
else {
this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Popup, request);
}
var result;
if (this.canUseNative(request)) {
result = this.acquireTokenNative(request, ApiId.acquireTokenPopup).then(function (response) {
_this.browserStorage.setInteractionInProgress(false);
atPopupMeasurement.endMeasurement({
success: true,
isNativeBroker: true,
requestId: response.requestId
});
atPopupMeasurement.flushMeasurement();
return response;
}).catch(function (e) {
if (e instanceof NativeAuthError && e.isFatal()) {
_this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
var popupClient = _this.createPopupClient(request.correlationId);
return popupClient.acquireToken(request);
}
else if (e instanceof InteractionRequiredAuthError) {
_this.logger.verbose("acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow");
var popupClient = _this.createPopupClient(request.correlationId);
return popupClient.acquireToken(request);
}
_this.browserStorage.setInteractionInProgress(false);
throw e;
});
}
else {
var popupClient = this.createPopupClient(request.correlationId);
result = popupClient.acquireToken(request);
}
return result.then(function (result) {
/*
* If logged in, emit acquire token events
*/
var isLoggingIn = loggedInAccounts.length < _this.getAllAccounts().length;
if (isLoggingIn) {
_this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Popup, result);
}
else {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Popup, result);
}
atPopupMeasurement.addStaticFields({
accessTokenSize: result.accessToken.length,
idTokenSize: result.idToken.length
});
atPopupMeasurement.endMeasurement({
success: true,
requestId: result.requestId
});
atPopupMeasurement.flushMeasurement();
return result;
}).catch(function (e) {
if (loggedInAccounts.length > 0) {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Popup, null, e);
}
else {
_this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Popup, null, e);
}
atPopupMeasurement.endMeasurement({
errorCode: e.errorCode,
subErrorCode: e.subError,
success: false
});
atPopupMeasurement.flushMeasurement();
// Since this function is syncronous we need to reject
return Promise.reject(e);
});
};
// #endregion
// #region Silent Flow
/**
* This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:
* - Any browser using a form of Intelligent Tracking Prevention
* - If there is not an established session with the service
*
* In these cases, the request must be done inside a popup or full frame redirect.
*
* For the cases where interaction is required, you cannot send a request with prompt=none.
*
* If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as
* you session on the server still exists.
* @param request {@link SsoSilentRequest}
*
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
*/
ClientApplication.prototype.ssoSilent = function (request) {
return __awaiter(this, void 0, void 0, function () {
var correlationId, validRequest, ssoSilentMeasurement, result, silentIframeClient;
var _this = this;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(request);
validRequest = __assign(__assign({}, request), {
// will be PromptValue.NONE or PromptValue.NO_SESSION
prompt: request.prompt, correlationId: correlationId });
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);
this.logger.verbose("ssoSilent called", correlationId);
this.eventHandler.emitEvent(EventType.SSO_SILENT_START, InteractionType.Silent, validRequest);
if (this.canUseNative(validRequest)) {
result = this.acquireTokenNative(validRequest, ApiId.ssoSilent).catch(function (e) {
// If native token acquisition fails for availability reasons fallback to standard flow
if (e instanceof NativeAuthError && e.isFatal()) {
_this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
var silentIframeClient = _this.createSilentIframeClient(validRequest.correlationId);
return silentIframeClient.acquireToken(validRequest);
}
throw e;
});
}
else {
silentIframeClient = this.createSilentIframeClient(validRequest.correlationId);
result = silentIframeClient.acquireToken(validRequest);
}
return [2 /*return*/, result.then(function (response) {
_this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, response);
ssoSilentMeasurement.addStaticFields({
accessTokenSize: response.accessToken.length,
idTokenSize: response.idToken.length
});
ssoSilentMeasurement.endMeasurement({
success: true,
isNativeBroker: response.fromNativeBroker,
requestId: response.requestId
});
ssoSilentMeasurement.flushMeasurement();
return response;
}).catch(function (e) {
_this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, InteractionType.Silent, null, e);
ssoSilentMeasurement.endMeasurement({
errorCode: e.errorCode,
subErrorCode: e.subError,
success: false
});
ssoSilentMeasurement.flushMeasurement();
throw e;
})];
});
});
};
/**
* This function redeems an authorization code (passed as code) from the eSTS token endpoint.
* This authorization code should be acquired server-side using a confidential client to acquire a spa_code.
* This API is not indended for normal authorization code acquisition and redemption.
*
* Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.
*
* @param request {@link AuthorizationCodeRequest}
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
*/
ClientApplication.prototype.acquireTokenByCode = function (request) {
return __awaiter(this, void 0, void 0, function () {
var correlationId, atbcMeasurement, hybridAuthCode_1, response;
var _this = this;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(request);
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
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 {
if (request.code) {
hybridAuthCode_1 = request.code;
response = this.hybridAuthCodeResponses.get(hybridAuthCode_1);
if (!response) {
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(hybridAuthCode_1);
atbcMeasurement.addStaticFields({
accessTokenSize: result.accessToken.length,
idTokenSize: result.idToken.length
});
atbcMeasurement.endMeasurement({
success: true,
isNativeBroker: result.fromNativeBroker,
requestId: result.requestId
});
atbcMeasurement.flushMeasurement();
return result;
})
.catch(function (error) {
_this.hybridAuthCodeResponses.delete(hybridAuthCode_1);
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, error);
atbcMeasurement.endMeasurement({
errorCode: error.errorCode,
subErrorCode: error.subError,
success: false
});
atbcMeasurement.flushMeasurement();
throw error;
});
this.hybridAuthCodeResponses.set(hybridAuthCode_1, response);
}
else {
this.logger.verbose("Existing acquireTokenByCode request found", request.correlationId);
atbcMeasurement.endMeasurement({
success: true
});
atbcMeasurement.discardMeasurement();
}
return [2 /*return*/, response];
}
else if (request.nativeAccountId) {
if (this.canUseNative(request, request.nativeAccountId)) {
return [2 /*return*/, this.acquireTokenNative(request, ApiId.acquireTokenByCode, request.nativeAccountId).catch(function (e) {
// If native token acquisition fails for availability reasons fallback to standard flow
if (e instanceof NativeAuthError && e.isFatal()) {
_this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt
}
throw e;
})];
}
else {
throw BrowserAuthError.createUnableToAcquireTokenFromNativePlatformError();
}
}
else {
throw BrowserAuthError.createAuthCodeOrNativeAccountIdRequiredError();
}
}
catch (e) {
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, e);
atbcMeasurement.endMeasurement({
errorCode: e instanceof AuthError && e.errorCode || undefined,
subErrorCode: e instanceof AuthError && e.subError || undefined,
success: false
});
throw e;
}
return [2 /*return*/];
});
});
};
/**
* Creates a SilentAuthCodeClient to redeem an authorization code.
* @param request
* @returns Result of the operation to redeem the authorization code
*/
ClientApplication.prototype.acquireTokenByCodeAsync = function (request) {
return __awaiter(this, void 0, void 0, function () {
var silentAuthCodeClient, silentTokenResult;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.logger.trace("acquireTokenByCodeAsync called", request.correlationId);
silentAuthCodeClient = this.createSilentAuthCodeClient(request.correlationId);
return [4 /*yield*/, silentAuthCodeClient.acquireToken(request)];
case 1:
silentTokenResult = _a.sent();
return [2 /*return*/, silentTokenResult];
}
});
});
};
/**
* Attempt to acquire an access token from the cache
* @param silentCacheClient SilentCacheClient
* @param commonRequest CommonSilentFlowRequest
* @param silentRequest SilentRequest
* @returns A promise that, when resolved, returns the access token
*/
ClientApplication.prototype.acquireTokenFromCache = function (silentCacheClient, commonRequest, silentRequest) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (silentRequest.cacheLookupPolicy) {
case CacheLookupPolicy.Default:
case CacheLookupPolicy.AccessToken:
case CacheLookupPolicy.AccessTokenAndRefreshToken:
return [2 /*return*/, silentCacheClient.acquireToken(commonRequest)];
default:
throw ClientAuthError.createRefreshRequiredError();
}
return [2 /*return*/];
});
});
};
/**
* Attempt to acquire an access token via a refresh token
* @param commonRequest CommonSilentFlowRequest
* @param silentRequest SilentRequest
* @returns A promise that, when resolved, returns the access token
*/
ClientApplication.prototype.acquireTokenByRefreshToken = function (commonRequest, silentRequest) {
return __awaiter(this, void 0, void 0, function () {
var silentRefreshClient;
return __generator(this, function (_a) {
switch (silentRequest.cacheLookupPolicy) {
case CacheLookupPolicy.Default:
case CacheLookupPolicy.AccessTokenAndRefreshToken:
case CacheLookupPolicy.RefreshToken:
case CacheLookupPolicy.RefreshTokenAndNetwork:
silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);
return [2 /*return*/, silentRefreshClient.acquireToken(commonRequest)];
default:
throw ClientAuthError.createRefreshRequiredError();
}
return [2 /*return*/];
});
});
};
/**
* Attempt to acquire an access token via an iframe
* @param request CommonSilentFlowRequest
* @returns A promise that, when resolved, returns the access token
*/
ClientApplication.prototype.acquireTokenBySilentIframe = function (request) {
return __awaiter(this, void 0, void 0, function () {
var silentIframeClient;
return __generator(this, function (_a) {
silentIframeClient = this.createSilentIframeClient(request.correlationId);
return [2 /*return*/, silentIframeClient.acquireToken(request)];
});
});
};
// #endregion
// #region Logout
/**
* Deprecated logout function. Use logoutRedirect or logoutPopup instead
* @param logoutRequest
* @deprecated
*/
ClientApplication.prototype.logout = function (logoutRequest) {
return __awaiter(this, void 0, void 0, function () {
var correlationId;
return __generator(this, function (_a) {
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))];
});
});
};
/**
* Use to log out the current user, and redirect the user to the postLogoutRedirectUri.
* Default behaviour is to redirect the user to `window.location.href`.
* @param logoutRequest
*/
ClientApplication.prototype.logoutRedirect = function (logoutRequest) {
return __awaiter(this, void 0, void 0, function () {
var correlationId, redirectClient;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(logoutRequest);
this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);
redirectClient = this.createRedirectClient(correlationId);
return [2 /*return*/, redirectClient.logout(logoutRequest)];
});
});
};
/**
* Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
* @param logoutRequest
*/
ClientApplication.prototype.logoutPopup = function (logoutRequest) {
try {
var correlationId = this.getRequestCorrelationId(logoutRequest);
this.preflightBrowserEnvironmentCheck(InteractionType.Popup);
var popupClient = this.createPopupClient(correlationId);
return popupClient.logout(logoutRequest);
}
catch (e) {
// Since this function is syncronous we need to reject
return Promise.reject(e);
}
};
// #endregion
// #region Account APIs
/**
* Returns all accounts that MSAL currently has data for.
* (the account object is created at the time of successful login)
* or empty array when no accounts are found
* @returns Array of account objects in cache
*/
ClientApplication.prototype.getAllAccounts = function () {
this.logger.verbose("getAllAccounts called");
return this.isBrowserEnvironment ? this.browserStorage.getAllAccounts() : [];
};
/**
* Returns the signed in account matching username.
* (the account object is created at the time of successful login)
* or null when no matching account is found.
* This API is provided for convenience but getAccountById should be used for best reliability
* @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;
}
else {
this.logger.verbose("getAccountByUsername: No matching account found, returning null");
return null;
}
};
/**
* Returns the signed in account matching homeAccountId.
* (the account object is created at the time of successful login)
* or null when no matching account is found
* @param homeAccountId
* @returns The account object stored in MSAL
*/
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;
}
else {
this.logger.verbose("getAccountByHomeId: No matching account found, returning null");
return null;
}
};
/**
* Returns the signed in account matching localAccountId.
* (the account object is created at the time of successful login)
* or null when no matching account is found
* @param localAccountId
* @returns The account object stored in MSAL
*/
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;
}
else {
this.logger.verbose("getAccountByLocalId: No matching account found, returning null");
return null;
}
};
/**
* Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.
* @param account
*/
ClientApplication.prototype.setActiveAccount = function (account) {
this.browserStorage.setActiveAccount(account);
};
/**
* Gets the currently active account
*/
ClientApplication.prototype.getActiveAccount = function () {
return this.browserStorage.getActiveAccount();
};
// #endregion
// #region Helpers
/**
* Helper to validate app environment before making an auth request
*
* @protected
* @param {InteractionType} interactionType What kind of interaction is being used
* @param {boolean} [setInteractionInProgress=true] Whether to set interaction in progress temp cache flag
*/
ClientApplication.prototype.preflightBrowserEnvironmentCheck = function (interactionType, setInteractionInProgress) {
if (setInteractionInProgress === void 0) { setInteractionInProgress = true; }
this.logger.verbose("preflightBrowserEnvironmentCheck started");
// Block request if not in browser environment
BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);
// Block redirects if in an iframe
BrowserUtils.blockRedirectInIframe(interactionType, this.config.system.allowRedirectInIframe);
// Block auth requests inside a hidden iframe
BrowserUtils.blockReloadInHiddenIframes();
// Block redirectUri opened in a popup from calling MSAL APIs
BrowserUtils.blockAcquireTokenInPopups();
// Block token acquisition before initialize has been called if native brokering is enabled
BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);
// Block redirects if memory storage is enabled but storeAuthStateInCookie is not
if (interactionType === InteractionType.Redirect &&
this.config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage &&
!this.config.cache.storeAuthStateInCookie) {
throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();
}
if (interactionType === InteractionType.Redirect || interactionType === InteractionType.Popup) {
this.preflightInteractiveRequest(setInteractionInProgress);
}
};
/**
* Preflight check for interactive requests
*
* @protected
* @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag
*/
ClientApplication.prototype.preflightInteractiveRequest = function (setInteractionInProgress) {
this.logger.verbose("preflightInteractiveRequest called, validating app environment");
// block the reload if it occurred inside a hidden iframe
BrowserUtils.blockReloadInHiddenIframes();
// Set interaction in progress temporary cache or throw if alread set.
if (setInteractionInProgress) {
this.browserStorage.setInteractionInProgress(true);
}
};
/**
* Acquire a token from native device (e.g. WAM)
* @param request
*/
ClientApplication.prototype.acquireTokenNative = function (request, apiId, accountId) {
return __awaiter(this, void 0, void 0, function () {
var nativeClient;
return __generator(this, function (_a) {
this.logger.trace("acquireTokenNative called");
if (!this.nativeExtensionProvider) {
throw BrowserAuthError.createNativeConnectionNotEstablishedError();
}
nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.nativeExtensionProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);
return [2 /*return*/, nativeClient.acquireToken(request)];
});
});
};
/**
* Returns boolean indicating if this request can use the native broker
* @param request
*/
ClientApplication.prototype.canUseNative = function (request, accountId) {
this.logger.trace("canUseNative called");
if (!NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme)) {
this.logger.trace("canUseNative: isNativeAvailable returned false, returning false");
return false;
}
if (request.prompt) {
switch (request.prompt) {
case PromptValue.NONE:
case PromptValue.CONSENT:
case PromptValue.LOGIN:
this.logger.trace("canUseNative: prompt is compatible with native flow");
break;
default:
this.logger.trace("canUseNative: prompt = " + request.prompt + " is not compatible with native flow, returning false");
return false;
}
}
if (!accountId && !this.getNativeAccountId(request)) {
this.logger.trace("canUseNative: nativeAccountId is not available, returning false");
return false;
}
return true;
};
/**
* Get the native accountId from the account
* @param request
* @returns
*/
ClientApplication.prototype.getNativeAccountId = function (request) {
var account = request.account || this.browserStorage.getAccountInfoByHints(request.loginHint, request.sid) || this.getActiveAccount();
return account && account.nativeAccountId || "";
};
/**
* Returns new instance of the Popup Interaction Client
* @param correlationId
*/
ClientApplication.prototype.createPopupClient = function (correlationId) {
return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
};
/**
* Returns new instance of the Redirect Interaction Client
* @param correlationId
*/
ClientApplication.prototype.createRedirectClient = function (correlationId) {
return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
};
/**
* Returns new instance of the Silent Iframe Interaction Client
* @param correlationId
*/
ClientApplication.prototype.createSilentIframeClient = function (correlationId) {
return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);
};
/**
* Returns new instance of the Silent Cache Interaction Client
*/
ClientApplication.prototype.createSilentCacheClient = function (correlationId) {
return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
};
/**
* Returns new instance of the Silent Refresh Interaction Client
*/
ClientApplication.prototype.createSilentRefreshClient = function (correlationId) {
return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);
};
/**
* Returns new instance of the Silent AuthCode Interaction Client
*/
ClientApplication.prototype.createSilentAuthCodeClient = function (correlationId) {
return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, this.nativeExtensionProvider, correlationId);
};
/**
* Adds event callbacks to array
* @param callback
*/
ClientApplication.prototype.addEventCallback = function (callback) {
return this.eventHandler.addEventCallback(callback);
};
/**
* Removes callback with provided id from callback array
* @param callbackId
*/
ClientApplication.prototype.removeEventCallback = function (callbackId) {
this.eventHandler.removeEventCallback(callbackId);
};
/**
* 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
*/
ClientApplication.prototype.enableAccountStorageEvents = function () {
this.eventHandler.enableAccountStorageEvents();
};
/**
* Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window
*/
ClientApplication.prototype.disableAccountStorageEvents = function () {
this.eventHandler.disableAccountStorageEvents();
};
/**
* Gets the token cache for the application.
*/
ClientApplication.prototype.getTokenCache = function () {
return this.tokenCache;
};
/**
* Returns the logger instance
*/
ClientApplication.prototype.getLogger = function () {
return this.logger;
};
/**
* Replaces the default logger set in configurations with new Logger with new configurations
* @param logger Logger instance
*/
ClientApplication.prototype.setLogger = function (logger) {
this.logger = logger;
};
/**
* Called by wrapper libraries (Angular & React) to set SKU and Version passed down to telemetry, logger, etc.
* @param sku
* @param version
*/
ClientApplication.prototype.initializeWrapperLibrary = function (sku, version) {
// Validate the SKU passed in is one we expect
this.browserStorage.setWrapperMetadata(sku, version);
};
/**
* Sets navigation client
* @param navigationClient
*/
ClientApplication.prototype.setNavigationClient = function (navigationClient) {
this.navigationClient = navigationClient;
};
/**
* Returns the configuration object
*/
ClientApplication.prototype.getConfiguration = function () {
return this.config;
};
/**
* 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;
}());
export { ClientApplication };
//# sourceMappingURL=ClientApplication.js.map
{"version":3,"file":"ClientApplication.js","sources":["../../src/app/ClientApplication.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { CryptoOps } from \"../crypto/CryptoOps\";\nimport { StringUtils, InteractionRequiredAuthError, AccountInfo, Constants, INetworkModule, AuthenticationResult, Logger, CommonSilentFlowRequest, ICrypto, DEFAULT_CRYPTO_IMPLEMENTATION, AuthError, PerformanceEvents, PerformanceCallbackFunction, StubPerformanceClient, IPerformanceClient, BaseAuthRequest, PromptValue, ClientAuthError } from \"@azure/msal-common\";\nimport { BrowserCacheManager, DEFAULT_BROWSER_CACHE_MANAGER } from \"../cache/BrowserCacheManager\";\nimport { BrowserConfiguration, buildConfiguration, CacheOptions, Configuration } from \"../config/Configuration\";\nimport { InteractionType, ApiId, BrowserCacheLocation, WrapperSKU, TemporaryCacheKeys, CacheLookupPolicy } from \"../utils/BrowserConstants\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { version, name } from \"../packageMetadata\";\nimport { EventCallbackFunction } from \"../event/EventMessage\";\nimport { EventType } from \"../event/EventType\";\nimport { EndSessionRequest } from \"../request/EndSessionRequest\";\nimport { BrowserConfigurationAuthError } from \"../error/BrowserConfigurationAuthError\";\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { EventHandler } from \"../event/EventHandler\";\nimport { PopupClient } from \"../interaction_client/PopupClient\";\nimport { RedirectClient } from \"../interaction_client/RedirectClient\";\nimport { SilentIframeClient } from \"../interaction_client/SilentIframeClient\";\nimport { SilentRefreshClient } from \"../interaction_client/SilentRefreshClient\";\nimport { TokenCache } from \"../cache/TokenCache\";\nimport { ITokenCache } from \"../cache/ITokenCache\";\nimport { NativeInteractionClient } from \"../interaction_client/NativeInteractionClient\";\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { NativeAuthError } from \"../error/NativeAuthError\";\nimport { SilentCacheClient } from \"../interaction_client/SilentCacheClient\";\nimport { SilentAuthCodeClient } from \"../interaction_client/SilentAuthCodeClient\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { AuthorizationCodeRequest } from \"../request/AuthorizationCodeRequest\";\nimport { NativeTokenRequest } from \"../broker/nativeBroker/NativeRequest\";\nimport { BrowserPerformanceClient } from \"../telemetry/BrowserPerformanceClient\";\n\nexport abstract class ClientApplication {\n\n // Crypto interface implementation\n protected readonly browserCrypto: ICrypto;\n\n // Storage interface implementation\n protected readonly browserStorage: BrowserCacheManager;\n\n // Native Cache in memory storage implementation\n protected readonly nativeInternalStorage: BrowserCacheManager;\n\n // Network interface implementation\n protected readonly networkClient: INetworkModule;\n\n // Navigation interface implementation\n protected navigationClient: INavigationClient;\n\n // Input configuration by developer/user\n protected config: BrowserConfiguration;\n\n // Token cache implementation\n private tokenCache: TokenCache;\n\n // Logger\n protected logger: Logger;\n\n // Flag to indicate if in browser environment\n protected isBrowserEnvironment: boolean;\n\n protected eventHandler: EventHandler;\n\n // Redirect Response Object\n protected redirectResponse: Map<string, Promise<AuthenticationResult | null>>;\n\n // Native Extension Provider\n protected nativeExtensionProvider: NativeMessageHandler | undefined;\n\n // Hybrid auth code responses\n private hybridAuthCodeResponses: Map<string, Promise<AuthenticationResult>>;\n\n // Performance telemetry client\n protected performanceClient: IPerformanceClient;\n\n // Flag representing whether or not the initialize API has been called and completed\n protected initialized: boolean;\n\n /**\n * @constructor\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\n *\n * Important attributes in the Configuration object for auth are:\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\n * - authority: the authority URL for your application.\n * - redirect_uri: the uri of your application registered in the portal.\n *\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\n *\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\n * Full B2C functionality will be available in this library in future versions.\n *\n * @param configuration Object for the MSAL PublicClientApplication instance\n */\n constructor(configuration: Configuration) {\n /*\n * If loaded in an environment where window is not available,\n * set internal flag to false so that further requests fail.\n * This is to support server-side rendering environments.\n */\n this.isBrowserEnvironment = typeof window !== \"undefined\";\n // Set the configuration.\n this.config = buildConfiguration(configuration, this.isBrowserEnvironment);\n this.initialized = false;\n\n // Initialize logger\n this.logger = new Logger(this.config.system.loggerOptions, name, version);\n\n // Initialize the network module class.\n this.networkClient = this.config.system.networkClient;\n\n // Initialize the navigation client class.\n this.navigationClient = this.config.system.navigationClient;\n\n // Initialize redirectResponse Map\n this.redirectResponse = new Map();\n\n // Initial hybrid spa map\n this.hybridAuthCodeResponses = new Map();\n\n // Initialize performance client\n this.performanceClient = this.isBrowserEnvironment ?\n new BrowserPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application, this.config.system.cryptoOptions) :\n new StubPerformanceClient(this.config.auth.clientId, this.config.auth.authority, this.logger, name, version, this.config.telemetry.application);\n\n // Initialize the crypto class.\n this.browserCrypto = this.isBrowserEnvironment ? new CryptoOps(this.logger, this.performanceClient, this.config.system.cryptoOptions) : DEFAULT_CRYPTO_IMPLEMENTATION;\n\n this.eventHandler = new EventHandler(this.logger, this.browserCrypto);\n\n // Initialize the browser storage class.\n this.browserStorage = this.isBrowserEnvironment ?\n new BrowserCacheManager(this.config.auth.clientId, this.config.cache, this.browserCrypto, this.logger) :\n DEFAULT_BROWSER_CACHE_MANAGER(this.config.auth.clientId, this.logger);\n\n // initialize in memory storage for native flows\n const nativeCacheOptions: Required<CacheOptions> = {\n cacheLocation: BrowserCacheLocation.MemoryStorage,\n storeAuthStateInCookie: false,\n secureCookies: false\n };\n this.nativeInternalStorage = new BrowserCacheManager(this.config.auth.clientId, nativeCacheOptions, this.browserCrypto, this.logger);\n\n // Initialize the token cache\n this.tokenCache = new TokenCache(this.config, this.browserStorage, this.logger, this.browserCrypto);\n }\n\n /**\n * Initializer function to perform async startup tasks such as connecting to WAM extension\n */\n async initialize(): Promise<void> {\n this.logger.trace(\"initialize called\");\n if (this.initialized) {\n this.logger.info(\"initialize has already been called, exiting early.\");\n return;\n }\n this.eventHandler.emitEvent(EventType.INITIALIZE_START);\n if (this.config.system.allowNativeBroker) {\n try {\n this.nativeExtensionProvider = await NativeMessageHandler.createProvider(this.logger, this.config.system.nativeBrokerHandshakeTimeout);\n } catch (e) {\n this.logger.verbose(e);\n }\n }\n this.initialized = true;\n this.eventHandler.emitEvent(EventType.INITIALIZE_END);\n }\n\n // #region Redirect Flow\n\n /**\n * Event handler function which allows users to fire events after the PublicClientApplication object\n * has loaded during redirect flows. This should be invoked on all page loads involved in redirect\n * auth flows.\n * @param hash Hash to process. Defaults to the current value of window.location.hash. Only needs to be provided explicitly if the response to be handled is not contained in the current value.\n * @returns Token response or null. If the return value is null, then no auth redirect was detected.\n */\n async handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null> {\n this.logger.verbose(\"handleRedirectPromise called\");\n // Block token acquisition before initialize has been called if native brokering is enabled\n BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);\n\n const loggedInAccounts = this.getAllAccounts();\n if (this.isBrowserEnvironment) {\n /**\n * Store the promise on the PublicClientApplication instance if this is the first invocation of handleRedirectPromise,\n * otherwise return the promise from the first invocation. Prevents race conditions when handleRedirectPromise is called\n * several times concurrently.\n */\n const redirectResponseKey = hash || Constants.EMPTY_STRING;\n let response = this.redirectResponse.get(redirectResponseKey);\n if (typeof response === \"undefined\") {\n this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_START, InteractionType.Redirect);\n this.logger.verbose(\"handleRedirectPromise has been called for the first time, storing the promise\");\n\n const request: NativeTokenRequest | null = this.browserStorage.getCachedNativeRequest();\n let redirectResponse: Promise<AuthenticationResult | null>;\n if (request && NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider) && this.nativeExtensionProvider && !hash) {\n this.logger.trace(\"handleRedirectPromise - acquiring token from native platform\");\n const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.handleRedirectPromise, this.performanceClient, this.nativeExtensionProvider, request.accountId, this.nativeInternalStorage, request.correlationId);\n redirectResponse = nativeClient.handleRedirectPromise();\n } else {\n this.logger.trace(\"handleRedirectPromise - acquiring token from web flow\");\n const correlationId = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.CORRELATION_ID, true) || Constants.EMPTY_STRING;\n const redirectClient = this.createRedirectClient(correlationId);\n redirectResponse = redirectClient.handleRedirectPromise(hash);\n }\n\n response = redirectResponse.then((result: AuthenticationResult | null) => {\n if (result) {\n // Emit login event if number of accounts change\n\n const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;\n if (isLoggingIn) {\n this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Redirect, result);\n this.logger.verbose(\"handleRedirectResponse returned result, login success\");\n } else {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Redirect, result);\n this.logger.verbose(\"handleRedirectResponse returned result, acquire token success\");\n }\n }\n this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);\n\n return result;\n }).catch((e) => {\n // Emit login event if there is an account\n if (loggedInAccounts.length > 0) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);\n } else {\n this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e);\n }\n this.eventHandler.emitEvent(EventType.HANDLE_REDIRECT_END, InteractionType.Redirect);\n\n throw e;\n });\n this.redirectResponse.set(redirectResponseKey, response);\n } else {\n this.logger.verbose(\"handleRedirectPromise has been called previously, returning the result from the first call\");\n }\n\n return response;\n }\n this.logger.verbose(\"handleRedirectPromise returns null, not browser environment\");\n return null;\n }\n\n /**\n * Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint. This function redirects\n * the page, so any code that follows this function will not execute.\n *\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\n *\n * @param request\n */\n async acquireTokenRedirect(request: RedirectRequest): Promise<void> {\n // Preflight request\n const correlationId = this.getRequestCorrelationId(request);\n this.logger.verbose(\"acquireTokenRedirect called\", correlationId);\n this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);\n\n // If logged in, emit acquire token events\n const isLoggedIn = this.getAllAccounts().length > 0;\n if (isLoggedIn) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Redirect, request);\n } else {\n this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Redirect, request);\n }\n\n let result: Promise<void>;\n\n if (this.nativeExtensionProvider && this.canUseNative(request)) {\n const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenRedirect, this.performanceClient, this.nativeExtensionProvider, this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);\n result = nativeClient.acquireTokenRedirect(request).catch((e: AuthError) => {\n if (e instanceof NativeAuthError && e.isFatal()) {\n this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\n const redirectClient = this.createRedirectClient(request.correlationId);\n return redirectClient.acquireToken(request);\n } else if (e instanceof InteractionRequiredAuthError) {\n this.logger.verbose(\"acquireTokenRedirect - Resolving interaction required error thrown by native broker by falling back to web flow\");\n const redirectClient = this.createRedirectClient(request.correlationId);\n return redirectClient.acquireToken(request);\n }\n this.browserStorage.setInteractionInProgress(false);\n throw e;\n });\n } else {\n const redirectClient = this.createRedirectClient(request.correlationId);\n result = redirectClient.acquireToken(request);\n }\n\n return result.catch((e) => {\n // If logged in, emit acquire token events\n if (isLoggedIn) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Redirect, null, e);\n } else {\n this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Redirect, null, e);\n }\n throw e;\n });\n }\n\n // #endregion\n\n // #region Popup Flow\n\n /**\n * Use when you want to obtain an access_token for your API via opening a popup window in the user's browser\n *\n * @param request\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult> {\n const correlationId = this.getRequestCorrelationId(request);\n const atPopupMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenPopup, correlationId);\n\n try {\n this.logger.verbose(\"acquireTokenPopup called\", correlationId);\n this.preflightBrowserEnvironmentCheck(InteractionType.Popup);\n } catch (e) {\n // Since this function is syncronous we need to reject\n return Promise.reject(e);\n }\n\n // If logged in, emit acquire token events\n const loggedInAccounts = this.getAllAccounts();\n if (loggedInAccounts.length > 0) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Popup, request);\n } else {\n this.eventHandler.emitEvent(EventType.LOGIN_START, InteractionType.Popup, request);\n }\n\n let result: Promise<AuthenticationResult>;\n\n if (this.canUseNative(request)) {\n result = this.acquireTokenNative(request, ApiId.acquireTokenPopup).then((response) => {\n this.browserStorage.setInteractionInProgress(false);\n atPopupMeasurement.endMeasurement({\n success: true,\n isNativeBroker: true,\n requestId: response.requestId\n });\n atPopupMeasurement.flushMeasurement();\n return response;\n }).catch((e: AuthError) => {\n if (e instanceof NativeAuthError && e.isFatal()) {\n this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\n const popupClient = this.createPopupClient(request.correlationId);\n return popupClient.acquireToken(request);\n } else if (e instanceof InteractionRequiredAuthError) {\n this.logger.verbose(\"acquireTokenPopup - Resolving interaction required error thrown by native broker by falling back to web flow\");\n const popupClient = this.createPopupClient(request.correlationId);\n return popupClient.acquireToken(request);\n }\n this.browserStorage.setInteractionInProgress(false);\n throw e;\n });\n } else {\n const popupClient = this.createPopupClient(request.correlationId);\n result = popupClient.acquireToken(request);\n }\n\n return result.then((result) => {\n\n /*\n * If logged in, emit acquire token events\n */\n const isLoggingIn = loggedInAccounts.length < this.getAllAccounts().length;\n if (isLoggingIn) {\n this.eventHandler.emitEvent(EventType.LOGIN_SUCCESS, InteractionType.Popup, result);\n } else {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Popup, result);\n }\n\n atPopupMeasurement.addStaticFields({\n accessTokenSize: result.accessToken.length,\n idTokenSize: result.idToken.length\n });\n atPopupMeasurement.endMeasurement({\n success: true,\n requestId: result.requestId\n });\n\n atPopupMeasurement.flushMeasurement();\n return result;\n }).catch((e: AuthError) => {\n if (loggedInAccounts.length > 0) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Popup, null, e);\n } else {\n this.eventHandler.emitEvent(EventType.LOGIN_FAILURE, InteractionType.Popup, null, e);\n }\n\n atPopupMeasurement.endMeasurement({\n errorCode: e.errorCode,\n subErrorCode: e.subError,\n success: false\n });\n atPopupMeasurement.flushMeasurement();\n\n // Since this function is syncronous we need to reject\n return Promise.reject(e);\n });\n }\n\n // #endregion\n\n // #region Silent Flow\n\n /**\n * This function uses a hidden iframe to fetch an authorization code from the eSTS. There are cases where this may not work:\n * - Any browser using a form of Intelligent Tracking Prevention\n * - If there is not an established session with the service\n *\n * In these cases, the request must be done inside a popup or full frame redirect.\n *\n * For the cases where interaction is required, you cannot send a request with prompt=none.\n *\n * If your refresh token has expired, you can use this function to fetch a new set of tokens silently as long as\n * you session on the server still exists.\n * @param request {@link SsoSilentRequest}\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n async ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult> {\n const correlationId = this.getRequestCorrelationId(request);\n const validRequest = {\n ...request,\n // will be PromptValue.NONE or PromptValue.NO_SESSION\n prompt: request.prompt,\n correlationId: correlationId\n };\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\n const ssoSilentMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.SsoSilent, correlationId);\n this.logger.verbose(\"ssoSilent called\", correlationId);\n this.eventHandler.emitEvent(EventType.SSO_SILENT_START, InteractionType.Silent, validRequest);\n\n let result: Promise<AuthenticationResult>;\n\n if (this.canUseNative(validRequest)) {\n result = this.acquireTokenNative(validRequest, ApiId.ssoSilent).catch((e: AuthError) => {\n // If native token acquisition fails for availability reasons fallback to standard flow\n if (e instanceof NativeAuthError && e.isFatal()) {\n this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\n const silentIframeClient = this.createSilentIframeClient(validRequest.correlationId);\n return silentIframeClient.acquireToken(validRequest);\n }\n throw e;\n });\n } else {\n const silentIframeClient = this.createSilentIframeClient(validRequest.correlationId);\n result = silentIframeClient.acquireToken(validRequest);\n }\n\n return result.then((response) => {\n this.eventHandler.emitEvent(EventType.SSO_SILENT_SUCCESS, InteractionType.Silent, response);\n ssoSilentMeasurement.addStaticFields({\n accessTokenSize: response.accessToken.length,\n idTokenSize: response.idToken.length\n });\n ssoSilentMeasurement.endMeasurement({\n success: true,\n isNativeBroker: response.fromNativeBroker,\n requestId: response.requestId\n });\n ssoSilentMeasurement.flushMeasurement();\n return response;\n }).catch((e: AuthError) => {\n this.eventHandler.emitEvent(EventType.SSO_SILENT_FAILURE, InteractionType.Silent, null, e);\n ssoSilentMeasurement.endMeasurement({\n errorCode: e.errorCode,\n subErrorCode: e.subError,\n success: false\n });\n ssoSilentMeasurement.flushMeasurement();\n throw e;\n });\n }\n\n /**\n * This function redeems an authorization code (passed as code) from the eSTS token endpoint.\n * This authorization code should be acquired server-side using a confidential client to acquire a spa_code.\n * This API is not indended for normal authorization code acquisition and redemption.\n *\n * Redemption of this authorization code will not require PKCE, as it was acquired by a confidential client.\n *\n * @param request {@link AuthorizationCodeRequest}\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n async acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult> {\n const correlationId = this.getRequestCorrelationId(request);\n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\n this.logger.trace(\"acquireTokenByCode called\", correlationId);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_START, InteractionType.Silent, request);\n const atbcMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenByCode, request.correlationId);\n\n try {\n if (request.code) {\n const hybridAuthCode = request.code;\n let response = this.hybridAuthCodeResponses.get(hybridAuthCode);\n if (!response) {\n this.logger.verbose(\"Initiating new acquireTokenByCode request\", correlationId);\n response = this.acquireTokenByCodeAsync({\n ...request,\n correlationId\n })\n .then((result: AuthenticationResult) => {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_SUCCESS, InteractionType.Silent, result);\n this.hybridAuthCodeResponses.delete(hybridAuthCode);\n atbcMeasurement.addStaticFields({\n accessTokenSize: result.accessToken.length,\n idTokenSize: result.idToken.length\n });\n atbcMeasurement.endMeasurement({\n success: true,\n isNativeBroker: result.fromNativeBroker,\n requestId: result.requestId\n });\n atbcMeasurement.flushMeasurement();\n return result;\n })\n .catch((error: AuthError) => {\n this.hybridAuthCodeResponses.delete(hybridAuthCode);\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, error);\n atbcMeasurement.endMeasurement({\n errorCode: error.errorCode,\n subErrorCode: error.subError,\n success: false\n });\n atbcMeasurement.flushMeasurement();\n throw error;\n });\n this.hybridAuthCodeResponses.set(hybridAuthCode, response);\n } else {\n this.logger.verbose(\"Existing acquireTokenByCode request found\", request.correlationId);\n atbcMeasurement.endMeasurement({\n success: true\n });\n atbcMeasurement.discardMeasurement();\n }\n return response;\n } else if (request.nativeAccountId) {\n if (this.canUseNative(request, request.nativeAccountId)) {\n return this.acquireTokenNative(request, ApiId.acquireTokenByCode, request.nativeAccountId).catch((e: AuthError) => {\n // If native token acquisition fails for availability reasons fallback to standard flow\n if (e instanceof NativeAuthError && e.isFatal()) {\n this.nativeExtensionProvider = undefined; // If extension gets uninstalled during session prevent future requests from continuing to attempt\n }\n throw e;\n });\n } else {\n throw BrowserAuthError.createUnableToAcquireTokenFromNativePlatformError();\n }\n } else {\n throw BrowserAuthError.createAuthCodeOrNativeAccountIdRequiredError();\n }\n\n } catch (e) {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_BY_CODE_FAILURE, InteractionType.Silent, null, e);\n atbcMeasurement.endMeasurement({\n errorCode: e instanceof AuthError && e.errorCode || undefined,\n subErrorCode: e instanceof AuthError && e.subError || undefined,\n success: false\n });\n throw e;\n }\n }\n\n /**\n * Creates a SilentAuthCodeClient to redeem an authorization code.\n * @param request\n * @returns Result of the operation to redeem the authorization code\n */\n private async acquireTokenByCodeAsync(request: AuthorizationCodeRequest): Promise<AuthenticationResult> {\n this.logger.trace(\"acquireTokenByCodeAsync called\", request.correlationId);\n const silentAuthCodeClient = this.createSilentAuthCodeClient(request.correlationId);\n const silentTokenResult = await silentAuthCodeClient.acquireToken(request);\n return silentTokenResult;\n }\n\n /**\n * Attempt to acquire an access token from the cache\n * @param silentCacheClient SilentCacheClient\n * @param commonRequest CommonSilentFlowRequest\n * @param silentRequest SilentRequest\n * @returns A promise that, when resolved, returns the access token\n */\n protected async acquireTokenFromCache(\n silentCacheClient: SilentCacheClient,\n commonRequest: CommonSilentFlowRequest,\n silentRequest: SilentRequest\n ): Promise<AuthenticationResult> {\n switch(silentRequest.cacheLookupPolicy) {\n case CacheLookupPolicy.Default:\n case CacheLookupPolicy.AccessToken:\n case CacheLookupPolicy.AccessTokenAndRefreshToken:\n return silentCacheClient.acquireToken(commonRequest);\n default:\n throw ClientAuthError.createRefreshRequiredError();\n }\n }\n\n /**\n * Attempt to acquire an access token via a refresh token\n * @param commonRequest CommonSilentFlowRequest\n * @param silentRequest SilentRequest\n * @returns A promise that, when resolved, returns the access token\n */\n protected async acquireTokenByRefreshToken(\n commonRequest: CommonSilentFlowRequest,\n silentRequest: SilentRequest\n ): Promise<AuthenticationResult> {\n switch(silentRequest.cacheLookupPolicy) {\n case CacheLookupPolicy.Default:\n case CacheLookupPolicy.AccessTokenAndRefreshToken:\n case CacheLookupPolicy.RefreshToken:\n case CacheLookupPolicy.RefreshTokenAndNetwork:\n const silentRefreshClient = this.createSilentRefreshClient(commonRequest.correlationId);\n return silentRefreshClient.acquireToken(commonRequest);\n default:\n throw ClientAuthError.createRefreshRequiredError();\n }\n }\n\n /**\n * Attempt to acquire an access token via an iframe\n * @param request CommonSilentFlowRequest\n * @returns A promise that, when resolved, returns the access token\n */\n protected async acquireTokenBySilentIframe(\n request: CommonSilentFlowRequest\n ): Promise<AuthenticationResult> {\n const silentIframeClient = this.createSilentIframeClient(request.correlationId);\n return silentIframeClient.acquireToken(request);\n }\n\n // #endregion\n\n // #region Logout\n\n /**\n * Deprecated logout function. Use logoutRedirect or logoutPopup instead\n * @param logoutRequest\n * @deprecated\n */\n async logout(logoutRequest?: EndSessionRequest): Promise<void> {\n const correlationId = this.getRequestCorrelationId(logoutRequest);\n this.logger.warning(\"logout API is deprecated and will be removed in msal-browser v3.0.0. Use logoutRedirect instead.\", correlationId);\n return this.logoutRedirect({\n correlationId,\n ...logoutRequest\n });\n }\n\n /**\n * Use to log out the current user, and redirect the user to the postLogoutRedirectUri.\n * Default behaviour is to redirect the user to `window.location.href`.\n * @param logoutRequest\n */\n async logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void> {\n const correlationId = this.getRequestCorrelationId(logoutRequest);\n this.preflightBrowserEnvironmentCheck(InteractionType.Redirect);\n\n const redirectClient = this.createRedirectClient(correlationId);\n return redirectClient.logout(logoutRequest);\n }\n\n /**\n * Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server\n * @param logoutRequest\n */\n logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void> {\n try {\n const correlationId = this.getRequestCorrelationId(logoutRequest);\n this.preflightBrowserEnvironmentCheck(InteractionType.Popup);\n const popupClient = this.createPopupClient(correlationId);\n return popupClient.logout(logoutRequest);\n } catch (e) {\n // Since this function is syncronous we need to reject\n return Promise.reject(e);\n }\n }\n\n // #endregion\n\n // #region Account APIs\n\n /**\n * Returns all accounts that MSAL currently has data for.\n * (the account object is created at the time of successful login)\n * or empty array when no accounts are found\n * @returns Array of account objects in cache\n */\n getAllAccounts(): AccountInfo[] {\n this.logger.verbose(\"getAllAccounts called\");\n return this.isBrowserEnvironment ? this.browserStorage.getAllAccounts() : [];\n }\n\n /**\n * Returns the signed in account matching username.\n * (the account object is created at the time of successful login)\n * or null when no matching account is found.\n * This API is provided for convenience but getAccountById should be used for best reliability\n * @param userName\n * @returns The account object stored in MSAL\n */\n getAccountByUsername(userName: string): AccountInfo | null {\n const allAccounts = this.getAllAccounts();\n if (!StringUtils.isEmpty(userName) && allAccounts && allAccounts.length) {\n this.logger.verbose(\"Account matching username found, returning\");\n this.logger.verbosePii(`Returning signed-in accounts matching username: ${userName}`);\n return allAccounts.filter(accountObj => accountObj.username.toLowerCase() === userName.toLowerCase())[0] || null;\n } else {\n this.logger.verbose(\"getAccountByUsername: No matching account found, returning null\");\n return null;\n }\n }\n\n /**\n * Returns the signed in account matching homeAccountId.\n * (the account object is created at the time of successful login)\n * or null when no matching account is found\n * @param homeAccountId\n * @returns The account object stored in MSAL\n */\n getAccountByHomeId(homeAccountId: string): AccountInfo | null {\n const allAccounts = this.getAllAccounts();\n if (!StringUtils.isEmpty(homeAccountId) && allAccounts && allAccounts.length) {\n this.logger.verbose(\"Account matching homeAccountId found, returning\");\n this.logger.verbosePii(`Returning signed-in accounts matching homeAccountId: ${homeAccountId}`);\n return allAccounts.filter(accountObj => accountObj.homeAccountId === homeAccountId)[0] || null;\n } else {\n this.logger.verbose(\"getAccountByHomeId: No matching account found, returning null\");\n return null;\n }\n }\n\n /**\n * Returns the signed in account matching localAccountId.\n * (the account object is created at the time of successful login)\n * or null when no matching account is found\n * @param localAccountId\n * @returns The account object stored in MSAL\n */\n getAccountByLocalId(localAccountId: string): AccountInfo | null {\n const allAccounts = this.getAllAccounts();\n if (!StringUtils.isEmpty(localAccountId) && allAccounts && allAccounts.length) {\n this.logger.verbose(\"Account matching localAccountId found, returning\");\n this.logger.verbosePii(`Returning signed-in accounts matching localAccountId: ${localAccountId}`);\n return allAccounts.filter(accountObj => accountObj.localAccountId === localAccountId)[0] || null;\n } else {\n this.logger.verbose(\"getAccountByLocalId: No matching account found, returning null\");\n return null;\n }\n }\n\n /**\n * Sets the account to use as the active account. If no account is passed to the acquireToken APIs, then MSAL will use this active account.\n * @param account\n */\n setActiveAccount(account: AccountInfo | null): void {\n this.browserStorage.setActiveAccount(account);\n }\n\n /**\n * Gets the currently active account\n */\n getActiveAccount(): AccountInfo | null {\n return this.browserStorage.getActiveAccount();\n }\n\n // #endregion\n\n // #region Helpers\n\n /**\n * Helper to validate app environment before making an auth request\n *\n * @protected\n * @param {InteractionType} interactionType What kind of interaction is being used\n * @param {boolean} [setInteractionInProgress=true] Whether to set interaction in progress temp cache flag\n */\n protected preflightBrowserEnvironmentCheck(interactionType: InteractionType, setInteractionInProgress: boolean = true): void {\n this.logger.verbose(\"preflightBrowserEnvironmentCheck started\");\n // Block request if not in browser environment\n BrowserUtils.blockNonBrowserEnvironment(this.isBrowserEnvironment);\n\n // Block redirects if in an iframe\n BrowserUtils.blockRedirectInIframe(interactionType, this.config.system.allowRedirectInIframe);\n\n // Block auth requests inside a hidden iframe\n BrowserUtils.blockReloadInHiddenIframes();\n\n // Block redirectUri opened in a popup from calling MSAL APIs\n BrowserUtils.blockAcquireTokenInPopups();\n\n // Block token acquisition before initialize has been called if native brokering is enabled\n BrowserUtils.blockNativeBrokerCalledBeforeInitialized(this.config.system.allowNativeBroker, this.initialized);\n\n // Block redirects if memory storage is enabled but storeAuthStateInCookie is not\n if (interactionType === InteractionType.Redirect &&\n this.config.cache.cacheLocation === BrowserCacheLocation.MemoryStorage &&\n !this.config.cache.storeAuthStateInCookie) {\n throw BrowserConfigurationAuthError.createInMemoryRedirectUnavailableError();\n }\n\n if (interactionType === InteractionType.Redirect || interactionType === InteractionType.Popup) {\n this.preflightInteractiveRequest(setInteractionInProgress);\n }\n }\n\n /**\n * Preflight check for interactive requests\n *\n * @protected\n * @param {boolean} setInteractionInProgress Whether to set interaction in progress temp cache flag\n */\n protected preflightInteractiveRequest(setInteractionInProgress: boolean): void {\n this.logger.verbose(\"preflightInteractiveRequest called, validating app environment\");\n // block the reload if it occurred inside a hidden iframe\n BrowserUtils.blockReloadInHiddenIframes();\n\n // Set interaction in progress temporary cache or throw if alread set.\n if (setInteractionInProgress) {\n this.browserStorage.setInteractionInProgress(true);\n }\n }\n\n /**\n * Acquire a token from native device (e.g. WAM)\n * @param request\n */\n protected async acquireTokenNative(request: PopupRequest | SilentRequest | SsoSilentRequest, apiId: ApiId, accountId?: string): Promise<AuthenticationResult> {\n this.logger.trace(\"acquireTokenNative called\");\n if (!this.nativeExtensionProvider) {\n throw BrowserAuthError.createNativeConnectionNotEstablishedError();\n }\n\n const nativeClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, apiId, this.performanceClient, this.nativeExtensionProvider, accountId || this.getNativeAccountId(request), this.nativeInternalStorage, request.correlationId);\n\n return nativeClient.acquireToken(request);\n }\n\n /**\n * Returns boolean indicating if this request can use the native broker\n * @param request\n */\n protected canUseNative(request: RedirectRequest | PopupRequest | SsoSilentRequest, accountId?: string): boolean {\n this.logger.trace(\"canUseNative called\");\n if (!NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme)) {\n this.logger.trace(\"canUseNative: isNativeAvailable returned false, returning false\");\n return false;\n }\n\n if (request.prompt) {\n switch (request.prompt) {\n case PromptValue.NONE:\n case PromptValue.CONSENT:\n case PromptValue.LOGIN:\n this.logger.trace(\"canUseNative: prompt is compatible with native flow\");\n break;\n default:\n this.logger.trace(`canUseNative: prompt = ${request.prompt} is not compatible with native flow, returning false`);\n return false;\n }\n }\n\n if (!accountId && !this.getNativeAccountId(request)) {\n this.logger.trace(\"canUseNative: nativeAccountId is not available, returning false\");\n return false;\n }\n\n return true;\n }\n\n /**\n * Get the native accountId from the account\n * @param request\n * @returns\n */\n protected getNativeAccountId(request: RedirectRequest | PopupRequest | SsoSilentRequest): string {\n const account = request.account || this.browserStorage.getAccountInfoByHints(request.loginHint, request.sid) || this.getActiveAccount();\n\n return account && account.nativeAccountId || \"\";\n }\n\n /**\n * Returns new instance of the Popup Interaction Client\n * @param correlationId\n */\n protected createPopupClient(correlationId?: string): PopupClient {\n return new PopupClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);\n }\n\n /**\n * Returns new instance of the Redirect Interaction Client\n * @param correlationId\n */\n protected createRedirectClient(correlationId?: string): RedirectClient {\n return new RedirectClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);\n }\n\n /**\n * Returns new instance of the Silent Iframe Interaction Client\n * @param correlationId\n */\n protected createSilentIframeClient(correlationId?: string): SilentIframeClient {\n return new SilentIframeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.ssoSilent, this.performanceClient, this.nativeInternalStorage, this.nativeExtensionProvider, correlationId);\n }\n\n /**\n * Returns new instance of the Silent Cache Interaction Client\n */\n protected createSilentCacheClient(correlationId?: string): SilentCacheClient {\n return new SilentCacheClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);\n }\n\n /**\n * Returns new instance of the Silent Refresh Interaction Client\n */\n protected createSilentRefreshClient(correlationId?: string): SilentRefreshClient {\n return new SilentRefreshClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.performanceClient, this.nativeExtensionProvider, correlationId);\n }\n\n /**\n * Returns new instance of the Silent AuthCode Interaction Client\n */\n protected createSilentAuthCodeClient(correlationId?: string): SilentAuthCodeClient {\n return new SilentAuthCodeClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenByCode, this.performanceClient, this.nativeExtensionProvider, correlationId);\n }\n\n /**\n * Adds event callbacks to array\n * @param callback\n */\n addEventCallback(callback: EventCallbackFunction): string | null {\n return this.eventHandler.addEventCallback(callback);\n }\n\n /**\n * Removes callback with provided id from callback array\n * @param callbackId\n */\n removeEventCallback(callbackId: string): void {\n this.eventHandler.removeEventCallback(callbackId);\n }\n\n /**\n * Registers a callback to receive performance events.\n *\n * @param {PerformanceCallbackFunction} callback\n * @returns {string}\n */\n addPerformanceCallback(callback: PerformanceCallbackFunction): string {\n return this.performanceClient.addPerformanceCallback(callback);\n }\n\n /**\n * Removes a callback registered with addPerformanceCallback.\n *\n * @param {string} callbackId\n * @returns {boolean}\n */\n removePerformanceCallback(callbackId: string): boolean {\n return this.performanceClient.removePerformanceCallback(callbackId);\n }\n\n /**\n * Adds event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\n */\n enableAccountStorageEvents(): void {\n this.eventHandler.enableAccountStorageEvents();\n }\n\n /**\n * Removes event listener that emits an event when a user account is added or removed from localstorage in a different browser tab or window\n */\n disableAccountStorageEvents(): void {\n this.eventHandler.disableAccountStorageEvents();\n }\n\n /**\n * Gets the token cache for the application.\n */\n getTokenCache(): ITokenCache {\n return this.tokenCache;\n }\n\n /**\n * Returns the logger instance\n */\n getLogger(): Logger {\n return this.logger;\n }\n\n /**\n * Replaces the default logger set in configurations with new Logger with new configurations\n * @param logger Logger instance\n */\n setLogger(logger: Logger): void {\n this.logger = logger;\n }\n\n /**\n * Called by wrapper libraries (Angular & React) to set SKU and Version passed down to telemetry, logger, etc.\n * @param sku\n * @param version\n */\n initializeWrapperLibrary(sku: WrapperSKU, version: string): void {\n // Validate the SKU passed in is one we expect\n this.browserStorage.setWrapperMetadata(sku, version);\n }\n\n /**\n * Sets navigation client\n * @param navigationClient\n */\n setNavigationClient(navigationClient: INavigationClient): void {\n this.navigationClient = navigationClient;\n }\n\n /**\n * Returns the configuration object\n */\n getConfiguration(): BrowserConfiguration {\n return this.config;\n }\n\n /**\n * Generates a correlation id for a request if none is provided.\n *\n * @protected\n * @param {?Partial<BaseAuthRequest>} [request]\n * @returns {string}\n */\n protected getRequestCorrelationId(request?: Partial<BaseAuthRequest>): string {\n if (request?.correlationId) {\n return request.correlationId;\n }\n\n if (this.isBrowserEnvironment) {\n return this.browserCrypto.createNewGuid();\n }\n\n /*\n * Included for fallback for non-browser environments,\n * and to ensure this method always returns a string.\n */\n return Constants.EMPTY_STRING;\n }\n\n // #endregion\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;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C;KACjC;IAGL,wBAAC;AAAD,CAAC;;;;"}
\ No newline at end of file
import { AuthenticationResult, AccountInfo, Logger, PerformanceCallbackFunction } from "@azure/msal-common";
import { RedirectRequest } from "../request/RedirectRequest";
import { PopupRequest } from "../request/PopupRequest";
import { SilentRequest } from "../request/SilentRequest";
import { SsoSilentRequest } from "../request/SsoSilentRequest";
import { EndSessionRequest } from "../request/EndSessionRequest";
import { WrapperSKU } from "../utils/BrowserConstants";
import { INavigationClient } from "../navigation/INavigationClient";
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest";
import { ITokenCache } from "../cache/ITokenCache";
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest";
import { BrowserConfiguration } from "../config/Configuration";
export interface IPublicClientApplication {
initialize(): Promise<void>;
acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;
acquireTokenRedirect(request: RedirectRequest): Promise<void>;
acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;
acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
addEventCallback(callback: Function): string | null;
removeEventCallback(callbackId: string): void;
addPerformanceCallback(callback: PerformanceCallbackFunction): string;
removePerformanceCallback(callbackId: string): boolean;
enableAccountStorageEvents(): void;
disableAccountStorageEvents(): void;
getAccountByHomeId(homeAccountId: string): AccountInfo | null;
getAccountByLocalId(localId: string): AccountInfo | null;
getAccountByUsername(userName: string): AccountInfo | null;
getAllAccounts(): AccountInfo[];
handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;
loginPopup(request?: PopupRequest): Promise<AuthenticationResult>;
loginRedirect(request?: RedirectRequest): Promise<void>;
logout(logoutRequest?: EndSessionRequest): Promise<void>;
logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;
logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void>;
ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;
getTokenCache(): ITokenCache;
getLogger(): Logger;
setLogger(logger: Logger): void;
setActiveAccount(account: AccountInfo | null): void;
getActiveAccount(): AccountInfo | null;
initializeWrapperLibrary(sku: WrapperSKU, version: string): void;
setNavigationClient(navigationClient: INavigationClient): void;
getConfiguration(): BrowserConfiguration;
}
export declare const stubbedPublicClientApplication: IPublicClientApplication;
//# sourceMappingURL=IPublicClientApplication.d.ts.map
\ No newline at end of file
{"version":3,"file":"IPublicClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/IPublicClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,oBAAoB,EAAE,WAAW,EAAE,MAAM,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAC;AAC5G,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAEjE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,wBAAwB,EAAE,MAAM,qCAAqC,CAAC;AAC/E,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,MAAM,WAAW,wBAAwB;IACrC,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5B,iBAAiB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACxE,oBAAoB,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9D,kBAAkB,CAAC,aAAa,EAAE,aAAa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AoB,CAAC,CAAC;IACpE,aAAa,IAAI,WAAW,CAAC;IAC7B,SAAS,IAAI,MAAM,CAAC;IACpB,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;IACpD,gBAAgB,IAAI,WAAW,GAAG,IAAI,CAAC;IACvC,wBAAwB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACjE,mBAAmB,CAAC,gBAAgB,EAAE,iBAAiB,GAAG,IAAI,CAAC;IAC/D,gBAAgB,IAAI,oBAAoB,CAAC;CAC5C;AAED,eAAO,MAAM,8BAA8B,EAAE,wBA2F5C,CAAC"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { BrowserConfigurationAuthError } from '../error/BrowserConfigurationAuthError.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var stubbedPublicClientApplication = {
initialize: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
acquireTokenPopup: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
acquireTokenRedirect: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
acquireTokenSilent: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
acquireTokenByCode: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
getAllAccounts: function () {
return [];
},
getAccountByHomeId: function () {
return null;
},
getAccountByUsername: function () {
return null;
},
getAccountByLocalId: function () {
return null;
},
handleRedirectPromise: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
loginPopup: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
loginRedirect: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
logout: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
logoutRedirect: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
logoutPopup: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
ssoSilent: function () {
return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());
},
addEventCallback: function () {
return null;
},
removeEventCallback: function () {
return;
},
addPerformanceCallback: function () {
return "";
},
removePerformanceCallback: function () {
return false;
},
enableAccountStorageEvents: function () {
return;
},
disableAccountStorageEvents: function () {
return;
},
getTokenCache: function () {
throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();
},
getLogger: function () {
throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();
},
setLogger: function () {
return;
},
setActiveAccount: function () {
return;
},
getActiveAccount: function () {
return null;
},
initializeWrapperLibrary: function () {
return;
},
setNavigationClient: function () {
return;
},
getConfiguration: function () {
throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();
}
};
export { stubbedPublicClientApplication };
//# sourceMappingURL=IPublicClientApplication.js.map
{"version":3,"file":"IPublicClientApplication.js","sources":["../../src/app/IPublicClientApplication.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AuthenticationResult, AccountInfo, Logger, PerformanceCallbackFunction } from \"@azure/msal-common\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { SsoSilentRequest } from \"../request/SsoSilentRequest\";\nimport { EndSessionRequest } from \"../request/EndSessionRequest\";\nimport { BrowserConfigurationAuthError } from \"../error/BrowserConfigurationAuthError\";\nimport { WrapperSKU } from \"../utils/BrowserConstants\";\nimport { INavigationClient } from \"../navigation/INavigationClient\";\nimport { EndSessionPopupRequest } from \"../request/EndSessionPopupRequest\";\nimport { ITokenCache } from \"../cache/ITokenCache\";\nimport { AuthorizationCodeRequest } from \"../request/AuthorizationCodeRequest\";\nimport { BrowserConfiguration } from \"../config/Configuration\";\n\nexport interface IPublicClientApplication {\n initialize(): Promise<void>;\n acquireTokenPopup(request: PopupRequest): Promise<AuthenticationResult>;\n acquireTokenRedirect(request: RedirectRequest): Promise<void>;\n acquireTokenSilent(silentRequest: SilentRequest): Promise<AuthenticationResult>;\n acquireTokenByCode(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;\n addEventCallback(callback: Function): string | null;\n removeEventCallback(callbackId: string): void;\n addPerformanceCallback(callback: PerformanceCallbackFunction): string;\n removePerformanceCallback(callbackId: string): boolean;\n enableAccountStorageEvents(): void;\n disableAccountStorageEvents(): void;\n getAccountByHomeId(homeAccountId: string): AccountInfo | null;\n getAccountByLocalId(localId: string): AccountInfo | null;\n getAccountByUsername(userName: string): AccountInfo | null;\n getAllAccounts(): AccountInfo[];\n handleRedirectPromise(hash?: string): Promise<AuthenticationResult | null>;\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult>;\n loginRedirect(request?: RedirectRequest): Promise<void>;\n logout(logoutRequest?: EndSessionRequest): Promise<void>;\n logoutRedirect(logoutRequest?: EndSessionRequest): Promise<void>;\n logoutPopup(logoutRequest?: EndSessionPopupRequest): Promise<void>;\n ssoSilent(request: SsoSilentRequest): Promise<AuthenticationResult>;\n getTokenCache(): ITokenCache;\n getLogger(): Logger;\n setLogger(logger: Logger): void;\n setActiveAccount(account: AccountInfo | null): void;\n getActiveAccount(): AccountInfo | null;\n initializeWrapperLibrary(sku: WrapperSKU, version: string): void;\n setNavigationClient(navigationClient: INavigationClient): void;\n getConfiguration(): BrowserConfiguration;\n}\n\nexport const stubbedPublicClientApplication: IPublicClientApplication = {\n initialize: () => {\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\n },\n acquireTokenPopup: () => {\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\n },\n acquireTokenRedirect: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n acquireTokenSilent: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n acquireTokenByCode: () => {\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\n },\n getAllAccounts: () => {\n return [];\t\n },\t\n getAccountByHomeId: () => {\n return null;\n },\n getAccountByUsername: () => {\t\n return null;\t\n },\t\n getAccountByLocalId: () => {\n return null;\n },\n handleRedirectPromise: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n loginPopup: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n loginRedirect: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n logout: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\t\n logoutRedirect: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n logoutPopup: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n ssoSilent: () => {\t\n return Promise.reject(BrowserConfigurationAuthError.createStubPcaInstanceCalledError());\t\n },\n addEventCallback: () => {\n return null;\n },\n removeEventCallback: () => {\n return;\n },\n addPerformanceCallback: () => {\n return \"\";\n },\n removePerformanceCallback: () => {\n return false;\n },\n enableAccountStorageEvents: () => {\n return;\n },\n disableAccountStorageEvents: () => {\n return;\n },\n getTokenCache: () => {\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\n },\n getLogger: () => {\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\n },\n setLogger: () => {\n return;\n },\n setActiveAccount: () => {\n return;\n },\n getActiveAccount: () => {\n return null;\n },\n initializeWrapperLibrary: () => {\n return;\n },\n setNavigationClient: () => {\n return;\n },\n getConfiguration: () => {\n throw BrowserConfigurationAuthError.createStubPcaInstanceCalledError();\n }\n};\n"],"names":[],"mappings":";;;;AAAA;;;;IAoDa,8BAA8B,GAA6B;IACpE,UAAU,EAAE;QACR,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,iBAAiB,EAAE;QACf,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,oBAAoB,EAAE;QAClB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,kBAAkB,EAAE;QAChB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,kBAAkB,EAAE;QAChB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,cAAc,EAAE;QACZ,OAAO,EAAE,CAAC;KACb;IACD,kBAAkB,EAAE;QAChB,OAAO,IAAI,CAAC;KACf;IACD,oBAAoB,EAAE;QAClB,OAAO,IAAI,CAAC;KACf;IACD,mBAAmB,EAAE;QACjB,OAAO,IAAI,CAAC;KACf;IACD,qBAAqB,EAAE;QACnB,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,UAAU,EAAE;QACR,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,aAAa,EAAE;QACX,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,MAAM,EAAE;QACJ,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,cAAc,EAAE;QACZ,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,WAAW,EAAE;QACT,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,SAAS,EAAE;QACP,OAAO,OAAO,CAAC,MAAM,CAAC,6BAA6B,CAAC,gCAAgC,EAAE,CAAC,CAAC;KAC3F;IACD,gBAAgB,EAAE;QACd,OAAO,IAAI,CAAC;KACf;IACD,mBAAmB,EAAE;QACjB,OAAO;KACV;IACD,sBAAsB,EAAE;QACpB,OAAO,EAAE,CAAC;KACb;IACD,yBAAyB,EAAE;QACvB,OAAO,KAAK,CAAC;KAChB;IACD,0BAA0B,EAAE;QACxB,OAAO;KACV;IACD,2BAA2B,EAAE;QACzB,OAAO;KACV;IACD,aAAa,EAAE;QACX,MAAM,6BAA6B,CAAC,gCAAgC,EAAE,CAAC;KAC1E;IACD,SAAS,EAAE;QACP,MAAM,6BAA6B,CAAC,gCAAgC,EAAE,CAAC;KAC1E;IACD,SAAS,EAAE;QACP,OAAO;KACV;IACD,gBAAgB,EAAE;QACd,OAAO;KACV;IACD,gBAAgB,EAAE;QACd,OAAO,IAAI,CAAC;KACf;IACD,wBAAwB,EAAE;QACtB,OAAO;KACV;IACD,mBAAmB,EAAE;QACjB,OAAO;KACV;IACD,gBAAgB,EAAE;QACd,MAAM,6BAA6B,CAAC,gCAAgC,EAAE,CAAC;KAC1E;;;;;"}
\ No newline at end of file
{"version":3,"file":"PublicClientApplication.d.ts","sourceRoot":"","sources":["../../src/app/PublicClientApplication.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAyG,MAAM,oBAAoB,CAAC;AAC9K,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAE,wBAAwB,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAOzD;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,iBAAkB,YAAW,wBAAwB;IAG9F,OAAO,CAAC,yBAAyB,CAA6C;IAE9E;;;;;;;;;;;;;;;;;;;;OAoBG;gBACS,aAAa,EAAE,aAAa;IAMxC;;;;;;;;OAQG;IACG,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7D;;;;;;OAMG;IACH,UAAU,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC;IASjE;;;;;OAKG;IACG,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC;IA2E/E;;;;;OAKG;cACa,uBAAuB,CAAC,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAoFvH"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { __extends, __awaiter, __generator, __assign } from '../_virtual/_tslib.js';
import { PerformanceEvents, Constants, ServerError, InteractionRequiredAuthError } from '@azure/msal-common';
import { DEFAULT_REQUEST, InteractionType, CacheLookupPolicy, ApiId, BrowserConstants } from '../utils/BrowserConstants.js';
import { ClientApplication } from './ClientApplication.js';
import { EventType } from '../event/EventType.js';
import { BrowserAuthError } from '../error/BrowserAuthError.js';
import { NativeAuthError } from '../error/NativeAuthError.js';
import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.js';
import { BrowserUtils } from '../utils/BrowserUtils.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications
* to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.
*/
var PublicClientApplication = /** @class */ (function (_super) {
__extends(PublicClientApplication, _super);
/**
* @constructor
* Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object
*
* Important attributes in the Configuration object for auth are:
* - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview
* - authority: the authority URL for your application.
* - redirect_uri: the uri of your application registered in the portal.
*
* In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.
* It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}
* If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).
* If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations.
* If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common.
* To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
*
* In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/
* Full B2C functionality will be available in this library in future versions.
*
* @param configuration object for the MSAL PublicClientApplication instance
*/
function PublicClientApplication(configuration) {
var _this = _super.call(this, configuration) || this;
_this.activeSilentTokenRequests = new Map();
return _this;
}
/**
* Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so
* any code that follows this function will not execute.
*
* IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current
* browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.
*
* @param request
*/
PublicClientApplication.prototype.loginRedirect = function (request) {
return __awaiter(this, void 0, void 0, function () {
var correlationId;
return __generator(this, function (_a) {
correlationId = this.getRequestCorrelationId(request);
this.logger.verbose("loginRedirect called", correlationId);
return [2 /*return*/, this.acquireTokenRedirect(__assign({ correlationId: correlationId }, (request || DEFAULT_REQUEST)))];
});
});
};
/**
* Use when initiating the login process via opening a popup window in the user's browser
*
* @param request
*
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
*/
PublicClientApplication.prototype.loginPopup = function (request) {
var correlationId = this.getRequestCorrelationId(request);
this.logger.verbose("loginPopup called", correlationId);
return this.acquireTokenPopup(__assign({ correlationId: correlationId }, (request || DEFAULT_REQUEST)));
};
/**
* Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.
*
* @param {@link (SilentRequest:type)}
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object
*/
PublicClientApplication.prototype.acquireTokenSilent = function (request) {
return __awaiter(this, void 0, void 0, function () {
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);
atsMeasurement.addStaticFields({
cacheLookupPolicy: request.cacheLookupPolicy
});
this.preflightBrowserEnvironmentCheck(InteractionType.Silent);
this.logger.verbose("acquireTokenSilent called", correlationId);
account = request.account || this.getActiveAccount();
if (!account) {
throw BrowserAuthError.createNoAccountError();
}
thumbprint = {
clientId: this.config.auth.clientId,
authority: request.authority || Constants.EMPTY_STRING,
scopes: request.scopes,
homeAccountIdentifier: account.homeAccountId,
claims: request.claims,
authenticationScheme: request.authenticationScheme,
resourceRequestMethod: request.resourceRequestMethod,
resourceRequestUri: request.resourceRequestUri,
shrClaims: request.shrClaims,
sshKid: request.sshKid
};
silentRequestKey = JSON.stringify(thumbprint);
cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);
if (typeof cachedResponse === "undefined") {
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.addStaticFields({
accessTokenSize: result.accessToken.length,
idTokenSize: result.idToken.length
});
atsMeasurement.endMeasurement({
success: true,
fromCache: result.fromCache,
isNativeBroker: result.fromNativeBroker,
requestId: result.requestId
});
atsMeasurement.flushMeasurement();
return result;
})
.catch(function (error) {
_this.activeSilentTokenRequests.delete(silentRequestKey);
atsMeasurement.endMeasurement({
errorCode: error.errorCode,
subErrorCode: error.subError,
success: false
});
atsMeasurement.flushMeasurement();
throw error;
});
this.activeSilentTokenRequests.set(silentRequestKey, response);
return [2 /*return*/, response];
}
else {
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];
}
});
});
};
/**
* Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.
* @param {@link (SilentRequest:type)}
* @param {@link (AccountInfo:type)}
* @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse}
*/
PublicClientApplication.prototype.acquireTokenSilentAsync = function (request, account) {
return __awaiter(this, void 0, void 0, function () {
var astsAsyncMeasurement, result, silentRequest, silentCacheClient, silentRequest_1, requestWithCLP_1;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);
astsAsyncMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);
if (!(NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme) && account.nativeAccountId)) return [3 /*break*/, 1];
this.logger.verbose("acquireTokenSilent - attempting to acquire token from native platform");
silentRequest = __assign(__assign({}, request), { account: account });
result = this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(function (e) { return __awaiter(_this, void 0, void 0, function () {
var silentIframeClient;
return __generator(this, function (_a) {
// If native token acquisition fails for availability reasons fallback to web flow
if (e instanceof NativeAuthError && e.isFatal()) {
this.logger.verbose("acquireTokenSilent - native platform unavailable, falling back to web flow");
this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt
silentIframeClient = this.createSilentIframeClient(request.correlationId);
return [2 /*return*/, silentIframeClient.acquireToken(request)];
}
throw e;
});
}); });
return [3 /*break*/, 3];
case 1:
this.logger.verbose("acquireTokenSilent - attempting to acquire token from web flow");
silentCacheClient = this.createSilentCacheClient(request.correlationId);
return [4 /*yield*/, silentCacheClient.initializeSilentRequest(request, account)];
case 2:
silentRequest_1 = _a.sent();
requestWithCLP_1 = __assign(__assign({}, request), {
// set the request's CacheLookupPolicy to Default if it was not optionally passed in
cacheLookupPolicy: request.cacheLookupPolicy || CacheLookupPolicy.Default });
result = this.acquireTokenFromCache(silentCacheClient, silentRequest_1, requestWithCLP_1).catch(function (cacheError) {
if (requestWithCLP_1.cacheLookupPolicy === CacheLookupPolicy.AccessToken) {
throw cacheError;
}
// block the reload if it occurred inside a hidden iframe
BrowserUtils.blockReloadInHiddenIframes();
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, silentRequest_1);
return _this.acquireTokenByRefreshToken(silentRequest_1, requestWithCLP_1).catch(function (refreshTokenError) {
var isServerError = refreshTokenError instanceof ServerError;
var isInteractionRequiredError = refreshTokenError instanceof InteractionRequiredAuthError;
var isInvalidGrantError = (refreshTokenError.errorCode === BrowserConstants.INVALID_GRANT_ERROR);
if ((!isServerError ||
!isInvalidGrantError ||
isInteractionRequiredError ||
requestWithCLP_1.cacheLookupPolicy === CacheLookupPolicy.AccessTokenAndRefreshToken ||
requestWithCLP_1.cacheLookupPolicy === CacheLookupPolicy.RefreshToken)
&& (requestWithCLP_1.cacheLookupPolicy !== CacheLookupPolicy.Skip)) {
throw refreshTokenError;
}
_this.logger.verbose("Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.", request.correlationId);
return _this.acquireTokenBySilentIframe(silentRequest_1);
});
});
_a.label = 3;
case 3: return [2 /*return*/, result.then(function (response) {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, response);
astsAsyncMeasurement.endMeasurement({
success: true,
fromCache: response.fromCache,
isNativeBroker: response.fromNativeBroker,
requestId: response.requestId
});
return response;
}).catch(function (tokenRenewalError) {
_this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError);
astsAsyncMeasurement.endMeasurement({
errorCode: tokenRenewalError.errorCode,
subErrorCode: tokenRenewalError.subError,
success: false
});
throw tokenRenewalError;
})];
}
});
});
};
return PublicClientApplication;
}(ClientApplication));
export { PublicClientApplication };
//# sourceMappingURL=PublicClientApplication.js.map
{"version":3,"file":"PublicClientApplication.js","sources":["../../src/app/PublicClientApplication.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { AccountInfo, AuthenticationResult, Constants, RequestThumbprint, AuthError, PerformanceEvents, ServerError, InteractionRequiredAuthError } from \"@azure/msal-common\";\nimport { Configuration } from \"../config/Configuration\";\nimport { DEFAULT_REQUEST, InteractionType, ApiId, CacheLookupPolicy, BrowserConstants } from \"../utils/BrowserConstants\";\nimport { IPublicClientApplication } from \"./IPublicClientApplication\";\nimport { RedirectRequest } from \"../request/RedirectRequest\";\nimport { PopupRequest } from \"../request/PopupRequest\";\nimport { ClientApplication } from \"./ClientApplication\";\nimport { SilentRequest } from \"../request/SilentRequest\";\nimport { EventType } from \"../event/EventType\";\nimport { BrowserAuthError } from \"../error/BrowserAuthError\";\nimport { NativeAuthError } from \"../error/NativeAuthError\";\nimport { NativeMessageHandler } from \"../broker/nativeBroker/NativeMessageHandler\";\nimport { BrowserUtils } from \"../utils/BrowserUtils\";\n\n/**\n * The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications\n * to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.\n */\nexport class PublicClientApplication extends ClientApplication implements IPublicClientApplication {\n\n // Active requests\n private activeSilentTokenRequests: Map<string, Promise<AuthenticationResult>>;\n\n /**\n * @constructor\n * Constructor for the PublicClientApplication used to instantiate the PublicClientApplication object\n *\n * Important attributes in the Configuration object for auth are:\n * - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview\n * - authority: the authority URL for your application.\n * - redirect_uri: the uri of your application registered in the portal.\n *\n * In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens.\n * It is of the form https://login.microsoftonline.com/{Enter_the_Tenant_Info_Here}\n * If your application supports Accounts in one organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com).\n * If your application supports Accounts in any organizational directory, replace \"Enter_the_Tenant_Info_Here\" value with organizations.\n * If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace \"Enter_the_Tenant_Info_Here\" value with common.\n * To restrict support to Personal Microsoft accounts only, replace \"Enter_the_Tenant_Info_Here\" value with consumers.\n *\n * In Azure B2C, authority is of the form https://{instance}/tfp/{tenant}/{policyName}/\n * Full B2C functionality will be available in this library in future versions.\n *\n * @param configuration object for the MSAL PublicClientApplication instance\n */\n constructor(configuration: Configuration) {\n super(configuration);\n\n this.activeSilentTokenRequests = new Map();\n }\n\n /**\n * Use when initiating the login process by redirecting the user's browser to the authorization endpoint. This function redirects the page, so\n * any code that follows this function will not execute.\n *\n * IMPORTANT: It is NOT recommended to have code that is dependent on the resolution of the Promise. This function will navigate away from the current\n * browser window. It currently returns a Promise in order to reflect the asynchronous nature of the code running in this function.\n *\n * @param request\n */\n async loginRedirect(request?: RedirectRequest): Promise<void> {\n const correlationId: string = this.getRequestCorrelationId(request);\n this.logger.verbose(\"loginRedirect called\", correlationId);\n return this.acquireTokenRedirect({\n correlationId,\n ...(request || DEFAULT_REQUEST)\n });\n }\n\n /**\n * Use when initiating the login process via opening a popup window in the user's browser\n *\n * @param request\n *\n * @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.\n */\n loginPopup(request?: PopupRequest): Promise<AuthenticationResult> {\n const correlationId: string = this.getRequestCorrelationId(request);\n this.logger.verbose(\"loginPopup called\", correlationId);\n return this.acquireTokenPopup({\n correlationId,\n ...(request || DEFAULT_REQUEST)\n });\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Returns currently processing promise if parallel requests are made.\n *\n * @param {@link (SilentRequest:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} object\n */\n async acquireTokenSilent(request: SilentRequest): Promise<AuthenticationResult> {\n const correlationId = this.getRequestCorrelationId(request);\n const atsMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilent, correlationId);\n atsMeasurement.addStaticFields({\n cacheLookupPolicy: request.cacheLookupPolicy\n });\n \n this.preflightBrowserEnvironmentCheck(InteractionType.Silent);\n this.logger.verbose(\"acquireTokenSilent called\", correlationId);\n\n const account = request.account || this.getActiveAccount();\n if (!account) {\n throw BrowserAuthError.createNoAccountError();\n }\n\n const thumbprint: RequestThumbprint = {\n clientId: this.config.auth.clientId,\n authority: request.authority || Constants.EMPTY_STRING,\n scopes: request.scopes,\n homeAccountIdentifier: account.homeAccountId,\n claims: request.claims,\n authenticationScheme: request.authenticationScheme,\n resourceRequestMethod: request.resourceRequestMethod,\n resourceRequestUri: request.resourceRequestUri,\n shrClaims: request.shrClaims,\n sshKid: request.sshKid\n };\n const silentRequestKey = JSON.stringify(thumbprint);\n\n const cachedResponse = this.activeSilentTokenRequests.get(silentRequestKey);\n if (typeof cachedResponse === \"undefined\") {\n this.logger.verbose(\"acquireTokenSilent called for the first time, storing active request\", correlationId);\n\n const response = this.acquireTokenSilentAsync({\n ...request,\n correlationId\n }, account)\n .then((result) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n atsMeasurement.addStaticFields({\n accessTokenSize: result.accessToken.length,\n idTokenSize: result.idToken.length\n });\n atsMeasurement.endMeasurement({\n success: true,\n fromCache: result.fromCache,\n isNativeBroker: result.fromNativeBroker,\n requestId: result.requestId\n });\n atsMeasurement.flushMeasurement();\n return result;\n })\n .catch((error: AuthError) => {\n this.activeSilentTokenRequests.delete(silentRequestKey);\n atsMeasurement.endMeasurement({\n errorCode: error.errorCode,\n subErrorCode: error.subError,\n success: false\n });\n atsMeasurement.flushMeasurement();\n throw error;\n });\n this.activeSilentTokenRequests.set(silentRequestKey, response);\n return response;\n } else {\n this.logger.verbose(\"acquireTokenSilent has been called previously, returning the result from the first call\", correlationId);\n atsMeasurement.endMeasurement({\n success: true\n });\n // Discard measurements for memoized calls, as they are usually only a couple of ms and will artificially deflate metrics\n atsMeasurement.discardMeasurement();\n return cachedResponse;\n }\n }\n\n /**\n * Silently acquire an access token for a given set of scopes. Will use cached token if available, otherwise will attempt to acquire a new token from the network via refresh token.\n * @param {@link (SilentRequest:type)}\n * @param {@link (AccountInfo:type)}\n * @returns {Promise.<AuthenticationResult>} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the {@link AuthResponse} \n */\n protected async acquireTokenSilentAsync(request: SilentRequest, account: AccountInfo): Promise<AuthenticationResult>{\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_START, InteractionType.Silent, request);\n const astsAsyncMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.AcquireTokenSilentAsync, request.correlationId);\n\n let result: Promise<AuthenticationResult>;\n if (NativeMessageHandler.isNativeAvailable(this.config, this.logger, this.nativeExtensionProvider, request.authenticationScheme) && account.nativeAccountId) {\n this.logger.verbose(\"acquireTokenSilent - attempting to acquire token from native platform\");\n const silentRequest: SilentRequest = {\n ...request,\n account\n };\n result = this.acquireTokenNative(silentRequest, ApiId.acquireTokenSilent_silentFlow).catch(async (e: AuthError) => {\n // If native token acquisition fails for availability reasons fallback to web flow\n if (e instanceof NativeAuthError && e.isFatal()) {\n this.logger.verbose(\"acquireTokenSilent - native platform unavailable, falling back to web flow\");\n this.nativeExtensionProvider = undefined; // Prevent future requests from continuing to attempt \n\n // Cache will not contain tokens, given that previous WAM requests succeeded. Skip cache and RT renewal and go straight to iframe renewal\n const silentIframeClient = this.createSilentIframeClient(request.correlationId);\n return silentIframeClient.acquireToken(request);\n }\n throw e;\n }); \n } else {\n this.logger.verbose(\"acquireTokenSilent - attempting to acquire token from web flow\");\n\n const silentCacheClient = this.createSilentCacheClient(request.correlationId);\n const silentRequest = await silentCacheClient.initializeSilentRequest(request, account);\n \n const requestWithCLP = {\n ...request,\n // set the request's CacheLookupPolicy to Default if it was not optionally passed in\n cacheLookupPolicy: request.cacheLookupPolicy || CacheLookupPolicy.Default\n };\n\n result = this.acquireTokenFromCache(silentCacheClient, silentRequest, requestWithCLP).catch((cacheError: AuthError) => {\n if (requestWithCLP.cacheLookupPolicy === CacheLookupPolicy.AccessToken) {\n throw cacheError;\n }\n\n // block the reload if it occurred inside a hidden iframe\n BrowserUtils.blockReloadInHiddenIframes();\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_NETWORK_START, InteractionType.Silent, silentRequest);\n\n return this.acquireTokenByRefreshToken(silentRequest, requestWithCLP).catch((refreshTokenError: AuthError) => {\n const isServerError = refreshTokenError instanceof ServerError;\n const isInteractionRequiredError = refreshTokenError instanceof InteractionRequiredAuthError;\n const isInvalidGrantError = (refreshTokenError.errorCode === BrowserConstants.INVALID_GRANT_ERROR);\n\n if ((!isServerError ||\n !isInvalidGrantError ||\n isInteractionRequiredError ||\n requestWithCLP.cacheLookupPolicy === CacheLookupPolicy.AccessTokenAndRefreshToken ||\n requestWithCLP.cacheLookupPolicy === CacheLookupPolicy.RefreshToken)\n && (requestWithCLP.cacheLookupPolicy !== CacheLookupPolicy.Skip)\n ) {\n throw refreshTokenError;\n }\n \n this.logger.verbose(\"Refresh token expired/invalid or CacheLookupPolicy is set to Skip, attempting acquire token by iframe.\", request.correlationId);\n return this.acquireTokenBySilentIframe(silentRequest);\n });\n });\n }\n\n return result.then((response) => {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_SUCCESS, InteractionType.Silent, response);\n astsAsyncMeasurement.endMeasurement({\n success: true,\n fromCache: response.fromCache,\n isNativeBroker: response.fromNativeBroker,\n requestId: response.requestId\n });\n return response;\n }).catch((tokenRenewalError: AuthError) => {\n this.eventHandler.emitEvent(EventType.ACQUIRE_TOKEN_FAILURE, InteractionType.Silent, null, tokenRenewalError);\n astsAsyncMeasurement.endMeasurement({\n errorCode: tokenRenewalError.errorCode,\n subErrorCode: tokenRenewalError.subError,\n success: false\n });\n throw tokenRenewalError;\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;AAmBA;;;;;IAI6C,2CAAiB;;;;;;;;;;;;;;;;;;;;;;IA0B1D,iCAAY,aAA4B;QAAxC,YACI,kBAAM,aAAa,CAAC,SAGvB;QADG,KAAI,CAAC,yBAAyB,GAAG,IAAI,GAAG,EAAE,CAAC;;KAC9C;;;;;;;;;;IAWK,+CAAa,GAAnB,UAAoB,OAAyB;;;;gBACnC,aAAa,GAAW,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;gBACpE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,sBAAsB,EAAE,aAAa,CAAC,CAAC;gBAC3D,sBAAO,IAAI,CAAC,oBAAoB,YAC5B,aAAa,eAAA,KACT,OAAO,IAAI,eAAe,GAChC,EAAC;;;KACN;;;;;;;;IASD,4CAAU,GAAV,UAAW,OAAsB;QAC7B,IAAM,aAAa,GAAW,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;QACpE,IAAI,CA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BAAC;AAAD,CA7OA,CAA6C,iBAAiB;;;;"}
\ No newline at end of file
{"version":3,"file":"NativeMessageHandler.d.ts","sourceRoot":"","sources":["../../../src/broker/nativeBroker/NativeMessageHandler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,MAAM,EAAa,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAA0B,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAGrF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAOlE,qBAAa,oBAAoB;IAC7B,OAAO,CAAC,WAAW,CAAqB;IACxC,OAAO,CAAC,gBAAgB,CAAqB;IAC7C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,SAAS,CAAyC;IAC1D,OAAO,CAAC,kBAAkB,CAAuC;IACjE,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,cAAc,CAAgC;gBAE1C,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;IAW5E;;;OAGG;IACG,WAAW,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,MAAM,CAAC;IAkBpE;;;;OAIG;WACU,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IActG;;OAEG;YACW,oBAAoB;IAqClC;;;OAGG;IACH,OAAO,CAAC,eAAe;IA+BvB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAwDxB;;;OAGG;IACH,cAAc,IAAI,MAAM,GAAG,SAAS;IAIpC;;;OAGG;IACH,mBAAmB,IAAI,MAAM,GAAG,SAAS;IAIzC;;;;;;OAMG;IACH,MAAM,CAAC,iBAAiB,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,EAAE,uBAAuB,CAAC,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,EAAE,oBAAoB,GAAG,OAAO;CA4B/K"}
\ No newline at end of file
/*! @azure/msal-browser v2.32.1 2022-12-07 */
'use strict';
import { __awaiter, __generator } from '../../_virtual/_tslib.js';
import { NativeConstants, NativeExtensionMethod } from '../../utils/BrowserConstants.js';
import { AuthError, AuthenticationScheme } from '@azure/msal-common';
import { NativeAuthError } from '../../error/NativeAuthError.js';
import { BrowserAuthError } from '../../error/BrowserAuthError.js';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
var NativeMessageHandler = /** @class */ (function () {
function NativeMessageHandler(logger, handshakeTimeoutMs, extensionId) {
this.logger = logger;
this.handshakeTimeoutMs = handshakeTimeoutMs;
this.extensionId = extensionId;
this.resolvers = new Map(); // Used for non-handshake messages
this.handshakeResolvers = new Map(); // Used for handshake messages
this.responseId = 0;
this.messageChannel = new MessageChannel();
this.windowListener = this.onWindowMessage.bind(this); // Window event callback doesn't have access to 'this' unless it's bound
}
/**
* Sends a given message to the extension and resolves with the extension response
* @param body
*/
NativeMessageHandler.prototype.sendMessage = function (body) {
return __awaiter(this, void 0, void 0, function () {
var req;
var _this = this;
return __generator(this, function (_a) {
this.logger.trace("NativeMessageHandler - sendMessage called.");
req = {
channel: NativeConstants.CHANNEL_ID,
extensionId: this.extensionId,
responseId: this.responseId++,
body: body
};
this.logger.trace("NativeMessageHandler - Sending request to browser extension");
this.logger.tracePii("NativeMessageHandler - Sending request to browser extension: " + JSON.stringify(req));
this.messageChannel.port1.postMessage(req);
return [2 /*return*/, new Promise(function (resolve, reject) {
_this.resolvers.set(req.responseId, { resolve: resolve, reject: reject });
})];
});
});
};
/**
* Returns an instance of the MessageHandler that has successfully established a connection with an extension
* @param logger
* @param handshakeTimeoutMs
*/
NativeMessageHandler.createProvider = function (logger, handshakeTimeoutMs) {
return __awaiter(this, void 0, void 0, function () {
var preferredProvider, backupProvider;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
logger.trace("NativeMessageHandler - createProvider called.");
_a.label = 1;
case 1:
_a.trys.push([1, 3, , 5]);
preferredProvider = new NativeMessageHandler(logger, handshakeTimeoutMs, NativeConstants.PREFERRED_EXTENSION_ID);
return [4 /*yield*/, preferredProvider.sendHandshakeRequest()];
case 2:
_a.sent();
return [2 /*return*/, preferredProvider];
case 3:
_a.sent();
backupProvider = new NativeMessageHandler(logger, handshakeTimeoutMs);
return [4 /*yield*/, backupProvider.sendHandshakeRequest()];
case 4:
_a.sent();
return [2 /*return*/, backupProvider];
case 5: return [2 /*return*/];
}
});
});
};
/**
* Send handshake request helper.
*/
NativeMessageHandler.prototype.sendHandshakeRequest = function () {
return __awaiter(this, void 0, void 0, function () {
var req;
var _this = this;
return __generator(this, function (_a) {
this.logger.trace("NativeMessageHandler - sendHandshakeRequest called.");
// Register this event listener before sending handshake
window.addEventListener("message", this.windowListener, false); // false is important, because content script message processing should work first
req = {
channel: NativeConstants.CHANNEL_ID,
extensionId: this.extensionId,
responseId: this.responseId++,
body: {
method: NativeExtensionMethod.HandshakeRequest
}
};
this.messageChannel.port1.onmessage = function (event) {
_this.onChannelMessage(event);
};
window.postMessage(req, window.origin, [this.messageChannel.port2]);
return [2 /*return*/, new Promise(function (resolve, reject) {
_this.handshakeResolvers.set(req.responseId, { resolve: resolve, reject: reject });
_this.timeoutId = window.setTimeout(function () {
/*
* Throw an error if neither HandshakeResponse nor original Handshake request are received in a reasonable timeframe.
* This typically suggests an event handler stopped propagation of the Handshake request but did not respond to it on the MessageChannel port
*/
window.removeEventListener("message", _this.windowListener, false);
_this.messageChannel.port1.close();
_this.messageChannel.port2.close();
reject(BrowserAuthError.createNativeHandshakeTimeoutError());
_this.handshakeResolvers.delete(req.responseId);
}, _this.handshakeTimeoutMs); // Use a reasonable timeout in milliseconds here
})];
});
});
};
/**
* Invoked when a message is posted to the window. If a handshake request is received it means the extension is not installed.
* @param event
*/
NativeMessageHandler.prototype.onWindowMessage = function (event) {
this.logger.trace("NativeMessageHandler - onWindowMessage called");
// We only accept messages from ourselves
if (event.source !== window) {
return;
}
var request = event.data;
if (!request.channel || request.channel !== NativeConstants.CHANNEL_ID) {
return;
}
if (request.extensionId && request.extensionId !== this.extensionId) {
return;
}
if (request.body.method === NativeExtensionMethod.HandshakeRequest) {
// If we receive this message back it means no extension intercepted the request, meaning no extension supporting handshake protocol is installed
this.logger.verbose(request.extensionId ? "Extension with id: " + request.extensionId + " not installed" : "No extension installed");
clearTimeout(this.timeoutId);
this.messageChannel.port1.close();
this.messageChannel.port2.close();
window.removeEventListener("message", this.windowListener, false);
var handshakeResolver = this.handshakeResolvers.get(request.responseId);
if (handshakeResolver) {
handshakeResolver.reject(BrowserAuthError.createNativeExtensionNotInstalledError());
}
}
};
/**
* Invoked when a message is received from the extension on the MessageChannel port
* @param event
*/
NativeMessageHandler.prototype.onChannelMessage = function (event) {
this.logger.trace("NativeMessageHandler - onChannelMessage called.");
var request = event.data;
var resolver = this.resolvers.get(request.responseId);
var handshakeResolver = this.handshakeResolvers.get(request.responseId);
try {
var method = request.body.method;
if (method === NativeExtensionMethod.Response) {
if (!resolver) {
return;
}
var response = request.body.response;
this.logger.trace("NativeMessageHandler - Received response from browser extension");
this.logger.tracePii("NativeMessageHandler - Received response from browser extension: " + JSON.stringify(response));
if (response.status !== "Success") {
resolver.reject(NativeAuthError.createError(response.code, response.description, response.ext));
}
else if (response.result) {
if (response.result["code"] && response.result["description"]) {
resolver.reject(NativeAuthError.createError(response.result["code"], response.result["description"], response.result["ext"]));
}
else {
resolver.resolve(response.result);
}
}
else {
throw AuthError.createUnexpectedError("Event does not contain result.");
}
this.resolvers.delete(request.responseId);
}
else if (method === NativeExtensionMethod.HandshakeResponse) {
if (!handshakeResolver) {
return;
}
clearTimeout(this.timeoutId); // Clear setTimeout
window.removeEventListener("message", this.windowListener, false); // Remove 'No extension' listener
this.extensionId = request.extensionId;
this.extensionVersion = request.body.version;
this.logger.verbose("NativeMessageHandler - Received HandshakeResponse from extension: " + this.extensionId);
handshakeResolver.resolve();
this.handshakeResolvers.delete(request.responseId);
}
// Do nothing if method is not Response or HandshakeResponse
}
catch (err) {
this.logger.error("Error parsing response from WAM Extension");
this.logger.errorPii("Error parsing response from WAM Extension: " + err.toString());
this.logger.errorPii("Unable to parse " + event);
if (resolver) {
resolver.reject(err);
}
else if (handshakeResolver) {
handshakeResolver.reject(err);
}
}
};
/**
* Returns the Id for the browser extension this handler is communicating with
* @returns
*/
NativeMessageHandler.prototype.getExtensionId = function () {
return this.extensionId;
};
/**
* Returns the version for the browser extension this handler is communicating with
* @returns
*/
NativeMessageHandler.prototype.getExtensionVersion = function () {
return this.extensionVersion;
};
/**
* Returns boolean indicating whether or not the request should attempt to use native broker
* @param logger
* @param config
* @param nativeExtensionProvider
* @param authenticationScheme
*/
NativeMessageHandler.isNativeAvailable = function (config, logger, nativeExtensionProvider, authenticationScheme) {
logger.trace("isNativeAvailable called");
if (!config.system.allowNativeBroker) {
logger.trace("isNativeAvailable: allowNativeBroker is not enabled, returning false");
// Developer disabled WAM
return false;
}
if (!nativeExtensionProvider) {
logger.trace("isNativeAvailable: WAM extension provider is not initialized, returning false");
// Extension is not available
return false;
}
if (authenticationScheme) {
switch (authenticationScheme) {
case AuthenticationScheme.BEARER:
case AuthenticationScheme.POP:
logger.trace("isNativeAvailable: authenticationScheme is supported, returning true");
return true;
default:
logger.trace("isNativeAvailable: authenticationScheme is not supported, returning false");
return false;
}
}
return true;
};
return NativeMessageHandler;
}());
export { NativeMessageHandler };
//# sourceMappingURL=NativeMessageHandler.js.map
{"version":3,"file":"NativeMessageHandler.js","sources":["../../../src/broker/nativeBroker/NativeMessageHandler.ts"],"sourcesContent":["/*\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { NativeConstants, NativeExtensionMethod } from \"../../utils/BrowserConstants\";\nimport { Logger, AuthError, AuthenticationScheme } from \"@azure/msal-common\";\nimport { NativeExtensionRequest, NativeExtensionRequestBody } from \"./NativeRequest\";\nimport { NativeAuthError } from \"../../error/NativeAuthError\";\nimport { BrowserAuthError } from \"../../error/BrowserAuthError\";\nimport { BrowserConfiguration } from \"../../config/Configuration\";\n\ntype ResponseResolvers<T> = {\n resolve: (value:T|PromiseLike<T>) => void;\n reject: (value:AuthError|Error|PromiseLike<Error>|PromiseLike<AuthError>) => void;\n};\n\nexport class NativeMessageHandler {\n private extensionId: string | undefined;\n private extensionVersion: string | undefined;\n private logger: Logger;\n private handshakeTimeoutMs: number;\n private responseId: number;\n private timeoutId: number | undefined;\n private resolvers: Map<number, ResponseResolvers<object>>;\n private handshakeResolvers: Map<number, ResponseResolvers<void>>;\n private messageChannel: MessageChannel;\n private windowListener: (event: MessageEvent) => void;\n\n constructor(logger: Logger, handshakeTimeoutMs: number, extensionId?: string) {\n this.logger = logger;\n this.handshakeTimeoutMs = handshakeTimeoutMs;\n this.extensionId = extensionId;\n this.resolvers = new Map(); // Used for non-handshake messages\n this.handshakeResolvers = new Map(); // Used for handshake messages\n this.responseId = 0;\n this.messageChannel = new MessageChannel();\n this.windowListener = this.onWindowMessage.bind(this); // Window event callback doesn't have access to 'this' unless it's bound\n }\n\n /**\n * Sends a given message to the extension and resolves with the extension response\n * @param body \n */\n async sendMessage(body: NativeExtensionRequestBody): Promise<object> {\n this.logger.trace(\"NativeMessageHandler - sendMessage called.\");\n const req: NativeExtensionRequest = {\n channel: NativeConstants.CHANNEL_ID,\n extensionId: this.extensionId,\n responseId: this.responseId++,\n body: body\n };\n\n this.logger.trace(\"NativeMessageHandler - Sending request to browser extension\");\n this.logger.tracePii(`NativeMessageHandler - Sending request to browser extension: ${JSON.stringify(req)}`);\n this.messageChannel.port1.postMessage(req);\n\n return new Promise((resolve, reject) => {\n this.resolvers.set(req.responseId, {resolve, reject});\n });\n }\n\n /**\n * Returns an instance of the MessageHandler that has successfully established a connection with an extension\n * @param logger \n * @param handshakeTimeoutMs\n */\n static async createProvider(logger: Logger, handshakeTimeoutMs: number): Promise<NativeMessageHandler> {\n logger.trace(\"NativeMessageHandler - createProvider called.\");\n try {\n const preferredProvider = new NativeMessageHandler(logger, handshakeTimeoutMs, NativeConstants.PREFERRED_EXTENSION_ID);\n await preferredProvider.sendHandshakeRequest();\n return preferredProvider;\n } catch (e) {\n // If preferred extension fails for whatever reason, fallback to using any installed extension\n const backupProvider = new NativeMessageHandler(logger, handshakeTimeoutMs);\n await backupProvider.sendHandshakeRequest();\n return backupProvider;\n }\n }\n\n /**\n * Send handshake request helper.\n */\n private async sendHandshakeRequest(): Promise<void> {\n this.logger.trace(\"NativeMessageHandler - sendHandshakeRequest called.\");\n // Register this event listener before sending handshake\n window.addEventListener(\"message\", this.windowListener, false); // false is important, because content script message processing should work first\n\n const req: NativeExtensionRequest = {\n channel: NativeConstants.CHANNEL_ID,\n extensionId: this.extensionId,\n responseId: this.responseId++,\n\n body: {\n method: NativeExtensionMethod.HandshakeRequest\n }\n };\n\n this.messageChannel.port1.onmessage = (event) => {\n this.onChannelMessage(event);\n };\n\n window.postMessage(req, window.origin, [this.messageChannel.port2]);\n\n return new Promise((resolve, reject) => {\n this.handshakeResolvers.set(req.responseId, {resolve, reject});\n this.timeoutId = window.setTimeout(() => {\n /*\n * Throw an error if neither HandshakeResponse nor original Handshake request are received in a reasonable timeframe.\n * This typically suggests an event handler stopped propagation of the Handshake request but did not respond to it on the MessageChannel port\n */\n window.removeEventListener(\"message\", this.windowListener, false);\n this.messageChannel.port1.close();\n this.messageChannel.port2.close();\n reject(BrowserAuthError.createNativeHandshakeTimeoutError());\n this.handshakeResolvers.delete(req.responseId);\n }, this.handshakeTimeoutMs); // Use a reasonable timeout in milliseconds here\n });\n }\n\n /**\n * Invoked when a message is posted to the window. If a handshake request is received it means the extension is not installed.\n * @param event \n */\n private onWindowMessage(event: MessageEvent): void {\n this.logger.trace(\"NativeMessageHandler - onWindowMessage called\");\n // We only accept messages from ourselves\n if (event.source !== window) {\n return;\n }\n\n const request = event.data;\n\n if (!request.channel || request.channel !== NativeConstants.CHANNEL_ID) {\n return;\n }\n\n if (request.extensionId && request.extensionId !== this.extensionId) {\n return;\n }\n\n if (request.body.method === NativeExtensionMethod.HandshakeRequest) {\n // If we receive this message back it means no extension intercepted the request, meaning no extension supporting handshake protocol is installed\n this.logger.verbose(request.extensionId ? `Extension with id: ${request.extensionId} not installed` : \"No extension installed\");\n clearTimeout(this.timeoutId);\n this.messageChannel.port1.close();\n this.messageChannel.port2.close();\n window.removeEventListener(\"message\", this.windowListener, false);\n const handshakeResolver = this.handshakeResolvers.get(request.responseId);\n if (handshakeResolver) {\n handshakeResolver.reject(BrowserAuthError.createNativeExtensionNotInstalledError());\n }\n }\n }\n\n /**\n * Invoked when a message is received from the extension on the MessageChannel port\n * @param event \n */\n private onChannelMessage(event: MessageEvent): void {\n this.logger.trace(\"NativeMessageHandler - onChannelMessage called.\");\n const request = event.data;\n \n const resolver = this.resolvers.get(request.responseId);\n const handshakeResolver = this.handshakeResolvers.get(request.responseId);\n\n try {\n const method = request.body.method;\n \n if (method === NativeExtensionMethod.Response) {\n if (!resolver) {\n return;\n }\n const response = request.body.response;\n this.logger.trace(\"NativeMessageHandler - Received response from browser extension\");\n this.logger.tracePii(`NativeMessageHandler - Received response from browser extension: ${JSON.stringify(response)}`);\n if (response.status !== \"Success\") {\n resolver.reject(NativeAuthError.createError(response.code, response.description, response.ext));\n } else if (response.result) {\n if (response.result[\"code\"] && response.result[\"description\"]) {\n resolver.reject(NativeAuthError.createError(response.result[\"code\"], response.result[\"description\"], response.result[\"ext\"]));\n } else {\n resolver.resolve(response.result);\n }\n } else {\n throw AuthError.createUnexpectedError(\"Event does not contain result.\");\n }\n this.resolvers.delete(request.responseId);\n } else if (method === NativeExtensionMethod.HandshakeResponse) {\n if (!handshakeResolver) {\n return;\n }\n clearTimeout(this.timeoutId); // Clear setTimeout\n window.removeEventListener(\"message\", this.windowListener, false); // Remove 'No extension' listener\n this.extensionId = request.extensionId;\n this.extensionVersion = request.body.version;\n this.logger.verbose(`NativeMessageHandler - Received HandshakeResponse from extension: ${this.extensionId}`);\n\n handshakeResolver.resolve();\n this.handshakeResolvers.delete(request.responseId);\n } \n // Do nothing if method is not Response or HandshakeResponse\n } catch (err) {\n this.logger.error(\"Error parsing response from WAM Extension\");\n this.logger.errorPii(`Error parsing response from WAM Extension: ${err.toString()}`);\n this.logger.errorPii(`Unable to parse ${event}`);\n\n if (resolver) {\n resolver.reject(err as AuthError);\n } else if (handshakeResolver) {\n handshakeResolver.reject(err as AuthError);\n }\n }\n }\n\n /**\n * Returns the Id for the browser extension this handler is communicating with\n * @returns \n */\n getExtensionId(): string | undefined {\n return this.extensionId;\n }\n\n /**\n * Returns the version for the browser extension this handler is communicating with\n * @returns \n */\n getExtensionVersion(): string | undefined {\n return this.extensionVersion;\n }\n \n /**\n * Returns boolean indicating whether or not the request should attempt to use native broker\n * @param logger\n * @param config\n * @param nativeExtensionProvider\n * @param authenticationScheme \n */\n static isNativeAvailable(config: BrowserConfiguration, logger: Logger, nativeExtensionProvider?: NativeMessageHandler, authenticationScheme?: AuthenticationScheme): boolean {\n logger.trace(\"isNativeAvailable called\");\n if (!config.system.allowNativeBroker) {\n logger.trace(\"isNativeAvailable: allowNativeBroker is not enabled, returning false\");\n // Developer disabled WAM\n return false;\n }\n\n if (!nativeExtensionProvider) {\n logger.trace(\"isNativeAvailable: WAM extension provider is not initialized, returning false\");\n // Extension is not available\n return false;\n }\n\n if (authenticationScheme) {\n switch(authenticationScheme) {\n case AuthenticationScheme.BEARER:\n case AuthenticationScheme.POP:\n logger.trace(\"isNativeAvailable: authenticationScheme is supported, returning true\");\n return true;\n default:\n logger.trace(\"isNativeAvailable: authenticationScheme is not supported, returning false\");\n return false;\n }\n }\n\n return true;\n }\n} \n"],"names":[],"mappings":";;;;;;;;AAAA;;;;;IA6BI,8BAAY,MAAc,EAAE,kBAA0B,EAAE,WAAoB;QACxE,IAAI,CAAC,MAAM,GAAG,MA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AAC;oBAC1F,OAAO,KAAK,CAAC;aACpB;SACJ;QAED,OAAO,IAAI,CAAC;KACf;IACL,2BAAC;AAAD,CAAC;;;;"}
\ No newline at end of file
{"version":3,"file":"NativeRequest.d.ts","sourceRoot":"","sources":["../../../src/broker/nativeBroker/NativeRequest.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD;;GAEG;AACH,oBAAY,kBAAkB,GAAG;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,MAAM,CAAC;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,eAAe,CAAC,EAAE,UAAU,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,oBAAY,0BAA0B,GAAG;IACrC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,OAAO,CAAC,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,oBAAY,sBAAsB,GAAG;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,0BAA0B,CAAA;CACnC,CAAC"}
\ No newline at end of file
{"version":3,"file":"NativeResponse.d.ts","sourceRoot":"","sources":["../../../src/broker/nativeBroker/NativeResponse.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,oBAAY,iBAAiB,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,oBAAY,cAAc,GAAG;IACzB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,wBAAwB,CAAC;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACnC,CAAC;AAEF;;GAEG;AACH,oBAAY,wBAAwB,GAAG;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,oBAAY,IAAI,GAAG;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC"}
\ No newline at end of file
import { Logger } from "@azure/msal-common";
import { IAsyncStorage } from "./IAsyncMemoryStorage";
/**
* This class allows MSAL to store artifacts asynchronously using the DatabaseStorage IndexedDB wrapper,
* backed up with the more volatile MemoryStorage object for cases in which IndexedDB may be unavailable.
*/
export declare class AsyncMemoryStorage<T> implements IAsyncStorage<T> {
private inMemoryCache;
private indexedDBCache;
private logger;
private storeName;
constructor(logger: Logger, storeName: string);
private handleDatabaseAccessError;
/**
* Get the item matching the given key. Tries in-memory cache first, then in the asynchronous
* storage object if item isn't found in-memory.
* @param key
*/
getItem(key: string): Promise<T | null>;
/**
* Sets the item in the in-memory cache and then tries to set it in the asynchronous
* storage object with the given key.
* @param key
* @param value
*/
setItem(key: string, value: T): Promise<void>;
/**
* Removes the item matching the key from the in-memory cache, then tries to remove it from the asynchronous storage object.
* @param key
*/
removeItem(key: string): Promise<void>;
/**
* Get all the keys from the in-memory cache as an iterable array of strings. If no keys are found, query the keys in the
* asynchronous storage object.
*/
getKeys(): Promise<string[]>;
/**
* Returns true or false if the given key is present in the cache.
* @param key
*/
containsKey(key: string): Promise<boolean>;
/**
* Clears in-memory Map
*/
clearInMemory(): void;
/**
* Tries to delete the IndexedDB database
* @returns
*/
clearPersistent(): Promise<boolean>;
}
//# sourceMappingURL=AsyncMemoryStorage.d.ts.map
\ No newline at end of file
{"version":3,"file":"AsyncMemoryStorage.d.ts","sourceRoot":"","sources":["../../src/cache/AsyncMemoryStorage.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAG5C,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAGtD;;;GAGG;AACH,qBAAa,kBAAkB,CAAC,CAAC,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAC1D,OAAO,CAAC,aAAa,CAAmB;IACxC,OAAO,CAAC,cAAc,CAAqB;IAC3C,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAS;gBAEd,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO7C,OAAO,CAAC,yBAAyB;IAOjC;;;;OAIG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC;IAa7C;;;;;OAKG;IACG,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IASnD;;;OAGG;IACG,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5C;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAalC;;;OAGG;IACG,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAahD;;OAEG;IACH,aAAa,IAAI,IAAI;IAOrB;;;OAGG;IACG,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC;CAc5C"}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment