Commit iniziale

This commit is contained in:
Paolo A
2025-02-18 22:59:07 +00:00
commit 4bbf35cefb
6879 changed files with 623784 additions and 0 deletions

858
node_modules/@azure/msal-common/lib/index-browser.cjs generated vendored Normal file
View File

@@ -0,0 +1,858 @@
/*! @azure/msal-common v15.1.1 2025-02-05 */
'use strict';
'use strict';
var indexNode = require('./index-node-BFQ-PSLs.js');
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
const missingKidError = "missing_kid_error";
const missingAlgError = "missing_alg_error";
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
const JoseHeaderErrorMessages = {
[missingKidError]: "The JOSE Header for the requested JWT, JWS or JWK object requires a keyId to be configured as the 'kid' header claim. No 'kid' value was provided.",
[missingAlgError]: "The JOSE Header for the requested JWT, JWS or JWK object requires an algorithm to be specified as the 'alg' header claim. No 'alg' value was provided.",
};
/**
* Error thrown when there is an error in the client code running on the browser.
*/
class JoseHeaderError extends indexNode.AuthError {
constructor(errorCode, errorMessage) {
super(errorCode, errorMessage);
this.name = "JoseHeaderError";
Object.setPrototypeOf(this, JoseHeaderError.prototype);
}
}
/** Returns JoseHeaderError object */
function createJoseHeaderError(code) {
return new JoseHeaderError(code, JoseHeaderErrorMessages[code]);
}
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/** @internal */
class JoseHeader {
constructor(options) {
this.typ = options.typ;
this.alg = options.alg;
this.kid = options.kid;
}
/**
* Builds SignedHttpRequest formatted JOSE Header from the
* JOSE Header options provided or previously set on the object and returns
* the stringified header object.
* Throws if keyId or algorithm aren't provided since they are required for Access Token Binding.
* @param shrHeaderOptions
* @returns
*/
static getShrHeaderString(shrHeaderOptions) {
// KeyID is required on the SHR header
if (!shrHeaderOptions.kid) {
throw createJoseHeaderError(missingKidError);
}
// Alg is required on the SHR header
if (!shrHeaderOptions.alg) {
throw createJoseHeaderError(missingAlgError);
}
const shrHeader = new JoseHeader({
// Access Token PoP headers must have type pop, but the type header can be overriden for special cases
typ: shrHeaderOptions.typ || indexNode.JsonWebTokenTypes.Pop,
kid: shrHeaderOptions.kid,
alg: shrHeaderOptions.alg,
});
return JSON.stringify(shrHeader);
}
}
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
class StubPerformanceMeasurement {
startMeasurement() {
return;
}
endMeasurement() {
return;
}
flushMeasurement() {
return null;
}
}
class StubPerformanceClient {
generateId() {
return "callback-id";
}
startMeasurement(measureName, correlationId) {
return {
end: () => null,
discard: () => { },
add: () => { },
increment: () => { },
event: {
eventId: this.generateId(),
status: indexNode.PerformanceEventStatus.InProgress,
authority: "",
libraryName: "",
libraryVersion: "",
clientId: "",
name: measureName,
startTimeMs: Date.now(),
correlationId: correlationId || "",
},
measurement: new StubPerformanceMeasurement(),
};
}
startPerformanceMeasurement() {
return new StubPerformanceMeasurement();
}
calculateQueuedTime() {
return 0;
}
addQueueMeasurement() {
return;
}
setPreQueueTime() {
return;
}
endMeasurement() {
return null;
}
discardMeasurements() {
return;
}
removePerformanceCallback() {
return true;
}
addPerformanceCallback() {
return "";
}
emitEvents() {
return;
}
addFields() {
return;
}
incrementFields() {
return;
}
cacheEventByCorrelationId() {
return;
}
}
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
/**
* Starts context by adding payload to the stack
* @param event {PerformanceEvent}
* @param abbreviations {Map<string, string>} event name abbreviations
* @param stack {?PerformanceEventStackedContext[]} stack
*/
function startContext(event, abbreviations, stack) {
if (!stack) {
return;
}
stack.push({
name: abbreviations.get(event.name) || event.name,
});
}
/**
* Ends context by removing payload from the stack and returning parent or self, if stack is empty, payload
*
* @param event {PerformanceEvent}
* @param abbreviations {Map<string, string>} event name abbreviations
* @param stack {?PerformanceEventStackedContext[]} stack
* @param error {?unknown} error
*/
function endContext(event, abbreviations, stack, error) {
if (!stack?.length) {
return;
}
const peek = (stack) => {
return stack.length ? stack[stack.length - 1] : undefined;
};
const abbrEventName = abbreviations.get(event.name) || event.name;
const top = peek(stack);
if (top?.name !== abbrEventName) {
return;
}
const current = stack?.pop();
if (!current) {
return;
}
const errorCode = error instanceof indexNode.AuthError
? error.errorCode
: error instanceof Error
? error.name
: undefined;
const subErr = error instanceof indexNode.AuthError ? error.subError : undefined;
if (errorCode && current.childErr !== errorCode) {
current.err = errorCode;
if (subErr) {
current.subErr = subErr;
}
}
delete current.name;
delete current.childErr;
const context = {
...current,
dur: event.durationMs,
};
if (!event.success) {
context.fail = 1;
}
const parent = peek(stack);
if (!parent) {
return { [abbrEventName]: context };
}
if (errorCode) {
parent.childErr = errorCode;
}
let childName;
if (!parent[abbrEventName]) {
childName = abbrEventName;
}
else {
const siblings = Object.keys(parent).filter((key) => key.startsWith(abbrEventName)).length;
childName = `${abbrEventName}_${siblings + 1}`;
}
parent[childName] = context;
return parent;
}
/**
* Adds error name and stack trace to the telemetry event
* @param error {Error}
* @param logger {Logger}
* @param event {PerformanceEvent}
* @param stackMaxSize {number} max error stack size to capture
*/
function addError(error, logger, event, stackMaxSize = 5) {
if (!(error instanceof Error)) {
logger.trace("PerformanceClient.addErrorStack: Input error is not instance of Error", event.correlationId);
return;
}
else if (error instanceof indexNode.AuthError) {
event.errorCode = error.errorCode;
event.subErrorCode = error.subError;
if (error instanceof indexNode.ServerError ||
error instanceof indexNode.InteractionRequiredAuthError) {
event.serverErrorNo = error.errorNo;
}
return;
}
else if (error instanceof indexNode.CacheError) {
event.errorCode = error.errorCode;
return;
}
else if (event.errorStack?.length) {
logger.trace("PerformanceClient.addErrorStack: Stack already exist", event.correlationId);
return;
}
else if (!error.stack?.length) {
logger.trace("PerformanceClient.addErrorStack: Input stack is empty", event.correlationId);
return;
}
if (error.stack) {
event.errorStack = compactStack(error.stack, stackMaxSize);
}
event.errorName = error.name;
}
/**
* Compacts error stack into array by fetching N first entries
* @param stack {string} error stack
* @param stackMaxSize {number} max error stack size to capture
* @returns {string[]}
*/
function compactStack(stack, stackMaxSize) {
if (stackMaxSize < 0) {
return [];
}
const stackArr = stack.split("\n") || [];
const res = [];
// Check for a handful of known, common runtime errors and log them (with redaction where applicable).
const firstLine = stackArr[0];
if (firstLine.startsWith("TypeError: Cannot read property") ||
firstLine.startsWith("TypeError: Cannot read properties of") ||
firstLine.startsWith("TypeError: Cannot set property") ||
firstLine.startsWith("TypeError: Cannot set properties of") ||
firstLine.endsWith("is not a function")) {
// These types of errors are not at risk of leaking PII. They will indicate unavailable APIs
res.push(compactStackLine(firstLine));
}
else if (firstLine.startsWith("SyntaxError") ||
firstLine.startsWith("TypeError")) {
// Prevent unintentional leaking of arbitrary info by redacting contents between both single and double quotes
res.push(compactStackLine(
// Example: SyntaxError: Unexpected token 'e', "test" is not valid JSON -> SyntaxError: Unexpected token <redacted>, <redacted> is not valid JSON
firstLine.replace(/['].*[']|["].*["]/g, "<redacted>")));
}
// Get top N stack lines
for (let ix = 1; ix < stackArr.length; ix++) {
if (res.length >= stackMaxSize) {
break;
}
const line = stackArr[ix];
res.push(compactStackLine(line));
}
return res;
}
/**
* Compacts error stack line by shortening file path
* Example: https://localhost/msal-common/src/authority/Authority.js:100:1 -> Authority.js:100:1
* @param line {string} stack line
* @returns {string}
*/
function compactStackLine(line) {
const filePathIx = line.lastIndexOf(" ") + 1;
if (filePathIx < 1) {
return line;
}
const filePath = line.substring(filePathIx);
let fileNameIx = filePath.lastIndexOf("/");
fileNameIx = fileNameIx < 0 ? filePath.lastIndexOf("\\") : fileNameIx;
if (fileNameIx >= 0) {
return (line.substring(0, filePathIx) +
"(" +
filePath.substring(fileNameIx + 1) +
(filePath.charAt(filePath.length - 1) === ")" ? "" : ")")).trimStart();
}
return line.trimStart();
}
class PerformanceClient {
/**
* Creates an instance of PerformanceClient,
* an abstract class containing core performance telemetry logic.
*
* @constructor
* @param {string} clientId Client ID of the application
* @param {string} authority Authority used by the application
* @param {Logger} logger Logger used by the application
* @param {string} libraryName Name of the library
* @param {string} libraryVersion Version of the library
* @param {ApplicationTelemetry} applicationTelemetry application name and version
* @param {Set<String>} intFields integer fields to be truncated
* @param {Map<string, string>} abbreviations event name abbreviations
*/
constructor(clientId, authority, logger, libraryName, libraryVersion, applicationTelemetry, intFields, abbreviations) {
this.authority = authority;
this.libraryName = libraryName;
this.libraryVersion = libraryVersion;
this.applicationTelemetry = applicationTelemetry;
this.clientId = clientId;
this.logger = logger;
this.callbacks = new Map();
this.eventsByCorrelationId = new Map();
this.eventStack = new Map();
this.queueMeasurements = new Map();
this.preQueueTimeByCorrelationId = new Map();
this.intFields = intFields || new Set();
for (const item of indexNode.IntFields) {
this.intFields.add(item);
}
this.abbreviations = abbreviations || new Map();
for (const [key, value] of indexNode.PerformanceEventAbbreviations) {
this.abbreviations.set(key, value);
}
}
/**
* Starts and returns an platform-specific implementation of IPerformanceMeasurement.
* Note: this function can be changed to abstract at the next major version bump.
*
* @param {string} measureName
* @param {string} correlationId
* @returns {IPerformanceMeasurement}
* @deprecated This method will be removed in the next major version
*/
startPerformanceMeasurement(measureName, // eslint-disable-line @typescript-eslint/no-unused-vars
correlationId // eslint-disable-line @typescript-eslint/no-unused-vars
) {
return {};
}
/**
* Gets map of pre-queue times by correlation Id
*
* @param {PerformanceEvents} eventName
* @param {string} correlationId
* @returns {number}
*/
getPreQueueTime(eventName, correlationId) {
const preQueueEvent = this.preQueueTimeByCorrelationId.get(correlationId);
if (!preQueueEvent) {
this.logger.trace(`PerformanceClient.getPreQueueTime: no pre-queue times found for correlationId: ${correlationId}, unable to add queue measurement`);
return;
}
else if (preQueueEvent.name !== eventName) {
this.logger.trace(`PerformanceClient.getPreQueueTime: no pre-queue time found for ${eventName}, unable to add queue measurement`);
return;
}
return preQueueEvent.time;
}
/**
* Calculates the difference between current time and time when function was queued.
* Note: It is possible to have 0 as the queue time if the current time and the queued time was the same.
*
* @param {number} preQueueTime
* @param {number} currentTime
* @returns {number}
*/
calculateQueuedTime(preQueueTime, currentTime) {
if (preQueueTime < 1) {
this.logger.trace(`PerformanceClient: preQueueTime should be a positive integer and not ${preQueueTime}`);
return 0;
}
if (currentTime < 1) {
this.logger.trace(`PerformanceClient: currentTime should be a positive integer and not ${currentTime}`);
return 0;
}
if (currentTime < preQueueTime) {
this.logger.trace("PerformanceClient: currentTime is less than preQueueTime, check how time is being retrieved");
return 0;
}
return currentTime - preQueueTime;
}
/**
* Adds queue measurement time to QueueMeasurements array for given correlation ID.
*
* @param {PerformanceEvents} eventName
* @param {?string} correlationId
* @param {?number} queueTime
* @param {?boolean} manuallyCompleted - indicator for manually completed queue measurements
* @returns
*/
addQueueMeasurement(eventName, correlationId, queueTime, manuallyCompleted) {
if (!correlationId) {
this.logger.trace(`PerformanceClient.addQueueMeasurement: correlationId not provided for ${eventName}, cannot add queue measurement`);
return;
}
if (queueTime === 0) {
// Possible for there to be no queue time after calculation
this.logger.trace(`PerformanceClient.addQueueMeasurement: queue time provided for ${eventName} is ${queueTime}`);
}
else if (!queueTime) {
this.logger.trace(`PerformanceClient.addQueueMeasurement: no queue time provided for ${eventName}`);
return;
}
const queueMeasurement = {
eventName,
// Always default queue time to 0 for manually completed (improperly instrumented)
queueTime: manuallyCompleted ? 0 : queueTime,
manuallyCompleted,
};
// Adds to existing correlation Id if present in queueMeasurements
const existingMeasurements = this.queueMeasurements.get(correlationId);
if (existingMeasurements) {
existingMeasurements.push(queueMeasurement);
this.queueMeasurements.set(correlationId, existingMeasurements);
}
else {
// Sets new correlation Id if not present in queueMeasurements
this.logger.trace(`PerformanceClient.addQueueMeasurement: adding correlationId ${correlationId} to queue measurements`);
const measurementArray = [queueMeasurement];
this.queueMeasurements.set(correlationId, measurementArray);
}
// Delete processed pre-queue event.
this.preQueueTimeByCorrelationId.delete(correlationId);
}
/**
* Starts measuring performance for a given operation. Returns a function that should be used to end the measurement.
*
* @param {PerformanceEvents} measureName
* @param {?string} [correlationId]
* @returns {InProgressPerformanceEvent}
*/
startMeasurement(measureName, correlationId) {
// Generate a placeholder correlation if the request does not provide one
const eventCorrelationId = correlationId || this.generateId();
if (!correlationId) {
this.logger.info(`PerformanceClient: No correlation id provided for ${measureName}, generating`, eventCorrelationId);
}
this.logger.trace(`PerformanceClient: Performance measurement started for ${measureName}`, eventCorrelationId);
const inProgressEvent = {
eventId: this.generateId(),
status: indexNode.PerformanceEventStatus.InProgress,
authority: this.authority,
libraryName: this.libraryName,
libraryVersion: this.libraryVersion,
clientId: this.clientId,
name: measureName,
startTimeMs: Date.now(),
correlationId: eventCorrelationId,
appName: this.applicationTelemetry?.appName,
appVersion: this.applicationTelemetry?.appVersion,
};
// Store in progress events so they can be discarded if not ended properly
this.cacheEventByCorrelationId(inProgressEvent);
startContext(inProgressEvent, this.abbreviations, this.eventStack.get(eventCorrelationId));
// Return the event and functions the caller can use to properly end/flush the measurement
return {
end: (event, error) => {
return this.endMeasurement({
// Initial set of event properties
...inProgressEvent,
// Properties set when event ends
...event,
}, error);
},
discard: () => {
return this.discardMeasurements(inProgressEvent.correlationId);
},
add: (fields) => {
return this.addFields(fields, inProgressEvent.correlationId);
},
increment: (fields) => {
return this.incrementFields(fields, inProgressEvent.correlationId);
},
event: inProgressEvent,
measurement: new StubPerformanceMeasurement(),
};
}
/**
* Stops measuring the performance for an operation. Should only be called directly by PerformanceClient classes,
* as consumers should instead use the function returned by startMeasurement.
* Adds a new field named as "[event name]DurationMs" for sub-measurements, completes and emits an event
* otherwise.
*
* @param {PerformanceEvent} event
* @param {unknown} error
* @returns {(PerformanceEvent | null)}
*/
endMeasurement(event, error) {
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
if (!rootEvent) {
this.logger.trace(`PerformanceClient: Measurement not found for ${event.eventId}`, event.correlationId);
return null;
}
const isRoot = event.eventId === rootEvent.eventId;
let queueInfo = {
totalQueueTime: 0,
totalQueueCount: 0,
manuallyCompletedCount: 0,
};
event.durationMs = Math.round(event.durationMs || this.getDurationMs(event.startTimeMs));
const context = JSON.stringify(endContext(event, this.abbreviations, this.eventStack.get(rootEvent.correlationId), error));
if (isRoot) {
queueInfo = this.getQueueInfo(event.correlationId);
this.discardMeasurements(rootEvent.correlationId);
}
else {
rootEvent.incompleteSubMeasurements?.delete(event.eventId);
}
this.logger.trace(`PerformanceClient: Performance measurement ended for ${event.name}: ${event.durationMs} ms`, event.correlationId);
if (error) {
addError(error, this.logger, rootEvent);
}
// Add sub-measurement attribute to root event.
if (!isRoot) {
rootEvent[event.name + "DurationMs"] = Math.floor(event.durationMs);
return { ...rootEvent };
}
if (isRoot &&
!error &&
(rootEvent.errorCode || rootEvent.subErrorCode)) {
this.logger.trace(`PerformanceClient: Remove error and sub-error codes for root event ${event.name} as intermediate error was successfully handled`, event.correlationId);
rootEvent.errorCode = undefined;
rootEvent.subErrorCode = undefined;
}
let finalEvent = { ...rootEvent, ...event };
let incompleteSubsCount = 0;
// Incomplete sub-measurements are discarded. They are likely an instrumentation bug that should be fixed.
finalEvent.incompleteSubMeasurements?.forEach((subMeasurement) => {
this.logger.trace(`PerformanceClient: Incomplete submeasurement ${subMeasurement.name} found for ${event.name}`, finalEvent.correlationId);
incompleteSubsCount++;
});
finalEvent.incompleteSubMeasurements = undefined;
finalEvent = {
...finalEvent,
queuedTimeMs: queueInfo.totalQueueTime,
queuedCount: queueInfo.totalQueueCount,
queuedManuallyCompletedCount: queueInfo.manuallyCompletedCount,
status: indexNode.PerformanceEventStatus.Completed,
incompleteSubsCount,
context,
};
this.truncateIntegralFields(finalEvent);
this.emitEvents([finalEvent], event.correlationId);
return finalEvent;
}
/**
* Saves extra information to be emitted when the measurements are flushed
* @param fields
* @param correlationId
*/
addFields(fields, correlationId) {
this.logger.trace("PerformanceClient: Updating static fields");
const event = this.eventsByCorrelationId.get(correlationId);
if (event) {
this.eventsByCorrelationId.set(correlationId, {
...event,
...fields,
});
}
else {
this.logger.trace("PerformanceClient: Event not found for", correlationId);
}
}
/**
* Increment counters to be emitted when the measurements are flushed
* @param fields {string[]}
* @param correlationId {string} correlation identifier
*/
incrementFields(fields, correlationId) {
this.logger.trace("PerformanceClient: Updating counters");
const event = this.eventsByCorrelationId.get(correlationId);
if (event) {
for (const counter in fields) {
if (!event.hasOwnProperty(counter)) {
event[counter] = 0;
}
else if (isNaN(Number(event[counter]))) {
return;
}
event[counter] += fields[counter];
}
}
else {
this.logger.trace("PerformanceClient: Event not found for", correlationId);
}
}
/**
* Upserts event into event cache.
* First key is the correlation id, second key is the event id.
* Allows for events to be grouped by correlation id,
* and to easily allow for properties on them to be updated.
*
* @private
* @param {PerformanceEvent} event
*/
cacheEventByCorrelationId(event) {
const rootEvent = this.eventsByCorrelationId.get(event.correlationId);
if (rootEvent) {
this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} added/updated`, event.correlationId);
rootEvent.incompleteSubMeasurements =
rootEvent.incompleteSubMeasurements || new Map();
rootEvent.incompleteSubMeasurements.set(event.eventId, {
name: event.name,
startTimeMs: event.startTimeMs,
});
}
else {
this.logger.trace(`PerformanceClient: Performance measurement for ${event.name} started`, event.correlationId);
this.eventsByCorrelationId.set(event.correlationId, { ...event });
this.eventStack.set(event.correlationId, []);
}
}
getQueueInfo(correlationId) {
const queueMeasurementForCorrelationId = this.queueMeasurements.get(correlationId);
if (!queueMeasurementForCorrelationId) {
this.logger.trace(`PerformanceClient: no queue measurements found for for correlationId: ${correlationId}`);
}
let totalQueueTime = 0;
let totalQueueCount = 0;
let manuallyCompletedCount = 0;
queueMeasurementForCorrelationId?.forEach((measurement) => {
totalQueueTime += measurement.queueTime;
totalQueueCount++;
manuallyCompletedCount += measurement.manuallyCompleted ? 1 : 0;
});
return {
totalQueueTime,
totalQueueCount,
manuallyCompletedCount,
};
}
/**
* Removes measurements and aux data for a given correlation id.
*
* @param {string} correlationId
*/
discardMeasurements(correlationId) {
this.logger.trace("PerformanceClient: Performance measurements discarded", correlationId);
this.eventsByCorrelationId.delete(correlationId);
this.logger.trace("PerformanceClient: QueueMeasurements discarded", correlationId);
this.queueMeasurements.delete(correlationId);
this.logger.trace("PerformanceClient: Pre-queue times discarded", correlationId);
this.preQueueTimeByCorrelationId.delete(correlationId);
this.logger.trace("PerformanceClient: Event stack discarded", correlationId);
this.eventStack.delete(correlationId);
}
/**
* Registers a callback function to receive performance events.
*
* @param {PerformanceCallbackFunction} callback
* @returns {string}
*/
addPerformanceCallback(callback) {
for (const [id, cb] of this.callbacks) {
if (cb.toString() === callback.toString()) {
this.logger.warning(`PerformanceClient: Performance callback is already registered with id: ${id}`);
return id;
}
}
const callbackId = this.generateId();
this.callbacks.set(callbackId, callback);
this.logger.verbose(`PerformanceClient: Performance callback registered with id: ${callbackId}`);
return callbackId;
}
/**
* Removes a callback registered with addPerformanceCallback.
*
* @param {string} callbackId
* @returns {boolean}
*/
removePerformanceCallback(callbackId) {
const result = this.callbacks.delete(callbackId);
if (result) {
this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} removed.`);
}
else {
this.logger.verbose(`PerformanceClient: Performance callback ${callbackId} not removed.`);
}
return result;
}
/**
* Emits events to all registered callbacks.
*
* @param {PerformanceEvent[]} events
* @param {?string} [correlationId]
*/
emitEvents(events, correlationId) {
this.logger.verbose("PerformanceClient: Emitting performance events", correlationId);
this.callbacks.forEach((callback, callbackId) => {
this.logger.trace(`PerformanceClient: Emitting event to callback ${callbackId}`, correlationId);
callback.apply(null, [events]);
});
}
/**
* Enforce truncation of integral fields in performance event.
* @param {PerformanceEvent} event performance event to update.
*/
truncateIntegralFields(event) {
this.intFields.forEach((key) => {
if (key in event && typeof event[key] === "number") {
event[key] = Math.floor(event[key]);
}
});
}
/**
* Returns event duration in milliseconds
* @param startTimeMs {number}
* @returns {number}
*/
getDurationMs(startTimeMs) {
const durationMs = Date.now() - startTimeMs;
// Handle clock skew
return durationMs < 0 ? durationMs : 0;
}
}
exports.AADAuthorityConstants = indexNode.AADAuthorityConstants;
exports.AADServerParamKeys = indexNode.AADServerParamKeys;
exports.AccountEntity = indexNode.AccountEntity;
exports.AuthError = indexNode.AuthError;
exports.AuthErrorCodes = indexNode.AuthErrorCodes;
exports.AuthErrorMessage = indexNode.AuthErrorMessage;
exports.AuthToken = indexNode.AuthToken;
exports.AuthenticationHeaderParser = indexNode.AuthenticationHeaderParser;
exports.AuthenticationScheme = indexNode.AuthenticationScheme;
exports.Authority = indexNode.Authority;
exports.AuthorityFactory = indexNode.AuthorityFactory;
exports.AuthorityType = indexNode.AuthorityType;
exports.AuthorizationCodeClient = indexNode.AuthorizationCodeClient;
exports.AzureCloudInstance = indexNode.AzureCloudInstance;
exports.BaseClient = indexNode.BaseClient;
exports.CacheAccountType = indexNode.CacheAccountType;
exports.CacheError = indexNode.CacheError;
exports.CacheErrorCodes = indexNode.CacheErrorCodes;
exports.CacheHelpers = indexNode.CacheHelpers;
exports.CacheManager = indexNode.CacheManager;
exports.CacheOutcome = indexNode.CacheOutcome;
exports.CacheType = indexNode.CacheType;
exports.CcsCredentialType = indexNode.CcsCredentialType;
exports.ClaimsRequestKeys = indexNode.ClaimsRequestKeys;
exports.ClientAuthError = indexNode.ClientAuthError;
exports.ClientAuthErrorCodes = indexNode.ClientAuthErrorCodes;
exports.ClientAuthErrorMessage = indexNode.ClientAuthErrorMessage;
exports.ClientConfigurationError = indexNode.ClientConfigurationError;
exports.ClientConfigurationErrorCodes = indexNode.ClientConfigurationErrorCodes;
exports.ClientConfigurationErrorMessage = indexNode.ClientConfigurationErrorMessage;
exports.CodeChallengeMethodValues = indexNode.CodeChallengeMethodValues;
exports.Constants = indexNode.Constants;
exports.CredentialType = indexNode.CredentialType;
exports.DEFAULT_CRYPTO_IMPLEMENTATION = indexNode.DEFAULT_CRYPTO_IMPLEMENTATION;
exports.DEFAULT_SYSTEM_OPTIONS = indexNode.DEFAULT_SYSTEM_OPTIONS;
exports.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = indexNode.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC;
exports.DefaultStorageClass = indexNode.DefaultStorageClass;
exports.Errors = indexNode.Errors;
exports.GrantType = indexNode.GrantType;
exports.HeaderNames = indexNode.HeaderNames;
exports.HttpStatus = indexNode.HttpStatus;
exports.IntFields = indexNode.IntFields;
exports.InteractionRequiredAuthError = indexNode.InteractionRequiredAuthError;
exports.InteractionRequiredAuthErrorCodes = indexNode.InteractionRequiredAuthErrorCodes;
exports.InteractionRequiredAuthErrorMessage = indexNode.InteractionRequiredAuthErrorMessage;
exports.JsonWebTokenTypes = indexNode.JsonWebTokenTypes;
Object.defineProperty(exports, "LogLevel", {
enumerable: true,
get: function () { return indexNode.LogLevel; }
});
exports.Logger = indexNode.Logger;
exports.NetworkError = indexNode.NetworkError;
exports.OIDC_DEFAULT_SCOPES = indexNode.OIDC_DEFAULT_SCOPES;
exports.ONE_DAY_IN_MS = indexNode.ONE_DAY_IN_MS;
exports.PasswordGrantConstants = indexNode.PasswordGrantConstants;
exports.PerformanceEventStatus = indexNode.PerformanceEventStatus;
exports.PerformanceEvents = indexNode.PerformanceEvents;
exports.PersistentCacheKeys = indexNode.PersistentCacheKeys;
exports.PopTokenGenerator = indexNode.PopTokenGenerator;
exports.PromptValue = indexNode.PromptValue;
exports.ProtocolMode = indexNode.ProtocolMode;
exports.ProtocolUtils = indexNode.ProtocolUtils;
exports.RefreshTokenClient = indexNode.RefreshTokenClient;
exports.RequestParameterBuilder = indexNode.RequestParameterBuilder;
exports.ResponseHandler = indexNode.ResponseHandler;
exports.ResponseMode = indexNode.ResponseMode;
exports.ScopeSet = indexNode.ScopeSet;
exports.ServerError = indexNode.ServerError;
exports.ServerResponseType = indexNode.ServerResponseType;
exports.ServerTelemetryManager = indexNode.ServerTelemetryManager;
exports.SilentFlowClient = indexNode.SilentFlowClient;
exports.StringUtils = indexNode.StringUtils;
exports.StubbedNetworkModule = indexNode.StubbedNetworkModule;
exports.THE_FAMILY_ID = indexNode.THE_FAMILY_ID;
exports.ThrottlingConstants = indexNode.ThrottlingConstants;
exports.ThrottlingUtils = indexNode.ThrottlingUtils;
exports.TimeUtils = indexNode.TimeUtils;
exports.UrlString = indexNode.UrlString;
exports.UrlUtils = indexNode.UrlUtils;
exports.buildAccountToCache = indexNode.buildAccountToCache;
exports.buildClientInfo = indexNode.buildClientInfo;
exports.buildClientInfoFromHomeAccountId = indexNode.buildClientInfoFromHomeAccountId;
exports.buildStaticAuthorityOptions = indexNode.buildStaticAuthorityOptions;
exports.buildTenantProfile = indexNode.buildTenantProfile;
exports.createAuthError = indexNode.createAuthError;
exports.createClientAuthError = indexNode.createClientAuthError;
exports.createClientConfigurationError = indexNode.createClientConfigurationError;
exports.createInteractionRequiredAuthError = indexNode.createInteractionRequiredAuthError;
exports.createNetworkError = indexNode.createNetworkError;
exports.formatAuthorityUri = indexNode.formatAuthorityUri;
exports.getTenantIdFromIdTokenClaims = indexNode.getTenantIdFromIdTokenClaims;
exports.invoke = indexNode.invoke;
exports.invokeAsync = indexNode.invokeAsync;
exports.tenantIdMatchesHomeTenant = indexNode.tenantIdMatchesHomeTenant;
exports.updateAccountTenantProfileData = indexNode.updateAccountTenantProfileData;
exports.version = indexNode.version;
exports.JoseHeader = JoseHeader;
exports.PerformanceClient = PerformanceClient;
exports.StubPerformanceClient = StubPerformanceClient;
//# sourceMappingURL=index-browser.cjs.map

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

