CoolFace
Datasetpublic

basant307/AI_Governance_Project

sourceHugging Faceapache-2.0updated 2mo agoView on Hugging Face
0likes48downloads
Configuration.mjs109 linesDownload Raw Back to config
1/*! @azure/msal-node v5.2.3 2026-06-05 */2'use strict';3import { LogLevel, ProtocolMode, AzureCloudInstance, Constants } from '@azure/msal-common/node';4import { HttpClient } from '../network/HttpClient.mjs';5import { ManagedIdentityId } from './ManagedIdentityId.mjs';6import { NodeAuthError } from '../error/NodeAuthError.mjs';7 8/*
9 * Copyright (c) Microsoft Corporation. All rights reserved.
10 * Licensed under the MIT License.
11 */
12const DEFAULT_AUTH_OPTIONS = {
13    clientId: "",
14    authority: Constants.DEFAULT_AUTHORITY,
15    clientSecret: "",
16    clientAssertion: "",
17    clientCertificate: {
18        thumbprint: "",
19        thumbprintSha256: "",
20        privateKey: "",
21        x5c: "",
22    },
23    knownAuthorities: [],
24    cloudDiscoveryMetadata: "",
25    authorityMetadata: "",
26    clientCapabilities: [],
27    azureCloudOptions: {
28        azureCloudInstance: AzureCloudInstance.None,
29        tenant: "",
30    },
31    isMcp: false,
32};
33const DEFAULT_LOGGER_OPTIONS = {
34    loggerCallback: () => {
35        // allow users to not set logger call back
36    },
37    piiLoggingEnabled: false,
38    logLevel: LogLevel.Info,
39};
40const DEFAULT_SYSTEM_OPTIONS = {
41    loggerOptions: DEFAULT_LOGGER_OPTIONS,
42    networkClient: new HttpClient(),
43    disableInternalRetries: false,
44    protocolMode: ProtocolMode.AAD,
45};
46const DEFAULT_TELEMETRY_OPTIONS = {
47    application: {
48        appName: "",
49        appVersion: "",
50    },
51};
52/**
53 * Sets the default options when not explicitly configured from app developer
54 *
55 * @param auth - Authentication options
56 * @param cache - Cache options
57 * @param system - System options
58 * @param telemetry - Telemetry options
59 *
60 * @returns Configuration
61 * @internal
62 */
63function buildAppConfiguration({ auth, broker, cache, system, telemetry, }) {
64    const systemOptions = {
65        ...DEFAULT_SYSTEM_OPTIONS,
66        networkClient: new HttpClient(),
67        loggerOptions: system?.loggerOptions || DEFAULT_LOGGER_OPTIONS,
68        disableInternalRetries: system?.disableInternalRetries || false,
69    };
70    // if client certificate was provided, ensure that at least one of the SHA-1 or SHA-256 thumbprints were provided
71    if (!!auth.clientCertificate &&
72        !!!auth.clientCertificate.thumbprint &&
73        !!!auth.clientCertificate.thumbprintSha256) {
74        throw NodeAuthError.createStateNotFoundError();
75    }
76    return {
77        auth: { ...DEFAULT_AUTH_OPTIONS, ...auth },
78        broker: { ...broker },
79        cache: { ...cache },
80        system: { ...systemOptions, ...system },
81        telemetry: { ...DEFAULT_TELEMETRY_OPTIONS, ...telemetry },
82    };
83}
84function buildManagedIdentityConfiguration({ clientCapabilities, managedIdentityIdParams, system, }) {
85    const managedIdentityId = new ManagedIdentityId(managedIdentityIdParams);
86    const loggerOptions = system?.loggerOptions || DEFAULT_LOGGER_OPTIONS;
87    let networkClient;
88    // use developer provided network client if passed in
89    if (system?.networkClient) {
90        networkClient = system.networkClient;
91        // otherwise, create a new one
92    }
93    else {
94        networkClient = new HttpClient();
95    }
96    return {
97        clientCapabilities: clientCapabilities || [],
98        managedIdentityId: managedIdentityId,
99        system: {
100            loggerOptions,
101            networkClient,
102        },
103        disableInternalRetries: system?.disableInternalRetries || false,
104    };
105}106 107export { buildAppConfiguration, buildManagedIdentityConfiguration };108//# sourceMappingURL=Configuration.mjs.map109 
basant307/AI_Governance_Project · CoolFace