Commit iniziale
This commit is contained in:
59
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.d.ts
generated
vendored
Normal file
59
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
import { ICrypto, INetworkModule, Logger, AccountInfo, ServerTelemetryManager, Authority, IPerformanceClient, AzureCloudOptions, StringDict } from "@azure/msal-common/browser";
|
||||
import { BrowserConfiguration } from "../config/Configuration.js";
|
||||
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
||||
import { EventHandler } from "../event/EventHandler.js";
|
||||
import { EndSessionRequest } from "../request/EndSessionRequest.js";
|
||||
import { RedirectRequest } from "../request/RedirectRequest.js";
|
||||
import { PopupRequest } from "../request/PopupRequest.js";
|
||||
import { SsoSilentRequest } from "../request/SsoSilentRequest.js";
|
||||
import { INavigationClient } from "../navigation/INavigationClient.js";
|
||||
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler.js";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
import { ClearCacheRequest } from "../request/ClearCacheRequest.js";
|
||||
export declare abstract class BaseInteractionClient {
|
||||
protected config: BrowserConfiguration;
|
||||
protected browserStorage: BrowserCacheManager;
|
||||
protected browserCrypto: ICrypto;
|
||||
protected networkClient: INetworkModule;
|
||||
protected logger: Logger;
|
||||
protected eventHandler: EventHandler;
|
||||
protected navigationClient: INavigationClient;
|
||||
protected nativeMessageHandler: NativeMessageHandler | undefined;
|
||||
protected correlationId: string;
|
||||
protected performanceClient: IPerformanceClient;
|
||||
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
|
||||
abstract acquireToken(request: RedirectRequest | PopupRequest | SsoSilentRequest): Promise<AuthenticationResult | void>;
|
||||
abstract logout(request: EndSessionRequest | ClearCacheRequest | undefined): Promise<void>;
|
||||
protected clearCacheOnLogout(account?: AccountInfo | null): Promise<void>;
|
||||
/**
|
||||
*
|
||||
* Use to get the redirect uri configured in MSAL or null.
|
||||
* @param requestRedirectUri
|
||||
* @returns Redirect URL
|
||||
*
|
||||
*/
|
||||
getRedirectUri(requestRedirectUri?: string): string;
|
||||
/**
|
||||
*
|
||||
* @param apiId
|
||||
* @param correlationId
|
||||
* @param forceRefresh
|
||||
*/
|
||||
protected initializeServerTelemetryManager(apiId: number, forceRefresh?: boolean): ServerTelemetryManager;
|
||||
/**
|
||||
* Used to get a discovered version of the default authority.
|
||||
* @param params {
|
||||
* requestAuthority?: string;
|
||||
* requestAzureCloudOptions?: AzureCloudOptions;
|
||||
* requestExtraQueryParameters?: StringDict;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
protected getDiscoveredAuthority(params: {
|
||||
requestAuthority?: string;
|
||||
requestAzureCloudOptions?: AzureCloudOptions;
|
||||
requestExtraQueryParameters?: StringDict;
|
||||
account?: AccountInfo;
|
||||
}): Promise<Authority>;
|
||||
}
|
||||
//# sourceMappingURL=BaseInteractionClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BaseInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/BaseInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,OAAO,EACP,cAAc,EACd,MAAM,EACN,WAAW,EAGX,sBAAsB,EAItB,SAAS,EAGT,kBAAkB,EAElB,iBAAiB,EAEjB,UAAU,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC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,CACjB,OAAO,EAAE,eAAe,GAAG,YAAY,GAAG,gBAAgB,GAC3D,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAEvC,QAAQ,CAAC,MAAM,CACX,OAAO,EAAE,iBAAiB,GAAG,iBAAiB,GAAG,SAAS,GAC3D,OAAO,CAAC,IAAI,CAAC;cAEA,kBAAkB,CAC9B,OAAO,CAAC,EAAE,WAAW,GAAG,IAAI,GAC7B,OAAO,CAAC,IAAI,CAAC;IA2ChB;;;;;;OAMG;IACH,cAAc,CAAC,kBAAkB,CAAC,EAAE,MAAM,GAAG,MAAM;IASnD;;;;;OAKG;IACH,SAAS,CAAC,gCAAgC,CACtC,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,OAAO,GACvB,sBAAsB;IAiBzB;;;;;;;;OAQG;cACa,sBAAsB,CAAC,MAAM,EAAE;QAC3C,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,wBAAwB,CAAC,EAAE,iBAAiB,CAAC;QAC7C,2BAA2B,CAAC,EAAE,UAAU,CAAC;QACzC,OAAO,CAAC,EAAE,WAAW,CAAC;KACzB,GAAG,OAAO,CAAC,SAAS,CAAC;CAmEzB"}
|
||||
128
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.mjs
generated
vendored
Normal file
128
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,128 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { AccountEntity, UrlString, ServerTelemetryManager, PerformanceEvents, Authority, invokeAsync, AuthorityFactory, createClientConfigurationError, ClientConfigurationErrorCodes } from '@azure/msal-common/browser';
|
||||
import { version } from '../packageMetadata.mjs';
|
||||
import { BrowserConstants } from '../utils/BrowserConstants.mjs';
|
||||
import { getCurrentUri } from '../utils/BrowserUtils.mjs';
|
||||
import { createNewGuid } from '../crypto/BrowserCrypto.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class BaseInteractionClient {
|
||||
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId) {
|
||||
this.config = config;
|
||||
this.browserStorage = storageImpl;
|
||||
this.browserCrypto = browserCrypto;
|
||||
this.networkClient = this.config.system.networkClient;
|
||||
this.eventHandler = eventHandler;
|
||||
this.navigationClient = navigationClient;
|
||||
this.nativeMessageHandler = nativeMessageHandler;
|
||||
this.correlationId = correlationId || createNewGuid();
|
||||
this.logger = logger.clone(BrowserConstants.MSAL_SKU, version, this.correlationId);
|
||||
this.performanceClient = performanceClient;
|
||||
}
|
||||
async clearCacheOnLogout(account) {
|
||||
if (account) {
|
||||
if (AccountEntity.accountInfoIsEqual(account, this.browserStorage.getActiveAccount(), false)) {
|
||||
this.logger.verbose("Setting active account to null");
|
||||
this.browserStorage.setActiveAccount(null);
|
||||
}
|
||||
// Clear given account.
|
||||
try {
|
||||
await this.browserStorage.removeAccount(AccountEntity.generateAccountCacheKey(account));
|
||||
this.logger.verbose("Cleared cache items belonging to the account provided in the logout request.");
|
||||
}
|
||||
catch (error) {
|
||||
this.logger.error("Account provided in logout request was not found. Local cache unchanged.");
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
this.logger.verbose("No account provided in logout request, clearing all cache items.", this.correlationId);
|
||||
// Clear all accounts and tokens
|
||||
await this.browserStorage.clear();
|
||||
// Clear any stray keys from IndexedDB
|
||||
await this.browserCrypto.clearKeystore();
|
||||
}
|
||||
catch (e) {
|
||||
this.logger.error("Attempted to clear all MSAL cache items and failed. Local cache unchanged.");
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* Use to get the redirect uri configured in MSAL or null.
|
||||
* @param requestRedirectUri
|
||||
* @returns Redirect URL
|
||||
*
|
||||
*/
|
||||
getRedirectUri(requestRedirectUri) {
|
||||
this.logger.verbose("getRedirectUri called");
|
||||
const redirectUri = requestRedirectUri || this.config.auth.redirectUri;
|
||||
return UrlString.getAbsoluteUrl(redirectUri, getCurrentUri());
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param apiId
|
||||
* @param correlationId
|
||||
* @param forceRefresh
|
||||
*/
|
||||
initializeServerTelemetryManager(apiId, forceRefresh) {
|
||||
this.logger.verbose("initializeServerTelemetryManager called");
|
||||
const telemetryPayload = {
|
||||
clientId: this.config.auth.clientId,
|
||||
correlationId: this.correlationId,
|
||||
apiId: apiId,
|
||||
forceRefresh: forceRefresh || false,
|
||||
wrapperSKU: this.browserStorage.getWrapperMetadata()[0],
|
||||
wrapperVer: this.browserStorage.getWrapperMetadata()[1],
|
||||
};
|
||||
return new ServerTelemetryManager(telemetryPayload, this.browserStorage);
|
||||
}
|
||||
/**
|
||||
* Used to get a discovered version of the default authority.
|
||||
* @param params {
|
||||
* requestAuthority?: string;
|
||||
* requestAzureCloudOptions?: AzureCloudOptions;
|
||||
* requestExtraQueryParameters?: StringDict;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
async getDiscoveredAuthority(params) {
|
||||
const { account } = params;
|
||||
const instanceAwareEQ = params.requestExtraQueryParameters &&
|
||||
params.requestExtraQueryParameters.hasOwnProperty("instance_aware")
|
||||
? params.requestExtraQueryParameters["instance_aware"]
|
||||
: undefined;
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.correlationId);
|
||||
const authorityOptions = {
|
||||
protocolMode: this.config.auth.protocolMode,
|
||||
OIDCOptions: this.config.auth.OIDCOptions,
|
||||
knownAuthorities: this.config.auth.knownAuthorities,
|
||||
cloudDiscoveryMetadata: this.config.auth.cloudDiscoveryMetadata,
|
||||
authorityMetadata: this.config.auth.authorityMetadata,
|
||||
skipAuthorityMetadataCache: this.config.auth.skipAuthorityMetadataCache,
|
||||
};
|
||||
// build authority string based on auth params, precedence - azureCloudInstance + tenant >> authority
|
||||
const resolvedAuthority = params.requestAuthority || this.config.auth.authority;
|
||||
const resolvedInstanceAware = instanceAwareEQ?.length
|
||||
? instanceAwareEQ === "true"
|
||||
: this.config.auth.instanceAware;
|
||||
const userAuthority = account && resolvedInstanceAware
|
||||
? this.config.auth.authority.replace(UrlString.getDomainFromUrl(resolvedAuthority), account.environment)
|
||||
: resolvedAuthority;
|
||||
// fall back to the authority from config
|
||||
const builtAuthority = Authority.generateAuthority(userAuthority, params.requestAzureCloudOptions ||
|
||||
this.config.auth.azureCloudOptions);
|
||||
const discoveredAuthority = await invokeAsync(AuthorityFactory.createDiscoveredInstance, PerformanceEvents.AuthorityFactoryCreateDiscoveredInstance, this.logger, this.performanceClient, this.correlationId)(builtAuthority, this.config.system.networkClient, this.browserStorage, authorityOptions, this.logger, this.correlationId, this.performanceClient);
|
||||
if (account && !discoveredAuthority.isAlias(account.environment)) {
|
||||
throw createClientConfigurationError(ClientConfigurationErrorCodes.authorityMismatch);
|
||||
}
|
||||
return discoveredAuthority;
|
||||
}
|
||||
}
|
||||
|
||||
export { BaseInteractionClient };
|
||||
//# sourceMappingURL=BaseInteractionClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/BaseInteractionClient.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"BaseInteractionClient.mjs","sources":["../../src/interaction_client/BaseInteractionClient.ts"],"sourcesContent":[null],"names":["BrowserUtils.getCurrentUri"],"mappings":";;;;;;;;AAAA;;;AAGG;MAsCmB,qBAAqB,CAAA;AAYvC,IAAA,WAAA,CACI,MAA4B,EAC5B,WAAgC,EAChC,aAAsB,EACtB,MAAc,EACd,YAA0B,EAC1B,gBAAmC,EACnC,iBAAqC,EACrC,oBAA2C,EAC3C,aAAsB,EAAA;AAEtB,QAAA,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;AACrB,QA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,OAAO,CAC9B,SAAS,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAC7C,OAAO,CAAC,WAAW,CACtB;cACD,iBAAiB,CAAC;;QAG5B,MAAM,cAAc,GAAG,SAAS,CAAC,iBAAiB,CAC9C,aAAa,EACb,MAAM,CAAC,wBAAwB;AAC3B,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CACzC,CAAC;QACF,MAAM,mBAAmB,GAAG,MAAM,WAAW,CACzC,gBAAgB,CAAC,wBAAwB,EACzC,iBAAiB,CAAC,wCAAwC,EAC1D,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,iBAAiB,EACtB,IAAI,CAAC,aAAa,CACrB,CACG,cAAc,EACd,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,EAChC,IAAI,CAAC,cAAc,EACnB,gBAAgB,EAChB,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,aAAa,EAClB,IAAI,CAAC,iBAAiB,CACzB,CAAC;QAEF,IAAI,OAAO,IAAI,CAAC,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE;AAC9D,YAAA,MAAM,8BAA8B,CAChC,6BAA6B,CAAC,iBAAiB,CAClD,CAAC;AACL,SAAA;AAED,QAAA,OAAO,mBAAmB,CAAC;KAC9B;AACJ;;;;"}
|
||||
5
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts
generated
vendored
Normal file
5
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
import { AuthorizationCodeClient, ClientConfiguration } from "@azure/msal-common/browser";
|
||||
export declare class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {
|
||||
constructor(config: ClientConfiguration);
|
||||
}
|
||||
//# sourceMappingURL=HybridSpaAuthorizationCodeClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"HybridSpaAuthorizationCodeClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/HybridSpaAuthorizationCodeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,uBAAuB,EACvB,mBAAmB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,qBAAa,gCAAiC,SAAQ,uBAAuB;gBAC7D,MAAM,EAAE,mBAAmB;CAI1C"}
|
||||
17
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs
generated
vendored
Normal file
17
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { AuthorizationCodeClient } from '@azure/msal-common/browser';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class HybridSpaAuthorizationCodeClient extends AuthorizationCodeClient {
|
||||
constructor(config) {
|
||||
super(config);
|
||||
this.includeRedirectUri = false;
|
||||
}
|
||||
}
|
||||
|
||||
export { HybridSpaAuthorizationCodeClient };
|
||||
//# sourceMappingURL=HybridSpaAuthorizationCodeClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/HybridSpaAuthorizationCodeClient.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"HybridSpaAuthorizationCodeClient.mjs","sources":["../../src/interaction_client/HybridSpaAuthorizationCodeClient.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAAA;;;AAGG;AAOG,MAAO,gCAAiC,SAAQ,uBAAuB,CAAA;AACzE,IAAA,WAAA,CAAY,MAA2B,EAAA;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;AACd,QAAA,IAAI,CAAC,kBAAkB,GAAG,KAAK,CAAC;KACnC;AACJ;;;;"}
|
||||
151
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.d.ts
generated
vendored
Normal file
151
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,151 @@
|
||||
import { Logger, ICrypto, AccountEntity, ScopeSet, IPerformanceClient, TokenClaims, InProgressPerformanceEvent } from "@azure/msal-common/browser";
|
||||
import { BaseInteractionClient } from "./BaseInteractionClient.js";
|
||||
import { BrowserConfiguration } from "../config/Configuration.js";
|
||||
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
||||
import { EventHandler } from "../event/EventHandler.js";
|
||||
import { PopupRequest } from "../request/PopupRequest.js";
|
||||
import { SilentRequest } from "../request/SilentRequest.js";
|
||||
import { SsoSilentRequest } from "../request/SsoSilentRequest.js";
|
||||
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler.js";
|
||||
import { ApiId } from "../utils/BrowserConstants.js";
|
||||
import { NativeTokenRequest } from "../broker/nativeBroker/NativeRequest.js";
|
||||
import { MATS, NativeResponse } from "../broker/nativeBroker/NativeResponse.js";
|
||||
import { RedirectRequest } from "../request/RedirectRequest.js";
|
||||
import { INavigationClient } from "../navigation/INavigationClient.js";
|
||||
import { SilentCacheClient } from "./SilentCacheClient.js";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
export declare class NativeInteractionClient extends BaseInteractionClient {
|
||||
protected apiId: ApiId;
|
||||
protected accountId: string;
|
||||
protected nativeMessageHandler: NativeMessageHandler;
|
||||
protected silentCacheClient: SilentCacheClient;
|
||||
protected nativeStorageManager: BrowserCacheManager;
|
||||
protected skus: string;
|
||||
constructor(config: BrowserConfiguration, browserStorage: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, provider: NativeMessageHandler, accountId: string, nativeStorageImpl: BrowserCacheManager, correlationId?: string);
|
||||
/**
|
||||
* Adds SKUs to request extra query parameters
|
||||
* @param request {NativeTokenRequest}
|
||||
* @private
|
||||
*/
|
||||
private addRequestSKUs;
|
||||
/**
|
||||
* Acquire token from native platform via browser extension
|
||||
* @param request
|
||||
*/
|
||||
acquireToken(request: PopupRequest | SilentRequest | SsoSilentRequest): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* Creates silent flow request
|
||||
* @param request
|
||||
* @param cachedAccount
|
||||
* @returns CommonSilentFlowRequest
|
||||
*/
|
||||
private createSilentCacheRequest;
|
||||
/**
|
||||
* Fetches the tokens from the cache if un-expired
|
||||
* @param nativeAccountId
|
||||
* @param request
|
||||
* @returns authenticationResult
|
||||
*/
|
||||
protected acquireTokensFromCache(nativeAccountId: string, request: NativeTokenRequest): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* Acquires a token from native platform then redirects to the redirectUri instead of returning the response
|
||||
* @param {RedirectRequest} request
|
||||
* @param {InProgressPerformanceEvent} rootMeasurement
|
||||
*/
|
||||
acquireTokenRedirect(request: RedirectRequest, rootMeasurement: InProgressPerformanceEvent): Promise<void>;
|
||||
/**
|
||||
* If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
|
||||
* @param performanceClient {IPerformanceClient?}
|
||||
* @param correlationId {string?} correlation identifier
|
||||
*/
|
||||
handleRedirectPromise(performanceClient?: IPerformanceClient, correlationId?: string): Promise<AuthenticationResult | null>;
|
||||
/**
|
||||
* Logout from native platform via browser extension
|
||||
* @param request
|
||||
*/
|
||||
logout(): Promise<void>;
|
||||
/**
|
||||
* Transform response from native platform into AuthenticationResult object which will be returned to the end user
|
||||
* @param response
|
||||
* @param request
|
||||
* @param reqTimestamp
|
||||
*/
|
||||
protected handleNativeResponse(response: NativeResponse, request: NativeTokenRequest, reqTimestamp: number): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* creates an homeAccountIdentifier for the account
|
||||
* @param response
|
||||
* @param idTokenObj
|
||||
* @returns
|
||||
*/
|
||||
protected createHomeAccountIdentifier(response: NativeResponse, idTokenClaims: TokenClaims): string;
|
||||
/**
|
||||
* Helper to generate scopes
|
||||
* @param response
|
||||
* @param request
|
||||
* @returns
|
||||
*/
|
||||
generateScopes(response: NativeResponse, request: NativeTokenRequest): ScopeSet;
|
||||
/**
|
||||
* If PoP token is requesred, records the PoP token if returned from the WAM, else generates one in the browser
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
generatePopAccessToken(response: NativeResponse, request: NativeTokenRequest): Promise<string>;
|
||||
/**
|
||||
* Generates authentication result
|
||||
* @param response
|
||||
* @param request
|
||||
* @param idTokenObj
|
||||
* @param accountEntity
|
||||
* @param authority
|
||||
* @param reqTimestamp
|
||||
* @returns
|
||||
*/
|
||||
protected generateAuthenticationResult(response: NativeResponse, request: NativeTokenRequest, idTokenClaims: TokenClaims, accountEntity: AccountEntity, authority: string, reqTimestamp: number): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* cache the account entity in browser storage
|
||||
* @param accountEntity
|
||||
*/
|
||||
cacheAccount(accountEntity: AccountEntity): Promise<void>;
|
||||
/**
|
||||
* Stores the access_token and id_token in inmemory storage
|
||||
* @param response
|
||||
* @param request
|
||||
* @param homeAccountIdentifier
|
||||
* @param idTokenObj
|
||||
* @param responseAccessToken
|
||||
* @param tenantId
|
||||
* @param reqTimestamp
|
||||
*/
|
||||
cacheNativeTokens(response: NativeResponse, request: NativeTokenRequest, homeAccountIdentifier: string, idTokenClaims: TokenClaims, responseAccessToken: string, tenantId: string, reqTimestamp: number): Promise<void>;
|
||||
protected addTelemetryFromNativeResponse(response: NativeResponse): MATS | null;
|
||||
/**
|
||||
* Validates native platform response before processing
|
||||
* @param response
|
||||
*/
|
||||
private validateNativeResponse;
|
||||
/**
|
||||
* Gets MATS telemetry from native response
|
||||
* @param response
|
||||
* @returns
|
||||
*/
|
||||
private getMATSFromResponse;
|
||||
/**
|
||||
* Returns whether or not response came from native cache
|
||||
* @param response
|
||||
* @returns
|
||||
*/
|
||||
protected isResponseFromCache(mats: MATS): boolean;
|
||||
/**
|
||||
* Translates developer provided request object into NativeRequest object
|
||||
* @param request
|
||||
*/
|
||||
protected initializeNativeRequest(request: PopupRequest | SsoSilentRequest): Promise<NativeTokenRequest>;
|
||||
/**
|
||||
* Handles extra broker request parameters
|
||||
* @param request {NativeTokenRequest}
|
||||
* @private
|
||||
*/
|
||||
private handleExtraBrokerParams;
|
||||
}
|
||||
//# sourceMappingURL=NativeInteractionClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"NativeInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/NativeInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,MAAM,EACN,OAAO,EAIP,aAAa,EAEb,QAAQ,EAOR,kBAAkB,EAQlB,WAAW,EASX,0BAA0B,EAE7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oB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EAAE,cAAc,EACxB,OAAO,EAAE,kBAAkB,EAC3B,qBAAqB,EAAE,MAAM,EAC7B,aAAa,EAAE,WAAW,EAC1B,mBAAmB,EAAE,MAAM,EAC3B,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,GACrB,OAAO,CAAC,IAAI,CAAC;IAiDhB,SAAS,CAAC,8BAA8B,CACpC,QAAQ,EAAE,cAAc,GACzB,IAAI,GAAG,IAAI;IAgCd;;;OAGG;IACH,OAAO,CAAC,sBAAsB;IAkB9B;;;;OAIG;IACH,OAAO,CAAC,mBAAmB;IAc3B;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,OAAO;IAWlD;;;OAGG;cACa,uBAAuB,CACnC,OAAO,EAAE,YAAY,GAAG,gBAAgB,GACzC,OAAO,CAAC,kBAAkB,CAAC;IAwI9B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;CA2ClC"}
|
||||
653
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.mjs
generated
vendored
Normal file
653
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,653 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { ServerTelemetryManager, AADServerParamKeys, PerformanceEvents, TimeUtils, ScopeSet, createClientAuthError, ClientAuthErrorCodes, AuthToken, buildAccountToCache, AccountEntity, Constants, AuthorityType, AuthenticationScheme, PopTokenGenerator, updateAccountTenantProfileData, CacheHelpers, createAuthError, AuthErrorCodes, UrlString, OIDC_DEFAULT_SCOPES, invokeAsync, PromptValue } from '@azure/msal-common/browser';
|
||||
import { BaseInteractionClient } from './BaseInteractionClient.mjs';
|
||||
import { NativeConstants, BrowserConstants, NativeExtensionMethod, TemporaryCacheKeys, ApiId } from '../utils/BrowserConstants.mjs';
|
||||
import { NativeAuthError, isFatalNativeAuthError, createNativeAuthError } from '../error/NativeAuthError.mjs';
|
||||
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
||||
import { SilentCacheClient } from './SilentCacheClient.mjs';
|
||||
import { base64Decode } from '../encode/Base64Decode.mjs';
|
||||
import { version } from '../packageMetadata.mjs';
|
||||
import { invalidPopTokenRequest, nativePromptNotSupported } from '../error/BrowserAuthErrorCodes.mjs';
|
||||
import { userSwitch } from '../error/NativeAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class NativeInteractionClient extends BaseInteractionClient {
|
||||
constructor(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, provider, accountId, nativeStorageImpl, correlationId) {
|
||||
super(config, browserStorage, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);
|
||||
this.apiId = apiId;
|
||||
this.accountId = accountId;
|
||||
this.nativeMessageHandler = provider;
|
||||
this.nativeStorageManager = nativeStorageImpl;
|
||||
this.silentCacheClient = new SilentCacheClient(config, this.nativeStorageManager, browserCrypto, logger, eventHandler, navigationClient, performanceClient, provider, correlationId);
|
||||
const extensionName = this.nativeMessageHandler.getExtensionId() ===
|
||||
NativeConstants.PREFERRED_EXTENSION_ID
|
||||
? "chrome"
|
||||
: this.nativeMessageHandler.getExtensionId()?.length
|
||||
? "unknown"
|
||||
: undefined;
|
||||
this.skus = ServerTelemetryManager.makeExtraSkuString({
|
||||
libraryName: BrowserConstants.MSAL_SKU,
|
||||
libraryVersion: version,
|
||||
extensionName: extensionName,
|
||||
extensionVersion: this.nativeMessageHandler.getExtensionVersion(),
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Adds SKUs to request extra query parameters
|
||||
* @param request {NativeTokenRequest}
|
||||
* @private
|
||||
*/
|
||||
addRequestSKUs(request) {
|
||||
request.extraParameters = {
|
||||
...request.extraParameters,
|
||||
[AADServerParamKeys.X_CLIENT_EXTRA_SKU]: this.skus,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Acquire token from native platform via browser extension
|
||||
* @param request
|
||||
*/
|
||||
async acquireToken(request) {
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
|
||||
this.logger.trace("NativeInteractionClient - acquireToken called.");
|
||||
// start the perf measurement
|
||||
const nativeATMeasurement = this.performanceClient.startMeasurement(PerformanceEvents.NativeInteractionClientAcquireToken, request.correlationId);
|
||||
const reqTimestamp = TimeUtils.nowSeconds();
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
||||
try {
|
||||
// initialize native request
|
||||
const nativeRequest = await this.initializeNativeRequest(request);
|
||||
// check if the tokens can be retrieved from internal cache
|
||||
try {
|
||||
const result = await this.acquireTokensFromCache(this.accountId, nativeRequest);
|
||||
nativeATMeasurement.end({
|
||||
success: true,
|
||||
isNativeBroker: false,
|
||||
fromCache: true,
|
||||
});
|
||||
return result;
|
||||
}
|
||||
catch (e) {
|
||||
// continue with a native call for any and all errors
|
||||
this.logger.info("MSAL internal Cache does not contain tokens, proceed to make a native call");
|
||||
}
|
||||
const { ...nativeTokenRequest } = nativeRequest;
|
||||
// fall back to native calls
|
||||
const messageBody = {
|
||||
method: NativeExtensionMethod.GetToken,
|
||||
request: nativeTokenRequest,
|
||||
};
|
||||
const response = await this.nativeMessageHandler.sendMessage(messageBody);
|
||||
const validatedResponse = this.validateNativeResponse(response);
|
||||
return await this.handleNativeResponse(validatedResponse, nativeRequest, reqTimestamp)
|
||||
.then((result) => {
|
||||
nativeATMeasurement.end({
|
||||
success: true,
|
||||
isNativeBroker: true,
|
||||
requestId: result.requestId,
|
||||
});
|
||||
serverTelemetryManager.clearNativeBrokerErrorCode();
|
||||
return result;
|
||||
})
|
||||
.catch((error) => {
|
||||
nativeATMeasurement.end({
|
||||
success: false,
|
||||
errorCode: error.errorCode,
|
||||
subErrorCode: error.subError,
|
||||
isNativeBroker: true,
|
||||
});
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof NativeAuthError) {
|
||||
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Creates silent flow request
|
||||
* @param request
|
||||
* @param cachedAccount
|
||||
* @returns CommonSilentFlowRequest
|
||||
*/
|
||||
createSilentCacheRequest(request, cachedAccount) {
|
||||
return {
|
||||
authority: request.authority,
|
||||
correlationId: this.correlationId,
|
||||
scopes: ScopeSet.fromString(request.scope).asArray(),
|
||||
account: cachedAccount,
|
||||
forceRefresh: false,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Fetches the tokens from the cache if un-expired
|
||||
* @param nativeAccountId
|
||||
* @param request
|
||||
* @returns authenticationResult
|
||||
*/
|
||||
async acquireTokensFromCache(nativeAccountId, request) {
|
||||
if (!nativeAccountId) {
|
||||
this.logger.warning("NativeInteractionClient:acquireTokensFromCache - No nativeAccountId provided");
|
||||
throw createClientAuthError(ClientAuthErrorCodes.noAccountFound);
|
||||
}
|
||||
// fetch the account from browser cache
|
||||
const account = this.browserStorage.getBaseAccountInfo({
|
||||
nativeAccountId,
|
||||
});
|
||||
if (!account) {
|
||||
throw createClientAuthError(ClientAuthErrorCodes.noAccountFound);
|
||||
}
|
||||
// leverage silent flow for cached tokens retrieval
|
||||
try {
|
||||
const silentRequest = this.createSilentCacheRequest(request, account);
|
||||
const result = await this.silentCacheClient.acquireToken(silentRequest);
|
||||
const fullAccount = {
|
||||
...account,
|
||||
idTokenClaims: result?.idTokenClaims,
|
||||
idToken: result?.idToken,
|
||||
};
|
||||
return {
|
||||
...result,
|
||||
account: fullAccount,
|
||||
};
|
||||
}
|
||||
catch (e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Acquires a token from native platform then redirects to the redirectUri instead of returning the response
|
||||
* @param {RedirectRequest} request
|
||||
* @param {InProgressPerformanceEvent} rootMeasurement
|
||||
*/
|
||||
async acquireTokenRedirect(request, rootMeasurement) {
|
||||
this.logger.trace("NativeInteractionClient - acquireTokenRedirect called.");
|
||||
const { ...remainingParameters } = request;
|
||||
delete remainingParameters.onRedirectNavigate;
|
||||
const nativeRequest = await this.initializeNativeRequest(remainingParameters);
|
||||
const messageBody = {
|
||||
method: NativeExtensionMethod.GetToken,
|
||||
request: nativeRequest,
|
||||
};
|
||||
try {
|
||||
const response = await this.nativeMessageHandler.sendMessage(messageBody);
|
||||
this.validateNativeResponse(response);
|
||||
}
|
||||
catch (e) {
|
||||
// Only throw fatal errors here to allow application to fallback to regular redirect. Otherwise proceed and the error will be thrown in handleRedirectPromise
|
||||
if (e instanceof NativeAuthError) {
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
||||
serverTelemetryManager.setNativeBrokerErrorCode(e.errorCode);
|
||||
if (isFatalNativeAuthError(e)) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.NATIVE_REQUEST, JSON.stringify(nativeRequest), true);
|
||||
const navigationOptions = {
|
||||
apiId: ApiId.acquireTokenRedirect,
|
||||
timeout: this.config.system.redirectNavigationTimeout,
|
||||
noHistory: false,
|
||||
};
|
||||
const redirectUri = this.config.auth.navigateToLoginRequestUrl
|
||||
? window.location.href
|
||||
: this.getRedirectUri(request.redirectUri);
|
||||
rootMeasurement.end({ success: true });
|
||||
await this.navigationClient.navigateExternal(redirectUri, navigationOptions); // Need to treat this as external to ensure handleRedirectPromise is run again
|
||||
}
|
||||
/**
|
||||
* If the previous page called native platform for a token using redirect APIs, send the same request again and return the response
|
||||
* @param performanceClient {IPerformanceClient?}
|
||||
* @param correlationId {string?} correlation identifier
|
||||
*/
|
||||
async handleRedirectPromise(performanceClient, correlationId) {
|
||||
this.logger.trace("NativeInteractionClient - handleRedirectPromise called.");
|
||||
if (!this.browserStorage.isInteractionInProgress(true)) {
|
||||
this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null.");
|
||||
return null;
|
||||
}
|
||||
// remove prompt from the request to prevent WAM from prompting twice
|
||||
const cachedRequest = this.browserStorage.getCachedNativeRequest();
|
||||
if (!cachedRequest) {
|
||||
this.logger.verbose("NativeInteractionClient - handleRedirectPromise called but there is no cached request, returning null.");
|
||||
if (performanceClient && correlationId) {
|
||||
performanceClient?.addFields({ errorCode: "no_cached_request" }, correlationId);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
const { prompt, ...request } = cachedRequest;
|
||||
if (prompt) {
|
||||
this.logger.verbose("NativeInteractionClient - handleRedirectPromise called and prompt was included in the original request, removing prompt from cached request to prevent second interaction with native broker window.");
|
||||
}
|
||||
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.NATIVE_REQUEST));
|
||||
const messageBody = {
|
||||
method: NativeExtensionMethod.GetToken,
|
||||
request: request,
|
||||
};
|
||||
const reqTimestamp = TimeUtils.nowSeconds();
|
||||
try {
|
||||
this.logger.verbose("NativeInteractionClient - handleRedirectPromise sending message to native broker.");
|
||||
const response = await this.nativeMessageHandler.sendMessage(messageBody);
|
||||
this.validateNativeResponse(response);
|
||||
const result = this.handleNativeResponse(response, request, reqTimestamp);
|
||||
this.browserStorage.setInteractionInProgress(false);
|
||||
const res = await result;
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
||||
serverTelemetryManager.clearNativeBrokerErrorCode();
|
||||
return res;
|
||||
}
|
||||
catch (e) {
|
||||
this.browserStorage.setInteractionInProgress(false);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Logout from native platform via browser extension
|
||||
* @param request
|
||||
*/
|
||||
logout() {
|
||||
this.logger.trace("NativeInteractionClient - logout called.");
|
||||
return Promise.reject("Logout not implemented yet");
|
||||
}
|
||||
/**
|
||||
* Transform response from native platform into AuthenticationResult object which will be returned to the end user
|
||||
* @param response
|
||||
* @param request
|
||||
* @param reqTimestamp
|
||||
*/
|
||||
async handleNativeResponse(response, request, reqTimestamp) {
|
||||
this.logger.trace("NativeInteractionClient - handleNativeResponse called.");
|
||||
// generate identifiers
|
||||
const idTokenClaims = AuthToken.extractTokenClaims(response.id_token, base64Decode);
|
||||
const homeAccountIdentifier = this.createHomeAccountIdentifier(response, idTokenClaims);
|
||||
const cachedhomeAccountId = this.browserStorage.getAccountInfoFilteredBy({
|
||||
nativeAccountId: request.accountId,
|
||||
})?.homeAccountId;
|
||||
if (homeAccountIdentifier !== cachedhomeAccountId &&
|
||||
response.account.id !== request.accountId) {
|
||||
// User switch in native broker prompt is not supported. All users must first sign in through web flow to ensure server state is in sync
|
||||
throw createNativeAuthError(userSwitch);
|
||||
}
|
||||
// Get the preferred_cache domain for the given authority
|
||||
const authority = await this.getDiscoveredAuthority({
|
||||
requestAuthority: request.authority,
|
||||
});
|
||||
const baseAccount = buildAccountToCache(this.browserStorage, authority, homeAccountIdentifier, base64Decode, idTokenClaims, response.client_info, undefined, // environment
|
||||
idTokenClaims.tid, undefined, // auth code payload
|
||||
response.account.id, this.logger);
|
||||
// generate authenticationResult
|
||||
const result = await this.generateAuthenticationResult(response, request, idTokenClaims, baseAccount, authority.canonicalAuthority, reqTimestamp);
|
||||
// cache accounts and tokens in the appropriate storage
|
||||
await this.cacheAccount(baseAccount);
|
||||
await this.cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, response.access_token, result.tenantId, reqTimestamp);
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* creates an homeAccountIdentifier for the account
|
||||
* @param response
|
||||
* @param idTokenObj
|
||||
* @returns
|
||||
*/
|
||||
createHomeAccountIdentifier(response, idTokenClaims) {
|
||||
// Save account in browser storage
|
||||
const homeAccountIdentifier = AccountEntity.generateHomeAccountId(response.client_info || Constants.EMPTY_STRING, AuthorityType.Default, this.logger, this.browserCrypto, idTokenClaims);
|
||||
return homeAccountIdentifier;
|
||||
}
|
||||
/**
|
||||
* Helper to generate scopes
|
||||
* @param response
|
||||
* @param request
|
||||
* @returns
|
||||
*/
|
||||
generateScopes(response, request) {
|
||||
return response.scope
|
||||
? ScopeSet.fromString(response.scope)
|
||||
: ScopeSet.fromString(request.scope);
|
||||
}
|
||||
/**
|
||||
* If PoP token is requesred, records the PoP token if returned from the WAM, else generates one in the browser
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
async generatePopAccessToken(response, request) {
|
||||
if (request.tokenType === AuthenticationScheme.POP &&
|
||||
request.signPopToken) {
|
||||
/**
|
||||
* This code prioritizes SHR returned from the native layer. In case of error/SHR not calculated from WAM and the AT
|
||||
* is still received, SHR is calculated locally
|
||||
*/
|
||||
// Check if native layer returned an SHR token
|
||||
if (response.shr) {
|
||||
this.logger.trace("handleNativeServerResponse: SHR is enabled in native layer");
|
||||
return response.shr;
|
||||
}
|
||||
// Generate SHR in msal js if WAM does not compute it when POP is enabled
|
||||
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
|
||||
const shrParameters = {
|
||||
resourceRequestMethod: request.resourceRequestMethod,
|
||||
resourceRequestUri: request.resourceRequestUri,
|
||||
shrClaims: request.shrClaims,
|
||||
shrNonce: request.shrNonce,
|
||||
};
|
||||
/**
|
||||
* KeyID must be present in the native request from when the PoP key was generated in order for
|
||||
* PopTokenGenerator to query the full key for signing
|
||||
*/
|
||||
if (!request.keyId) {
|
||||
throw createClientAuthError(ClientAuthErrorCodes.keyIdMissing);
|
||||
}
|
||||
return popTokenGenerator.signPopToken(response.access_token, request.keyId, shrParameters);
|
||||
}
|
||||
else {
|
||||
return response.access_token;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Generates authentication result
|
||||
* @param response
|
||||
* @param request
|
||||
* @param idTokenObj
|
||||
* @param accountEntity
|
||||
* @param authority
|
||||
* @param reqTimestamp
|
||||
* @returns
|
||||
*/
|
||||
async generateAuthenticationResult(response, request, idTokenClaims, accountEntity, authority, reqTimestamp) {
|
||||
// Add Native Broker fields to Telemetry
|
||||
const mats = this.addTelemetryFromNativeResponse(response);
|
||||
// If scopes not returned in server response, use request scopes
|
||||
const responseScopes = response.scope
|
||||
? ScopeSet.fromString(response.scope)
|
||||
: ScopeSet.fromString(request.scope);
|
||||
const accountProperties = response.account.properties || {};
|
||||
const uid = accountProperties["UID"] ||
|
||||
idTokenClaims.oid ||
|
||||
idTokenClaims.sub ||
|
||||
Constants.EMPTY_STRING;
|
||||
const tid = accountProperties["TenantId"] ||
|
||||
idTokenClaims.tid ||
|
||||
Constants.EMPTY_STRING;
|
||||
const accountInfo = updateAccountTenantProfileData(accountEntity.getAccountInfo(), undefined, // tenantProfile optional
|
||||
idTokenClaims, response.id_token);
|
||||
/**
|
||||
* In pairwise broker flows, this check prevents the broker's native account id
|
||||
* from being returned over the embedded app's account id.
|
||||
*/
|
||||
if (accountInfo.nativeAccountId !== response.account.id) {
|
||||
accountInfo.nativeAccountId = response.account.id;
|
||||
}
|
||||
// generate PoP token as needed
|
||||
const responseAccessToken = await this.generatePopAccessToken(response, request);
|
||||
const tokenType = request.tokenType === AuthenticationScheme.POP
|
||||
? AuthenticationScheme.POP
|
||||
: AuthenticationScheme.BEARER;
|
||||
const result = {
|
||||
authority: authority,
|
||||
uniqueId: uid,
|
||||
tenantId: tid,
|
||||
scopes: responseScopes.asArray(),
|
||||
account: accountInfo,
|
||||
idToken: response.id_token,
|
||||
idTokenClaims: idTokenClaims,
|
||||
accessToken: responseAccessToken,
|
||||
fromCache: mats ? this.isResponseFromCache(mats) : false,
|
||||
expiresOn: new Date(Number(reqTimestamp + response.expires_in) * 1000),
|
||||
tokenType: tokenType,
|
||||
correlationId: this.correlationId,
|
||||
state: response.state,
|
||||
fromNativeBroker: true,
|
||||
};
|
||||
return result;
|
||||
}
|
||||
/**
|
||||
* cache the account entity in browser storage
|
||||
* @param accountEntity
|
||||
*/
|
||||
async cacheAccount(accountEntity) {
|
||||
// Store the account info and hence `nativeAccountId` in browser cache
|
||||
await this.browserStorage.setAccount(accountEntity, this.correlationId);
|
||||
// Remove any existing cached tokens for this account in browser storage
|
||||
this.browserStorage.removeAccountContext(accountEntity).catch((e) => {
|
||||
this.logger.error(`Error occurred while removing account context from browser storage. ${e}`);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Stores the access_token and id_token in inmemory storage
|
||||
* @param response
|
||||
* @param request
|
||||
* @param homeAccountIdentifier
|
||||
* @param idTokenObj
|
||||
* @param responseAccessToken
|
||||
* @param tenantId
|
||||
* @param reqTimestamp
|
||||
*/
|
||||
cacheNativeTokens(response, request, homeAccountIdentifier, idTokenClaims, responseAccessToken, tenantId, reqTimestamp) {
|
||||
const cachedIdToken = CacheHelpers.createIdTokenEntity(homeAccountIdentifier, request.authority, response.id_token || "", request.clientId, idTokenClaims.tid || "");
|
||||
// cache accessToken in inmemory storage
|
||||
const expiresIn = request.tokenType === AuthenticationScheme.POP
|
||||
? Constants.SHR_NONCE_VALIDITY
|
||||
: (typeof response.expires_in === "string"
|
||||
? parseInt(response.expires_in, 10)
|
||||
: response.expires_in) || 0;
|
||||
const tokenExpirationSeconds = reqTimestamp + expiresIn;
|
||||
const responseScopes = this.generateScopes(response, request);
|
||||
const cachedAccessToken = CacheHelpers.createAccessTokenEntity(homeAccountIdentifier, request.authority, responseAccessToken, request.clientId, idTokenClaims.tid || tenantId, responseScopes.printScopes(), tokenExpirationSeconds, 0, base64Decode, undefined, request.tokenType, undefined, request.keyId);
|
||||
const nativeCacheRecord = {
|
||||
idToken: cachedIdToken,
|
||||
accessToken: cachedAccessToken,
|
||||
};
|
||||
return this.nativeStorageManager.saveCacheRecord(nativeCacheRecord, this.correlationId, request.storeInCache);
|
||||
}
|
||||
addTelemetryFromNativeResponse(response) {
|
||||
const mats = this.getMATSFromResponse(response);
|
||||
if (!mats) {
|
||||
return null;
|
||||
}
|
||||
this.performanceClient.addFields({
|
||||
extensionId: this.nativeMessageHandler.getExtensionId(),
|
||||
extensionVersion: this.nativeMessageHandler.getExtensionVersion(),
|
||||
matsBrokerVersion: mats.broker_version,
|
||||
matsAccountJoinOnStart: mats.account_join_on_start,
|
||||
matsAccountJoinOnEnd: mats.account_join_on_end,
|
||||
matsDeviceJoin: mats.device_join,
|
||||
matsPromptBehavior: mats.prompt_behavior,
|
||||
matsApiErrorCode: mats.api_error_code,
|
||||
matsUiVisible: mats.ui_visible,
|
||||
matsSilentCode: mats.silent_code,
|
||||
matsSilentBiSubCode: mats.silent_bi_sub_code,
|
||||
matsSilentMessage: mats.silent_message,
|
||||
matsSilentStatus: mats.silent_status,
|
||||
matsHttpStatus: mats.http_status,
|
||||
matsHttpEventCount: mats.http_event_count,
|
||||
}, this.correlationId);
|
||||
return mats;
|
||||
}
|
||||
/**
|
||||
* Validates native platform response before processing
|
||||
* @param response
|
||||
*/
|
||||
validateNativeResponse(response) {
|
||||
if (response.hasOwnProperty("access_token") &&
|
||||
response.hasOwnProperty("id_token") &&
|
||||
response.hasOwnProperty("client_info") &&
|
||||
response.hasOwnProperty("account") &&
|
||||
response.hasOwnProperty("scope") &&
|
||||
response.hasOwnProperty("expires_in")) {
|
||||
return response;
|
||||
}
|
||||
else {
|
||||
throw createAuthError(AuthErrorCodes.unexpectedError, "Response missing expected properties.");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets MATS telemetry from native response
|
||||
* @param response
|
||||
* @returns
|
||||
*/
|
||||
getMATSFromResponse(response) {
|
||||
if (response.properties.MATS) {
|
||||
try {
|
||||
return JSON.parse(response.properties.MATS);
|
||||
}
|
||||
catch (e) {
|
||||
this.logger.error("NativeInteractionClient - Error parsing MATS telemetry, returning null instead");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Returns whether or not response came from native cache
|
||||
* @param response
|
||||
* @returns
|
||||
*/
|
||||
isResponseFromCache(mats) {
|
||||
if (typeof mats.is_cached === "undefined") {
|
||||
this.logger.verbose("NativeInteractionClient - MATS telemetry does not contain field indicating if response was served from cache. Returning false.");
|
||||
return false;
|
||||
}
|
||||
return !!mats.is_cached;
|
||||
}
|
||||
/**
|
||||
* Translates developer provided request object into NativeRequest object
|
||||
* @param request
|
||||
*/
|
||||
async initializeNativeRequest(request) {
|
||||
this.logger.trace("NativeInteractionClient - initializeNativeRequest called");
|
||||
const requestAuthority = request.authority || this.config.auth.authority;
|
||||
if (request.account) {
|
||||
// validate authority
|
||||
await this.getDiscoveredAuthority({
|
||||
requestAuthority,
|
||||
requestAzureCloudOptions: request.azureCloudOptions,
|
||||
account: request.account,
|
||||
});
|
||||
}
|
||||
const canonicalAuthority = new UrlString(requestAuthority);
|
||||
canonicalAuthority.validateAsUri();
|
||||
// scopes are expected to be received by the native broker as "scope" and will be added to the request below. Other properties that should be dropped from the request to the native broker can be included in the object destructuring here.
|
||||
const { scopes, ...remainingProperties } = request;
|
||||
const scopeSet = new ScopeSet(scopes || []);
|
||||
scopeSet.appendScopes(OIDC_DEFAULT_SCOPES);
|
||||
const getPrompt = () => {
|
||||
// If request is silent, prompt is always none
|
||||
switch (this.apiId) {
|
||||
case ApiId.ssoSilent:
|
||||
case ApiId.acquireTokenSilent_silentFlow:
|
||||
this.logger.trace("initializeNativeRequest: silent request sets prompt to none");
|
||||
return PromptValue.NONE;
|
||||
}
|
||||
// Prompt not provided, request may proceed and native broker decides if it needs to prompt
|
||||
if (!request.prompt) {
|
||||
this.logger.trace("initializeNativeRequest: prompt was not provided");
|
||||
return undefined;
|
||||
}
|
||||
// If request is interactive, check if prompt provided is allowed to go directly to native broker
|
||||
switch (request.prompt) {
|
||||
case PromptValue.NONE:
|
||||
case PromptValue.CONSENT:
|
||||
case PromptValue.LOGIN:
|
||||
this.logger.trace("initializeNativeRequest: prompt is compatible with native flow");
|
||||
return request.prompt;
|
||||
default:
|
||||
this.logger.trace(`initializeNativeRequest: prompt = ${request.prompt} is not compatible with native flow`);
|
||||
throw createBrowserAuthError(nativePromptNotSupported);
|
||||
}
|
||||
};
|
||||
const validatedRequest = {
|
||||
...remainingProperties,
|
||||
accountId: this.accountId,
|
||||
clientId: this.config.auth.clientId,
|
||||
authority: canonicalAuthority.urlString,
|
||||
scope: scopeSet.printScopes(),
|
||||
redirectUri: this.getRedirectUri(request.redirectUri),
|
||||
prompt: getPrompt(),
|
||||
correlationId: this.correlationId,
|
||||
tokenType: request.authenticationScheme,
|
||||
windowTitleSubstring: document.title,
|
||||
extraParameters: {
|
||||
...request.extraQueryParameters,
|
||||
...request.tokenQueryParameters,
|
||||
},
|
||||
extendedExpiryToken: false,
|
||||
keyId: request.popKid,
|
||||
};
|
||||
// Check for PoP token requests: signPopToken should only be set to true if popKid is not set
|
||||
if (validatedRequest.signPopToken && !!request.popKid) {
|
||||
throw createBrowserAuthError(invalidPopTokenRequest);
|
||||
}
|
||||
this.handleExtraBrokerParams(validatedRequest);
|
||||
validatedRequest.extraParameters =
|
||||
validatedRequest.extraParameters || {};
|
||||
validatedRequest.extraParameters.telemetry =
|
||||
NativeConstants.MATS_TELEMETRY;
|
||||
if (request.authenticationScheme === AuthenticationScheme.POP) {
|
||||
// add POP request type
|
||||
const shrParameters = {
|
||||
resourceRequestUri: request.resourceRequestUri,
|
||||
resourceRequestMethod: request.resourceRequestMethod,
|
||||
shrClaims: request.shrClaims,
|
||||
shrNonce: request.shrNonce,
|
||||
};
|
||||
const popTokenGenerator = new PopTokenGenerator(this.browserCrypto);
|
||||
// generate reqCnf if not provided in the request
|
||||
let reqCnfData;
|
||||
if (!validatedRequest.keyId) {
|
||||
const generatedReqCnfData = await invokeAsync(popTokenGenerator.generateCnf.bind(popTokenGenerator), PerformanceEvents.PopTokenGenerateCnf, this.logger, this.performanceClient, request.correlationId)(shrParameters, this.logger);
|
||||
reqCnfData = generatedReqCnfData.reqCnfString;
|
||||
validatedRequest.keyId = generatedReqCnfData.kid;
|
||||
validatedRequest.signPopToken = true;
|
||||
}
|
||||
else {
|
||||
reqCnfData = this.browserCrypto.base64UrlEncode(JSON.stringify({ kid: validatedRequest.keyId }));
|
||||
validatedRequest.signPopToken = false;
|
||||
}
|
||||
// SPAs require whole string to be passed to broker
|
||||
validatedRequest.reqCnf = reqCnfData;
|
||||
}
|
||||
this.addRequestSKUs(validatedRequest);
|
||||
return validatedRequest;
|
||||
}
|
||||
/**
|
||||
* Handles extra broker request parameters
|
||||
* @param request {NativeTokenRequest}
|
||||
* @private
|
||||
*/
|
||||
handleExtraBrokerParams(request) {
|
||||
const hasExtraBrokerParams = request.extraParameters &&
|
||||
request.extraParameters.hasOwnProperty(AADServerParamKeys.BROKER_CLIENT_ID) &&
|
||||
request.extraParameters.hasOwnProperty(AADServerParamKeys.BROKER_REDIRECT_URI) &&
|
||||
request.extraParameters.hasOwnProperty(AADServerParamKeys.CLIENT_ID);
|
||||
if (!request.embeddedClientId && !hasExtraBrokerParams) {
|
||||
return;
|
||||
}
|
||||
let child_client_id = "";
|
||||
const child_redirect_uri = request.redirectUri;
|
||||
if (request.embeddedClientId) {
|
||||
request.redirectUri = this.config.auth.redirectUri;
|
||||
child_client_id = request.embeddedClientId;
|
||||
}
|
||||
else if (request.extraParameters) {
|
||||
request.redirectUri =
|
||||
request.extraParameters[AADServerParamKeys.BROKER_REDIRECT_URI];
|
||||
child_client_id =
|
||||
request.extraParameters[AADServerParamKeys.CLIENT_ID];
|
||||
}
|
||||
request.extraParameters = {
|
||||
child_client_id,
|
||||
child_redirect_uri,
|
||||
};
|
||||
this.performanceClient?.addFields({
|
||||
embeddedClientId: child_client_id,
|
||||
embeddedRedirectUri: child_redirect_uri,
|
||||
}, request.correlationId);
|
||||
}
|
||||
}
|
||||
|
||||
export { NativeInteractionClient };
|
||||
//# sourceMappingURL=NativeInteractionClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/NativeInteractionClient.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
107
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.d.ts
generated
vendored
Normal file
107
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
import { CommonEndSessionRequest, IPerformanceClient, Logger, ICrypto } from "@azure/msal-common/browser";
|
||||
import { StandardInteractionClient } from "./StandardInteractionClient.js";
|
||||
import { EndSessionPopupRequest } from "../request/EndSessionPopupRequest.js";
|
||||
import { PopupRequest } from "../request/PopupRequest.js";
|
||||
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler.js";
|
||||
import { INavigationClient } from "../navigation/INavigationClient.js";
|
||||
import { EventHandler } from "../event/EventHandler.js";
|
||||
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
||||
import { BrowserConfiguration } from "../config/Configuration.js";
|
||||
import { PopupWindowAttributes } from "../request/PopupWindowAttributes.js";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
export type PopupParams = {
|
||||
popup?: Window | null;
|
||||
popupName: string;
|
||||
popupWindowAttributes: PopupWindowAttributes;
|
||||
popupWindowParent: Window;
|
||||
};
|
||||
export declare class PopupClient extends StandardInteractionClient {
|
||||
private currentWindow;
|
||||
protected nativeStorage: BrowserCacheManager;
|
||||
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, nativeStorageImpl: BrowserCacheManager, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
|
||||
/**
|
||||
* Acquires tokens by opening a popup window to the /authorize endpoint of the authority
|
||||
* @param request
|
||||
*/
|
||||
acquireToken(request: PopupRequest): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
|
||||
* @param logoutRequest
|
||||
*/
|
||||
logout(logoutRequest?: EndSessionPopupRequest): Promise<void>;
|
||||
/**
|
||||
* Helper which obtains an access_token for your API via opening a popup window in the user's browser
|
||||
* @param validRequest
|
||||
* @param popupName
|
||||
* @param popup
|
||||
* @param popupWindowAttributes
|
||||
*
|
||||
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
||||
*/
|
||||
protected acquireTokenPopupAsync(request: PopupRequest, popupParams: PopupParams): Promise<AuthenticationResult>;
|
||||
/**
|
||||
*
|
||||
* @param validRequest
|
||||
* @param popupName
|
||||
* @param requestAuthority
|
||||
* @param popup
|
||||
* @param mainWindowRedirectUri
|
||||
* @param popupWindowAttributes
|
||||
*/
|
||||
protected logoutPopupAsync(validRequest: CommonEndSessionRequest, popupParams: PopupParams, requestAuthority?: string, mainWindowRedirectUri?: string): Promise<void>;
|
||||
/**
|
||||
* Opens a popup window with given request Url.
|
||||
* @param requestUrl
|
||||
*/
|
||||
initiateAuthRequest(requestUrl: string, params: PopupParams): Window;
|
||||
/**
|
||||
* Monitors a window until it loads a url with the same origin.
|
||||
* @param popupWindow - window that is being monitored
|
||||
* @param timeout - timeout for processing hash once popup is redirected back to application
|
||||
*/
|
||||
monitorPopupForHash(popupWindow: Window, popupWindowParent: Window): Promise<string>;
|
||||
/**
|
||||
* @hidden
|
||||
*
|
||||
* Configures popup window for login.
|
||||
*
|
||||
* @param urlNavigate
|
||||
* @param title
|
||||
* @param popUpWidth
|
||||
* @param popUpHeight
|
||||
* @param popupWindowAttributes
|
||||
* @ignore
|
||||
* @hidden
|
||||
*/
|
||||
openPopup(urlNavigate: string, popupParams: PopupParams): Window;
|
||||
/**
|
||||
* Helper function to set popup window dimensions and position
|
||||
* @param urlNavigate
|
||||
* @param popupName
|
||||
* @param popupWindowAttributes
|
||||
* @returns
|
||||
*/
|
||||
openSizedPopup(urlNavigate: string, { popupName, popupWindowAttributes, popupWindowParent }: PopupParams): Window | null;
|
||||
/**
|
||||
* Event callback to unload main window.
|
||||
*/
|
||||
unloadWindow(e: Event): void;
|
||||
/**
|
||||
* Closes popup, removes any state vars created during popup calls.
|
||||
* @param popupWindow
|
||||
*/
|
||||
cleanPopup(popupWindow: Window, popupWindowParent: Window): void;
|
||||
/**
|
||||
* Generates the name for the popup based on the client id and request
|
||||
* @param clientId
|
||||
* @param request
|
||||
*/
|
||||
generatePopupName(scopes: Array<string>, authority: string): string;
|
||||
/**
|
||||
* Generates the name for the popup based on the client id and request for logouts
|
||||
* @param clientId
|
||||
* @param request
|
||||
*/
|
||||
generateLogoutPopupName(request: CommonEndSessionRequest): string;
|
||||
}
|
||||
//# sourceMappingURL=PopupClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"PopupClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/PopupClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAIH,uBAAuB,EAMvB,kBAAkB,EAClB,MAAM,EACN,OAAO,EAKV,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAO3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAG9E,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAKtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAElE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qCAAqC,CAAC;AAE5E,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,MAAM,MAAM,WAAW,GAAG;IACtB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,iBAAiB,E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WAAW,EAAE,MAAM,EACnB,EAAE,SAAS,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,EAAE,WAAW,GACrE,MAAM,GAAG,IAAI;IAsEhB;;OAEG;IACH,YAAY,CAAC,CAAC,EAAE,KAAK,GAAG,IAAI;IAW5B;;;OAGG;IACH,UAAU,CAAC,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,GAAG,IAAI;IAchE;;;;OAIG;IACH,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAMnE;;;;OAIG;IACH,uBAAuB,CAAC,OAAO,EAAE,uBAAuB,GAAG,MAAM;CAIpE"}
|
||||
454
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.mjs
generated
vendored
Normal file
454
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,454 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { OIDC_DEFAULT_SCOPES, invokeAsync, PerformanceEvents, invoke, ThrottlingUtils, ProtocolUtils, AuthError, ProtocolMode, UrlString, ServerResponseType } from '@azure/msal-common/browser';
|
||||
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
||||
import { EventType } from '../event/EventType.mjs';
|
||||
import { ApiId, InteractionType, BrowserConstants } from '../utils/BrowserConstants.mjs';
|
||||
import { preconnect, getCurrentUri } from '../utils/BrowserUtils.mjs';
|
||||
import { NativeInteractionClient } from './NativeInteractionClient.mjs';
|
||||
import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.mjs';
|
||||
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
||||
import { InteractionHandler } from '../interaction_handler/InteractionHandler.mjs';
|
||||
import { deserializeResponse } from '../response/ResponseHandler.mjs';
|
||||
import { nativeConnectionNotEstablished, emptyNavigateUri, userCancelled, emptyWindowError, popupWindowError } from '../error/BrowserAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class PopupClient extends StandardInteractionClient {
|
||||
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
|
||||
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
|
||||
// Properly sets this reference for the unload event.
|
||||
this.unloadWindow = this.unloadWindow.bind(this);
|
||||
this.nativeStorage = nativeStorageImpl;
|
||||
}
|
||||
/**
|
||||
* Acquires tokens by opening a popup window to the /authorize endpoint of the authority
|
||||
* @param request
|
||||
*/
|
||||
acquireToken(request) {
|
||||
try {
|
||||
const popupName = this.generatePopupName(request.scopes || OIDC_DEFAULT_SCOPES, request.authority || this.config.auth.authority);
|
||||
const popupParams = {
|
||||
popupName,
|
||||
popupWindowAttributes: request.popupWindowAttributes || {},
|
||||
popupWindowParent: request.popupWindowParent ?? window,
|
||||
};
|
||||
this.performanceClient.addFields({ isAsyncPopup: this.config.system.asyncPopups }, this.correlationId);
|
||||
// asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
||||
if (this.config.system.asyncPopups) {
|
||||
this.logger.verbose("asyncPopups set to true, acquiring token");
|
||||
// Passes on popup position and dimensions if in request
|
||||
return this.acquireTokenPopupAsync(request, popupParams);
|
||||
}
|
||||
else {
|
||||
// asyncPopups flag is set to false. Opens popup before acquiring token.
|
||||
this.logger.verbose("asyncPopup set to false, opening popup before acquiring token");
|
||||
popupParams.popup = this.openSizedPopup("about:blank", popupParams);
|
||||
return this.acquireTokenPopupAsync(request, popupParams);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
return Promise.reject(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server
|
||||
* @param logoutRequest
|
||||
*/
|
||||
logout(logoutRequest) {
|
||||
try {
|
||||
this.logger.verbose("logoutPopup called");
|
||||
const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
||||
const popupParams = {
|
||||
popupName: this.generateLogoutPopupName(validLogoutRequest),
|
||||
popupWindowAttributes: logoutRequest?.popupWindowAttributes || {},
|
||||
popupWindowParent: logoutRequest?.popupWindowParent ?? window,
|
||||
};
|
||||
const authority = logoutRequest && logoutRequest.authority;
|
||||
const mainWindowRedirectUri = logoutRequest && logoutRequest.mainWindowRedirectUri;
|
||||
// asyncPopups flag is true. Acquires token without first opening popup. Popup will be opened later asynchronously.
|
||||
if (this.config.system.asyncPopups) {
|
||||
this.logger.verbose("asyncPopups set to true");
|
||||
// Passes on popup position and dimensions if in request
|
||||
return this.logoutPopupAsync(validLogoutRequest, popupParams, authority, mainWindowRedirectUri);
|
||||
}
|
||||
else {
|
||||
// asyncPopups flag is set to false. Opens popup before logging out.
|
||||
this.logger.verbose("asyncPopup set to false, opening popup");
|
||||
popupParams.popup = this.openSizedPopup("about:blank", popupParams);
|
||||
return this.logoutPopupAsync(validLogoutRequest, popupParams, authority, mainWindowRedirectUri);
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// Since this function is synchronous we need to reject
|
||||
return Promise.reject(e);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Helper which obtains an access_token for your API via opening a popup window in the user's browser
|
||||
* @param validRequest
|
||||
* @param popupName
|
||||
* @param popup
|
||||
* @param popupWindowAttributes
|
||||
*
|
||||
* @returns A promise that is fulfilled when this function has completed, or rejected if an error was raised.
|
||||
*/
|
||||
async acquireTokenPopupAsync(request, popupParams) {
|
||||
this.logger.verbose("acquireTokenPopupAsync called");
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenPopup);
|
||||
const validRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, this.correlationId)(request, InteractionType.Popup);
|
||||
preconnect(validRequest.authority);
|
||||
try {
|
||||
// Create auth code request and generate PKCE params
|
||||
const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, this.correlationId)(validRequest);
|
||||
// Initialize the client
|
||||
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
|
||||
serverTelemetryManager,
|
||||
requestAuthority: validRequest.authority,
|
||||
requestAzureCloudOptions: validRequest.azureCloudOptions,
|
||||
requestExtraQueryParameters: validRequest.extraQueryParameters,
|
||||
account: validRequest.account,
|
||||
});
|
||||
const isPlatformBroker = NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme);
|
||||
// Start measurement for server calls with native brokering enabled
|
||||
let fetchNativeAccountIdMeasurement;
|
||||
if (isPlatformBroker) {
|
||||
fetchNativeAccountIdMeasurement =
|
||||
this.performanceClient.startMeasurement(PerformanceEvents.FetchAccountIdWithNativeBroker, request.correlationId);
|
||||
}
|
||||
// Create acquire token url.
|
||||
const navigateUrl = await authClient.getAuthCodeUrl({
|
||||
...validRequest,
|
||||
platformBroker: isPlatformBroker,
|
||||
});
|
||||
// Create popup interaction handler.
|
||||
const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
||||
// Show the UI once the url has been created. Get the window handle for the popup.
|
||||
const popupWindow = this.initiateAuthRequest(navigateUrl, popupParams);
|
||||
this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow }, null);
|
||||
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
||||
const responseString = await this.monitorPopupForHash(popupWindow, popupParams.popupWindowParent);
|
||||
const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, this.config.auth.OIDCOptions.serverResponseType, this.logger);
|
||||
// Remove throttle if it exists
|
||||
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, authCodeRequest);
|
||||
if (serverParams.accountId) {
|
||||
this.logger.verbose("Account id found in hash, calling WAM for token");
|
||||
// end measurement for server call with native brokering enabled
|
||||
if (fetchNativeAccountIdMeasurement) {
|
||||
fetchNativeAccountIdMeasurement.end({
|
||||
success: true,
|
||||
isNativeBroker: true,
|
||||
});
|
||||
}
|
||||
if (!this.nativeMessageHandler) {
|
||||
throw createBrowserAuthError(nativeConnectionNotEstablished);
|
||||
}
|
||||
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, validRequest.correlationId);
|
||||
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, validRequest.state);
|
||||
return await nativeInteractionClient.acquireToken({
|
||||
...validRequest,
|
||||
state: userRequestState,
|
||||
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
||||
});
|
||||
}
|
||||
// Handle response from hash string.
|
||||
const result = await interactionHandler.handleCodeResponse(serverParams, validRequest);
|
||||
return result;
|
||||
}
|
||||
catch (e) {
|
||||
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
||||
popupParams.popup?.close();
|
||||
if (e instanceof AuthError) {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param validRequest
|
||||
* @param popupName
|
||||
* @param requestAuthority
|
||||
* @param popup
|
||||
* @param mainWindowRedirectUri
|
||||
* @param popupWindowAttributes
|
||||
*/
|
||||
async logoutPopupAsync(validRequest, popupParams, requestAuthority, mainWindowRedirectUri) {
|
||||
this.logger.verbose("logoutPopupAsync called");
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Popup, validRequest);
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logoutPopup);
|
||||
try {
|
||||
// Clear cache on logout
|
||||
await this.clearCacheOnLogout(validRequest.account);
|
||||
// Initialize the client
|
||||
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
|
||||
serverTelemetryManager,
|
||||
requestAuthority: requestAuthority,
|
||||
account: validRequest.account || undefined,
|
||||
});
|
||||
try {
|
||||
authClient.authority.endSessionEndpoint;
|
||||
}
|
||||
catch {
|
||||
if (validRequest.account?.homeAccountId &&
|
||||
validRequest.postLogoutRedirectUri &&
|
||||
authClient.authority.protocolMode === ProtocolMode.OIDC) {
|
||||
void this.browserStorage.removeAccount(validRequest.account?.homeAccountId);
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);
|
||||
if (mainWindowRedirectUri) {
|
||||
const navigationOptions = {
|
||||
apiId: ApiId.logoutPopup,
|
||||
timeout: this.config.system.redirectNavigationTimeout,
|
||||
noHistory: false,
|
||||
};
|
||||
const absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, getCurrentUri());
|
||||
await this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
|
||||
}
|
||||
popupParams.popup?.close();
|
||||
return;
|
||||
}
|
||||
}
|
||||
// Create logout string and navigate user window to logout.
|
||||
const logoutUri = authClient.getLogoutUri(validRequest);
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Popup, validRequest);
|
||||
// Open the popup window to requestUrl.
|
||||
const popupWindow = this.openPopup(logoutUri, popupParams);
|
||||
this.eventHandler.emitEvent(EventType.POPUP_OPENED, InteractionType.Popup, { popupWindow }, null);
|
||||
await this.monitorPopupForHash(popupWindow, popupParams.popupWindowParent).catch(() => {
|
||||
// Swallow any errors related to monitoring the window. Server logout is best effort
|
||||
});
|
||||
if (mainWindowRedirectUri) {
|
||||
const navigationOptions = {
|
||||
apiId: ApiId.logoutPopup,
|
||||
timeout: this.config.system.redirectNavigationTimeout,
|
||||
noHistory: false,
|
||||
};
|
||||
const absoluteUrl = UrlString.getAbsoluteUrl(mainWindowRedirectUri, getCurrentUri());
|
||||
this.logger.verbose("Redirecting main window to url specified in the request");
|
||||
this.logger.verbosePii(`Redirecting main window to: ${absoluteUrl}`);
|
||||
await this.navigationClient.navigateInternal(absoluteUrl, navigationOptions);
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("No main window navigation requested");
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
// Close the synchronous popup if an error is thrown before the window unload event is registered
|
||||
popupParams.popup?.close();
|
||||
if (e instanceof AuthError) {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
}
|
||||
this.browserStorage.setInteractionInProgress(false);
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Popup, null, e);
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
|
||||
throw e;
|
||||
}
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Popup);
|
||||
}
|
||||
/**
|
||||
* Opens a popup window with given request Url.
|
||||
* @param requestUrl
|
||||
*/
|
||||
initiateAuthRequest(requestUrl, params) {
|
||||
// Check that request url is not empty.
|
||||
if (requestUrl) {
|
||||
this.logger.infoPii(`Navigate to: ${requestUrl}`);
|
||||
// Open the popup window to requestUrl.
|
||||
return this.openPopup(requestUrl, params);
|
||||
}
|
||||
else {
|
||||
// Throw error if request URL is empty.
|
||||
this.logger.error("Navigate url is empty");
|
||||
throw createBrowserAuthError(emptyNavigateUri);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Monitors a window until it loads a url with the same origin.
|
||||
* @param popupWindow - window that is being monitored
|
||||
* @param timeout - timeout for processing hash once popup is redirected back to application
|
||||
*/
|
||||
monitorPopupForHash(popupWindow, popupWindowParent) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.logger.verbose("PopupHandler.monitorPopupForHash - polling started");
|
||||
const intervalId = setInterval(() => {
|
||||
// Window is closed
|
||||
if (popupWindow.closed) {
|
||||
this.logger.error("PopupHandler.monitorPopupForHash - window closed");
|
||||
clearInterval(intervalId);
|
||||
reject(createBrowserAuthError(userCancelled));
|
||||
return;
|
||||
}
|
||||
let href = "";
|
||||
try {
|
||||
/*
|
||||
* Will throw if cross origin,
|
||||
* which should be caught and ignored
|
||||
* since we need the interval to keep running while on STS UI.
|
||||
*/
|
||||
href = popupWindow.location.href;
|
||||
}
|
||||
catch (e) { }
|
||||
// Don't process blank pages or cross domain
|
||||
if (!href || href === "about:blank") {
|
||||
return;
|
||||
}
|
||||
clearInterval(intervalId);
|
||||
let responseString = "";
|
||||
const responseType = this.config.auth.OIDCOptions.serverResponseType;
|
||||
if (popupWindow) {
|
||||
if (responseType === ServerResponseType.QUERY) {
|
||||
responseString = popupWindow.location.search;
|
||||
}
|
||||
else {
|
||||
responseString = popupWindow.location.hash;
|
||||
}
|
||||
}
|
||||
this.logger.verbose("PopupHandler.monitorPopupForHash - popup window is on same origin as caller");
|
||||
resolve(responseString);
|
||||
}, this.config.system.pollIntervalMilliseconds);
|
||||
}).finally(() => {
|
||||
this.cleanPopup(popupWindow, popupWindowParent);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @hidden
|
||||
*
|
||||
* Configures popup window for login.
|
||||
*
|
||||
* @param urlNavigate
|
||||
* @param title
|
||||
* @param popUpWidth
|
||||
* @param popUpHeight
|
||||
* @param popupWindowAttributes
|
||||
* @ignore
|
||||
* @hidden
|
||||
*/
|
||||
openPopup(urlNavigate, popupParams) {
|
||||
try {
|
||||
let popupWindow;
|
||||
// Popup window passed in, setting url to navigate to
|
||||
if (popupParams.popup) {
|
||||
popupWindow = popupParams.popup;
|
||||
this.logger.verbosePii(`Navigating popup window to: ${urlNavigate}`);
|
||||
popupWindow.location.assign(urlNavigate);
|
||||
}
|
||||
else if (typeof popupParams.popup === "undefined") {
|
||||
// Popup will be undefined if it was not passed in
|
||||
this.logger.verbosePii(`Opening popup window to: ${urlNavigate}`);
|
||||
popupWindow = this.openSizedPopup(urlNavigate, popupParams);
|
||||
}
|
||||
// Popup will be null if popups are blocked
|
||||
if (!popupWindow) {
|
||||
throw createBrowserAuthError(emptyWindowError);
|
||||
}
|
||||
if (popupWindow.focus) {
|
||||
popupWindow.focus();
|
||||
}
|
||||
this.currentWindow = popupWindow;
|
||||
popupParams.popupWindowParent.addEventListener("beforeunload", this.unloadWindow);
|
||||
return popupWindow;
|
||||
}
|
||||
catch (e) {
|
||||
this.logger.error("error opening popup " + e.message);
|
||||
this.browserStorage.setInteractionInProgress(false);
|
||||
throw createBrowserAuthError(popupWindowError);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Helper function to set popup window dimensions and position
|
||||
* @param urlNavigate
|
||||
* @param popupName
|
||||
* @param popupWindowAttributes
|
||||
* @returns
|
||||
*/
|
||||
openSizedPopup(urlNavigate, { popupName, popupWindowAttributes, popupWindowParent }) {
|
||||
/**
|
||||
* adding winLeft and winTop to account for dual monitor
|
||||
* using screenLeft and screenTop for IE8 and earlier
|
||||
*/
|
||||
const winLeft = popupWindowParent.screenLeft
|
||||
? popupWindowParent.screenLeft
|
||||
: popupWindowParent.screenX;
|
||||
const winTop = popupWindowParent.screenTop
|
||||
? popupWindowParent.screenTop
|
||||
: popupWindowParent.screenY;
|
||||
/**
|
||||
* window.innerWidth displays browser window"s height and width excluding toolbars
|
||||
* using document.documentElement.clientWidth for IE8 and earlier
|
||||
*/
|
||||
const winWidth = popupWindowParent.innerWidth ||
|
||||
document.documentElement.clientWidth ||
|
||||
document.body.clientWidth;
|
||||
const winHeight = popupWindowParent.innerHeight ||
|
||||
document.documentElement.clientHeight ||
|
||||
document.body.clientHeight;
|
||||
let width = popupWindowAttributes.popupSize?.width;
|
||||
let height = popupWindowAttributes.popupSize?.height;
|
||||
let top = popupWindowAttributes.popupPosition?.top;
|
||||
let left = popupWindowAttributes.popupPosition?.left;
|
||||
if (!width || width < 0 || width > winWidth) {
|
||||
this.logger.verbose("Default popup window width used. Window width not configured or invalid.");
|
||||
width = BrowserConstants.POPUP_WIDTH;
|
||||
}
|
||||
if (!height || height < 0 || height > winHeight) {
|
||||
this.logger.verbose("Default popup window height used. Window height not configured or invalid.");
|
||||
height = BrowserConstants.POPUP_HEIGHT;
|
||||
}
|
||||
if (!top || top < 0 || top > winHeight) {
|
||||
this.logger.verbose("Default popup window top position used. Window top not configured or invalid.");
|
||||
top = Math.max(0, winHeight / 2 - BrowserConstants.POPUP_HEIGHT / 2 + winTop);
|
||||
}
|
||||
if (!left || left < 0 || left > winWidth) {
|
||||
this.logger.verbose("Default popup window left position used. Window left not configured or invalid.");
|
||||
left = Math.max(0, winWidth / 2 - BrowserConstants.POPUP_WIDTH / 2 + winLeft);
|
||||
}
|
||||
return popupWindowParent.open(urlNavigate, popupName, `width=${width}, height=${height}, top=${top}, left=${left}, scrollbars=yes`);
|
||||
}
|
||||
/**
|
||||
* Event callback to unload main window.
|
||||
*/
|
||||
unloadWindow(e) {
|
||||
this.browserStorage.cleanRequestByInteractionType(InteractionType.Popup);
|
||||
if (this.currentWindow) {
|
||||
this.currentWindow.close();
|
||||
}
|
||||
// Guarantees browser unload will happen, so no other errors will be thrown.
|
||||
e.preventDefault();
|
||||
}
|
||||
/**
|
||||
* Closes popup, removes any state vars created during popup calls.
|
||||
* @param popupWindow
|
||||
*/
|
||||
cleanPopup(popupWindow, popupWindowParent) {
|
||||
// Close window.
|
||||
popupWindow.close();
|
||||
// Remove window unload function
|
||||
popupWindowParent.removeEventListener("beforeunload", this.unloadWindow);
|
||||
// Interaction is completed - remove interaction status.
|
||||
this.browserStorage.setInteractionInProgress(false);
|
||||
}
|
||||
/**
|
||||
* Generates the name for the popup based on the client id and request
|
||||
* @param clientId
|
||||
* @param request
|
||||
*/
|
||||
generatePopupName(scopes, authority) {
|
||||
return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${scopes.join("-")}.${authority}.${this.correlationId}`;
|
||||
}
|
||||
/**
|
||||
* Generates the name for the popup based on the client id and request for logouts
|
||||
* @param clientId
|
||||
* @param request
|
||||
*/
|
||||
generateLogoutPopupName(request) {
|
||||
const homeAccountId = request.account && request.account.homeAccountId;
|
||||
return `${BrowserConstants.POPUP_NAME_PREFIX}.${this.config.auth.clientId}.${homeAccountId}.${this.correlationId}`;
|
||||
}
|
||||
}
|
||||
|
||||
export { PopupClient };
|
||||
//# sourceMappingURL=PopupClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/PopupClient.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
51
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.d.ts
generated
vendored
Normal file
51
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
import { ServerTelemetryManager, ServerAuthorizationCodeResponse, ICrypto, Logger, IPerformanceClient, InProgressPerformanceEvent } from "@azure/msal-common/browser";
|
||||
import { StandardInteractionClient } from "./StandardInteractionClient.js";
|
||||
import { EndSessionRequest } from "../request/EndSessionRequest.js";
|
||||
import { RedirectRequest } from "../request/RedirectRequest.js";
|
||||
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler.js";
|
||||
import { BrowserConfiguration } from "../config/Configuration.js";
|
||||
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
||||
import { EventHandler } from "../event/EventHandler.js";
|
||||
import { INavigationClient } from "../navigation/INavigationClient.js";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
export declare class RedirectClient extends StandardInteractionClient {
|
||||
protected nativeStorage: BrowserCacheManager;
|
||||
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, performanceClient: IPerformanceClient, nativeStorageImpl: BrowserCacheManager, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
|
||||
/**
|
||||
* Redirects the page to the /authorize endpoint of the IDP
|
||||
* @param request
|
||||
*/
|
||||
acquireToken(request: RedirectRequest): Promise<void>;
|
||||
/**
|
||||
* Checks if navigateToLoginRequestUrl is set, and:
|
||||
* - if true, performs logic to cache and navigate
|
||||
* - if false, handles hash string and parses response
|
||||
* @param hash {string} url hash
|
||||
* @param parentMeasurement {InProgressPerformanceEvent} parent measurement
|
||||
*/
|
||||
handleRedirectPromise(hash: string | undefined, parentMeasurement: InProgressPerformanceEvent): Promise<AuthenticationResult | null>;
|
||||
/**
|
||||
* Gets the response hash for a redirect request
|
||||
* Returns null if interactionType in the state value is not "redirect" or the hash does not contain known properties
|
||||
* @param hash
|
||||
*/
|
||||
protected getRedirectResponse(userProvidedResponse: string): [ServerAuthorizationCodeResponse | null, string];
|
||||
/**
|
||||
* Checks if hash exists and handles in window.
|
||||
* @param hash
|
||||
* @param state
|
||||
*/
|
||||
protected handleResponse(serverParams: ServerAuthorizationCodeResponse, serverTelemetryManager: ServerTelemetryManager): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
logout(logoutRequest?: EndSessionRequest): Promise<void>;
|
||||
/**
|
||||
* Use to get the redirectStartPage either from request or use current window
|
||||
* @param requestStartPage
|
||||
*/
|
||||
protected getRedirectStartPage(requestStartPage?: string): string;
|
||||
}
|
||||
//# sourceMappingURL=RedirectClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"RedirectClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/RedirectClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAKH,sBAAsB,EAGtB,+BAA+B,EAE/B,OAAO,EACP,MAAM,EACN,kBAAkB,EAMlB,0BAA0B,EAC7B,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAQ3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAOpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAEhE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAEvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAmB3E,qBAAa,cAAe,SAAQ,yBAAyB;IACzD,SAAS,CAAC,aAAa,EAAE,mBAAmB,CAAC;gBAGzC,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,mBAAmB,EAChC,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,iBAAiB,EACnC,iBAAiB,EAAE,kBAAkB,EACrC,iBAAiB,EAAE,mBAAmB,EACtC,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,aAAa,CAAC,EAAE,MAAM;IAgB1B;;;OAGG;IACG,YAAY,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC;IA4G3D;;;;;;OAMG;IACG,qBAAqB,CACvB,IAAI,oBAAa,EACjB,iBAAiB,EAAE,0BAA0B,GAC9C,OAAO,CAAC,oBAAoB,GAAG,IAAI,CAAC;IAsJvC;;;;OAIG;IACH,SAAS,CAAC,mBAAmB,CACzB,oBAAoB,EAAE,MAAM,GAC7B,CAAC,+BAA+B,GAAG,IAAI,EAAE,MAAM,CAAC;IA4DnD;;;;OAIG;cACa,cAAc,CAC1B,YAAY,EAAE,+BAA+B,EAC7C,sBAAsB,EAAE,sBAAsB,GAC/C,OAAO,CAAC,oBAAoB,CAAC;IA8EhC;;;;OAIG;IACG,MAAM,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAgI9D;;;OAGG;IACH,SAAS,CAAC,oBAAoB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM;CAOpE"}
|
||||
360
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.mjs
generated
vendored
Normal file
360
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,360 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { invokeAsync, PerformanceEvents, AuthError, Constants, UrlString, UrlUtils, ProtocolUtils, ThrottlingUtils, ProtocolMode, ServerResponseType } from '@azure/msal-common/browser';
|
||||
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
||||
import { InteractionType, ApiId, TemporaryCacheKeys } from '../utils/BrowserConstants.mjs';
|
||||
import { RedirectHandler } from '../interaction_handler/RedirectHandler.mjs';
|
||||
import { replaceHash, isInIframe, getHomepage, clearHash, getCurrentUri } from '../utils/BrowserUtils.mjs';
|
||||
import { EventType } from '../event/EventType.mjs';
|
||||
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
||||
import { NativeInteractionClient } from './NativeInteractionClient.mjs';
|
||||
import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.mjs';
|
||||
import { validateInteractionType } from '../response/ResponseHandler.mjs';
|
||||
import { noStateInHash, nativeConnectionNotEstablished, noCachedAuthorityError } from '../error/BrowserAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
function getNavigationType() {
|
||||
if (typeof window === "undefined" ||
|
||||
typeof window.performance === "undefined" ||
|
||||
typeof window.performance.getEntriesByType !== "function") {
|
||||
return undefined;
|
||||
}
|
||||
const navigationEntries = window.performance.getEntriesByType("navigation");
|
||||
const navigation = navigationEntries.length
|
||||
? navigationEntries[0]
|
||||
: undefined;
|
||||
return navigation?.type;
|
||||
}
|
||||
class RedirectClient extends StandardInteractionClient {
|
||||
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
|
||||
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
|
||||
this.nativeStorage = nativeStorageImpl;
|
||||
}
|
||||
/**
|
||||
* Redirects the page to the /authorize endpoint of the IDP
|
||||
* @param request
|
||||
*/
|
||||
async acquireToken(request) {
|
||||
const validRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, this.correlationId)(request, InteractionType.Redirect);
|
||||
this.browserStorage.updateCacheEntries(validRequest.state, validRequest.nonce, validRequest.authority, validRequest.loginHint || "", validRequest.account || null);
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenRedirect);
|
||||
const handleBackButton = (event) => {
|
||||
// Clear temporary cache if the back button is clicked during the redirect flow.
|
||||
if (event.persisted) {
|
||||
this.logger.verbose("Page was restored from back/forward cache. Clearing temporary cache.");
|
||||
this.browserStorage.cleanRequestByState(validRequest.state);
|
||||
this.eventHandler.emitEvent(EventType.RESTORE_FROM_BFCACHE, InteractionType.Redirect);
|
||||
}
|
||||
};
|
||||
try {
|
||||
// Create auth code request and generate PKCE params
|
||||
const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, this.correlationId)(validRequest);
|
||||
// Initialize the client
|
||||
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
|
||||
serverTelemetryManager,
|
||||
requestAuthority: validRequest.authority,
|
||||
requestAzureCloudOptions: validRequest.azureCloudOptions,
|
||||
requestExtraQueryParameters: validRequest.extraQueryParameters,
|
||||
account: validRequest.account,
|
||||
});
|
||||
// Create redirect interaction handler.
|
||||
const interactionHandler = new RedirectHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
||||
// Create acquire token url.
|
||||
const navigateUrl = await authClient.getAuthCodeUrl({
|
||||
...validRequest,
|
||||
platformBroker: NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeMessageHandler, request.authenticationScheme),
|
||||
});
|
||||
const redirectStartPage = this.getRedirectStartPage(request.redirectStartPage);
|
||||
this.logger.verbosePii(`Redirect start page: ${redirectStartPage}`);
|
||||
// Clear temporary cache if the back button is clicked during the redirect flow.
|
||||
window.addEventListener("pageshow", handleBackButton);
|
||||
// Show the UI once the url has been created. Response will come back in the hash, which will be handled in the handleRedirectCallback function.
|
||||
return await interactionHandler.initiateAuthRequest(navigateUrl, {
|
||||
navigationClient: this.navigationClient,
|
||||
redirectTimeout: this.config.system.redirectNavigationTimeout,
|
||||
redirectStartPage: redirectStartPage,
|
||||
onRedirectNavigate: request.onRedirectNavigate ||
|
||||
this.config.auth.onRedirectNavigate,
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof AuthError) {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
}
|
||||
window.removeEventListener("pageshow", handleBackButton);
|
||||
this.browserStorage.cleanRequestByState(validRequest.state);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Checks if navigateToLoginRequestUrl is set, and:
|
||||
* - if true, performs logic to cache and navigate
|
||||
* - if false, handles hash string and parses response
|
||||
* @param hash {string} url hash
|
||||
* @param parentMeasurement {InProgressPerformanceEvent} parent measurement
|
||||
*/
|
||||
async handleRedirectPromise(hash = "", parentMeasurement) {
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.handleRedirectPromise);
|
||||
try {
|
||||
if (!this.browserStorage.isInteractionInProgress(true)) {
|
||||
this.logger.info("handleRedirectPromise called but there is no interaction in progress, returning null.");
|
||||
return null;
|
||||
}
|
||||
const [serverParams, responseString] = this.getRedirectResponse(hash || "");
|
||||
if (!serverParams) {
|
||||
// Not a recognized server response hash or hash not associated with a redirect request
|
||||
this.logger.info("handleRedirectPromise did not detect a response as a result of a redirect. Cleaning temporary cache.");
|
||||
this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);
|
||||
// Do not instrument "no_server_response" if user clicked back button
|
||||
if (getNavigationType() !== "back_forward") {
|
||||
parentMeasurement.event.errorCode = "no_server_response";
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("Back navigation event detected. Muting no_server_response error");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// If navigateToLoginRequestUrl is true, get the url where the redirect request was initiated
|
||||
const loginRequestUrl = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, true) || Constants.EMPTY_STRING;
|
||||
const loginRequestUrlNormalized = UrlString.removeHashFromUrl(loginRequestUrl);
|
||||
const currentUrlNormalized = UrlString.removeHashFromUrl(window.location.href);
|
||||
if (loginRequestUrlNormalized === currentUrlNormalized &&
|
||||
this.config.auth.navigateToLoginRequestUrl) {
|
||||
// We are on the page we need to navigate to - handle hash
|
||||
this.logger.verbose("Current page is loginRequestUrl, handling response");
|
||||
if (loginRequestUrl.indexOf("#") > -1) {
|
||||
// Replace current hash with non-msal hash, if present
|
||||
replaceHash(loginRequestUrl);
|
||||
}
|
||||
const handleHashResult = await this.handleResponse(serverParams, serverTelemetryManager);
|
||||
return handleHashResult;
|
||||
}
|
||||
else if (!this.config.auth.navigateToLoginRequestUrl) {
|
||||
this.logger.verbose("NavigateToLoginRequestUrl set to false, handling response");
|
||||
return await this.handleResponse(serverParams, serverTelemetryManager);
|
||||
}
|
||||
else if (!isInIframe() ||
|
||||
this.config.system.allowRedirectInIframe) {
|
||||
/*
|
||||
* Returned from authority using redirect - need to perform navigation before processing response
|
||||
* Cache the hash to be retrieved after the next redirect
|
||||
*/
|
||||
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.URL_HASH, responseString, true);
|
||||
const navigationOptions = {
|
||||
apiId: ApiId.handleRedirectPromise,
|
||||
timeout: this.config.system.redirectNavigationTimeout,
|
||||
noHistory: true,
|
||||
};
|
||||
/**
|
||||
* Default behavior is to redirect to the start page and not process the hash now.
|
||||
* The start page is expected to also call handleRedirectPromise which will process the hash in one of the checks above.
|
||||
*/
|
||||
let processHashOnRedirect = true;
|
||||
if (!loginRequestUrl || loginRequestUrl === "null") {
|
||||
// Redirect to home page if login request url is null (real null or the string null)
|
||||
const homepage = getHomepage();
|
||||
// Cache the homepage under ORIGIN_URI to ensure cached hash is processed on homepage
|
||||
this.browserStorage.setTemporaryCache(TemporaryCacheKeys.ORIGIN_URI, homepage, true);
|
||||
this.logger.warning("Unable to get valid login request url from cache, redirecting to home page");
|
||||
processHashOnRedirect =
|
||||
await this.navigationClient.navigateInternal(homepage, navigationOptions);
|
||||
}
|
||||
else {
|
||||
// Navigate to page that initiated the redirect request
|
||||
this.logger.verbose(`Navigating to loginRequestUrl: ${loginRequestUrl}`);
|
||||
processHashOnRedirect =
|
||||
await this.navigationClient.navigateInternal(loginRequestUrl, navigationOptions);
|
||||
}
|
||||
// If navigateInternal implementation returns false, handle the hash now
|
||||
if (!processHashOnRedirect) {
|
||||
return await this.handleResponse(serverParams, serverTelemetryManager);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof AuthError) {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
}
|
||||
this.browserStorage.cleanRequestByInteractionType(InteractionType.Redirect);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Gets the response hash for a redirect request
|
||||
* Returns null if interactionType in the state value is not "redirect" or the hash does not contain known properties
|
||||
* @param hash
|
||||
*/
|
||||
getRedirectResponse(userProvidedResponse) {
|
||||
this.logger.verbose("getRedirectResponseHash called");
|
||||
// Get current location hash from window or cache.
|
||||
let responseString = userProvidedResponse;
|
||||
if (!responseString) {
|
||||
if (this.config.auth.OIDCOptions.serverResponseType ===
|
||||
ServerResponseType.QUERY) {
|
||||
responseString = window.location.search;
|
||||
}
|
||||
else {
|
||||
responseString = window.location.hash;
|
||||
}
|
||||
}
|
||||
let response = UrlUtils.getDeserializedResponse(responseString);
|
||||
if (response) {
|
||||
try {
|
||||
validateInteractionType(response, this.browserCrypto, InteractionType.Redirect);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof AuthError) {
|
||||
this.logger.error(`Interaction type validation failed due to ${e.errorCode}: ${e.errorMessage}`);
|
||||
}
|
||||
return [null, ""];
|
||||
}
|
||||
clearHash(window);
|
||||
this.logger.verbose("Hash contains known properties, returning response hash");
|
||||
return [response, responseString];
|
||||
}
|
||||
const cachedHash = this.browserStorage.getTemporaryCache(TemporaryCacheKeys.URL_HASH, true);
|
||||
this.browserStorage.removeItem(this.browserStorage.generateCacheKey(TemporaryCacheKeys.URL_HASH));
|
||||
if (cachedHash) {
|
||||
response = UrlUtils.getDeserializedResponse(cachedHash);
|
||||
if (response) {
|
||||
this.logger.verbose("Hash does not contain known properties, returning cached hash");
|
||||
return [response, cachedHash];
|
||||
}
|
||||
}
|
||||
return [null, ""];
|
||||
}
|
||||
/**
|
||||
* Checks if hash exists and handles in window.
|
||||
* @param hash
|
||||
* @param state
|
||||
*/
|
||||
async handleResponse(serverParams, serverTelemetryManager) {
|
||||
const state = serverParams.state;
|
||||
if (!state) {
|
||||
throw createBrowserAuthError(noStateInHash);
|
||||
}
|
||||
const cachedRequest = this.browserStorage.getCachedRequest(state);
|
||||
this.logger.verbose("handleResponse called, retrieved cached request");
|
||||
if (serverParams.accountId) {
|
||||
this.logger.verbose("Account id found in hash, calling WAM for token");
|
||||
if (!this.nativeMessageHandler) {
|
||||
throw createBrowserAuthError(nativeConnectionNotEstablished);
|
||||
}
|
||||
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, ApiId.acquireTokenPopup, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.nativeStorage, cachedRequest.correlationId);
|
||||
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, state);
|
||||
return nativeInteractionClient
|
||||
.acquireToken({
|
||||
...cachedRequest,
|
||||
state: userRequestState,
|
||||
prompt: undefined, // Server should handle the prompt, ideally native broker can do this part silently
|
||||
})
|
||||
.finally(() => {
|
||||
this.browserStorage.cleanRequestByState(state);
|
||||
});
|
||||
}
|
||||
// Hash contains known properties - handle and return in callback
|
||||
const currentAuthority = this.browserStorage.getCachedAuthority(state);
|
||||
if (!currentAuthority) {
|
||||
throw createBrowserAuthError(noCachedAuthorityError);
|
||||
}
|
||||
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({ serverTelemetryManager, requestAuthority: currentAuthority });
|
||||
ThrottlingUtils.removeThrottle(this.browserStorage, this.config.auth.clientId, cachedRequest);
|
||||
const interactionHandler = new RedirectHandler(authClient, this.browserStorage, cachedRequest, this.logger, this.performanceClient);
|
||||
return interactionHandler.handleCodeResponse(serverParams, state);
|
||||
}
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
async logout(logoutRequest) {
|
||||
this.logger.verbose("logoutRedirect called");
|
||||
const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.logout);
|
||||
try {
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_START, InteractionType.Redirect, logoutRequest);
|
||||
// Clear cache on logout
|
||||
await this.clearCacheOnLogout(validLogoutRequest.account);
|
||||
const navigationOptions = {
|
||||
apiId: ApiId.logout,
|
||||
timeout: this.config.system.redirectNavigationTimeout,
|
||||
noHistory: false,
|
||||
};
|
||||
const authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, this.correlationId)({
|
||||
serverTelemetryManager,
|
||||
requestAuthority: logoutRequest && logoutRequest.authority,
|
||||
requestExtraQueryParameters: logoutRequest?.extraQueryParameters,
|
||||
account: (logoutRequest && logoutRequest.account) || undefined,
|
||||
});
|
||||
if (authClient.authority.protocolMode === ProtocolMode.OIDC) {
|
||||
try {
|
||||
authClient.authority.endSessionEndpoint;
|
||||
}
|
||||
catch {
|
||||
if (validLogoutRequest.account?.homeAccountId) {
|
||||
void this.browserStorage.removeAccount(validLogoutRequest.account?.homeAccountId);
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Redirect, validLogoutRequest);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create logout string and navigate user window to logout.
|
||||
const logoutUri = authClient.getLogoutUri(validLogoutRequest);
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_SUCCESS, InteractionType.Redirect, validLogoutRequest);
|
||||
// Check if onRedirectNavigate is implemented, and invoke it if so
|
||||
if (logoutRequest &&
|
||||
typeof logoutRequest.onRedirectNavigate === "function") {
|
||||
const navigate = logoutRequest.onRedirectNavigate(logoutUri);
|
||||
if (navigate !== false) {
|
||||
this.logger.verbose("Logout onRedirectNavigate did not return false, navigating");
|
||||
// Ensure interaction is in progress
|
||||
if (!this.browserStorage.getInteractionInProgress()) {
|
||||
this.browserStorage.setInteractionInProgress(true);
|
||||
}
|
||||
await this.navigationClient.navigateExternal(logoutUri, navigationOptions);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
// Ensure interaction is not in progress
|
||||
this.browserStorage.setInteractionInProgress(false);
|
||||
this.logger.verbose("Logout onRedirectNavigate returned false, stopping navigation");
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Ensure interaction is in progress
|
||||
if (!this.browserStorage.getInteractionInProgress()) {
|
||||
this.browserStorage.setInteractionInProgress(true);
|
||||
}
|
||||
await this.navigationClient.navigateExternal(logoutUri, navigationOptions);
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof AuthError) {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
}
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_FAILURE, InteractionType.Redirect, null, e);
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Redirect);
|
||||
throw e;
|
||||
}
|
||||
this.eventHandler.emitEvent(EventType.LOGOUT_END, InteractionType.Redirect);
|
||||
}
|
||||
/**
|
||||
* Use to get the redirectStartPage either from request or use current window
|
||||
* @param requestStartPage
|
||||
*/
|
||||
getRedirectStartPage(requestStartPage) {
|
||||
const redirectStartPage = requestStartPage || window.location.href;
|
||||
return UrlString.getAbsoluteUrl(redirectStartPage, getCurrentUri());
|
||||
}
|
||||
}
|
||||
|
||||
export { RedirectClient };
|
||||
//# sourceMappingURL=RedirectClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/RedirectClient.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.d.ts
generated
vendored
Normal file
24
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import { ICrypto, Logger, IPerformanceClient } from "@azure/msal-common/browser";
|
||||
import { StandardInteractionClient } from "./StandardInteractionClient.js";
|
||||
import { BrowserConfiguration } from "../config/Configuration.js";
|
||||
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
||||
import { EventHandler } from "../event/EventHandler.js";
|
||||
import { INavigationClient } from "../navigation/INavigationClient.js";
|
||||
import { ApiId } from "../utils/BrowserConstants.js";
|
||||
import { AuthorizationCodeRequest } from "../request/AuthorizationCodeRequest.js";
|
||||
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler.js";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
export declare class SilentAuthCodeClient extends StandardInteractionClient {
|
||||
private apiId;
|
||||
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
|
||||
/**
|
||||
* Acquires a token silently by redeeming an authorization code against the /token endpoint
|
||||
* @param request
|
||||
*/
|
||||
acquireToken(request: AuthorizationCodeRequest): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* Currently Unsupported
|
||||
*/
|
||||
logout(): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=SilentAuthCodeClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SilentAuthCodeClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/SilentAuthCodeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,OAAO,EACP,MAAM,EAGN,kBAAkB,EAGrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAKvE,OAAO,EAAmB,KAAK,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AACtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,qBAAa,oBAAqB,SAAQ,yBAAyB;IAC/D,OAAO,CAAC,KAAK,CAAQ;gBAGjB,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,mBAAmB,EAChC,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,iBAAiB,EACnC,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,kBAAkB,EACrC,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,aAAa,CAAC,EAAE,MAAM;IAgB1B;;;OAGG;IACG,YAAY,CACd,OAAO,EAAE,wBAAwB,GAClC,OAAO,CAAC,oBAAoB,CAAC;IAmFhC;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;CAQ1B"}
|
||||
76
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.mjs
generated
vendored
Normal file
76
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { invokeAsync, PerformanceEvents, AuthError } from '@azure/msal-common/browser';
|
||||
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
||||
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
||||
import { InteractionType } from '../utils/BrowserConstants.mjs';
|
||||
import { HybridSpaAuthorizationCodeClient } from './HybridSpaAuthorizationCodeClient.mjs';
|
||||
import { InteractionHandler } from '../interaction_handler/InteractionHandler.mjs';
|
||||
import { authCodeRequired, silentLogoutUnsupported } from '../error/BrowserAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class SilentAuthCodeClient extends StandardInteractionClient {
|
||||
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeMessageHandler, correlationId) {
|
||||
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
|
||||
this.apiId = apiId;
|
||||
}
|
||||
/**
|
||||
* Acquires a token silently by redeeming an authorization code against the /token endpoint
|
||||
* @param request
|
||||
*/
|
||||
async acquireToken(request) {
|
||||
// Auth code payload is required
|
||||
if (!request.code) {
|
||||
throw createBrowserAuthError(authCodeRequired);
|
||||
}
|
||||
// Create silent request
|
||||
const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(request, InteractionType.Silent);
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
||||
try {
|
||||
// Create auth code request (PKCE not needed)
|
||||
const authCodeRequest = {
|
||||
...silentRequest,
|
||||
code: request.code,
|
||||
};
|
||||
// Initialize the client
|
||||
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, request.correlationId)({
|
||||
serverTelemetryManager,
|
||||
requestAuthority: silentRequest.authority,
|
||||
requestAzureCloudOptions: silentRequest.azureCloudOptions,
|
||||
requestExtraQueryParameters: silentRequest.extraQueryParameters,
|
||||
account: silentRequest.account,
|
||||
});
|
||||
const authClient = new HybridSpaAuthorizationCodeClient(clientConfig);
|
||||
this.logger.verbose("Auth code client created");
|
||||
// Create silent handler
|
||||
const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
||||
// Handle auth code parameters from request
|
||||
return await invokeAsync(interactionHandler.handleCodeResponseFromServer.bind(interactionHandler), PerformanceEvents.HandleCodeResponseFromServer, this.logger, this.performanceClient, request.correlationId)({
|
||||
code: request.code,
|
||||
msgraph_host: request.msGraphHost,
|
||||
cloud_graph_host_name: request.cloudGraphHostName,
|
||||
cloud_instance_host_name: request.cloudInstanceHostName,
|
||||
}, silentRequest, false);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof AuthError) {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Currently Unsupported
|
||||
*/
|
||||
logout() {
|
||||
// Synchronous so we must reject
|
||||
return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
|
||||
}
|
||||
}
|
||||
|
||||
export { SilentAuthCodeClient };
|
||||
//# sourceMappingURL=SilentAuthCodeClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentAuthCodeClient.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SilentAuthCodeClient.mjs","sources":["../../src/interaction_client/SilentAuthCodeClient.ts"],"sourcesContent":[null],"names":["BrowserAuthErrorCodes.authCodeR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;AAED;;AAEG;IACH,MAAM,GAAA;;QAEF,OAAO,OAAO,CAAC,MAAM,CACjB,sBAAsB,CAClBC,uBAA6C,CAChD,CACJ,CAAC;KACL;AACJ;;;;"}
|
||||
17
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.d.ts
generated
vendored
Normal file
17
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
import { StandardInteractionClient } from "./StandardInteractionClient.js";
|
||||
import { CommonSilentFlowRequest } from "@azure/msal-common/browser";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
import { ClearCacheRequest } from "../request/ClearCacheRequest.js";
|
||||
export declare class SilentCacheClient extends StandardInteractionClient {
|
||||
/**
|
||||
* Returns unexpired tokens from the cache, if available
|
||||
* @param silentRequest
|
||||
*/
|
||||
acquireToken(silentRequest: CommonSilentFlowRequest): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* API to silenty clear the browser cache.
|
||||
* @param logoutRequest
|
||||
*/
|
||||
logout(logoutRequest?: ClearCacheRequest): Promise<void>;
|
||||
}
|
||||
//# sourceMappingURL=SilentCacheClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SilentCacheClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/SilentCacheClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACH,uBAAuB,EAI1B,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC3E,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,qBAAa,iBAAkB,SAAQ,yBAAyB;IAC5D;;;OAGG;IACG,YAAY,CACd,aAAa,EAAE,uBAAuB,GACvC,OAAO,CAAC,oBAAoB,CAAC;IA0DhC;;;OAGG;IACH,MAAM,CAAC,aAAa,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;CAK3D"}
|
||||
58
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.mjs
generated
vendored
Normal file
58
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
||||
import { PerformanceEvents, invokeAsync, SilentFlowClient } from '@azure/msal-common/browser';
|
||||
import { ApiId } from '../utils/BrowserConstants.mjs';
|
||||
import { BrowserAuthError } from '../error/BrowserAuthError.mjs';
|
||||
import { cryptoKeyNotFound } from '../error/BrowserAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class SilentCacheClient extends StandardInteractionClient {
|
||||
/**
|
||||
* Returns unexpired tokens from the cache, if available
|
||||
* @param silentRequest
|
||||
*/
|
||||
async acquireToken(silentRequest) {
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentCacheClientAcquireToken, silentRequest.correlationId);
|
||||
// Telemetry manager only used to increment cacheHits here
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
||||
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)({
|
||||
serverTelemetryManager,
|
||||
requestAuthority: silentRequest.authority,
|
||||
requestAzureCloudOptions: silentRequest.azureCloudOptions,
|
||||
account: silentRequest.account,
|
||||
});
|
||||
const silentAuthClient = new SilentFlowClient(clientConfig, this.performanceClient);
|
||||
this.logger.verbose("Silent auth client created");
|
||||
try {
|
||||
const response = await invokeAsync(silentAuthClient.acquireCachedToken.bind(silentAuthClient), PerformanceEvents.SilentFlowClientAcquireCachedToken, this.logger, this.performanceClient, silentRequest.correlationId)(silentRequest);
|
||||
const authResponse = response[0];
|
||||
this.performanceClient.addFields({
|
||||
fromCache: true,
|
||||
}, silentRequest.correlationId);
|
||||
return authResponse;
|
||||
}
|
||||
catch (error) {
|
||||
if (error instanceof BrowserAuthError &&
|
||||
error.errorCode === cryptoKeyNotFound) {
|
||||
this.logger.verbose("Signing keypair for bound access token not found. Refreshing bound access token and generating a new crypto keypair.");
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* API to silenty clear the browser cache.
|
||||
* @param logoutRequest
|
||||
*/
|
||||
logout(logoutRequest) {
|
||||
this.logger.verbose("logoutRedirect called");
|
||||
const validLogoutRequest = this.initializeLogoutRequest(logoutRequest);
|
||||
return this.clearCacheOnLogout(validLogoutRequest?.account);
|
||||
}
|
||||
}
|
||||
|
||||
export { SilentCacheClient };
|
||||
//# sourceMappingURL=SilentCacheClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentCacheClient.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SilentCacheClient.mjs","sources":["../../src/interaction_client/SilentCacheClient.ts"],"sourcesContent":[null],"names":["BrowserAuthErrorCodes.cryptoKeyNotFound"],"mappings":";;;;;;;;AAAA;;;AAGG;AAiBG,MAAO,iBAAkB,SAAQ,yBAAyB,CAAA;AAC5D;;;AAGG;IACH,MAAM,YAAY,CACd,aAAsC,EAAA;AAEtC,QAAA,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CACtC,iBAAiB,CAAC,6BAA6B,EAC/C,aAAa,CAAC,aAAa,CA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A,IAAI,CAAC,MAAM,CAAC,OAAO,CACf,sHAAsH,CACzH,CAAC;AACL,aAAA;AACD,YAAA,MAAM,KAAK,CAAC;AACf,SAAA;KACJ;AAED;;;AAGG;AACH,IAAA,MAAM,CAAC,aAAiC,EAAA;AACpC,QAAA,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;QAC7C,MAAM,kBAAkB,GAAG,IAAI,CAAC,uBAAuB,CAAC,aAAa,CAAC,CAAC;QACvE,OAAO,IAAI,CAAC,kBAAkB,CAAC,kBAAkB,EAAE,OAAO,CAAC,CAAC;KAC/D;AACJ;;;;"}
|
||||
33
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.d.ts
generated
vendored
Normal file
33
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { ICrypto, Logger, AuthorizationCodeClient, IPerformanceClient } from "@azure/msal-common/browser";
|
||||
import { StandardInteractionClient } from "./StandardInteractionClient.js";
|
||||
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
|
||||
import { BrowserConfiguration } from "../config/Configuration.js";
|
||||
import { BrowserCacheManager } from "../cache/BrowserCacheManager.js";
|
||||
import { EventHandler } from "../event/EventHandler.js";
|
||||
import { INavigationClient } from "../navigation/INavigationClient.js";
|
||||
import { ApiId } from "../utils/BrowserConstants.js";
|
||||
import { SsoSilentRequest } from "../request/SsoSilentRequest.js";
|
||||
import { NativeMessageHandler } from "../broker/nativeBroker/NativeMessageHandler.js";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
export declare class SilentIframeClient extends StandardInteractionClient {
|
||||
protected apiId: ApiId;
|
||||
protected nativeStorage: BrowserCacheManager;
|
||||
constructor(config: BrowserConfiguration, storageImpl: BrowserCacheManager, browserCrypto: ICrypto, logger: Logger, eventHandler: EventHandler, navigationClient: INavigationClient, apiId: ApiId, performanceClient: IPerformanceClient, nativeStorageImpl: BrowserCacheManager, nativeMessageHandler?: NativeMessageHandler, correlationId?: string);
|
||||
/**
|
||||
* Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session
|
||||
* @param request
|
||||
*/
|
||||
acquireToken(request: SsoSilentRequest): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* Currently Unsupported
|
||||
*/
|
||||
logout(): Promise<void>;
|
||||
/**
|
||||
* Helper which acquires an authorization code silently using a hidden iframe from given url
|
||||
* using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
|
||||
* @param navigateUrl
|
||||
* @param userRequestScopes
|
||||
*/
|
||||
protected silentTokenHelper(authClient: AuthorizationCodeClient, silentRequest: AuthorizationUrlRequest): Promise<AuthenticationResult>;
|
||||
}
|
||||
//# sourceMappingURL=SilentIframeClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SilentIframeClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/SilentIframeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,OAAO,EACP,MAAM,EAGN,uBAAuB,EAGvB,kBAAkB,EAIrB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AAKvE,OAAO,EAEH,KAAK,EAER,MAAM,8BAA8B,CAAC;AAKtC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAEtF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAK3E,qBAAa,kBAAmB,SAAQ,yBAAyB;IAC7D,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACvB,SAAS,CAAC,aAAa,EAAE,mBAAmB,CAAC;gBAGzC,MAAM,EAAE,oBAAoB,EAC5B,WAAW,EAAE,mBAAmB,EAChC,aAAa,EAAE,OAAO,EACtB,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,YAAY,EAC1B,gBAAgB,EAAE,iBAAiB,EACnC,KAAK,EAAE,KAAK,EACZ,iBAAiB,EAAE,kBAAkB,EACrC,iBAAiB,EAAE,mBAAmB,EACtC,oBAAoB,CAAC,EAAE,oBAAoB,EAC3C,aAAa,CAAC,EAAE,MAAM;IAiB1B;;;OAGG;IACG,YAAY,CACd,OAAO,EAAE,gBAAgB,GAC1B,OAAO,CAAC,oBAAoB,CAAC;IA+GhC;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IASvB;;;;;OAKG;cACa,iBAAiB,CAC7B,UAAU,EAAE,uBAAuB,EACnC,aAAa,EAAE,uBAAuB,GACvC,OAAO,CAAC,oBAAoB,CAAC;CAoInC"}
|
||||
132
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.mjs
generated
vendored
Normal file
132
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { PerformanceEvents, PromptValue, invokeAsync, AuthError, invoke, ProtocolUtils } from '@azure/msal-common/browser';
|
||||
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
||||
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
||||
import { InteractionType, BrowserConstants } from '../utils/BrowserConstants.mjs';
|
||||
import { initiateAuthRequest, monitorIframeForHash } from '../interaction_handler/SilentHandler.mjs';
|
||||
import { NativeMessageHandler } from '../broker/nativeBroker/NativeMessageHandler.mjs';
|
||||
import { NativeInteractionClient } from './NativeInteractionClient.mjs';
|
||||
import { InteractionHandler } from '../interaction_handler/InteractionHandler.mjs';
|
||||
import { preconnect } from '../utils/BrowserUtils.mjs';
|
||||
import { deserializeResponse } from '../response/ResponseHandler.mjs';
|
||||
import { silentLogoutUnsupported, nativeConnectionNotEstablished } from '../error/BrowserAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class SilentIframeClient extends StandardInteractionClient {
|
||||
constructor(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, apiId, performanceClient, nativeStorageImpl, nativeMessageHandler, correlationId) {
|
||||
super(config, storageImpl, browserCrypto, logger, eventHandler, navigationClient, performanceClient, nativeMessageHandler, correlationId);
|
||||
this.apiId = apiId;
|
||||
this.nativeStorage = nativeStorageImpl;
|
||||
}
|
||||
/**
|
||||
* Acquires a token silently by opening a hidden iframe to the /authorize endpoint with prompt=none or prompt=no_session
|
||||
* @param request
|
||||
*/
|
||||
async acquireToken(request) {
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientAcquireToken, request.correlationId);
|
||||
// Check that we have some SSO data
|
||||
if (!request.loginHint &&
|
||||
!request.sid &&
|
||||
(!request.account || !request.account.username)) {
|
||||
this.logger.warning("No user hint provided. The authorization server may need more information to complete this request.");
|
||||
}
|
||||
// Check the prompt value
|
||||
const inputRequest = { ...request };
|
||||
if (inputRequest.prompt) {
|
||||
if (inputRequest.prompt !== PromptValue.NONE &&
|
||||
inputRequest.prompt !== PromptValue.NO_SESSION) {
|
||||
this.logger.warning(`SilentIframeClient. Replacing invalid prompt ${inputRequest.prompt} with ${PromptValue.NONE}`);
|
||||
inputRequest.prompt = PromptValue.NONE;
|
||||
}
|
||||
}
|
||||
else {
|
||||
inputRequest.prompt = PromptValue.NONE;
|
||||
}
|
||||
// Create silent request
|
||||
const silentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(inputRequest, InteractionType.Silent);
|
||||
preconnect(silentRequest.authority);
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(this.apiId);
|
||||
let authClient;
|
||||
try {
|
||||
// Initialize the client
|
||||
authClient = await invokeAsync(this.createAuthCodeClient.bind(this), PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.logger, this.performanceClient, request.correlationId)({
|
||||
serverTelemetryManager,
|
||||
requestAuthority: silentRequest.authority,
|
||||
requestAzureCloudOptions: silentRequest.azureCloudOptions,
|
||||
requestExtraQueryParameters: silentRequest.extraQueryParameters,
|
||||
account: silentRequest.account,
|
||||
});
|
||||
return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, request.correlationId)(authClient, silentRequest);
|
||||
}
|
||||
catch (e) {
|
||||
if (e instanceof AuthError) {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
}
|
||||
if (!authClient ||
|
||||
!(e instanceof AuthError) ||
|
||||
e.errorCode !== BrowserConstants.INVALID_GRANT_ERROR) {
|
||||
throw e;
|
||||
}
|
||||
this.performanceClient.addFields({
|
||||
retryError: e.errorCode,
|
||||
}, this.correlationId);
|
||||
const retrySilentRequest = await invokeAsync(this.initializeAuthorizationRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.logger, this.performanceClient, request.correlationId)(inputRequest, InteractionType.Silent);
|
||||
return await invokeAsync(this.silentTokenHelper.bind(this), PerformanceEvents.SilentIframeClientTokenHelper, this.logger, this.performanceClient, this.correlationId)(authClient, retrySilentRequest);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Currently Unsupported
|
||||
*/
|
||||
logout() {
|
||||
// Synchronous so we must reject
|
||||
return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
|
||||
}
|
||||
/**
|
||||
* Helper which acquires an authorization code silently using a hidden iframe from given url
|
||||
* using the scopes requested as part of the id, and exchanges the code for a set of OAuth tokens.
|
||||
* @param navigateUrl
|
||||
* @param userRequestScopes
|
||||
*/
|
||||
async silentTokenHelper(authClient, silentRequest) {
|
||||
const correlationId = silentRequest.correlationId;
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentIframeClientTokenHelper, correlationId);
|
||||
// Create auth code request and generate PKCE params
|
||||
const authCodeRequest = await invokeAsync(this.initializeAuthorizationCodeRequest.bind(this), PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.logger, this.performanceClient, correlationId)(silentRequest);
|
||||
// Create authorize request url
|
||||
const navigateUrl = await invokeAsync(authClient.getAuthCodeUrl.bind(authClient), PerformanceEvents.GetAuthCodeUrl, this.logger, this.performanceClient, correlationId)({
|
||||
...silentRequest,
|
||||
platformBroker: NativeMessageHandler.isPlatformBrokerAvailable(this.config, this.logger, this.nativeMessageHandler, silentRequest.authenticationScheme),
|
||||
});
|
||||
// Create silent handler
|
||||
const interactionHandler = new InteractionHandler(authClient, this.browserStorage, authCodeRequest, this.logger, this.performanceClient);
|
||||
// Get the frame handle for the silent request
|
||||
const msalFrame = await invokeAsync(initiateAuthRequest, PerformanceEvents.SilentHandlerInitiateAuthRequest, this.logger, this.performanceClient, correlationId)(navigateUrl, this.performanceClient, this.logger, correlationId, this.config.system.navigateFrameWait);
|
||||
const responseType = this.config.auth.OIDCOptions.serverResponseType;
|
||||
// Monitor the window for the hash. Return the string value and close the popup when the hash is received. Default timeout is 60 seconds.
|
||||
const responseString = await invokeAsync(monitorIframeForHash, PerformanceEvents.SilentHandlerMonitorIframeForHash, this.logger, this.performanceClient, correlationId)(msalFrame, this.config.system.iframeHashTimeout, this.config.system.pollIntervalMilliseconds, this.performanceClient, this.logger, correlationId, responseType);
|
||||
const serverParams = invoke(deserializeResponse, PerformanceEvents.DeserializeResponse, this.logger, this.performanceClient, this.correlationId)(responseString, responseType, this.logger);
|
||||
if (serverParams.accountId) {
|
||||
this.logger.verbose("Account id found in hash, calling WAM for token");
|
||||
if (!this.nativeMessageHandler) {
|
||||
throw createBrowserAuthError(nativeConnectionNotEstablished);
|
||||
}
|
||||
const nativeInteractionClient = new NativeInteractionClient(this.config, this.browserStorage, this.browserCrypto, this.logger, this.eventHandler, this.navigationClient, this.apiId, this.performanceClient, this.nativeMessageHandler, serverParams.accountId, this.browserStorage, correlationId);
|
||||
const { userRequestState } = ProtocolUtils.parseRequestState(this.browserCrypto, silentRequest.state);
|
||||
return invokeAsync(nativeInteractionClient.acquireToken.bind(nativeInteractionClient), PerformanceEvents.NativeInteractionClientAcquireToken, this.logger, this.performanceClient, correlationId)({
|
||||
...silentRequest,
|
||||
state: userRequestState,
|
||||
prompt: silentRequest.prompt || PromptValue.NONE,
|
||||
});
|
||||
}
|
||||
// Handle response from hash string
|
||||
return invokeAsync(interactionHandler.handleCodeResponse.bind(interactionHandler), PerformanceEvents.HandleCodeResponse, this.logger, this.performanceClient, correlationId)(serverParams, silentRequest);
|
||||
}
|
||||
}
|
||||
|
||||
export { SilentIframeClient };
|
||||
//# sourceMappingURL=SilentIframeClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentIframeClient.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
32
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.d.ts
generated
vendored
Normal file
32
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import { StandardInteractionClient } from "./StandardInteractionClient.js";
|
||||
import { CommonSilentFlowRequest, ServerTelemetryManager, RefreshTokenClient, AzureCloudOptions, AccountInfo, StringDict } from "@azure/msal-common/browser";
|
||||
import { AuthenticationResult } from "../response/AuthenticationResult.js";
|
||||
export declare class SilentRefreshClient extends StandardInteractionClient {
|
||||
/**
|
||||
* Exchanges the refresh token for new tokens
|
||||
* @param request
|
||||
*/
|
||||
acquireToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult>;
|
||||
/**
|
||||
* Currently Unsupported
|
||||
*/
|
||||
logout(): Promise<void>;
|
||||
/**
|
||||
* Creates a Refresh Client with the given authority, or the default authority.
|
||||
* @param params {
|
||||
* serverTelemetryManager: ServerTelemetryManager;
|
||||
* authorityUrl?: string;
|
||||
* azureCloudOptions?: AzureCloudOptions;
|
||||
* extraQueryParams?: StringDict;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
protected createRefreshTokenClient(params: {
|
||||
serverTelemetryManager: ServerTelemetryManager;
|
||||
authorityUrl?: string;
|
||||
azureCloudOptions?: AzureCloudOptions;
|
||||
extraQueryParameters?: StringDict;
|
||||
account?: AccountInfo;
|
||||
}): Promise<RefreshTokenClient>;
|
||||
}
|
||||
//# sourceMappingURL=SilentRefreshClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SilentRefreshClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/SilentRefreshClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAC3E,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACtB,kBAAkB,EAElB,iBAAiB,EAGjB,WAAW,EACX,UAAU,EACb,MAAM,4BAA4B,CAAC;AAMpC,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAG3E,qBAAa,mBAAoB,SAAQ,yBAAyB;IAC9D;;;OAGG;IACG,YAAY,CACd,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,CAAC;IAmDhC;;OAEG;IACH,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IASvB;;;;;;;;;OASG;cACa,wBAAwB,CAAC,MAAM,EAAE;QAC7C,sBAAsB,EAAE,sBAAsB,CAAC;QAC/C,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,iBAAiB,CAAC,EAAE,iBAAiB,CAAC;QACtC,oBAAoB,CAAC,EAAE,UAAU,CAAC;QAClC,OAAO,CAAC,EAAE,WAAW,CAAC;KACzB,GAAG,OAAO,CAAC,kBAAkB,CAAC;CAiBlC"}
|
||||
75
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.mjs
generated
vendored
Normal file
75
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { StandardInteractionClient } from './StandardInteractionClient.mjs';
|
||||
import { PerformanceEvents, invokeAsync, RefreshTokenClient } from '@azure/msal-common/browser';
|
||||
import { ApiId } from '../utils/BrowserConstants.mjs';
|
||||
import { createBrowserAuthError } from '../error/BrowserAuthError.mjs';
|
||||
import { initializeBaseRequest } from '../request/RequestHelpers.mjs';
|
||||
import { silentLogoutUnsupported } from '../error/BrowserAuthErrorCodes.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
class SilentRefreshClient extends StandardInteractionClient {
|
||||
/**
|
||||
* Exchanges the refresh token for new tokens
|
||||
* @param request
|
||||
*/
|
||||
async acquireToken(request) {
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.SilentRefreshClientAcquireToken, request.correlationId);
|
||||
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, request.correlationId)(request, this.config, this.performanceClient, this.logger);
|
||||
const silentRequest = {
|
||||
...request,
|
||||
...baseRequest,
|
||||
};
|
||||
if (request.redirectUri) {
|
||||
// Make sure any passed redirectUri is converted to an absolute URL - redirectUri is not a required parameter for refresh token redemption so only include if explicitly provided
|
||||
silentRequest.redirectUri = this.getRedirectUri(request.redirectUri);
|
||||
}
|
||||
const serverTelemetryManager = this.initializeServerTelemetryManager(ApiId.acquireTokenSilent_silentFlow);
|
||||
const refreshTokenClient = await this.createRefreshTokenClient({
|
||||
serverTelemetryManager,
|
||||
authorityUrl: silentRequest.authority,
|
||||
azureCloudOptions: silentRequest.azureCloudOptions,
|
||||
account: silentRequest.account,
|
||||
});
|
||||
// Send request to renew token. Auth module will throw errors if token cannot be renewed.
|
||||
return invokeAsync(refreshTokenClient.acquireTokenByRefreshToken.bind(refreshTokenClient), PerformanceEvents.RefreshTokenClientAcquireTokenByRefreshToken, this.logger, this.performanceClient, request.correlationId)(silentRequest).catch((e) => {
|
||||
e.setCorrelationId(this.correlationId);
|
||||
serverTelemetryManager.cacheFailedRequest(e);
|
||||
throw e;
|
||||
});
|
||||
}
|
||||
/**
|
||||
* Currently Unsupported
|
||||
*/
|
||||
logout() {
|
||||
// Synchronous so we must reject
|
||||
return Promise.reject(createBrowserAuthError(silentLogoutUnsupported));
|
||||
}
|
||||
/**
|
||||
* Creates a Refresh Client with the given authority, or the default authority.
|
||||
* @param params {
|
||||
* serverTelemetryManager: ServerTelemetryManager;
|
||||
* authorityUrl?: string;
|
||||
* azureCloudOptions?: AzureCloudOptions;
|
||||
* extraQueryParams?: StringDict;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
async createRefreshTokenClient(params) {
|
||||
// Create auth module.
|
||||
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)({
|
||||
serverTelemetryManager: params.serverTelemetryManager,
|
||||
requestAuthority: params.authorityUrl,
|
||||
requestAzureCloudOptions: params.azureCloudOptions,
|
||||
requestExtraQueryParameters: params.extraQueryParameters,
|
||||
account: params.account,
|
||||
});
|
||||
return new RefreshTokenClient(clientConfig, this.performanceClient);
|
||||
}
|
||||
}
|
||||
|
||||
export { SilentRefreshClient };
|
||||
//# sourceMappingURL=SilentRefreshClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/SilentRefreshClient.mjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"SilentRefreshClient.mjs","sources":["../../src/interaction_client/SilentRefreshClient.ts"],"sourcesContent":[null],"names":["BrowserAuthErrorCodes.silentLogoutUnsupported"],"mappings":";;;;;;;;;AAAA;;;AAGG;AAsBG,MAAO,mBAAoB,SAAQ,yBAAyB,CAAA;AAC9D;;;AAGG;IACH,MAAM,YAAY,CACd,OAAgC,EAAA;AAEhC,QAAA,IAAI,CAAC,iBAAiB,CAAC,mBAAmB,CACtC,iBAAiB,CAAC,+BAA+B,EACjD,OAAO,CAAC,aAAa,CACxB,CAAC;AAEF,QAAA,MAAM,WAAW,GAAG,MAAM,WAAW,CACjC,qBAAqB,EACrB,iBAAiB,CAAC,qBAAqB,EACvC,IAAI,CAAC,MAAM,EACX,IAAI,CAAC,iBAAiB,EACtB,OAAO,CAAC,aAAa,CACxB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,iBAAiB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AAC7D,QAAA,MAAM,aAAa,GAA4B;AAC3C,YAAA,GAAG,OAAO;AACV,YAAA,GAAG,WAAW;SACjB,CAAC;QAEF,IAAI,OAAO,CAAC,WAAW,EAAE;;YAErB,aAAa,CAAC,WAAW,GAAG,IAAI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,gBAAgB,EAAE,MAAM,CAAC,YAAY;YACrC,wBAAwB,EAAE,MAAM,CAAC,iBAAiB;YAClD,2BAA2B,EAAE,MAAM,CAAC,oBAAoB;YACxD,OAAO,EAAE,MAAM,CAAC,OAAO;AAC1B,SAAA,CAAC,CAAC;QACH,OAAO,IAAI,kBAAkB,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;KACvE;AACJ;;;;"}
|
||||
70
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.d.ts
generated
vendored
Normal file
70
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.d.ts
generated
vendored
Normal file
@@ -0,0 +1,70 @@
|
||||
import { ServerTelemetryManager, CommonAuthorizationCodeRequest, AuthorizationCodeClient, ClientConfiguration, CommonEndSessionRequest, AccountInfo, AzureCloudOptions, StringDict } from "@azure/msal-common/browser";
|
||||
import { BaseInteractionClient } from "./BaseInteractionClient.js";
|
||||
import { AuthorizationUrlRequest } from "../request/AuthorizationUrlRequest.js";
|
||||
import { InteractionType } from "../utils/BrowserConstants.js";
|
||||
import { EndSessionRequest } from "../request/EndSessionRequest.js";
|
||||
import { RedirectRequest } from "../request/RedirectRequest.js";
|
||||
import { PopupRequest } from "../request/PopupRequest.js";
|
||||
import { SsoSilentRequest } from "../request/SsoSilentRequest.js";
|
||||
/**
|
||||
* Defines the class structure and helper functions used by the "standard", non-brokered auth flows (popup, redirect, silent (RT), silent (iframe))
|
||||
*/
|
||||
export declare abstract class StandardInteractionClient extends BaseInteractionClient {
|
||||
/**
|
||||
* Generates an auth code request tied to the url request.
|
||||
* @param request
|
||||
*/
|
||||
protected initializeAuthorizationCodeRequest(request: AuthorizationUrlRequest): Promise<CommonAuthorizationCodeRequest>;
|
||||
/**
|
||||
* Initializer for the logout request.
|
||||
* @param logoutRequest
|
||||
*/
|
||||
protected initializeLogoutRequest(logoutRequest?: EndSessionRequest): CommonEndSessionRequest;
|
||||
/**
|
||||
* Parses login_hint ID Token Claim out of AccountInfo object to be used as
|
||||
* logout_hint in end session request.
|
||||
* @param account
|
||||
*/
|
||||
protected getLogoutHintFromIdTokenClaims(account: AccountInfo): string | null;
|
||||
/**
|
||||
* Creates an Authorization Code Client with the given authority, or the default authority.
|
||||
* @param params {
|
||||
* serverTelemetryManager: ServerTelemetryManager;
|
||||
* authorityUrl?: string;
|
||||
* requestAzureCloudOptions?: AzureCloudOptions;
|
||||
* requestExtraQueryParameters?: StringDict;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
protected createAuthCodeClient(params: {
|
||||
serverTelemetryManager: ServerTelemetryManager;
|
||||
requestAuthority?: string;
|
||||
requestAzureCloudOptions?: AzureCloudOptions;
|
||||
requestExtraQueryParameters?: StringDict;
|
||||
account?: AccountInfo;
|
||||
}): Promise<AuthorizationCodeClient>;
|
||||
/**
|
||||
* Creates a Client Configuration object with the given request authority, or the default authority.
|
||||
* @param params {
|
||||
* serverTelemetryManager: ServerTelemetryManager;
|
||||
* requestAuthority?: string;
|
||||
* requestAzureCloudOptions?: AzureCloudOptions;
|
||||
* requestExtraQueryParameters?: boolean;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
protected getClientConfiguration(params: {
|
||||
serverTelemetryManager: ServerTelemetryManager;
|
||||
requestAuthority?: string;
|
||||
requestAzureCloudOptions?: AzureCloudOptions;
|
||||
requestExtraQueryParameters?: StringDict;
|
||||
account?: AccountInfo;
|
||||
}): Promise<ClientConfiguration>;
|
||||
/**
|
||||
* Helper to initialize required request parameters for interactive APIs and ssoSilent()
|
||||
* @param request
|
||||
* @param interactionType
|
||||
*/
|
||||
protected initializeAuthorizationRequest(request: RedirectRequest | PopupRequest | SsoSilentRequest, interactionType: InteractionType): Promise<AuthorizationUrlRequest>;
|
||||
}
|
||||
//# sourceMappingURL=StandardInteractionClient.d.ts.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.d.ts.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.d.ts.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"StandardInteractionClient.d.ts","sourceRoot":"","sources":["../../src/interaction_client/StandardInteractionClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,sBAAsB,EACtB,8BAA8B,EAE9B,uBAAuB,EACvB,mBAAmB,EAEnB,uBAAuB,EAIvB,WAAW,EACX,iBAAiB,EAIjB,UAAU,EACb,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAEH,eAAe,EAClB,MAAM,8BAA8B,CAAC;AAGtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAKlE;;GAEG;AACH,8BAAsB,yBAA0B,SAAQ,qBAAqB;IACzE;;;OAGG;cACa,kCAAkC,CAC9C,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,8BAA8B,CAAC;IA0B1C;;;OAGG;IACH,SAAS,CAAC,uBAAuB,CAC7B,aAAa,CAAC,EAAE,iBAAiB,GAClC,uBAAuB;IA+F1B;;;;OAIG;IACH,SAAS,CAAC,8BAA8B,CACpC,OAAO,EAAE,WAAW,GACrB,MAAM,GAAG,IAAI;IAmBhB;;;;;;;;;OASG;cACa,oBAAoB,CAAC,MAAM,EAAE;QACzC,sBAAsB,EAAE,sBAAsB,CAAC;QAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,wBAAwB,CAAC,EAAE,iBAAiB,CAAC;QAC7C,2BAA2B,CAAC,EAAE,UAAU,CAAC;QACzC,OAAO,CAAC,EAAE,WAAW,CAAC;KACzB,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAoBpC;;;;;;;;;OASG;cACa,sBAAsB,CAAC,MAAM,EAAE;QAC3C,sBAAsB,EAAE,sBAAsB,CAAC;QAC/C,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,wBAAwB,CAAC,EAAE,iBAAiB,CAAC;QAC7C,2BAA2B,CAAC,EAAE,UAAU,CAAC;QACzC,OAAO,CAAC,EAAE,WAAW,CAAC;KACzB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IA+DhC;;;;OAIG;cACa,8BAA8B,CAC1C,OAAO,EAAE,eAAe,GAAG,YAAY,GAAG,gBAAgB,EAC1D,eAAe,EAAE,eAAe,GACjC,OAAO,CAAC,uBAAuB,CAAC;CA2DtC"}
|
||||
226
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.mjs
generated
vendored
Normal file
226
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.mjs
generated
vendored
Normal file
@@ -0,0 +1,226 @@
|
||||
/*! @azure/msal-browser v4.2.1 2025-02-11 */
|
||||
'use strict';
|
||||
import { PerformanceEvents, invokeAsync, Constants, UrlString, AuthorizationCodeClient, ProtocolUtils } from '@azure/msal-common/browser';
|
||||
import { BaseInteractionClient } from './BaseInteractionClient.mjs';
|
||||
import { BrowserConstants } from '../utils/BrowserConstants.mjs';
|
||||
import { version } from '../packageMetadata.mjs';
|
||||
import { getCurrentUri } from '../utils/BrowserUtils.mjs';
|
||||
import { generatePkceCodes } from '../crypto/PkceGenerator.mjs';
|
||||
import { createNewGuid } from '../crypto/BrowserCrypto.mjs';
|
||||
import { initializeBaseRequest } from '../request/RequestHelpers.mjs';
|
||||
|
||||
/*
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License.
|
||||
*/
|
||||
/**
|
||||
* Defines the class structure and helper functions used by the "standard", non-brokered auth flows (popup, redirect, silent (RT), silent (iframe))
|
||||
*/
|
||||
class StandardInteractionClient extends BaseInteractionClient {
|
||||
/**
|
||||
* Generates an auth code request tied to the url request.
|
||||
* @param request
|
||||
*/
|
||||
async initializeAuthorizationCodeRequest(request) {
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationCodeRequest, this.correlationId);
|
||||
const generatedPkceParams = await invokeAsync(generatePkceCodes, PerformanceEvents.GeneratePkceCodes, this.logger, this.performanceClient, this.correlationId)(this.performanceClient, this.logger, this.correlationId);
|
||||
const authCodeRequest = {
|
||||
...request,
|
||||
redirectUri: request.redirectUri,
|
||||
code: Constants.EMPTY_STRING,
|
||||
codeVerifier: generatedPkceParams.verifier,
|
||||
};
|
||||
request.codeChallenge = generatedPkceParams.challenge;
|
||||
request.codeChallengeMethod = Constants.S256_CODE_CHALLENGE_METHOD;
|
||||
return authCodeRequest;
|
||||
}
|
||||
/**
|
||||
* Initializer for the logout request.
|
||||
* @param logoutRequest
|
||||
*/
|
||||
initializeLogoutRequest(logoutRequest) {
|
||||
this.logger.verbose("initializeLogoutRequest called", logoutRequest?.correlationId);
|
||||
const validLogoutRequest = {
|
||||
correlationId: this.correlationId || createNewGuid(),
|
||||
...logoutRequest,
|
||||
};
|
||||
/**
|
||||
* Set logout_hint to be login_hint from ID Token Claims if present
|
||||
* and logoutHint attribute wasn't manually set in logout request
|
||||
*/
|
||||
if (logoutRequest) {
|
||||
// If logoutHint isn't set and an account was passed in, try to extract logoutHint from ID Token Claims
|
||||
if (!logoutRequest.logoutHint) {
|
||||
if (logoutRequest.account) {
|
||||
const logoutHint = this.getLogoutHintFromIdTokenClaims(logoutRequest.account);
|
||||
if (logoutHint) {
|
||||
this.logger.verbose("Setting logoutHint to login_hint ID Token Claim value for the account provided");
|
||||
validLogoutRequest.logoutHint = logoutHint;
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("logoutHint was not set and account was not passed into logout request, logoutHint will not be set");
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("logoutHint has already been set in logoutRequest");
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("logoutHint will not be set since no logout request was configured");
|
||||
}
|
||||
/*
|
||||
* Only set redirect uri if logout request isn't provided or the set uri isn't null.
|
||||
* Otherwise, use passed uri, config, or current page.
|
||||
*/
|
||||
if (!logoutRequest || logoutRequest.postLogoutRedirectUri !== null) {
|
||||
if (logoutRequest && logoutRequest.postLogoutRedirectUri) {
|
||||
this.logger.verbose("Setting postLogoutRedirectUri to uri set on logout request", validLogoutRequest.correlationId);
|
||||
validLogoutRequest.postLogoutRedirectUri =
|
||||
UrlString.getAbsoluteUrl(logoutRequest.postLogoutRedirectUri, getCurrentUri());
|
||||
}
|
||||
else if (this.config.auth.postLogoutRedirectUri === null) {
|
||||
this.logger.verbose("postLogoutRedirectUri configured as null and no uri set on request, not passing post logout redirect", validLogoutRequest.correlationId);
|
||||
}
|
||||
else if (this.config.auth.postLogoutRedirectUri) {
|
||||
this.logger.verbose("Setting postLogoutRedirectUri to configured uri", validLogoutRequest.correlationId);
|
||||
validLogoutRequest.postLogoutRedirectUri =
|
||||
UrlString.getAbsoluteUrl(this.config.auth.postLogoutRedirectUri, getCurrentUri());
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("Setting postLogoutRedirectUri to current page", validLogoutRequest.correlationId);
|
||||
validLogoutRequest.postLogoutRedirectUri =
|
||||
UrlString.getAbsoluteUrl(getCurrentUri(), getCurrentUri());
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("postLogoutRedirectUri passed as null, not setting post logout redirect uri", validLogoutRequest.correlationId);
|
||||
}
|
||||
return validLogoutRequest;
|
||||
}
|
||||
/**
|
||||
* Parses login_hint ID Token Claim out of AccountInfo object to be used as
|
||||
* logout_hint in end session request.
|
||||
* @param account
|
||||
*/
|
||||
getLogoutHintFromIdTokenClaims(account) {
|
||||
const idTokenClaims = account.idTokenClaims;
|
||||
if (idTokenClaims) {
|
||||
if (idTokenClaims.login_hint) {
|
||||
return idTokenClaims.login_hint;
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("The ID Token Claims tied to the provided account do not contain a login_hint claim, logoutHint will not be added to logout request");
|
||||
}
|
||||
}
|
||||
else {
|
||||
this.logger.verbose("The provided account does not contain ID Token Claims, logoutHint will not be added to logout request");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Creates an Authorization Code Client with the given authority, or the default authority.
|
||||
* @param params {
|
||||
* serverTelemetryManager: ServerTelemetryManager;
|
||||
* authorityUrl?: string;
|
||||
* requestAzureCloudOptions?: AzureCloudOptions;
|
||||
* requestExtraQueryParameters?: StringDict;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
async createAuthCodeClient(params) {
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientCreateAuthCodeClient, this.correlationId);
|
||||
// Create auth module.
|
||||
const clientConfig = await invokeAsync(this.getClientConfiguration.bind(this), PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.logger, this.performanceClient, this.correlationId)(params);
|
||||
return new AuthorizationCodeClient(clientConfig, this.performanceClient);
|
||||
}
|
||||
/**
|
||||
* Creates a Client Configuration object with the given request authority, or the default authority.
|
||||
* @param params {
|
||||
* serverTelemetryManager: ServerTelemetryManager;
|
||||
* requestAuthority?: string;
|
||||
* requestAzureCloudOptions?: AzureCloudOptions;
|
||||
* requestExtraQueryParameters?: boolean;
|
||||
* account?: AccountInfo;
|
||||
* }
|
||||
*/
|
||||
async getClientConfiguration(params) {
|
||||
const { serverTelemetryManager, requestAuthority, requestAzureCloudOptions, requestExtraQueryParameters, account, } = params;
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientGetClientConfiguration, this.correlationId);
|
||||
const discoveredAuthority = await invokeAsync(this.getDiscoveredAuthority.bind(this), PerformanceEvents.StandardInteractionClientGetDiscoveredAuthority, this.logger, this.performanceClient, this.correlationId)({
|
||||
requestAuthority,
|
||||
requestAzureCloudOptions,
|
||||
requestExtraQueryParameters,
|
||||
account,
|
||||
});
|
||||
const logger = this.config.system.loggerOptions;
|
||||
return {
|
||||
authOptions: {
|
||||
clientId: this.config.auth.clientId,
|
||||
authority: discoveredAuthority,
|
||||
clientCapabilities: this.config.auth.clientCapabilities,
|
||||
redirectUri: this.config.auth.redirectUri,
|
||||
},
|
||||
systemOptions: {
|
||||
tokenRenewalOffsetSeconds: this.config.system.tokenRenewalOffsetSeconds,
|
||||
preventCorsPreflight: true,
|
||||
},
|
||||
loggerOptions: {
|
||||
loggerCallback: logger.loggerCallback,
|
||||
piiLoggingEnabled: logger.piiLoggingEnabled,
|
||||
logLevel: logger.logLevel,
|
||||
correlationId: this.correlationId,
|
||||
},
|
||||
cacheOptions: {
|
||||
claimsBasedCachingEnabled: this.config.cache.claimsBasedCachingEnabled,
|
||||
},
|
||||
cryptoInterface: this.browserCrypto,
|
||||
networkInterface: this.networkClient,
|
||||
storageInterface: this.browserStorage,
|
||||
serverTelemetryManager: serverTelemetryManager,
|
||||
libraryInfo: {
|
||||
sku: BrowserConstants.MSAL_SKU,
|
||||
version: version,
|
||||
cpu: Constants.EMPTY_STRING,
|
||||
os: Constants.EMPTY_STRING,
|
||||
},
|
||||
telemetry: this.config.telemetry,
|
||||
};
|
||||
}
|
||||
/**
|
||||
* Helper to initialize required request parameters for interactive APIs and ssoSilent()
|
||||
* @param request
|
||||
* @param interactionType
|
||||
*/
|
||||
async initializeAuthorizationRequest(request, interactionType) {
|
||||
this.performanceClient.addQueueMeasurement(PerformanceEvents.StandardInteractionClientInitializeAuthorizationRequest, this.correlationId);
|
||||
const redirectUri = this.getRedirectUri(request.redirectUri);
|
||||
const browserState = {
|
||||
interactionType: interactionType,
|
||||
};
|
||||
const state = ProtocolUtils.setRequestState(this.browserCrypto, (request && request.state) || Constants.EMPTY_STRING, browserState);
|
||||
const baseRequest = await invokeAsync(initializeBaseRequest, PerformanceEvents.InitializeBaseRequest, this.logger, this.performanceClient, this.correlationId)({ ...request, correlationId: this.correlationId }, this.config, this.performanceClient, this.logger);
|
||||
const validatedRequest = {
|
||||
...baseRequest,
|
||||
redirectUri: redirectUri,
|
||||
state: state,
|
||||
nonce: request.nonce || createNewGuid(),
|
||||
responseMode: this.config.auth.OIDCOptions
|
||||
.serverResponseType,
|
||||
};
|
||||
// Skip active account lookup if either login hint or session id is set
|
||||
if (request.loginHint || request.sid) {
|
||||
return validatedRequest;
|
||||
}
|
||||
const account = request.account || this.browserStorage.getActiveAccount();
|
||||
if (account) {
|
||||
this.logger.verbose("Setting validated request account", this.correlationId);
|
||||
this.logger.verbosePii(`Setting validated request account: ${account.homeAccountId}`, this.correlationId);
|
||||
validatedRequest.account = account;
|
||||
}
|
||||
return validatedRequest;
|
||||
}
|
||||
}
|
||||
|
||||
export { StandardInteractionClient };
|
||||
//# sourceMappingURL=StandardInteractionClient.mjs.map
|
||||
1
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.mjs.map
generated
vendored
Normal file
1
node_modules/@azure/msal-browser/dist/interaction_client/StandardInteractionClient.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user