104
node_modules/@azure/msal-common/lib/index-node.cjs generated vendored Normal file
View File

@@ -0,0 +1,104 @@
/*! @azure/msal-common v15.1.1 2025-02-05 */
'use strict';
'use strict';
var indexNode = require('./index-node-BFQ-PSLs.js');
exports.AADAuthorityConstants = indexNode.AADAuthorityConstants;
exports.AADServerParamKeys = indexNode.AADServerParamKeys;
exports.AccountEntity = indexNode.AccountEntity;
exports.AuthError = indexNode.AuthError;
exports.AuthErrorCodes = indexNode.AuthErrorCodes;
exports.AuthErrorMessage = indexNode.AuthErrorMessage;
exports.AuthToken = indexNode.AuthToken;
exports.AuthenticationHeaderParser = indexNode.AuthenticationHeaderParser;
exports.AuthenticationScheme = indexNode.AuthenticationScheme;
exports.Authority = indexNode.Authority;
exports.AuthorityFactory = indexNode.AuthorityFactory;
exports.AuthorityType = indexNode.AuthorityType;
exports.AuthorizationCodeClient = indexNode.AuthorizationCodeClient;
exports.AzureCloudInstance = indexNode.AzureCloudInstance;
exports.BaseClient = indexNode.BaseClient;
exports.CacheAccountType = indexNode.CacheAccountType;
exports.CacheError = indexNode.CacheError;
exports.CacheErrorCodes = indexNode.CacheErrorCodes;
exports.CacheHelpers = indexNode.CacheHelpers;
exports.CacheManager = indexNode.CacheManager;
exports.CacheOutcome = indexNode.CacheOutcome;
exports.CacheType = indexNode.CacheType;
exports.CcsCredentialType = indexNode.CcsCredentialType;
exports.ClaimsRequestKeys = indexNode.ClaimsRequestKeys;
exports.ClientAssertionUtils = indexNode.ClientAssertionUtils;
exports.ClientAuthError = indexNode.ClientAuthError;
exports.ClientAuthErrorCodes = indexNode.ClientAuthErrorCodes;
exports.ClientAuthErrorMessage = indexNode.ClientAuthErrorMessage;
exports.ClientConfigurationError = indexNode.ClientConfigurationError;
exports.ClientConfigurationErrorCodes = indexNode.ClientConfigurationErrorCodes;
exports.ClientConfigurationErrorMessage = indexNode.ClientConfigurationErrorMessage;
exports.CodeChallengeMethodValues = indexNode.CodeChallengeMethodValues;
exports.Constants = indexNode.Constants;
exports.CredentialType = indexNode.CredentialType;
exports.DEFAULT_CRYPTO_IMPLEMENTATION = indexNode.DEFAULT_CRYPTO_IMPLEMENTATION;
exports.DEFAULT_SYSTEM_OPTIONS = indexNode.DEFAULT_SYSTEM_OPTIONS;
exports.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = indexNode.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC;
exports.DefaultStorageClass = indexNode.DefaultStorageClass;
exports.Errors = indexNode.Errors;
exports.GrantType = indexNode.GrantType;
exports.HeaderNames = indexNode.HeaderNames;
exports.HttpStatus = indexNode.HttpStatus;
exports.InteractionRequiredAuthError = indexNode.InteractionRequiredAuthError;
exports.InteractionRequiredAuthErrorCodes = indexNode.InteractionRequiredAuthErrorCodes;
exports.InteractionRequiredAuthErrorMessage = indexNode.InteractionRequiredAuthErrorMessage;
exports.JsonWebTokenTypes = indexNode.JsonWebTokenTypes;
Object.defineProperty(exports, "LogLevel", {
enumerable: true,
get: function () { return indexNode.LogLevel; }
});
exports.Logger = indexNode.Logger;
exports.NetworkError = indexNode.NetworkError;
exports.OIDC_DEFAULT_SCOPES = indexNode.OIDC_DEFAULT_SCOPES;
exports.ONE_DAY_IN_MS = indexNode.ONE_DAY_IN_MS;
exports.PasswordGrantConstants = indexNode.PasswordGrantConstants;
exports.PersistentCacheKeys = indexNode.PersistentCacheKeys;
exports.PromptValue = indexNode.PromptValue;
exports.ProtocolMode = indexNode.ProtocolMode;
exports.ProtocolUtils = indexNode.ProtocolUtils;
exports.RefreshTokenClient = indexNode.RefreshTokenClient;
exports.RequestParameterBuilder = indexNode.RequestParameterBuilder;
exports.ResponseHandler = indexNode.ResponseHandler;
exports.ResponseMode = indexNode.ResponseMode;
exports.ScopeSet = indexNode.ScopeSet;
exports.ServerError = indexNode.ServerError;
exports.ServerResponseType = indexNode.ServerResponseType;
exports.ServerTelemetryManager = indexNode.ServerTelemetryManager;
exports.SilentFlowClient = indexNode.SilentFlowClient;
exports.StringUtils = indexNode.StringUtils;
exports.StubbedNetworkModule = indexNode.StubbedNetworkModule;
exports.THE_FAMILY_ID = indexNode.THE_FAMILY_ID;
exports.ThrottlingConstants = indexNode.ThrottlingConstants;
exports.ThrottlingUtils = indexNode.ThrottlingUtils;
exports.TimeUtils = indexNode.TimeUtils;
exports.TokenCacheContext = indexNode.TokenCacheContext;
exports.UrlString = indexNode.UrlString;
exports.UrlUtils = indexNode.UrlUtils;
exports.buildAccountToCache = indexNode.buildAccountToCache;
exports.buildClientInfo = indexNode.buildClientInfo;
exports.buildClientInfoFromHomeAccountId = indexNode.buildClientInfoFromHomeAccountId;
exports.buildStaticAuthorityOptions = indexNode.buildStaticAuthorityOptions;
exports.buildTenantProfile = indexNode.buildTenantProfile;
exports.createAuthError = indexNode.createAuthError;
exports.createClientAuthError = indexNode.createClientAuthError;
exports.createClientConfigurationError = indexNode.createClientConfigurationError;
exports.createInteractionRequiredAuthError = indexNode.createInteractionRequiredAuthError;
exports.createNetworkError = indexNode.createNetworkError;
exports.formatAuthorityUri = indexNode.formatAuthorityUri;
exports.getClientAssertion = indexNode.getClientAssertion;
exports.getTenantIdFromIdTokenClaims = indexNode.getTenantIdFromIdTokenClaims;
exports.invoke = indexNode.invoke;
exports.invokeAsync = indexNode.invokeAsync;
exports.tenantIdMatchesHomeTenant = indexNode.tenantIdMatchesHomeTenant;
exports.updateAccountTenantProfileData = indexNode.updateAccountTenantProfileData;
exports.version = indexNode.version;
//# sourceMappingURL=index-node.cjs.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index-node.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

