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
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,8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C;IAC3D,cAAc,IAAI,WAAW,EAAE,CAAC;IAChC,qBAAqB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC,CAAC;IAC3E,UAAU,CAAC,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAClE,aAAa,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,MAAM,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACzD,cAAc,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,WAAW,CAAC,aAAa,CAAC,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnE,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,oBAAoB,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;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E;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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oB,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,MAAM,CAAC;QACrB,IAAI,CAAC,kBAAkB,GAAG,kBAAkB,CAAC;QAC7C,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C;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