Add extracted source directory and README navigation

This commit is contained in:
Shawn Bot
2026-03-31 14:56:06 +00:00
parent 6252bb6eb5
commit 91e01d755b
4757 changed files with 984951 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
/*! @azure/msal-node v3.8.1 2025-10-29 */
'use strict';
import { Constants, LogLevel, AzureCloudInstance, ProtocolMode } from '@azure/msal-common/node';
import { HttpClient } from '../network/HttpClient.mjs';
import { ManagedIdentityId } from './ManagedIdentityId.mjs';
import { NodeAuthError } from '../error/NodeAuthError.mjs';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
const DEFAULT_AUTH_OPTIONS = {
clientId: Constants.EMPTY_STRING,
authority: Constants.DEFAULT_AUTHORITY,
clientSecret: Constants.EMPTY_STRING,
clientAssertion: Constants.EMPTY_STRING,
clientCertificate: {
thumbprint: Constants.EMPTY_STRING,
thumbprintSha256: Constants.EMPTY_STRING,
privateKey: Constants.EMPTY_STRING,
x5c: Constants.EMPTY_STRING,
},
knownAuthorities: [],
cloudDiscoveryMetadata: Constants.EMPTY_STRING,
authorityMetadata: Constants.EMPTY_STRING,
clientCapabilities: [],
protocolMode: ProtocolMode.AAD,
azureCloudOptions: {
azureCloudInstance: AzureCloudInstance.None,
tenant: Constants.EMPTY_STRING,
},
skipAuthorityMetadataCache: false,
encodeExtraQueryParams: false,
};
const DEFAULT_CACHE_OPTIONS = {
claimsBasedCachingEnabled: false,
};
const DEFAULT_LOGGER_OPTIONS = {
loggerCallback: () => {
// allow users to not set logger call back
},
piiLoggingEnabled: false,
logLevel: LogLevel.Info,
};
const DEFAULT_SYSTEM_OPTIONS = {
loggerOptions: DEFAULT_LOGGER_OPTIONS,
networkClient: new HttpClient(),
proxyUrl: Constants.EMPTY_STRING,
customAgentOptions: {},
disableInternalRetries: false,
};
const DEFAULT_TELEMETRY_OPTIONS = {
application: {
appName: Constants.EMPTY_STRING,
appVersion: Constants.EMPTY_STRING,
},
};
/**
* Sets the default options when not explicitly configured from app developer
*
* @param auth - Authentication options
* @param cache - Cache options
* @param system - System options
* @param telemetry - Telemetry options
*
* @returns Configuration
* @internal
*/
function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
const systemOptions = {
...DEFAULT_SYSTEM_OPTIONS,
networkClient: new HttpClient(system?.proxyUrl, system?.customAgentOptions),
loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
disableInternalRetries: system?.disableInternalRetries || false,
};
// if client certificate was provided, ensure that at least one of the SHA-1 or SHA-256 thumbprints were provided
if (!!auth.clientCertificate &&
!!!auth.clientCertificate.thumbprint &&
!!!auth.clientCertificate.thumbprintSha256) {
throw NodeAuthError.createStateNotFoundError();
}
return {
auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
broker: { ...broker },
cache: { ...DEFAULT_CACHE_OPTIONS, ...cache },
system: { ...systemOptions, ...system },
telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
};
}
function buildManagedIdentityConfiguration({ clientCapabilities, managedIdentityIdParams, system, }) {
const managedIdentityId = new ManagedIdentityId(managedIdentityIdParams);
const loggerOptions = system?.loggerOptions || DEFAULT_LOGGER_OPTIONS;
let networkClient;
// use developer provided network client if passed in
if (system?.networkClient) {
networkClient = system.networkClient;
// otherwise, create a new one
}
else {
networkClient = new HttpClient(system?.proxyUrl, system?.customAgentOptions);
}
return {
clientCapabilities: clientCapabilities || [],
managedIdentityId: managedIdentityId,
system: {
loggerOptions,
networkClient,
},
disableInternalRetries: system?.disableInternalRetries || false,
};
}
export { buildAppConfiguration, buildManagedIdentityConfiguration };
//# sourceMappingURL=Configuration.mjs.map

View File

@@ -0,0 +1,57 @@
/*! @azure/msal-node v3.8.1 2025-10-29 */
'use strict';
import { createManagedIdentityError } from '../error/ManagedIdentityError.mjs';
import { ManagedIdentityIdType, DEFAULT_MANAGED_IDENTITY_ID } from '../utils/Constants.mjs';
import { invalidManagedIdentityIdType } from '../error/ManagedIdentityErrorCodes.mjs';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
class ManagedIdentityId {
get id() {
return this._id;
}
set id(value) {
this._id = value;
}
get idType() {
return this._idType;
}
set idType(value) {
this._idType = value;
}
constructor(managedIdentityIdParams) {
const userAssignedClientId = managedIdentityIdParams?.userAssignedClientId;
const userAssignedResourceId = managedIdentityIdParams?.userAssignedResourceId;
const userAssignedObjectId = managedIdentityIdParams?.userAssignedObjectId;
if (userAssignedClientId) {
if (userAssignedResourceId || userAssignedObjectId) {
throw createManagedIdentityError(invalidManagedIdentityIdType);
}
this.id = userAssignedClientId;
this.idType = ManagedIdentityIdType.USER_ASSIGNED_CLIENT_ID;
}
else if (userAssignedResourceId) {
if (userAssignedClientId || userAssignedObjectId) {
throw createManagedIdentityError(invalidManagedIdentityIdType);
}
this.id = userAssignedResourceId;
this.idType = ManagedIdentityIdType.USER_ASSIGNED_RESOURCE_ID;
}
else if (userAssignedObjectId) {
if (userAssignedClientId || userAssignedResourceId) {
throw createManagedIdentityError(invalidManagedIdentityIdType);
}
this.id = userAssignedObjectId;
this.idType = ManagedIdentityIdType.USER_ASSIGNED_OBJECT_ID;
}
else {
this.id = DEFAULT_MANAGED_IDENTITY_ID;
this.idType = ManagedIdentityIdType.SYSTEM_ASSIGNED;
}
}
}
export { ManagedIdentityId };
//# sourceMappingURL=ManagedIdentityId.mjs.map

View File

@@ -0,0 +1,38 @@
/*! @azure/msal-node v3.8.1 2025-10-29 */
'use strict';
import { RequestParameterBuilder, UrlUtils, UrlString } from '@azure/msal-common/node';
import { DefaultManagedIdentityRetryPolicy } from '../retry/DefaultManagedIdentityRetryPolicy.mjs';
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
class ManagedIdentityRequestParameters {
constructor(httpMethod, endpoint, retryPolicy) {
this.httpMethod = httpMethod;
this._baseEndpoint = endpoint;
this.headers = {};
this.bodyParameters = {};
this.queryParameters = {};
this.retryPolicy =
retryPolicy || new DefaultManagedIdentityRetryPolicy();
}
computeUri() {
const parameters = new Map();
if (this.queryParameters) {
RequestParameterBuilder.addExtraQueryParameters(parameters, this.queryParameters);
}
const queryParametersString = UrlUtils.mapToQueryString(parameters);
return UrlString.appendQueryString(this._baseEndpoint, queryParametersString);
}
computeParametersBodyString() {
const parameters = new Map();
if (this.bodyParameters) {
RequestParameterBuilder.addExtraQueryParameters(parameters, this.bodyParameters);
}
return UrlUtils.mapToQueryString(parameters);
}
}
export { ManagedIdentityRequestParameters };
//# sourceMappingURL=ManagedIdentityRequestParameters.mjs.map