112
node_modules/@azure/msal-common/lib/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,112 @@
/*! @azure/msal-common v15.1.1 2025-02-05 */
'use strict';
'use strict';
var indexNode = require('./index-node-BFQ-PSLs.js');
var indexBrowser = require('./index-browser.cjs');
exports.AADAuthorityConstants = indexNode.AADAuthorityConstants;
exports.AADServerParamKeys = indexNode.AADServerParamKeys;
exports.AccountEntity = indexNode.AccountEntity;
exports.AuthError = indexNode.AuthError;
exports.AuthErrorCodes = indexNode.AuthErrorCodes;
exports.AuthErrorMessage = indexNode.AuthErrorMessage;
exports.AuthToken = indexNode.AuthToken;
exports.AuthenticationHeaderParser = indexNode.AuthenticationHeaderParser;
exports.AuthenticationScheme = indexNode.AuthenticationScheme;
exports.Authority = indexNode.Authority;
exports.AuthorityFactory = indexNode.AuthorityFactory;
exports.AuthorityType = indexNode.AuthorityType;
exports.AuthorizationCodeClient = indexNode.AuthorizationCodeClient;
exports.AzureCloudInstance = indexNode.AzureCloudInstance;
exports.BaseClient = indexNode.BaseClient;
exports.CacheAccountType = indexNode.CacheAccountType;
exports.CacheError = indexNode.CacheError;
exports.CacheErrorCodes = indexNode.CacheErrorCodes;
exports.CacheHelpers = indexNode.CacheHelpers;
exports.CacheManager = indexNode.CacheManager;
exports.CacheOutcome = indexNode.CacheOutcome;
exports.CacheType = indexNode.CacheType;
exports.CcsCredentialType = indexNode.CcsCredentialType;
exports.ClaimsRequestKeys = indexNode.ClaimsRequestKeys;
exports.ClientAssertionUtils = indexNode.ClientAssertionUtils;
exports.ClientAuthError = indexNode.ClientAuthError;
exports.ClientAuthErrorCodes = indexNode.ClientAuthErrorCodes;
exports.ClientAuthErrorMessage = indexNode.ClientAuthErrorMessage;
exports.ClientConfigurationError = indexNode.ClientConfigurationError;
exports.ClientConfigurationErrorCodes = indexNode.ClientConfigurationErrorCodes;
exports.ClientConfigurationErrorMessage = indexNode.ClientConfigurationErrorMessage;
exports.CodeChallengeMethodValues = indexNode.CodeChallengeMethodValues;
exports.Constants = indexNode.Constants;
exports.CredentialType = indexNode.CredentialType;
exports.DEFAULT_CRYPTO_IMPLEMENTATION = indexNode.DEFAULT_CRYPTO_IMPLEMENTATION;
exports.DEFAULT_SYSTEM_OPTIONS = indexNode.DEFAULT_SYSTEM_OPTIONS;
exports.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC = indexNode.DEFAULT_TOKEN_RENEWAL_OFFSET_SEC;
exports.DefaultStorageClass = indexNode.DefaultStorageClass;
exports.Errors = indexNode.Errors;
exports.GrantType = indexNode.GrantType;
exports.HeaderNames = indexNode.HeaderNames;
exports.HttpStatus = indexNode.HttpStatus;
exports.IntFields = indexNode.IntFields;
exports.InteractionRequiredAuthError = indexNode.InteractionRequiredAuthError;
exports.InteractionRequiredAuthErrorCodes = indexNode.InteractionRequiredAuthErrorCodes;
exports.InteractionRequiredAuthErrorMessage = indexNode.InteractionRequiredAuthErrorMessage;
exports.JsonWebTokenTypes = indexNode.JsonWebTokenTypes;
Object.defineProperty(exports, "LogLevel", {
enumerable: true,
get: function () { return indexNode.LogLevel; }
});
exports.Logger = indexNode.Logger;
exports.NetworkError = indexNode.NetworkError;
exports.OIDC_DEFAULT_SCOPES = indexNode.OIDC_DEFAULT_SCOPES;
exports.ONE_DAY_IN_MS = indexNode.ONE_DAY_IN_MS;
exports.PasswordGrantConstants = indexNode.PasswordGrantConstants;
exports.PerformanceEventStatus = indexNode.PerformanceEventStatus;
exports.PerformanceEvents = indexNode.PerformanceEvents;
exports.PersistentCacheKeys = indexNode.PersistentCacheKeys;
exports.PopTokenGenerator = indexNode.PopTokenGenerator;
exports.PromptValue = indexNode.PromptValue;
exports.ProtocolMode = indexNode.ProtocolMode;
exports.ProtocolUtils = indexNode.ProtocolUtils;
exports.RefreshTokenClient = indexNode.RefreshTokenClient;
exports.RequestParameterBuilder = indexNode.RequestParameterBuilder;
exports.ResponseHandler = indexNode.ResponseHandler;
exports.ResponseMode = indexNode.ResponseMode;
exports.ScopeSet = indexNode.ScopeSet;
exports.ServerError = indexNode.ServerError;
exports.ServerResponseType = indexNode.ServerResponseType;
exports.ServerTelemetryManager = indexNode.ServerTelemetryManager;
exports.SilentFlowClient = indexNode.SilentFlowClient;
exports.StringUtils = indexNode.StringUtils;
exports.StubbedNetworkModule = indexNode.StubbedNetworkModule;
exports.THE_FAMILY_ID = indexNode.THE_FAMILY_ID;
exports.ThrottlingConstants = indexNode.ThrottlingConstants;
exports.ThrottlingUtils = indexNode.ThrottlingUtils;
exports.TimeUtils = indexNode.TimeUtils;
exports.TokenCacheContext = indexNode.TokenCacheContext;
exports.UrlString = indexNode.UrlString;
exports.UrlUtils = indexNode.UrlUtils;
exports.buildAccountToCache = indexNode.buildAccountToCache;
exports.buildClientInfo = indexNode.buildClientInfo;
exports.buildClientInfoFromHomeAccountId = indexNode.buildClientInfoFromHomeAccountId;
exports.buildStaticAuthorityOptions = indexNode.buildStaticAuthorityOptions;
exports.buildTenantProfile = indexNode.buildTenantProfile;
exports.createAuthError = indexNode.createAuthError;
exports.createClientAuthError = indexNode.createClientAuthError;
exports.createClientConfigurationError = indexNode.createClientConfigurationError;
exports.createInteractionRequiredAuthError = indexNode.createInteractionRequiredAuthError;
exports.createNetworkError = indexNode.createNetworkError;
exports.formatAuthorityUri = indexNode.formatAuthorityUri;
exports.getClientAssertion = indexNode.getClientAssertion;
exports.getTenantIdFromIdTokenClaims = indexNode.getTenantIdFromIdTokenClaims;
exports.invoke = indexNode.invoke;
exports.invokeAsync = indexNode.invokeAsync;
exports.tenantIdMatchesHomeTenant = indexNode.tenantIdMatchesHomeTenant;
exports.updateAccountTenantProfileData = indexNode.updateAccountTenantProfileData;
exports.version = indexNode.version;
exports.JoseHeader = indexBrowser.JoseHeader;
exports.PerformanceClient = indexBrowser.PerformanceClient;
exports.StubPerformanceClient = indexBrowser.StubPerformanceClient;
//# sourceMappingURL=index.cjs.map

1
node_modules/@azure/msal-common/lib/index.cjs.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}

1
node_modules/@azure/msal-common/lib/package.json generated vendored Normal file
View File

@@ -0,0 +1 @@
{"type":"commonjs"}

View File

@@ -0,0 +1,67 @@
import { TokenClaims } from "./TokenClaims.js";
/**
* Account object with the following signature:
* - homeAccountId - Home account identifier for this account object
* - environment - Entity which issued the token represented by the domain of the issuer (e.g. login.microsoftonline.com)
* - tenantId - Full tenant or organizational id that this account belongs to
* - username - preferred_username claim of the id_token that represents this account
* - localAccountId - Local, tenant-specific account identifer for this account object, usually used in legacy cases
* - name - Full name for the account, including given name and family name
* - idToken - raw ID token
* - idTokenClaims - Object contains claims from ID token
* - nativeAccountId - The user's native account ID
* - tenantProfiles - Map of tenant profile objects for each tenant that the account has authenticated with in the browser
*/
export type AccountInfo = {
homeAccountId: string;
environment: string;
tenantId: string;
username: string;
localAccountId: string;
name?: string;
idToken?: string;
idTokenClaims?: TokenClaims & {
[key: string]: string | number | string[] | object | undefined | unknown;
};
nativeAccountId?: string;
authorityType?: string;
tenantProfiles?: Map<string, TenantProfile>;
};
/**
* Account details that vary across tenants for the same user
*/
export type TenantProfile = Pick<AccountInfo, "tenantId" | "localAccountId" | "name"> & {
/**
* - isHomeTenant - True if this is the home tenant profile of the account, false if it's a guest tenant profile
*/
isHomeTenant?: boolean;
};
export type ActiveAccountFilters = {
homeAccountId: string;
localAccountId: string;
tenantId?: string;
};
/**
* Returns true if tenantId matches the utid portion of homeAccountId
* @param tenantId
* @param homeAccountId
* @returns
*/
export declare function tenantIdMatchesHomeTenant(tenantId?: string, homeAccountId?: string): boolean;
/**
* Build tenant profile
* @param homeAccountId - Home account identifier for this account object
* @param localAccountId - Local account identifer for this account object
* @param tenantId - Full tenant or organizational id that this account belongs to
* @param idTokenClaims - Claims from the ID token
* @returns
*/
export declare function buildTenantProfile(homeAccountId: string, localAccountId: string, tenantId: string, idTokenClaims?: TokenClaims): TenantProfile;
/**
* Replaces account info that varies by tenant profile sourced from the ID token claims passed in with the tenant-specific account info
* @param baseAccountInfo
* @param idTokenClaims
* @returns
*/
export declare function updateAccountTenantProfileData(baseAccountInfo: AccountInfo, tenantProfile?: TenantProfile, idTokenClaims?: TokenClaims, idTokenSecret?: string): AccountInfo;
//# sourceMappingURL=AccountInfo.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AccountInfo.d.ts","sourceRoot":"","sources":["../../../src/account/AccountInfo.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EA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

@@ -0,0 +1,18 @@
import { TokenClaims } from "./TokenClaims.js";
/**
* Extract token by decoding the rawToken
*
* @param encodedToken
*/
export declare function extractTokenClaims(encodedToken: string, base64Decode: (input: string) => string): TokenClaims;
/**
* decode a JWT
*
* @param authToken
*/
export declare function getJWSPayload(authToken: string): string;
/**
* Determine if the token's max_age has transpired
*/
export declare function checkMaxAge(authTime: number, maxAge: number): void;
//# sourceMappingURL=AuthToken.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AuthToken.d.ts","sourceRoot":"","sources":["../../../src/account/AuthToken.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAM/C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAC9B,YAAY,EAAE,MAAM,EACpB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GACxC,WAAW,CAWb;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAkBvD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAUlE"}

View File

@@ -0,0 +1,10 @@
export type CcsCredential = {
credential: string;
type: CcsCredentialType;
};
export declare const CcsCredentialType: {
readonly HOME_ACCOUNT_ID: "home_account_id";
readonly UPN: "UPN";
};
export type CcsCredentialType = (typeof CcsCredentialType)[keyof typeof CcsCredentialType];
//# sourceMappingURL=CcsCredential.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CcsCredential.d.ts","sourceRoot":"","sources":["../../../src/account/CcsCredential.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,aAAa,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,iBAAiB,CAAC;CAC3B,CAAC;AAEF,eAAO,MAAM,iBAAiB;;;CAGpB,CAAC;AACX,MAAM,MAAM,iBAAiB,GACzB,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,OAAO,iBAAiB,CAAC,CAAC"}

View File

@@ -0,0 +1,20 @@
export type ClientAssertionConfig = {
clientId: string;
tokenEndpoint?: string;
};
export type ClientAssertionCallback = (config: ClientAssertionConfig) => Promise<string>;
/**
* Client Assertion credential for Confidential Clients
*/
export type ClientAssertion = {
assertion: string | ClientAssertionCallback;
assertionType: string;
};
/**
* Client Credentials set for Confidential Clients
*/
export type ClientCredentials = {
clientSecret?: string;
clientAssertion?: ClientAssertion;
};
//# sourceMappingURL=ClientCredentials.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ClientCredentials.d.ts","sourceRoot":"","sources":["../../../src/account/ClientCredentials.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG,CAClC,MAAM,EAAE,qBAAqB,KAC5B,OAAO,CAAC,MAAM,CAAC,CAAC;AAErB;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAAC;IAC5C,aAAa,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,eAAe,CAAC;CACrC,CAAC"}

View File

@@ -0,0 +1,19 @@
/**
* Client info object which consists of two IDs. Need to add more info here.
*/
export type ClientInfo = {
uid: string;
utid: string;
};
/**
* Function to build a client info object from server clientInfo string
* @param rawClientInfo
* @param crypto
*/
export declare function buildClientInfo(rawClientInfo: string, base64Decode: (input: string) => string): ClientInfo;
/**
* Function to build a client info object from cached homeAccountId string
* @param homeAccountId
*/
export declare function buildClientInfoFromHomeAccountId(homeAccountId: string): ClientInfo;
//# sourceMappingURL=ClientInfo.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ClientInfo.d.ts","sourceRoot":"","sources":["../../../src/account/ClientInfo.ts"],"names":[],"mappings":"AAWA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF;;;;GAIG;AACH,wBAAgB,eAAe,CAC3B,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GACxC,UAAU,CAaZ;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAC5C,aAAa,EAAE,MAAM,GACtB,UAAU,CAiBZ"}

View File

@@ -0,0 +1,84 @@
/**
* Type which describes Id Token claims known by MSAL.
*/
export type TokenClaims = {
/**
* Audience
*/
aud?: string;
/**
* Issuer
*/
iss?: string;
/**
* Issued at
*/
iat?: number;
/**
* Not valid before
*/
nbf?: number;
/**
* Immutable object identifier, this ID uniquely identifies the user across applications
*/
oid?: string;
/**
* Immutable subject identifier, this is a pairwise identifier - it is unique to a particular application ID
*/
sub?: string;
/**
* Users' tenant or '9188040d-6c67-4c5b-b112-36a304b66dad' for personal accounts.
*/
tid?: string;
/**
* Trusted Framework Policy (B2C) The name of the policy that was used to acquire the ID token.
*/
tfp?: string;
/**
* Authentication Context Class Reference (B2C) Used only with older policies.
*/
acr?: string;
ver?: string;
upn?: string;
preferred_username?: string;
login_hint?: string;
emails?: string[];
name?: string;
nonce?: string;
/**
* Expiration
*/
exp?: number;
home_oid?: string;
sid?: string;
cloud_instance_host_name?: string;
cnf?: {
kid: string;
};
x5c_ca?: string[];
ts?: number;
at?: string;
u?: string;
p?: string;
m?: string;
roles?: string[];
amr?: string[];
idp?: string;
auth_time?: number;
/**
* Region of the resource tenant
*/
tenant_region_scope?: string;
tenant_region_sub_scope?: string;
};
/**
* Gets tenantId from available ID token claims to set as credential realm with the following precedence:
* 1. tid - if the token is acquired from an Azure AD tenant tid will be present
* 2. tfp - if the token is acquired from a modern B2C tenant tfp should be present
* 3. acr - if the token is acquired from a legacy B2C tenant acr should be present
* Downcased to match the realm case-insensitive comparison requirements
* @param idTokenClaims
* @returns
*/
export declare function getTenantIdFromIdTokenClaims(idTokenClaims?: TokenClaims): string | null;
//# sourceMappingURL=TokenClaims.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TokenClaims.d.ts","sourceRoot":"","sources":["../../../src/account/TokenClaims.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC,GAAG,CAAC,EAAE;QACF,GAAG,EAAE,MAAM,CAAC;KACf,CAAC;IACF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,uBAAuB,CAAC,EAAE,MAAM,CAAC;CACpC,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CACxC,aAAa,CAAC,EAAE,WAAW,GAC5B,MAAM,GAAG,IAAI,CAOf"}

View File

@@ -0,0 +1,255 @@
import { AuthorityType } from "./AuthorityType.js";
import { OpenIdConfigResponse } from "./OpenIdConfigResponse.js";
import { IUri } from "../url/IUri.js";
import { INetworkModule } from "../network/INetworkModule.js";
import { ProtocolMode } from "./ProtocolMode.js";
import { ICacheManager } from "../cache/interface/ICacheManager.js";
import { AuthorityOptions, StaticAuthorityOptions } from "./AuthorityOptions.js";
import { CloudDiscoveryMetadata } from "./CloudDiscoveryMetadata.js";
import { RegionDiscoveryMetadata } from "./RegionDiscoveryMetadata.js";
import { AzureCloudOptions } from "../config/ClientConfiguration.js";
import { Logger } from "../logger/Logger.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
/**
* The authority class validates the authority URIs used by the user, and retrieves the OpenID Configuration Data from the
* endpoint. It will store the pertinent config data in this object for use during token calls.
* @internal
*/
export declare class Authority {
private _canonicalAuthority;
private _canonicalAuthorityUrlComponents;
protected networkInterface: INetworkModule;
protected cacheManager: ICacheManager;
private authorityOptions;
private metadata;
private regionDiscovery;
regionDiscoveryMetadata: RegionDiscoveryMetadata;
private logger;
protected performanceClient: IPerformanceClient | undefined;
protected correlationId: string;
private managedIdentity;
private static reservedTenantDomains;
constructor(authority: string, networkInterface: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, logger: Logger, correlationId: string, performanceClient?: IPerformanceClient, managedIdentity?: boolean);
/**
* Get {@link AuthorityType}
* @param authorityUri {@link IUri}
* @private
*/
private getAuthorityType;
get authorityType(): AuthorityType;
/**
* ProtocolMode enum representing the way endpoints are constructed.
*/
get protocolMode(): ProtocolMode;
/**
* Returns authorityOptions which can be used to reinstantiate a new authority instance
*/
get options(): AuthorityOptions;
/**
* A URL that is the authority set by the developer
*/
get canonicalAuthority(): string;
/**
* Sets canonical authority.
*/
set canonicalAuthority(url: string);
/**
* Get authority components.
*/
get canonicalAuthorityUrlComponents(): IUri;
/**
* Get hostname and port i.e. login.microsoftonline.com
*/
get hostnameAndPort(): string;
/**
* Get tenant for authority.
*/
get tenant(): string;
/**
* OAuth /authorize endpoint for requests
*/
get authorizationEndpoint(): string;
/**
* OAuth /token endpoint for requests
*/
get tokenEndpoint(): string;
get deviceCodeEndpoint(): string;
/**
* OAuth logout endpoint for requests
*/
get endSessionEndpoint(): string;
/**
* OAuth issuer for requests
*/
get selfSignedJwtAudience(): string;
/**
* Jwks_uri for token signing keys
*/
get jwksUri(): string;
/**
* Returns a flag indicating that tenant name can be replaced in authority {@link IUri}
* @param authorityUri {@link IUri}
* @private
*/
private canReplaceTenant;
/**
* Replaces tenant in url path with current tenant. Defaults to common.
* @param urlString
*/
private replaceTenant;
/**
* Replaces path such as tenant or policy with the current tenant or policy.
* @param urlString
*/
private replacePath;
/**
* The default open id configuration endpoint for any canonical authority.
*/
protected get defaultOpenIdConfigurationEndpoint(): string;
/**
* Boolean that returns whether or not tenant discovery has been completed.
*/
discoveryComplete(): boolean;
/**
* Perform endpoint discovery to discover aliases, preferred_cache, preferred_network
* and the /authorize, /token and logout endpoints.
*/
resolveEndpointsAsync(): Promise<void>;
/**
* Returns metadata entity from cache if it exists, otherwiser returns a new metadata entity built
* from the configured canonical authority
* @returns
*/
private getCurrentMetadataEntity;
/**
* Updates cached metadata based on metadata source and sets the instance's metadata
* property to the same value
* @param metadataEntity
* @param cloudDiscoverySource
* @param endpointMetadataResult
*/
private updateCachedMetadata;
/**
* Update AuthorityMetadataEntity with new endpoints and return where the information came from
* @param metadataEntity
*/
private updateEndpointMetadata;
/**
* Updates endpoint metadata from local sources and returns where the information was retrieved from and the metadata config
* response if the source is hardcoded metadata
* @param metadataEntity
* @returns
*/
private updateEndpointMetadataFromLocalSources;
/**
* Compares the number of url components after the domain to determine if the cached
* authority metadata can be used for the requested authority. Protects against same domain different
* authority such as login.microsoftonline.com/tenant and login.microsoftonline.com/tfp/tenant/policy
* @param metadataEntity
*/
private isAuthoritySameType;
/**
* Parse authorityMetadata config option
*/
private getEndpointMetadataFromConfig;
/**
* Gets OAuth endpoints from the given OpenID configuration endpoint.
*
* @param hasHardcodedMetadata boolean
*/
private getEndpointMetadataFromNetwork;
/**
* Get OAuth endpoints for common authorities.
*/
private getEndpointMetadataFromHardcodedValues;
/**
* Update the retrieved metadata with regional information.
* User selected Azure region will be used if configured.
*/
private updateMetadataWithRegionalInformation;
/**
* Updates the AuthorityMetadataEntity with new aliases, preferred_network and preferred_cache
* and returns where the information was retrieved from
* @param metadataEntity
* @returns AuthorityMetadataSource
*/
private updateCloudDiscoveryMetadata;
private updateCloudDiscoveryMetadataFromLocalSources;
/**
* Parse cloudDiscoveryMetadata config or check knownAuthorities
*/
private getCloudDiscoveryMetadataFromConfig;
/**
* Called to get metadata from network if CloudDiscoveryMetadata was not populated by config
*
* @param hasHardcodedMetadata boolean
*/
private getCloudDiscoveryMetadataFromNetwork;
/**
* Helper function to determine if this host is included in the knownAuthorities config option
*/
private isInKnownAuthorities;
/**
* helper function to populate the authority based on azureCloudOptions
* @param authorityString
* @param azureCloudOptions
*/
static generateAuthority(authorityString: string, azureCloudOptions?: AzureCloudOptions): string;
/**
* Creates cloud discovery metadata object from a given host
* @param host
*/
static createCloudDiscoveryMetadataFromHost(host: string): CloudDiscoveryMetadata;
/**
* helper function to generate environment from authority object
*/
getPreferredCache(): string;
/**
* Returns whether or not the provided host is an alias of this authority instance
* @param host
*/
isAlias(host: string): boolean;
/**
* Returns whether or not the provided host is an alias of a known Microsoft authority for purposes of endpoint discovery
* @param host
*/
isAliasOfKnownMicrosoftAuthority(host: string): boolean;
/**
* Checks whether the provided host is that of a public cloud authority
*
* @param authority string
* @returns bool
*/
static isPublicCloudAuthority(host: string): boolean;
/**
* Rebuild the authority string with the region
*
* @param host string
* @param region string
*/
static buildRegionalAuthorityString(host: string, region: string, queryString?: string): string;
/**
* Replace the endpoints in the metadata object with their regional equivalents.
*
* @param metadata OpenIdConfigResponse
* @param azureRegion string
*/
static replaceWithRegionalInformation(metadata: OpenIdConfigResponse, azureRegion: string): OpenIdConfigResponse;
/**
* Transform CIAM_AUTHORIY as per the below rules:
* If no path segments found and it is a CIAM authority (hostname ends with .ciamlogin.com), then transform it
*
* NOTE: The transformation path should go away once STS supports CIAM with the format: `tenantIdorDomain.ciamlogin.com`
* `ciamlogin.com` can also change in the future and we should accommodate the same
*
* @param authority
*/
static transformCIAMAuthority(authority: string): string;
}
/**
* Extract tenantId from authority
*/
export declare function getTenantFromAuthorityString(authority: string): string | undefined;
export declare function formatAuthorityUri(authorityUri: string): string;
export declare function buildStaticAuthorityOptions(authOptions: Partial<AuthorityOptions>): StaticAuthorityOptions;
//# sourceMappingURL=Authority.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Authority.d.ts","sourceRoot":"","sources":["../../../src/authority/Authority.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAEH,oBAAoB,EACvB,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EAAE,IAAI,EAAE,MAAM,gBAAgB,CAAC;AAKt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,wBAAgB,2BAA2B,CACvC,WAAW,EAAE,OAAO,CAAC,gBAAgB,CAAC,GACvC,sBAAsB,CAoBxB"}

View File

@@ -0,0 +1,19 @@
import { Authority } from "./Authority.js";
import { INetworkModule } from "../network/INetworkModule.js";
import { ICacheManager } from "../cache/interface/ICacheManager.js";
import { AuthorityOptions } from "./AuthorityOptions.js";
import { Logger } from "../logger/Logger.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
/**
* Create an authority object of the correct type based on the url
* Performs basic authority validation - checks to see if the authority is of a valid type (i.e. aad, b2c, adfs)
*
* Also performs endpoint discovery.
*
* @param authorityUri
* @param networkClient
* @param protocolMode
* @internal
*/
export declare function createDiscoveredInstance(authorityUri: string, networkClient: INetworkModule, cacheManager: ICacheManager, authorityOptions: AuthorityOptions, logger: Logger, correlationId: string, performanceClient?: IPerformanceClient): Promise<Authority>;
//# sourceMappingURL=AuthorityFactory.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AuthorityFactory.d.ts","sourceRoot":"","sources":["../../../src/authority/AuthorityFactory.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,SAAS,EAAsB,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAK9D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAIpF;;;;;;;;;;GAUG;AACH,wBAAsB,wBAAwB,CAC1C,YAAY,EAAE,MAAM,EACpB,aAAa,EAAE,cAAc,EAC7B,YAAY,EAAE,aAAa,EAC3B,gBAAgB,EAAE,gBAAgB,EAClC,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,MAAM,EACrB,iBAAiB,CAAC,EAAE,kBAAkB,GACvC,OAAO,CAAC,SAAS,CAAC,CAoCpB"}

View File

@@ -0,0 +1,44 @@
import { Logger } from "../logger/Logger.js";
import { AuthorityMetadataSource } from "../utils/Constants.js";
import { StaticAuthorityOptions } from "./AuthorityOptions.js";
import { CloudDiscoveryMetadata } from "./CloudDiscoveryMetadata.js";
import { CloudInstanceDiscoveryResponse } from "./CloudInstanceDiscoveryResponse.js";
import { OpenIdConfigResponse } from "./OpenIdConfigResponse.js";
type RawMetadata = {
endpointMetadata: {
[key: string]: OpenIdConfigResponse;
};
instanceDiscoveryMetadata: CloudInstanceDiscoveryResponse;
};
export declare const rawMetdataJSON: RawMetadata;
export declare const EndpointMetadata: {
[key: string]: OpenIdConfigResponse;
};
export declare const InstanceDiscoveryMetadata: CloudInstanceDiscoveryResponse;
export declare const InstanceDiscoveryMetadataAliases: Set<String>;
/**
* Attempts to get an aliases array from the static authority metadata sources based on the canonical authority host
* @param staticAuthorityOptions
* @param logger
* @returns
*/
export declare function getAliasesFromStaticSources(staticAuthorityOptions: StaticAuthorityOptions, logger?: Logger): string[];
/**
* Returns aliases for from the raw cloud discovery metadata passed in
* @param authorityHost
* @param rawCloudDiscoveryMetadata
* @returns
*/
export declare function getAliasesFromMetadata(authorityHost?: string, cloudDiscoveryMetadata?: CloudDiscoveryMetadata[], source?: AuthorityMetadataSource, logger?: Logger): string[] | null;
/**
* Get cloud discovery metadata for common authorities
*/
export declare function getCloudDiscoveryMetadataFromHardcodedValues(authorityHost: string): CloudDiscoveryMetadata | null;
/**
* Searches instance discovery network response for the entry that contains the host in the aliases list
* @param response
* @param authority
*/
export declare function getCloudDiscoveryMetadataFromNetworkResponse(response: CloudDiscoveryMetadata[], authorityHost: string): CloudDiscoveryMetadata | null;
export {};
//# sourceMappingURL=AuthorityMetadata.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AuthorityMetadata.d.ts","sourceRoot":"","sources":["../../../src/authority/AuthorityMetadata.ts"],"names":[],"mappings":"AAKA,OAAO,EAA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Mode } from "./ProtocolMode.js";
import { OIDCOptions } from "./OIDCOptions.js";
import { AzureRegionConfiguration } from "./AzureRegionConfiguration.js";
import { CloudInstanceDiscoveryResponse } from "./CloudInstanceDiscoveryResponse.js";
export type AuthorityOptions = {
protocolMode: ProtocolMode;
OIDCOptions?: OIDCOptions | null;
knownAuthorities: Array<string>;
cloudDiscoveryMetadata: string;
authorityMetadata: string;
skipAuthorityMetadataCache?: boolean;
azureRegionConfiguration?: AzureRegionConfiguration;
authority?: string;
};
export type StaticAuthorityOptions = Partial<Pick<AuthorityOptions, "knownAuthorities">> & {
canonicalAuthority?: string;
cloudDiscoveryMetadata?: CloudInstanceDiscoveryResponse;
};
export declare const AzureCloudInstance: {
readonly None: "none";
readonly AzurePublic: "https://login.microsoftonline.com";
readonly AzurePpe: "https://login.windows-ppe.net";
readonly AzureChina: "https://login.chinacloudapi.cn";
readonly AzureGermany: "https://login.microsoftonline.de";
readonly AzureUsGovernment: "https://login.microsoftonline.us";
};
export type AzureCloudInstance = (typeof AzureCloudInstance)[keyof typeof AzureCloudInstance];
//# sourceMappingURL=AuthorityOptions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AuthorityOptions.d.ts","sourceRoot":"","sources":["../../../src/authority/AuthorityOptions.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AACzE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAErF,MAAM,MAAM,gBAAgB,GAAG;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,WAAW,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,wBAAwB,CAAC,EAAE,wBAAwB,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,OAAO,CACxC,IAAI,CAAC,gBAAgB,EAAE,kBAAkB,CAAC,CAC7C,GAAG;IACA,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,8BAA8B,CAAC;CAC3D,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;;CAkBrB,CAAC;AACX,MAAM,MAAM,kBAAkB,GAC1B,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,OAAO,kBAAkB,CAAC,CAAC"}

View File

@@ -0,0 +1,11 @@
/**
* Authority types supported by MSAL.
*/
export declare const AuthorityType: {
readonly Default: 0;
readonly Adfs: 1;
readonly Dsts: 2;
readonly Ciam: 3;
};
export type AuthorityType = (typeof AuthorityType)[keyof typeof AuthorityType];
//# sourceMappingURL=AuthorityType.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AuthorityType.d.ts","sourceRoot":"","sources":["../../../src/authority/AuthorityType.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AACX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,OAAO,aAAa,CAAC,CAAC"}

View File

@@ -0,0 +1,2 @@
export type AzureRegion = string;
//# sourceMappingURL=AzureRegion.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AzureRegion.d.ts","sourceRoot":"","sources":["../../../src/authority/AzureRegion.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC"}

View File

@@ -0,0 +1,6 @@
import { AzureRegion } from "./AzureRegion.js";
export type AzureRegionConfiguration = {
azureRegion?: AzureRegion;
environmentRegion: string | undefined;
};
//# sourceMappingURL=AzureRegionConfiguration.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AzureRegionConfiguration.d.ts","sourceRoot":"","sources":["../../../src/authority/AzureRegionConfiguration.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAO/C,MAAM,MAAM,wBAAwB,GAAG;IACnC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,iBAAiB,EAAE,MAAM,GAAG,SAAS,CAAC;CACzC,CAAC"}

View File

@@ -0,0 +1,6 @@
export type CloudDiscoveryMetadata = {
preferred_network: string;
preferred_cache: string;
aliases: Array<string>;
};
//# sourceMappingURL=CloudDiscoveryMetadata.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CloudDiscoveryMetadata.d.ts","sourceRoot":"","sources":["../../../src/authority/CloudDiscoveryMetadata.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,sBAAsB,GAAG;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC1B,CAAC"}

View File

@@ -0,0 +1,14 @@
/**
* The OpenID Configuration Endpoint Response type. Used by the authority class to get relevant OAuth endpoints.
*/
export type CloudInstanceDiscoveryErrorResponse = {
error: String;
error_description: String;
error_codes?: Array<Number>;
timestamp?: String;
trace_id?: String;
correlation_id?: String;
error_uri?: String;
};
export declare function isCloudInstanceDiscoveryErrorResponse(response: object): boolean;
//# sourceMappingURL=CloudInstanceDiscoveryErrorResponse.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CloudInstanceDiscoveryErrorResponse.d.ts","sourceRoot":"","sources":["../../../src/authority/CloudInstanceDiscoveryErrorResponse.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,mCAAmC,GAAG;IAC9C,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,wBAAgB,qCAAqC,CACjD,QAAQ,EAAE,MAAM,GACjB,OAAO,CAKT"}

View File

@@ -0,0 +1,10 @@
import { CloudDiscoveryMetadata } from "./CloudDiscoveryMetadata.js";
/**
* The OpenID Configuration Endpoint Response type. Used by the authority class to get relevant OAuth endpoints.
*/
export type CloudInstanceDiscoveryResponse = {
tenant_discovery_endpoint: string;
metadata: Array<CloudDiscoveryMetadata>;
};
export declare function isCloudInstanceDiscoveryResponse(response: object): boolean;
//# sourceMappingURL=CloudInstanceDiscoveryResponse.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CloudInstanceDiscoveryResponse.d.ts","sourceRoot":"","sources":["../../../src/authority/CloudInstanceDiscoveryResponse.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,8BAA8B,GAAG;IACzC,yBAAyB,EAAE,MAAM,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,CAAC;CAC3C,CAAC;AAEF,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAK1E"}

View File

@@ -0,0 +1,6 @@
export type ImdsOptions = {
headers?: {
Metadata: string;
};
};
//# sourceMappingURL=ImdsOptions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ImdsOptions.d.ts","sourceRoot":"","sources":["../../../src/authority/ImdsOptions.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,WAAW,GAAG;IACtB,OAAO,CAAC,EAAE;QACN,QAAQ,EAAE,MAAM,CAAC;KACpB,CAAC;CACL,CAAC"}

View File

@@ -0,0 +1,9 @@
import { ServerResponseType } from "../utils/Constants.js";
/**
* Options for the OIDC protocol mode.
*/
export type OIDCOptions = {
serverResponseType?: ServerResponseType;
defaultScopes?: Array<string>;
};
//# sourceMappingURL=OIDCOptions.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OIDCOptions.d.ts","sourceRoot":"","sources":["../../../src/authority/OIDCOptions.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG;IACtB,kBAAkB,CAAC,EAAE,kBAAkB,CAAC;IACxC,aAAa,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACjC,CAAC"}

View File

@@ -0,0 +1,12 @@
/**
* Tenant Discovery Response which contains the relevant OAuth endpoints and data needed for authentication and authorization.
*/
export type OpenIdConfigResponse = {
authorization_endpoint: string;
token_endpoint: string;
end_session_endpoint?: string;
issuer: string;
jwks_uri: string;
};
export declare function isOpenIdConfigResponse(response: object): boolean;
//# sourceMappingURL=OpenIdConfigResponse.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"OpenIdConfigResponse.d.ts","sourceRoot":"","sources":["../../../src/authority/OpenIdConfigResponse.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IAC/B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOhE"}

View File

@@ -0,0 +1,9 @@
/**
* Protocol modes supported by MSAL.
*/
export declare const ProtocolMode: {
readonly AAD: "AAD";
readonly OIDC: "OIDC";
};
export type ProtocolMode = (typeof ProtocolMode)[keyof typeof ProtocolMode];
//# sourceMappingURL=ProtocolMode.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ProtocolMode.d.ts","sourceRoot":"","sources":["../../../src/authority/ProtocolMode.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,eAAO,MAAM,YAAY;;;CAGf,CAAC;AACX,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,CAAC"}

View File

@@ -0,0 +1,33 @@
import { INetworkModule } from "../network/INetworkModule.js";
import { RegionDiscoveryMetadata } from "./RegionDiscoveryMetadata.js";
import { ImdsOptions } from "./ImdsOptions.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
import { Logger } from "../logger/Logger.js";
export declare class RegionDiscovery {
protected networkInterface: INetworkModule;
private logger;
protected performanceClient: IPerformanceClient | undefined;
protected correlationId: string | undefined;
protected static IMDS_OPTIONS: ImdsOptions;
constructor(networkInterface: INetworkModule, logger: Logger, performanceClient?: IPerformanceClient, correlationId?: string);
/**
* Detect the region from the application's environment.
*
* @returns Promise<string | null>
*/
detectRegion(environmentRegion: string | undefined, regionDiscoveryMetadata: RegionDiscoveryMetadata): Promise<string | null>;
/**
* Make the call to the IMDS endpoint
*
* @param imdsEndpointUrl
* @returns Promise<NetworkResponse<string>>
*/
private getRegionFromIMDS;
/**
* Get the most recent version of the IMDS endpoint available
*
* @returns Promise<string | null>
*/
private getCurrentVersion;
}
//# sourceMappingURL=RegionDiscovery.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"RegionDiscovery.d.ts","sourceRoot":"","sources":["../../../src/authority/RegionDiscovery.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAQ9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAGpF,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,qBAAa,eAAe;IAExB,SAAS,CAAC,gBAAgB,EAAE,cAAc,CAAC;IAE3C,OAAO,CAAC,MAAM,CAAS;IAEvB,SAAS,CAAC,iBAAiB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IAE5D,SAAS,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAE5C,SAAS,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,CAIxC;gBAGE,gBAAgB,EAAE,cAAc,EAChC,MAAM,EAAE,MAAM,EACd,iBAAiB,CAAC,EAAE,kBAAkB,EACtC,aAAa,CAAC,EAAE,MAAM;IAQ1B;;;;OAIG;IACU,YAAY,CACrB,iBAAiB,EAAE,MAAM,GAAG,SAAS,EACrC,uBAAuB,EAAE,uBAAuB,GACjD,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAoFzB;;;;;OAKG;YACW,iBAAiB;IAe/B;;;;OAIG;YACW,iBAAiB;CA6BlC"}

View File

@@ -0,0 +1,7 @@
import { RegionDiscoveryOutcomes, RegionDiscoverySources } from "../utils/Constants.js";
export type RegionDiscoveryMetadata = {
region_used?: string;
region_source?: RegionDiscoverySources;
region_outcome?: RegionDiscoveryOutcomes;
};
//# sourceMappingURL=RegionDiscoveryMetadata.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"RegionDiscoveryMetadata.d.ts","sourceRoot":"","sources":["../../../src/authority/RegionDiscoveryMetadata.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,uBAAuB,EACvB,sBAAsB,EACzB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,MAAM,uBAAuB,GAAG;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,sBAAsB,CAAC;IACvC,cAAc,CAAC,EAAE,uBAAuB,CAAC;CAC5C,CAAC"}

View File

@@ -0,0 +1,17 @@
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
import { AccountInfo } from "../../account/AccountInfo.js";
import { LoggerOptions } from "../../config/ClientConfiguration.js";
import { NativeRequest } from "../../request/NativeRequest.js";
import { NativeSignOutRequest } from "../../request/NativeSignOutRequest.js";
import { AuthenticationResult } from "../../response/AuthenticationResult.js";
export interface INativeBrokerPlugin {
isBrokerAvailable: boolean;
setLogger(loggerOptions: LoggerOptions): void;
getAccountById(accountId: string, correlationId: string): Promise<AccountInfo>;
getAllAccounts(clientId: string, correlationId: string): Promise<AccountInfo[]>;
acquireTokenSilent(request: NativeRequest): Promise<AuthenticationResult>;
acquireTokenInteractive(request: NativeRequest, windowHandle?: Buffer): Promise<AuthenticationResult>;
signOut(request: NativeSignOutRequest): Promise<void>;
}
//# sourceMappingURL=INativeBrokerPlugin.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"INativeBrokerPlugin.d.ts","sourceRoot":"","sources":["../../../../src/broker/nativeBroker/INativeBrokerPlugin.ts"],"names":[],"mappings":";;AAKA,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wCAAwC,CAAC;AAE9E,MAAM,WAAW,mBAAmB;IAChC,iBAAiB,EAAE,OAAO,CAAC;IAC3B,SAAS,CAAC,aAAa,EAAE,aAAa,GAAG,IAAI,CAAC;IAC9C,cAAc,CACV,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,CAAC,CAAC;IACxB,cAAc,CACV,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC;IAC1B,kBAAkB,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC1E,uBAAuB,CACnB,OAAO,EAAE,aAAa,EACtB,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACjC,OAAO,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACzD"}

View File

@@ -0,0 +1,473 @@
import { AccountFilter, CredentialFilter, ValidCredentialType, AppMetadataFilter, AppMetadataCache, TokenKeys } from "./utils/CacheTypes.js";
import { CacheRecord } from "./entities/CacheRecord.js";
import { AccountEntity } from "./entities/AccountEntity.js";
import { AccessTokenEntity } from "./entities/AccessTokenEntity.js";
import { IdTokenEntity } from "./entities/IdTokenEntity.js";
import { RefreshTokenEntity } from "./entities/RefreshTokenEntity.js";
import { ICacheManager } from "./interface/ICacheManager.js";
import { AccountInfo } from "../account/AccountInfo.js";
import { AppMetadataEntity } from "./entities/AppMetadataEntity.js";
import { ServerTelemetryEntity } from "./entities/ServerTelemetryEntity.js";
import { ThrottlingEntity } from "./entities/ThrottlingEntity.js";
import { ICrypto } from "../crypto/ICrypto.js";
import { AuthorityMetadataEntity } from "./entities/AuthorityMetadataEntity.js";
import { BaseAuthRequest } from "../request/BaseAuthRequest.js";
import { Logger } from "../logger/Logger.js";
import { StoreInCache } from "../request/StoreInCache.js";
import { StaticAuthorityOptions } from "../authority/AuthorityOptions.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
/**
* Interface class which implement cache storage functions used by MSAL to perform validity checks, and store tokens.
* @internal
*/
export declare abstract class CacheManager implements ICacheManager {
protected clientId: string;
protected cryptoImpl: ICrypto;
private commonLogger;
private staticAuthorityOptions?;
constructor(clientId: string, cryptoImpl: ICrypto, logger: Logger, staticAuthorityOptions?: StaticAuthorityOptions);
/**
* fetch the account entity from the platform cache
* @param accountKey
*/
abstract getAccount(accountKey: string, logger?: Logger): AccountEntity | null;
/**
* set account entity in the platform cache
* @param account
* @param correlationId
*/
abstract setAccount(account: AccountEntity, correlationId: string): Promise<void>;
/**
* fetch the idToken entity from the platform cache
* @param idTokenKey
*/
abstract getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;
/**
* set idToken entity to the platform cache
* @param idToken
* @param correlationId
*/
abstract setIdTokenCredential(idToken: IdTokenEntity, correlationId: string): Promise<void>;
/**
* fetch the idToken entity from the platform cache
* @param accessTokenKey
*/
abstract getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;
/**
* set accessToken entity to the platform cache
* @param accessToken
* @param correlationId
*/
abstract setAccessTokenCredential(accessToken: AccessTokenEntity, correlationId: string): Promise<void>;
/**
* fetch the idToken entity from the platform cache
* @param refreshTokenKey
*/
abstract getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;
/**
* set refreshToken entity to the platform cache
* @param refreshToken
* @param correlationId
*/
abstract setRefreshTokenCredential(refreshToken: RefreshTokenEntity, correlationId: string): Promise<void>;
/**
* fetch appMetadata entity from the platform cache
* @param appMetadataKey
*/
abstract getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;
/**
* set appMetadata entity to the platform cache
* @param appMetadata
*/
abstract setAppMetadata(appMetadata: AppMetadataEntity): void;
/**
* fetch server telemetry entity from the platform cache
* @param serverTelemetryKey
*/
abstract getServerTelemetry(serverTelemetryKey: string): ServerTelemetryEntity | null;
/**
* set server telemetry entity to the platform cache
* @param serverTelemetryKey
* @param serverTelemetry
*/
abstract setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;
/**
* fetch cloud discovery metadata entity from the platform cache
* @param key
*/
abstract getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;
/**
*
*/
abstract getAuthorityMetadataKeys(): Array<string>;
/**
* set cloud discovery metadata entity to the platform cache
* @param key
* @param value
*/
abstract setAuthorityMetadata(key: string, value: AuthorityMetadataEntity): void;
/**
* fetch throttling entity from the platform cache
* @param throttlingCacheKey
*/
abstract getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;
/**
* set throttling entity to the platform cache
* @param throttlingCacheKey
* @param throttlingCache
*/
abstract setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;
/**
* Function to remove an item from cache given its key.
* @param key
*/
abstract removeItem(key: string): void;
/**
* Function which retrieves all current keys from the cache.
*/
abstract getKeys(): string[];
/**
* Function which retrieves all account keys from the cache
*/
abstract getAccountKeys(): string[];
/**
* Function which retrieves all token keys from the cache
*/
abstract getTokenKeys(): TokenKeys;
/**
* Returns all the accounts in the cache that match the optional filter. If no filter is provided, all accounts are returned.
* @param accountFilter - (Optional) filter to narrow down the accounts returned
* @returns Array of AccountInfo objects in cache
*/
getAllAccounts(accountFilter?: AccountFilter): AccountInfo[];
/**
* Gets first tenanted AccountInfo object found based on provided filters
*/
getAccountInfoFilteredBy(accountFilter: AccountFilter): AccountInfo | null;
/**
* Returns a single matching
* @param accountFilter
* @returns
*/
getBaseAccountInfo(accountFilter: AccountFilter): AccountInfo | null;
/**
* Matches filtered account entities with cached ID tokens that match the tenant profile-specific account filters
* and builds the account info objects from the matching ID token's claims
* @param cachedAccounts
* @param accountFilter
* @returns Array of AccountInfo objects that match account and tenant profile filters
*/
private buildTenantProfiles;
private getTenantedAccountInfoByFilter;
private getTenantProfilesFromAccountEntity;
private tenantProfileMatchesFilter;
private idTokenClaimsMatchTenantProfileFilter;
/**
* saves a cache record
* @param cacheRecord {CacheRecord}
* @param storeInCache {?StoreInCache}
* @param correlationId {?string} correlation id
*/
saveCacheRecord(cacheRecord: CacheRecord, correlationId: string, storeInCache?: StoreInCache): Promise<void>;
/**
* saves access token credential
* @param credential
*/
private saveAccessToken;
/**
* Retrieve account entities matching all provided tenant-agnostic filters; if no filter is set, get all account entities in the cache
* Not checking for casing as keys are all generated in lower case, remember to convert to lower case if object properties are compared
* @param accountFilter - An object containing Account properties to filter by
*/
getAccountsFilteredBy(accountFilter: AccountFilter): AccountEntity[];
/**
* Returns true if the given key matches our account key schema. Also matches homeAccountId and/or tenantId if provided
* @param key
* @param homeAccountId
* @param tenantId
* @returns
*/
isAccountKey(key: string, homeAccountId?: string, tenantId?: string): boolean;
/**
* Returns true if the given key matches our credential key schema.
* @param key
*/
isCredentialKey(key: string): boolean;
/**
* Returns whether or not the given credential entity matches the filter
* @param entity
* @param filter
* @returns
*/
credentialMatchesFilter(entity: ValidCredentialType, filter: CredentialFilter): boolean;
/**
* retrieve appMetadata matching all provided filters; if no filter is set, get all appMetadata
* @param filter
*/
getAppMetadataFilteredBy(filter: AppMetadataFilter): AppMetadataCache;
/**
* retrieve authorityMetadata that contains a matching alias
* @param filter
*/
getAuthorityMetadataByAlias(host: string): AuthorityMetadataEntity | null;
/**
* Removes all accounts and related tokens from cache.
*/
removeAllAccounts(): Promise<void>;
/**
* Removes the account and related tokens for a given account key
* @param account
*/
removeAccount(accountKey: string): Promise<void>;
/**
* Removes credentials associated with the provided account
* @param account
*/
removeAccountContext(account: AccountEntity): Promise<void>;
/**
* returns a boolean if the given credential is removed
* @param credential
*/
removeAccessToken(key: string): Promise<void>;
/**
* Removes all app metadata objects from cache.
*/
removeAppMetadata(): boolean;
/**
* Retrieve AccountEntity from cache
* @param account
*/
readAccountFromCache(account: AccountInfo): AccountEntity | null;
/**
* Retrieve IdTokenEntity from cache
* @param account {AccountInfo}
* @param tokenKeys {?TokenKeys}
* @param targetRealm {?string}
* @param performanceClient {?IPerformanceClient}
* @param correlationId {?string}
*/
getIdToken(account: AccountInfo, tokenKeys?: TokenKeys, targetRealm?: string, performanceClient?: IPerformanceClient, correlationId?: string): IdTokenEntity | null;
/**
* Gets all idTokens matching the given filter
* @param filter
* @returns
*/
getIdTokensByFilter(filter: CredentialFilter, tokenKeys?: TokenKeys): Map<string, IdTokenEntity>;
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
* @returns
*/
idTokenKeyMatchesFilter(inputKey: string, filter: CredentialFilter): boolean;
/**
* Removes idToken from the cache
* @param key
*/
removeIdToken(key: string): void;
/**
* Removes refresh token from the cache
* @param key
*/
removeRefreshToken(key: string): void;
/**
* Retrieve AccessTokenEntity from cache
* @param account {AccountInfo}
* @param request {BaseAuthRequest}
* @param tokenKeys {?TokenKeys}
* @param performanceClient {?IPerformanceClient}
* @param correlationId {?string}
*/
getAccessToken(account: AccountInfo, request: BaseAuthRequest, tokenKeys?: TokenKeys, targetRealm?: string, performanceClient?: IPerformanceClient, correlationId?: string): AccessTokenEntity | null;
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
* @param keyMustContainAllScopes
* @returns
*/
accessTokenKeyMatchesFilter(inputKey: string, filter: CredentialFilter, keyMustContainAllScopes: boolean): boolean;
/**
* Gets all access tokens matching the filter
* @param filter
* @returns
*/
getAccessTokensByFilter(filter: CredentialFilter): AccessTokenEntity[];
/**
* Helper to retrieve the appropriate refresh token from cache
* @param account {AccountInfo}
* @param familyRT {boolean}
* @param tokenKeys {?TokenKeys}
* @param performanceClient {?IPerformanceClient}
* @param correlationId {?string}
*/
getRefreshToken(account: AccountInfo, familyRT: boolean, tokenKeys?: TokenKeys, performanceClient?: IPerformanceClient, correlationId?: string): RefreshTokenEntity | null;
/**
* Validate the cache key against filter before retrieving and parsing cache value
* @param key
* @param filter
*/
refreshTokenKeyMatchesFilter(inputKey: string, filter: CredentialFilter): boolean;
/**
* Retrieve AppMetadataEntity from cache
*/
readAppMetadataFromCache(environment: string): AppMetadataEntity | null;
/**
* Return the family_id value associated with FOCI
* @param environment
* @param clientId
*/
isAppMetadataFOCI(environment: string): boolean;
/**
* helper to match account ids
* @param value
* @param homeAccountId
*/
private matchHomeAccountId;
/**
* helper to match account ids
* @param entity
* @param localAccountId
* @returns
*/
private matchLocalAccountIdFromTokenClaims;
private matchLocalAccountIdFromTenantProfile;
/**
* helper to match names
* @param entity
* @param name
* @returns true if the downcased name properties are present and match in the filter and the entity
*/
private matchName;
/**
* helper to match usernames
* @param entity
* @param username
* @returns
*/
private matchUsername;
/**
* helper to match assertion
* @param value
* @param oboAssertion
*/
private matchUserAssertionHash;
/**
* helper to match environment
* @param value
* @param environment
*/
private matchEnvironment;
/**
* helper to match credential type
* @param entity
* @param credentialType
*/
private matchCredentialType;
/**
* helper to match client ids
* @param entity
* @param clientId
*/
private matchClientId;
/**
* helper to match family ids
* @param entity
* @param familyId
*/
private matchFamilyId;
/**
* helper to match realm
* @param entity
* @param realm
*/
private matchRealm;
/**
* helper to match nativeAccountId
* @param entity
* @param nativeAccountId
* @returns boolean indicating the match result
*/
private matchNativeAccountId;
/**
* helper to match loginHint which can be either:
* 1. login_hint ID token claim
* 2. username in cached account object
* 3. upn in ID token claims
* @param entity
* @param loginHint
* @returns
*/
private matchLoginHintFromTokenClaims;
/**
* Helper to match sid
* @param entity
* @param sid
* @returns true if the sid claim is present and matches the filter
*/
private matchSid;
private matchAuthorityType;
/**
* Returns true if the target scopes are a subset of the current entity's scopes, false otherwise.
* @param entity
* @param target
*/
private matchTarget;
/**
* Returns true if the credential's tokenType or Authentication Scheme matches the one in the request, false otherwise
* @param entity
* @param tokenType
*/
private matchTokenType;
/**
* Returns true if the credential's keyId matches the one in the request, false otherwise
* @param entity
* @param keyId
*/
private matchKeyId;
/**
* returns if a given cache entity is of the type appmetadata
* @param key
*/
private isAppMetadata;
/**
* returns if a given cache entity is of the type authoritymetadata
* @param key
*/
protected isAuthorityMetadata(key: string): boolean;
/**
* returns cache key used for cloud instance metadata
*/
generateAuthorityMetadataCacheKey(authority: string): string;
/**
* Helper to convert serialized data to object
* @param obj
* @param json
*/
static toObject<T>(obj: T, json: object): T;
}
/** @internal */
export declare class DefaultStorageClass extends CacheManager {
setAccount(): Promise<void>;
getAccount(): AccountEntity;
setIdTokenCredential(): Promise<void>;
getIdTokenCredential(): IdTokenEntity;
setAccessTokenCredential(): Promise<void>;
getAccessTokenCredential(): AccessTokenEntity;
setRefreshTokenCredential(): Promise<void>;
getRefreshTokenCredential(): RefreshTokenEntity;
setAppMetadata(): void;
getAppMetadata(): AppMetadataEntity;
setServerTelemetry(): void;
getServerTelemetry(): ServerTelemetryEntity;
setAuthorityMetadata(): void;
getAuthorityMetadata(): AuthorityMetadataEntity | null;
getAuthorityMetadataKeys(): Array<string>;
setThrottlingCache(): void;
getThrottlingCache(): ThrottlingEntity;
removeItem(): boolean;
getKeys(): string[];
getAccountKeys(): string[];
getTokenKeys(): TokenKeys;
}
//# sourceMappingURL=CacheManager.d.ts.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,26 @@
import { CredentialEntity } from "./CredentialEntity.js";
import { AuthenticationScheme } from "../../utils/Constants.js";
/**
* Access token cache type
*/
export type AccessTokenEntity = CredentialEntity & {
/** Full tenant or organizational identifier that the account belongs to */
realm: string;
/** Permissions that are included in the token, or for refresh tokens, the resource identifier. */
target: string;
/** Absolute device time when entry was created in the cache. */
cachedAt: string;
/** Token expiry time, calculated based on current UTC time in seconds. Represented as a string. */
expiresOn: string;
/** Additional extended expiry time until when token is valid in case of server-side outage. Represented as string in UTC seconds. */
extendedExpiresOn?: string;
/** Used for proactive refresh */
refreshOn?: string;
/** Matches the authentication scheme for which the token was issued (i.e. Bearer or pop) */
tokenType?: AuthenticationScheme;
/** Stringified claims object */
requestedClaims?: string;
/** Matches the SHA 256 hash of the claims object included in the token request */
requestedClaimsHash?: string;
};
//# sourceMappingURL=AccessTokenEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AccessTokenEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/AccessTokenEntity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,gBAAgB,GAAG;IAC/C,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,mGAAmG;IACnG,SAAS,EAAE,MAAM,CAAC;IAClB,qIAAqI;IACrI,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,iCAAiC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4FAA4F;IAC5F,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,gCAAgC;IAChC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kFAAkF;IAClF,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC"}

View File

@@ -0,0 +1,107 @@
import { Authority } from "../../authority/Authority.js";
import { ICrypto } from "../../crypto/ICrypto.js";
import { AccountInfo, TenantProfile } from "../../account/AccountInfo.js";
import { AuthorityType } from "../../authority/AuthorityType.js";
import { Logger } from "../../logger/Logger.js";
import { TokenClaims } from "../../account/TokenClaims.js";
/**
* Type that defines required and optional parameters for an Account field (based on universal cache schema implemented by all MSALs).
*
* Key : Value Schema
*
* Key: <home_account_id>-<environment>-<realm*>
*
* Value Schema:
* {
* homeAccountId: home account identifier for the auth scheme,
* environment: entity that issued the token, represented as a full host
* realm: Full tenant or organizational identifier that the account belongs to
* localAccountId: Original tenant-specific accountID, usually used for legacy cases
* username: primary username that represents the user, usually corresponds to preferred_username in the v2 endpt
* authorityType: Accounts authority type as a string
* name: Full name for the account, including given name and family name,
* lastModificationTime: last time this entity was modified in the cache
* lastModificationApp:
* nativeAccountId: Account identifier on the native device
* tenantProfiles: Array of tenant profile objects for each tenant that the account has authenticated with in the browser
* }
* @internal
*/
export declare class AccountEntity {
homeAccountId: string;
environment: string;
realm: string;
localAccountId: string;
username: string;
authorityType: string;
clientInfo?: string;
name?: string;
lastModificationTime?: string;
lastModificationApp?: string;
cloudGraphHostName?: string;
msGraphHost?: string;
nativeAccountId?: string;
tenantProfiles?: Array<TenantProfile>;
/**
* Generate Account Id key component as per the schema: <home_account_id>-<environment>
*/
generateAccountId(): string;
/**
* Generate Account Cache Key as per the schema: <home_account_id>-<environment>-<realm*>
*/
generateAccountKey(): string;
/**
* Returns the AccountInfo interface for this account.
*/
getAccountInfo(): AccountInfo;
/**
* Returns true if the account entity is in single tenant format (outdated), false otherwise
*/
isSingleTenant(): boolean;
/**
* Generates account key from interface
* @param accountInterface
*/
static generateAccountCacheKey(accountInterface: AccountInfo): string;
/**
* Build Account cache from IdToken, clientInfo and authority/policy. Associated with AAD.
* @param accountDetails
*/
static createAccount(accountDetails: {
homeAccountId: string;
idTokenClaims?: TokenClaims;
clientInfo?: string;
cloudGraphHostName?: string;
msGraphHost?: string;
environment?: string;
nativeAccountId?: string;
tenantProfiles?: Array<TenantProfile>;
}, authority: Authority, base64Decode?: (input: string) => string): AccountEntity;
/**
* Creates an AccountEntity object from AccountInfo
* @param accountInfo
* @param cloudGraphHostName
* @param msGraphHost
* @returns
*/
static createFromAccountInfo(accountInfo: AccountInfo, cloudGraphHostName?: string, msGraphHost?: string): AccountEntity;
/**
* Generate HomeAccountId from server response
* @param serverClientInfo
* @param authType
*/
static generateHomeAccountId(serverClientInfo: string, authType: AuthorityType, logger: Logger, cryptoObj: ICrypto, idTokenClaims?: TokenClaims): string;
/**
* Validates an entity: checks for all expected params
* @param entity
*/
static isAccountEntity(entity: object): boolean;
/**
* Helper function to determine whether 2 accountInfo objects represent the same account
* @param accountA
* @param accountB
* @param compareClaims - If set to true idTokenClaims will also be compared to determine account equality
*/
static accountInfoIsEqual(accountA: AccountInfo | null, accountB: AccountInfo | null, compareClaims?: boolean): boolean;
}
//# sourceMappingURL=AccountEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AccountEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/AccountEntity.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAElD,OAAO,EACH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W,CAAC,EAAE,MAAM,CAAC;QACrB,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC;KACzC,EACD,SAAS,EAAE,SAAS,EACpB,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GACzC,aAAa;IAiFhB;;;;;;OAMG;IACH,MAAM,CAAC,qBAAqB,CACxB,WAAW,EAAE,WAAW,EACxB,kBAAkB,CAAC,EAAE,MAAM,EAC3B,WAAW,CAAC,EAAE,MAAM,GACrB,aAAa;IAyBhB;;;;OAIG;IACH,MAAM,CAAC,qBAAqB,CACxB,gBAAgB,EAAE,MAAM,EACxB,QAAQ,EAAE,aAAa,EACvB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,OAAO,EAClB,aAAa,CAAC,EAAE,WAAW,GAC5B,MAAM;IA2BT;;;OAGG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAe/C;;;;;OAKG;IACH,MAAM,CAAC,kBAAkB,CACrB,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,QAAQ,EAAE,WAAW,GAAG,IAAI,EAC5B,aAAa,CAAC,EAAE,OAAO,GACxB,OAAO;CA4Bb"}

View File

@@ -0,0 +1,12 @@
/**
* App Metadata Cache Type
*/
export type AppMetadataEntity = {
/** clientId of the application */
clientId: string;
/** entity that issued the token, represented as a full host */
environment: string;
/** Family identifier, '1' represents Microsoft Family */
familyId?: string;
};
//# sourceMappingURL=AppMetadataEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AppMetadataEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/AppMetadataEntity.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,kCAAkC;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}

View File

@@ -0,0 +1,16 @@
/** @internal */
export type AuthorityMetadataEntity = {
aliases: Array<string>;
preferred_cache: string;
preferred_network: string;
canonical_authority: string;
authorization_endpoint: string;
token_endpoint: string;
end_session_endpoint?: string;
issuer: string;
aliasesFromNetwork: boolean;
endpointsFromNetwork: boolean;
expiresAt: number;
jwks_uri: string;
};
//# sourceMappingURL=AuthorityMetadataEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AuthorityMetadataEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/AuthorityMetadataEntity.ts"],"names":[],"mappings":"AAKA,gBAAgB;AAChB,MAAM,MAAM,uBAAuB,GAAG;IAClC,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,OAAO,CAAC;IAC5B,oBAAoB,EAAE,OAAO,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACpB,CAAC"}

View File

@@ -0,0 +1,14 @@
import { IdTokenEntity } from "./IdTokenEntity.js";
import { AccessTokenEntity } from "./AccessTokenEntity.js";
import { RefreshTokenEntity } from "./RefreshTokenEntity.js";
import { AccountEntity } from "./AccountEntity.js";
import { AppMetadataEntity } from "./AppMetadataEntity.js";
/** @internal */
export type CacheRecord = {
account?: AccountEntity | null;
idToken?: IdTokenEntity | null;
accessToken?: AccessTokenEntity | null;
refreshToken?: RefreshTokenEntity | null;
appMetadata?: AppMetadataEntity | null;
};
//# sourceMappingURL=CacheRecord.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CacheRecord.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/CacheRecord.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,gBAAgB;AAChB,MAAM,MAAM,WAAW,GAAG;IACtB,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACvC,YAAY,CAAC,EAAE,kBAAkB,GAAG,IAAI,CAAC;IACzC,WAAW,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;CAC1C,CAAC"}

View File

@@ -0,0 +1,31 @@
import { CredentialType, AuthenticationScheme } from "../../utils/Constants.js";
/**
* Credential Cache Type
*/
export type CredentialEntity = {
/** Identifier for the user in their home tenant*/
homeAccountId: string;
/** Entity that issued the token, represented as a full host */
environment: string;
/** Type of credential */
credentialType: CredentialType;
/** Client ID of the application */
clientId: string;
/** Actual credential as a string */
secret: string;
/** Family ID identifier, usually only used for refresh tokens */
familyId?: string;
/** Full tenant or organizational identifier that the account belongs to */
realm?: string;
/** Permissions that are included in the token, or for refresh tokens, the resource identifier. */
target?: string;
/** Matches the SHA 256 hash of the obo_assertion for the OBO flow */
userAssertionHash?: string;
/** Matches the authentication scheme for which the token was issued (i.e. Bearer or pop) */
tokenType?: AuthenticationScheme;
/** KeyId for PoP and SSH tokens stored in the kid claim */
keyId?: string;
/** Matches the SHA 256 hash of the claims object included in the token request */
requestedClaimsHash?: string;
};
//# sourceMappingURL=CredentialEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CredentialEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/CredentialEntity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAEhF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;IACtB,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB;IACzB,cAAc,EAAE,cAAc,CAAC;IAC/B,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,oCAAoC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kGAAkG;IAClG,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,qEAAqE;IACrE,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4FAA4F;IAC5F,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC"}

View File

@@ -0,0 +1,9 @@
import { CredentialEntity } from "./CredentialEntity.js";
/**
* Id Token Cache Type
*/
export type IdTokenEntity = CredentialEntity & {
/** Full tenant or organizational identifier that the account belongs to */
realm: string;
};
//# sourceMappingURL=IdTokenEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IdTokenEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/IdTokenEntity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG;IAC3C,4EAA4E;IAC5E,KAAK,EAAE,MAAM,CAAC;CACjB,CAAC"}

View File

@@ -0,0 +1,8 @@
import { CredentialEntity } from "./CredentialEntity.js";
/**
* Refresh Token Cache Type
*/
export type RefreshTokenEntity = CredentialEntity & {
expiresOn?: string;
};
//# sourceMappingURL=RefreshTokenEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"RefreshTokenEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/RefreshTokenEntity.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAEzD;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,gBAAgB,GAAG;IAChD,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC"}

View File

@@ -0,0 +1,7 @@
export type ServerTelemetryEntity = {
failedRequests: Array<string | number>;
errors: string[];
cacheHits: number;
nativeBrokerErrorCode?: string;
};
//# sourceMappingURL=ServerTelemetryEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ServerTelemetryEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/ServerTelemetryEntity.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,qBAAqB,GAAG;IAChC,cAAc,EAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC;IACvC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC"}

View File

@@ -0,0 +1,8 @@
export type ThrottlingEntity = {
throttleTime: number;
error?: string;
errorCodes?: Array<string>;
errorMessage?: string;
subError?: string;
};
//# sourceMappingURL=ThrottlingEntity.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ThrottlingEntity.d.ts","sourceRoot":"","sources":["../../../../src/cache/entities/ThrottlingEntity.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,gBAAgB,GAAG;IAE3B,YAAY,EAAE,MAAM,CAAC;IAErB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC"}

View File

@@ -0,0 +1,167 @@
import { AccountFilter } from "../utils/CacheTypes.js";
import { CacheRecord } from "../entities/CacheRecord.js";
import { AccountEntity } from "../entities/AccountEntity.js";
import { AccountInfo } from "../../account/AccountInfo.js";
import { AppMetadataEntity } from "../entities/AppMetadataEntity.js";
import { ServerTelemetryEntity } from "../entities/ServerTelemetryEntity.js";
import { ThrottlingEntity } from "../entities/ThrottlingEntity.js";
import { IdTokenEntity } from "../entities/IdTokenEntity.js";
import { AccessTokenEntity } from "../entities/AccessTokenEntity.js";
import { RefreshTokenEntity } from "../entities/RefreshTokenEntity.js";
import { AuthorityMetadataEntity } from "../entities/AuthorityMetadataEntity.js";
import { StoreInCache } from "../../request/StoreInCache.js";
export interface ICacheManager {
/**
* fetch the account entity from the platform cache
* @param accountKey
*/
getAccount(accountKey: string): AccountEntity | null;
/**
* set account entity in the platform cache
* @param account
*/
setAccount(account: AccountEntity, correlationId: string): Promise<void>;
/**
* Returns true if the given key matches our account key schema. Also matches homeAccountId and/or tenantId if provided
* @param key
* @param homeAccountId
* @param tenantId
* @returns
*/
isAccountKey(key: string, homeAccountId?: string, tenantId?: string): boolean;
/**
* fetch the idToken entity from the platform cache
* @param idTokenKey
*/
getIdTokenCredential(idTokenKey: string): IdTokenEntity | null;
/**
* set idToken entity to the platform cache
* @param idToken
*/
setIdTokenCredential(idToken: IdTokenEntity, correlationId: string): Promise<void>;
/**
* fetch the idToken entity from the platform cache
* @param accessTokenKey
*/
getAccessTokenCredential(accessTokenKey: string): AccessTokenEntity | null;
/**
* set idToken entity to the platform cache
* @param accessToken
*/
setAccessTokenCredential(accessToken: AccessTokenEntity, correlationId: string): Promise<void>;
/**
* fetch the idToken entity from the platform cache
* @param refreshTokenKey
*/
getRefreshTokenCredential(refreshTokenKey: string): RefreshTokenEntity | null;
/**
* set idToken entity to the platform cache
* @param refreshToken
*/
setRefreshTokenCredential(refreshToken: RefreshTokenEntity, correlationId: string): Promise<void>;
/**
* fetch appMetadata entity from the platform cache
* @param appMetadataKey
*/
getAppMetadata(appMetadataKey: string): AppMetadataEntity | null;
/**
* set appMetadata entity to the platform cache
* @param appMetadata
*/
setAppMetadata(appMetadata: AppMetadataEntity): void;
/**
* fetch server telemetry entity from the platform cache
* @param serverTelemetryKey
*/
getServerTelemetry(serverTelemetryKey: string): ServerTelemetryEntity | null;
/**
* set server telemetry entity to the platform cache
* @param serverTelemetryKey
* @param serverTelemetry
*/
setServerTelemetry(serverTelemetryKey: string, serverTelemetry: ServerTelemetryEntity): void;
/**
* fetch cloud discovery metadata entity from the platform cache
* @param key
*/
getAuthorityMetadata(key: string): AuthorityMetadataEntity | null;
/**
* Get cache keys for authority metadata
*/
getAuthorityMetadataKeys(): Array<string>;
/**
* set cloud discovery metadata entity to the platform cache
* @param key
* @param value
*/
setAuthorityMetadata(key: string, value: AuthorityMetadataEntity): void;
/**
* Provide an alias to find a matching AuthorityMetadataEntity in cache
* @param host
*/
getAuthorityMetadataByAlias(host: string): AuthorityMetadataEntity | null;
/**
* given an authority generates the cache key for authorityMetadata
* @param authority
*/
generateAuthorityMetadataCacheKey(authority: string): string;
/**
* fetch throttling entity from the platform cache
* @param throttlingCacheKey
*/
getThrottlingCache(throttlingCacheKey: string): ThrottlingEntity | null;
/**
* set throttling entity to the platform cache
* @param throttlingCacheKey
* @param throttlingCache
*/
setThrottlingCache(throttlingCacheKey: string, throttlingCache: ThrottlingEntity): void;
/**
* Returns all accounts in cache
*/
getAllAccounts(): AccountInfo[];
/**
* saves a cache record
* @param cacheRecord
*/
saveCacheRecord(cacheRecord: CacheRecord, correlationId: string, storeInCache?: StoreInCache): Promise<void>;
/**
* retrieve accounts matching all provided filters; if no filter is set, get all accounts
* @param homeAccountId
* @param environment
* @param realm
*/
getAccountsFilteredBy(filter: AccountFilter): AccountEntity[];
/**
* Get AccountInfo object based on provided filters
* @param filter
*/
getAccountInfoFilteredBy(filter: AccountFilter): AccountInfo | null;
/**
* Removes all accounts and related tokens from cache.
*/
removeAllAccounts(): Promise<void>;
/**
* returns a boolean if the given account is removed
* @param account
*/
removeAccount(accountKey: string): Promise<void>;
/**
* returns a boolean if the given account is removed
* @param account
*/
removeAccountContext(account: AccountEntity): Promise<void>;
/**
* @param key
*/
removeIdToken(key: string): void;
/**
* @param key
*/
removeAccessToken(key: string): Promise<void>;
/**
* @param key
*/
removeRefreshToken(key: string): void;
}
//# sourceMappingURL=ICacheManager.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ICacheManager.d.ts","sourceRoot":"","sources":["../../../../src/cache/interface/ICacheManager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAE7D,MAAM,WAAW,aAA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,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAEjC;;OAEG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE9C;;OAEG;IACH,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CACzC"}

View File

@@ -0,0 +1,6 @@
import { TokenCacheContext } from "../persistence/TokenCacheContext.js";
export interface ICachePlugin {
beforeCacheAccess: (tokenCacheContext: TokenCacheContext) => Promise<void>;
afterCacheAccess: (tokenCacheContext: TokenCacheContext) => Promise<void>;
}
//# sourceMappingURL=ICachePlugin.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ICachePlugin.d.ts","sourceRoot":"","sources":["../../../../src/cache/interface/ICachePlugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAExE,MAAM,WAAW,YAAY;IACzB,iBAAiB,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,gBAAgB,EAAE,CAAC,iBAAiB,EAAE,iBAAiB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7E"}

View File

@@ -0,0 +1,5 @@
export interface ISerializableTokenCache {
deserialize: (cache: string) => void;
serialize: () => string;
}
//# sourceMappingURL=ISerializableTokenCache.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"ISerializableTokenCache.d.ts","sourceRoot":"","sources":["../../../../src/cache/interface/ISerializableTokenCache.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,uBAAuB;IACpC,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,SAAS,EAAE,MAAM,MAAM,CAAC;CAC3B"}

View File

@@ -0,0 +1,24 @@
import { ISerializableTokenCache } from "../interface/ISerializableTokenCache.js";
/**
* This class instance helps track the memory changes facilitating
* decisions to read from and write to the persistent cache
*/ export declare class TokenCacheContext {
/**
* boolean indicating cache change
*/
hasChanged: boolean;
/**
* serializable token cache interface
*/
cache: ISerializableTokenCache;
constructor(tokenCache: ISerializableTokenCache, hasChanged: boolean);
/**
* boolean which indicates the changes in cache
*/
get cacheHasChanged(): boolean;
/**
* function to retrieve the token cache
*/
get tokenCache(): ISerializableTokenCache;
}
//# sourceMappingURL=TokenCacheContext.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"TokenCacheContext.d.ts","sourceRoot":"","sources":["../../../../src/cache/persistence/TokenCacheContext.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAElF;;;GAGG,CAAC,qBAAa,iBAAiB;IAC9B;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,KAAK,EAAE,uBAAuB,CAAC;gBAEnB,UAAU,EAAE,uBAAuB,EAAE,UAAU,EAAE,OAAO;IAKpE;;OAEG;IACH,IAAI,eAAe,IAAI,OAAO,CAE7B;IAED;;OAEG;IACH,IAAI,UAAU,IAAI,uBAAuB,CAExC;CACJ"}

View File

@@ -0,0 +1,95 @@
import { CloudDiscoveryMetadata } from "../../authority/CloudDiscoveryMetadata.js";
import { OpenIdConfigResponse } from "../../authority/OpenIdConfigResponse.js";
import { AuthenticationScheme } from "../../utils/Constants.js";
import { AccessTokenEntity } from "../entities/AccessTokenEntity.js";
import { AppMetadataEntity } from "../entities/AppMetadataEntity.js";
import { AuthorityMetadataEntity } from "../entities/AuthorityMetadataEntity.js";
import { CredentialEntity } from "../entities/CredentialEntity.js";
import { IdTokenEntity } from "../entities/IdTokenEntity.js";
import { RefreshTokenEntity } from "../entities/RefreshTokenEntity.js";
/**
* Cache Key: <home_account_id>-<environment>-<credential_type>-<client_id or familyId>-<realm>-<scopes>-<claims hash>-<scheme>
* IdToken Example: uid.utid-login.microsoftonline.com-idtoken-app_client_id-contoso.com
* AccessToken Example: uid.utid-login.microsoftonline.com-accesstoken-app_client_id-contoso.com-scope1 scope2--pop
* RefreshToken Example: uid.utid-login.microsoftonline.com-refreshtoken-1-contoso.com
* @param credentialEntity
* @returns
*/
export declare function generateCredentialKey(credentialEntity: CredentialEntity): string;
/**
* Create IdTokenEntity
* @param homeAccountId
* @param authenticationResult
* @param clientId
* @param authority
*/
export declare function createIdTokenEntity(homeAccountId: string, environment: string, idToken: string, clientId: string, tenantId: string): IdTokenEntity;
/**
* Create AccessTokenEntity
* @param homeAccountId
* @param environment
* @param accessToken
* @param clientId
* @param tenantId
* @param scopes
* @param expiresOn
* @param extExpiresOn
*/
export declare function createAccessTokenEntity(homeAccountId: string, environment: string, accessToken: string, clientId: string, tenantId: string, scopes: string, expiresOn: number, extExpiresOn: number, base64Decode: (input: string) => string, refreshOn?: number, tokenType?: AuthenticationScheme, userAssertionHash?: string, keyId?: string, requestedClaims?: string, requestedClaimsHash?: string): AccessTokenEntity;
/**
* Create RefreshTokenEntity
* @param homeAccountId
* @param authenticationResult
* @param clientId
* @param authority
*/
export declare function createRefreshTokenEntity(homeAccountId: string, environment: string, refreshToken: string, clientId: string, familyId?: string, userAssertionHash?: string, expiresOn?: number): RefreshTokenEntity;
export declare function isCredentialEntity(entity: object): boolean;
/**
* Validates an entity: checks for all expected params
* @param entity
*/
export declare function isAccessTokenEntity(entity: object): boolean;
/**
* Validates an entity: checks for all expected params
* @param entity
*/
export declare function isIdTokenEntity(entity: object): boolean;
/**
* Validates an entity: checks for all expected params
* @param entity
*/
export declare function isRefreshTokenEntity(entity: object): boolean;
/**
* validates if a given cache entry is "Telemetry", parses <key,value>
* @param key
* @param entity
*/
export declare function isServerTelemetryEntity(key: string, entity?: object): boolean;
/**
* validates if a given cache entry is "Throttling", parses <key,value>
* @param key
* @param entity
*/
export declare function isThrottlingEntity(key: string, entity?: object): boolean;
/**
* Generate AppMetadata Cache Key as per the schema: appmetadata-<environment>-<client_id>
*/
export declare function generateAppMetadataKey({ environment, clientId, }: AppMetadataEntity): string;
export declare function isAppMetadataEntity(key: string, entity: object): boolean;
/**
* Validates an entity: checks for all expected params
* @param entity
*/
export declare function isAuthorityMetadataEntity(key: string, entity: object): boolean;
/**
* Reset the exiresAt value
*/
export declare function generateAuthorityMetadataExpiresAt(): number;
export declare function updateAuthorityEndpointMetadata(authorityMetadata: AuthorityMetadataEntity, updatedValues: OpenIdConfigResponse, fromNetwork: boolean): void;
export declare function updateCloudDiscoveryMetadata(authorityMetadata: AuthorityMetadataEntity, updatedValues: CloudDiscoveryMetadata, fromNetwork: boolean): void;
/**
* Returns whether or not the data needs to be refreshed
*/
export declare function isAuthorityMetadataExpired(metadata: AuthorityMetadataEntity): boolean;
//# sourceMappingURL=CacheHelpers.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CacheHelpers.d.ts","sourceRoot":"","sources":["../../../../src/cache/utils/CacheHelpers.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,sBAAsB,EAAE,MAAM,2CAA2C,CAAC;AACnF,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAK/E,OAAO,EAGH,oBAAoB,EAKvB,MAAM,0BAA0B,CAAC;AAElC,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE,OAAO,EAAE,uBAAuB,EAAE,MAAM,wCAAwC,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AAEvE;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACjC,gBAAgB,EAAE,gBAAgB,GACnC,MAAM,CAUR;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,E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;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAYxE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,EACnC,WAAW,EACX,QAAQ,GACX,EAAE,iBAAiB,GAAG,MAAM,CAS5B;AAMD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAUxE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,MAAM,GACf,OAAO,CAmBT;AAED;;GAEG;AACH,wBAAgB,kCAAkC,IAAI,MAAM,CAK3D;AAED,wBAAgB,+BAA+B,CAC3C,iBAAiB,EAAE,uBAAuB,EAC1C,aAAa,EAAE,oBAAoB,EACnC,WAAW,EAAE,OAAO,GACrB,IAAI,CAQN;AAED,wBAAgB,4BAA4B,CACxC,iBAAiB,EAAE,uBAAuB,EAC1C,aAAa,EAAE,sBAAsB,EACrC,WAAW,EAAE,OAAO,GACrB,IAAI,CAKN;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACtC,QAAQ,EAAE,uBAAuB,GAClC,OAAO,CAET"}

View File

@@ -0,0 +1,70 @@
import { AccountEntity } from "../entities/AccountEntity.js";
import { IdTokenEntity } from "../entities/IdTokenEntity.js";
import { AccessTokenEntity } from "../entities/AccessTokenEntity.js";
import { RefreshTokenEntity } from "../entities/RefreshTokenEntity.js";
import { AppMetadataEntity } from "../entities/AppMetadataEntity.js";
import { ServerTelemetryEntity } from "../entities/ServerTelemetryEntity.js";
import { ThrottlingEntity } from "../entities/ThrottlingEntity.js";
import { AuthorityMetadataEntity } from "../entities/AuthorityMetadataEntity.js";
import { AuthenticationScheme } from "../../utils/Constants.js";
import { ScopeSet } from "../../request/ScopeSet.js";
import { AccountInfo } from "../../account/AccountInfo.js";
/** @internal */
export type AccountCache = Record<string, AccountEntity>;
/** @internal */
export type IdTokenCache = Record<string, IdTokenEntity>;
/** @internal */
export type AccessTokenCache = Record<string, AccessTokenEntity>;
/** @internal */
export type RefreshTokenCache = Record<string, RefreshTokenEntity>;
/** @internal */
export type AppMetadataCache = Record<string, AppMetadataEntity>;
/**
* Object type of all accepted cache types
* @internal
*/
export type ValidCacheType = AccountEntity | IdTokenEntity | AccessTokenEntity | RefreshTokenEntity | AppMetadataEntity | AuthorityMetadataEntity | ServerTelemetryEntity | ThrottlingEntity | string;
/**
* Object type of all credential types
* @internal
*/
export type ValidCredentialType = IdTokenEntity | AccessTokenEntity | RefreshTokenEntity;
/**
* Account: <home_account_id>-<environment>-<realm*>
*/
export type AccountFilter = Omit<Partial<AccountInfo>, "idToken" | "idTokenClaims"> & {
realm?: string;
loginHint?: string;
sid?: string;
isHomeTenant?: boolean;
};
export type TenantProfileFilter = Pick<AccountFilter, "localAccountId" | "loginHint" | "name" | "sid" | "isHomeTenant" | "username">;
/**
* Credential: <home_account_id*>-<environment>-<credential_type>-<client_id>-<realm*>-<target*>-<scheme*>
*/
export type CredentialFilter = {
homeAccountId?: string;
environment?: string;
credentialType?: string;
clientId?: string;
familyId?: string;
realm?: string;
target?: ScopeSet;
userAssertionHash?: string;
tokenType?: AuthenticationScheme;
keyId?: string;
requestedClaimsHash?: string;
};
/**
* AppMetadata: appmetadata-<environment>-<client_id>
*/
export type AppMetadataFilter = {
environment?: string;
clientId?: string;
};
export type TokenKeys = {
idToken: string[];
accessToken: string[];
refreshToken: string[];
};
//# sourceMappingURL=CacheTypes.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"CacheTypes.d.ts","sourceRoot":"","sources":["../../../../src/cache/utils/CacheTypes.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AACrE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;IACA,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAClC,aAAa,EACX,gBAAgB,GAChB,WAAW,GACX,MAAM,GACN,KAAK,GACL,cAAc,GACd,UAAU,CACf,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,QAAQ,CAAC;IAClB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,oBAAoB,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC5B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACpB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B,CAAC"}

View File

@@ -0,0 +1,76 @@
import { BaseClient } from "./BaseClient.js";
import { CommonAuthorizationUrlRequest } from "../request/CommonAuthorizationUrlRequest.js";
import { CommonAuthorizationCodeRequest } from "../request/CommonAuthorizationCodeRequest.js";
import { ClientConfiguration } from "../config/ClientConfiguration.js";
import { AuthenticationResult } from "../response/AuthenticationResult.js";
import { ServerAuthorizationCodeResponse } from "../response/ServerAuthorizationCodeResponse.js";
import { CommonEndSessionRequest } from "../request/CommonEndSessionRequest.js";
import { AuthorizationCodePayload } from "../response/AuthorizationCodePayload.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
/**
* Oauth2.0 Authorization Code client
* @internal
*/
export declare class AuthorizationCodeClient extends BaseClient {
protected includeRedirectUri: boolean;
private oidcDefaultScopes;
constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient);
/**
* Creates the URL of the authorization request letting the user input credentials and consent to the
* application. The URL target the /authorize endpoint of the authority configured in the
* application object.
*
* Once the user inputs their credentials and consents, the authority will send a response to the redirect URI
* sent in the request and should contain an authorization code, which can then be used to acquire tokens via
* acquireToken(AuthorizationCodeRequest)
* @param request
*/
getAuthCodeUrl(request: CommonAuthorizationUrlRequest): Promise<string>;
/**
* API to acquire a token in exchange of 'authorization_code` acquired by the user in the first leg of the
* authorization_code_grant
* @param request
*/
acquireToken(request: CommonAuthorizationCodeRequest, authCodePayload?: AuthorizationCodePayload): Promise<AuthenticationResult>;
/**
* Handles the hash fragment response from public client code request. Returns a code response used by
* the client to exchange for a token in acquireToken.
* @param hashFragment
*/
handleFragmentResponse(serverParams: ServerAuthorizationCodeResponse, cachedState: string): AuthorizationCodePayload;
/**
* Used 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 authorityUri
*/
getLogoutUri(logoutRequest: CommonEndSessionRequest): string;
/**
* Executes POST request to token endpoint
* @param authority
* @param request
*/
private executeTokenRequest;
/**
* Generates a map for all the params to be sent to the service
* @param request
*/
private createTokenRequestBody;
/**
* This API validates the `AuthorizationCodeUrlRequest` and creates a URL
* @param request
*/
private createAuthCodeUrlQueryString;
/**
* This API validates the `EndSessionRequest` and creates a URL
* @param request
*/
private createLogoutUrlQueryString;
private addExtraQueryParams;
/**
* Helper to get sid from account. Returns null if idTokenClaims are not present or sid is not present.
* @param account
*/
private extractAccountSid;
private extractLoginHint;
}
//# sourceMappingURL=AuthorizationCodeClient.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AuthorizationCodeClient.d.ts","sourceRoot":"","sources":["../../../src/client/AuthorizationCodeClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,6BAA6B,EAAE,MAAM,6CAA6C,CAAC;AAC5F,OAAO,EAAE,8BAA8B,EAAE,MAAM,8CAA8C,CAAC;AAW9F,OAAO,EACH,mBAAmB,EAEtB,MAAM,kCAAkC,CAAC;AAI1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAO3E,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AACjG,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAGhF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AAanF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAMpF;;;GAGG;AACH,qBAAa,uBAAwB,SAAQ,UAAU;IAEnD,SAAS,CAAC,kBAAkB,EAAE,OAAO,CAAQ;IAC7C,OAAO,CAAC,iBAAiB,CAAC;gBAGtB,aAAa,EAAE,mBAAmB,EAClC,iBAAiB,CAAC,EAAE,kBAAkB;IAO1C;;;;;;;;;OASG;IACG,cAAc,CAChB,OAAO,EAAE,6BAA6B,GACvC,OAAO,CAAC,MAAM,CAAC;IAoBlB;;;;OAIG;IACG,YAAY,CACd,OAAO,EAAE,8BAA8B,EACvC,eAAe,CAAC,EAAE,wBAAwB,GAC3C,OAAO,CAAC,oBAAoB,CAAC;IAwDhC;;;;OAIG;IACH,sBAAsB,CAClB,YAAY,EAAE,+BAA+B,EAC7C,WAAW,EAAE,MAAM,GACpB,wBAAwB;IA2B3B;;;;OAIG;IACH,YAAY,CAAC,aAAa,EAAE,uBAAuB,GAAG,MAAM;IAgB5D;;;;OAIG;YACW,mBAAmB;IA0EjC;;;OAGG;YACW,sBAAsB;IAoMpC;;;OAGG;YACW,4BAA4B;IA4P1C;;;OAGG;IACH,OAAO,CAAC,0BAA0B;IAmClC,OAAO,CAAC,mBAAmB;IAqB3B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAIzB,OAAO,CAAC,gBAAgB;CAG3B"}

View File

@@ -0,0 +1,59 @@
import { ClientConfiguration, CommonClientConfiguration } from "../config/ClientConfiguration.js";
import { INetworkModule, NetworkRequestOptions } from "../network/INetworkModule.js";
import { NetworkResponse } from "../network/NetworkResponse.js";
import { ICrypto } from "../crypto/ICrypto.js";
import { Authority } from "../authority/Authority.js";
import { Logger } from "../logger/Logger.js";
import { ServerAuthorizationTokenResponse } from "../response/ServerAuthorizationTokenResponse.js";
import { CacheManager } from "../cache/CacheManager.js";
import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
import { RequestThumbprint } from "../network/RequestThumbprint.js";
import { CcsCredential } from "../account/CcsCredential.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
import { BaseAuthRequest } from "../request/BaseAuthRequest.js";
/**
* Base application class which will construct requests to send to and handle responses from the Microsoft STS using the authorization code flow.
* @internal
*/
export declare abstract class BaseClient {
logger: Logger;
protected config: CommonClientConfiguration;
protected cryptoUtils: ICrypto;
protected cacheManager: CacheManager;
protected networkClient: INetworkModule;
protected serverTelemetryManager: ServerTelemetryManager | null;
authority: Authority;
protected performanceClient?: IPerformanceClient;
protected constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient);
/**
* Creates default headers for requests to token endpoint
*/
protected createTokenRequestHeaders(ccsCred?: CcsCredential): Record<string, string>;
/**
* Http post to token endpoint
* @param tokenEndpoint
* @param queryString
* @param headers
* @param thumbprint
*/
protected executePostToTokenEndpoint(tokenEndpoint: string, queryString: string, headers: Record<string, string>, thumbprint: RequestThumbprint, correlationId: string, queuedEvent?: string): Promise<NetworkResponse<ServerAuthorizationTokenResponse>>;
/**
* Wraps sendPostRequestAsync with necessary preflight and postflight logic
* @param thumbprint - Request thumbprint for throttling
* @param tokenEndpoint - Endpoint to make the POST to
* @param options - Body and Headers to include on the POST request
* @param correlationId - CorrelationId for telemetry
*/
sendPostRequest<T extends ServerAuthorizationTokenResponse>(thumbprint: RequestThumbprint, tokenEndpoint: string, options: NetworkRequestOptions, correlationId: string): Promise<NetworkResponse<T>>;
/**
* Updates the authority object of the client. Endpoint discovery must be completed.
* @param updatedAuthority
*/
updateAuthority(cloudInstanceHostname: string, correlationId: string): Promise<void>;
/**
* Creates query string for the /token request
* @param request
*/
createTokenQueryParameters(request: BaseAuthRequest): string;
}
//# sourceMappingURL=BaseClient.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"BaseClient.d.ts","sourceRoot":"","sources":["../../../src/client/BaseClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,mBAAmB,EAEnB,yBAAyB,EAC5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACH,cAAc,EACd,qBAAqB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,EAAE,gCAAgC,EAAE,MAAM,iDAAiD,CAAC;AACnG,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAqB,MAAM,6BAA6B,CAAC;AAE/E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAEpF,OAAO,EAAE,eAAe,E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AAE,eAAe,GAAG,MAAM;CAuB/D"}

View File

@@ -0,0 +1,36 @@
import { ClientConfiguration } from "../config/ClientConfiguration.js";
import { BaseClient } from "./BaseClient.js";
import { CommonRefreshTokenRequest } from "../request/CommonRefreshTokenRequest.js";
import { AuthenticationResult } from "../response/AuthenticationResult.js";
import { CommonSilentFlowRequest } from "../request/CommonSilentFlowRequest.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
/**
* OAuth2.0 refresh token client
* @internal
*/
export declare class RefreshTokenClient extends BaseClient {
constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient);
acquireToken(request: CommonRefreshTokenRequest): Promise<AuthenticationResult>;
/**
* Gets cached refresh token and attaches to request, then calls acquireToken API
* @param request
*/
acquireTokenByRefreshToken(request: CommonSilentFlowRequest): Promise<AuthenticationResult>;
/**
* makes a network call to acquire tokens by exchanging RefreshToken available in userCache; throws if refresh token is not cached
* @param request
*/
private acquireTokenWithCachedRefreshToken;
/**
* Constructs the network message and makes a NW call to the underlying secure token service
* @param request
* @param authority
*/
private executeTokenRequest;
/**
* Helper function to create the token request body
* @param request
*/
private createTokenRequestBody;
}
//# sourceMappingURL=RefreshTokenClient.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"RefreshTokenClient.d.ts","sourceRoot":"","sources":["../../../src/client/RefreshTokenClient.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,mBAAmB,EAEtB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,yBAAyB,EAAE,MAAM,yCAAyC,CAAC;AAYpF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAK3E,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAoBhF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAQpF;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,UAAU;gBAE1C,aAAa,EAAE,mBAAmB,EAClC,iBAAiB,CAAC,EAAE,kBAAkB;IAI7B,YAAY,CACrB,OAAO,EAAE,yBAAyB,GACnC,OAAO,CAAC,oBAAoB,CAAC;IA8ChC;;;OAGG;IACU,0BAA0B,CACnC,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,oBAAoB,CAAC;IAsEhC;;;OAGG;YACW,kCAAkC;IAyFhD;;;;OAIG;YACW,mBAAmB;IAuDjC;;;OAGG;YACW,sBAAsB;CAyJvC"}

View File

@@ -0,0 +1,22 @@
import { BaseClient } from "./BaseClient.js";
import { ClientConfiguration } from "../config/ClientConfiguration.js";
import { CommonSilentFlowRequest } from "../request/CommonSilentFlowRequest.js";
import { AuthenticationResult } from "../response/AuthenticationResult.js";
import { CacheOutcome } from "../utils/Constants.js";
import { IPerformanceClient } from "../telemetry/performance/IPerformanceClient.js";
/** @internal */
export declare class SilentFlowClient extends BaseClient {
constructor(configuration: ClientConfiguration, performanceClient?: IPerformanceClient);
/**
* Retrieves token from cache or throws an error if it must be refreshed.
* @param request
*/
acquireCachedToken(request: CommonSilentFlowRequest): Promise<[AuthenticationResult, CacheOutcome]>;
private setCacheOutcome;
/**
* Helper function to build response object from the CacheRecord
* @param cacheRecord
*/
private generateResultFromCacheRecord;
}
//# sourceMappingURL=SilentFlowClient.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"SilentFlowClient.d.ts","sourceRoot":"","sources":["../../../src/client/SilentFlowClient.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AAChF,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAQ3E,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AAQpF,gBAAgB;AAChB,qBAAa,gBAAiB,SAAQ,UAAU;gBAExC,aAAa,EAAE,mBAAmB,EAClC,iBAAiB,CAAC,EAAE,kBAAkB;IAK1C;;;OAGG;IACG,kBAAkB,CACpB,OAAO,EAAE,uBAAuB,GACjC,OAAO,CAAC,CAAC,oBAAoB,EAAE,YAAY,CAAC,CAAC;IA+GhD,OAAO,CAAC,eAAe;IAkBvB;;;OAGG;YACW,6BAA6B;CAqC9C"}

View File

@@ -0,0 +1,39 @@
/**
* Extensibility interface, which allows the app developer to return a token, based on the passed-in parameters, instead of fetching tokens from
* the Identity Provider (AAD).
* Developers need to construct and return an AppTokenProviderResult object back to MSAL. MSAL will cache the token response
* in the same way it would do if the result were comming from AAD.
* This extensibility point is only defined for the client_credential flow, i.e. acquireTokenByClientCredential and
* meant for Azure SDK to enhance Managed Identity support.
*/
export interface IAppTokenProvider {
(appTokenProviderParameters: AppTokenProviderParameters): Promise<AppTokenProviderResult>;
}
/**
* Input object for the IAppTokenProvider extensiblity. MSAL will create this object, which can be used
* to help create an AppTokenProviderResult.
*
* - correlationId - the correlation Id associated with the request
* - tenantId - the tenant Id for which the token must be provided
* - scopes - the scopes for which the token must be provided
* - claims - any extra claims that the token must satisfy
*/
export type AppTokenProviderParameters = {
readonly correlationId?: string;
readonly tenantId: string;
readonly scopes: Array<string>;
readonly claims?: string;
};
/**
* Output object for IAppTokenProvider extensiblity.
*
* - accessToken - the actual access token, typically in JWT format, that satisfies the request data AppTokenProviderParameters
* - expiresInSeconds - how long the tokens has before expiry, in seconds. Similar to the "expires_in" field in an AAD token response.
* - refreshInSeconds - how long the token has before it should be proactively refreshed. Similar to the "refresh_in" field in an AAD token response.
*/
export type AppTokenProviderResult = {
accessToken: string;
expiresInSeconds: number;
refreshInSeconds?: number;
};
//# sourceMappingURL=AppTokenProvider.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"AppTokenProvider.d.ts","sourceRoot":"","sources":["../../../src/config/AppTokenProvider.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,MAAM,WAAW,iBAAiB;IAC9B,CACI,0BAA0B,EAAE,0BAA0B,GACvD,OAAO,CAAC,sBAAsB,CAAC,CAAC;CACtC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,0BAA0B,GAAG;IACrC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC/B,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACjC,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC"}

View File

@@ -0,0 +1,155 @@
import { INetworkModule } from "../network/INetworkModule.js";
import { ICrypto } from "../crypto/ICrypto.js";
import { ILoggerCallback, LogLevel } from "../logger/Logger.js";
import { Authority } from "../authority/Authority.js";
import { AzureCloudInstance } from "../authority/AuthorityOptions.js";
import { CacheManager } from "../cache/CacheManager.js";
import { ServerTelemetryManager } from "../telemetry/server/ServerTelemetryManager.js";
import { ICachePlugin } from "../cache/interface/ICachePlugin.js";
import { ISerializableTokenCache } from "../cache/interface/ISerializableTokenCache.js";
import { ClientCredentials } from "../account/ClientCredentials.js";
/**
* Use the configuration object to configure MSAL Modules and initialize the base interfaces for MSAL.
*
* This object allows you to configure important elements of MSAL functionality:
* - authOptions - Authentication for application
* - cryptoInterface - Implementation of crypto functions
* - libraryInfo - Library metadata
* - telemetry - Telemetry options and data
* - loggerOptions - Logging for application
* - networkInterface - Network implementation
* - storageInterface - Storage implementation
* - systemOptions - Additional library options
* - clientCredentials - Credentials options for confidential clients
* @internal
*/
export type ClientConfiguration = {
authOptions: AuthOptions;
systemOptions?: SystemOptions;
loggerOptions?: LoggerOptions;
cacheOptions?: CacheOptions;
storageInterface?: CacheManager;
networkInterface?: INetworkModule;
cryptoInterface?: ICrypto;
clientCredentials?: ClientCredentials;
libraryInfo?: LibraryInfo;
telemetry?: TelemetryOptions;
serverTelemetryManager?: ServerTelemetryManager | null;
persistencePlugin?: ICachePlugin | null;
serializableCache?: ISerializableTokenCache | null;
};
export type CommonClientConfiguration = {
authOptions: Required<AuthOptions>;
systemOptions: Required<SystemOptions>;
loggerOptions: Required<LoggerOptions>;
cacheOptions: Required<CacheOptions>;
storageInterface: CacheManager;
networkInterface: INetworkModule;
cryptoInterface: Required<ICrypto>;
libraryInfo: LibraryInfo;
telemetry: Required<TelemetryOptions>;
serverTelemetryManager: ServerTelemetryManager | null;
clientCredentials: ClientCredentials;
persistencePlugin: ICachePlugin | null;
serializableCache: ISerializableTokenCache | null;
};
/**
* Use this to configure the auth options in the ClientConfiguration object
*
* - clientId - Client ID of your app registered with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview in Microsoft Identity Platform
* - authority - You can configure a specific authority, defaults to " " or "https://login.microsoftonline.com/common"
* - knownAuthorities - An array of URIs that are known to be valid. Used in B2C scenarios.
* - cloudDiscoveryMetadata - A string containing the cloud discovery response. Used in AAD scenarios.
* - clientCapabilities - Array of capabilities which will be added to the claims.access_token.xms_cc request property on every network request.
* - protocolMode - Enum that represents the protocol that msal follows. Used for configuring proper endpoints.
* - skipAuthorityMetadataCache - A flag to choose whether to use or not use the local metadata cache during authority initialization. Defaults to false.
* - instanceAware - A flag of whether the STS will send back additional parameters to specify where the tokens should be retrieved from.
* - redirectUri - The redirect URI where authentication responses can be received by your application. It must exactly match one of the redirect URIs registered in the Azure portal.
* @internal
*/
export type AuthOptions = {
clientId: string;
authority: Authority;
redirectUri: string;
clientCapabilities?: Array<string>;
azureCloudOptions?: AzureCloudOptions;
skipAuthorityMetadataCache?: boolean;
instanceAware?: boolean;
};
/**
* Use this to configure token renewal info in the Configuration object
*
* - tokenRenewalOffsetSeconds - Sets the window of offset needed to renew the token before expiry
*/
export type SystemOptions = {
tokenRenewalOffsetSeconds?: number;
preventCorsPreflight?: boolean;
};
/**
* Use this to configure the logging that MSAL does, by configuring logger options in the Configuration object
*
* - loggerCallback - Callback for logger
* - piiLoggingEnabled - Sets whether pii logging is enabled
* - logLevel - Sets the level at which logging happens
* - correlationId - Sets the correlationId printed by the logger
*/
export type LoggerOptions = {
loggerCallback?: ILoggerCallback;
piiLoggingEnabled?: boolean;
logLevel?: LogLevel;
correlationId?: string;
};
/**
* Use this to configure credential cache preferences in the ClientConfiguration object
*
* - claimsBasedCachingEnabled - Sets whether tokens should be cached based on the claims hash. Default is false.
*/
export type CacheOptions = {
claimsBasedCachingEnabled?: boolean;
};
/**
* Library-specific options
*/
export type LibraryInfo = {
sku: string;
version: string;
cpu: string;
os: string;
};
/**
* AzureCloudInstance specific options
*
* - azureCloudInstance - string enum providing short notation for soverign and public cloud authorities
* - tenant - provision to provide the tenant info
*/
export type AzureCloudOptions = {
azureCloudInstance: AzureCloudInstance;
tenant?: string;
};
export type TelemetryOptions = {
application: ApplicationTelemetry;
};
/**
* Telemetry information sent on request
* - appName: Unique string name of an application
* - appVersion: Version of the application using MSAL
*/
export type ApplicationTelemetry = {
appName: string;
appVersion: string;
};
export declare const DEFAULT_SYSTEM_OPTIONS: Required<SystemOptions>;
/**
* Function that sets the default options when not explicitly configured from app developer
*
* @param Configuration
*
* @returns Configuration
*/
export declare function buildClientConfiguration({ authOptions: userAuthOptions, systemOptions: userSystemOptions, loggerOptions: userLoggerOption, cacheOptions: userCacheOptions, storageInterface: storageImplementation, networkInterface: networkImplementation, cryptoInterface: cryptoImplementation, clientCredentials: clientCredentials, libraryInfo: libraryInfo, telemetry: telemetry, serverTelemetryManager: serverTelemetryManager, persistencePlugin: persistencePlugin, serializableCache: serializableCache, }: ClientConfiguration): CommonClientConfiguration;
/**
* Returns true if config has protocolMode set to ProtocolMode.OIDC, false otherwise
* @param ClientConfiguration
*/
export declare function isOidcProtocolMode(config: ClientConfiguration): boolean;
//# sourceMappingURL=ClientConfiguration.d.ts.map

Some files were not shown because too many files have changed in this diff Show More