/** * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. */ import { ConnectionMapItem } from './msalConnectionManager'; /** * Represents the authentication configuration. */ export interface AuthConfiguration { /** * The tenant ID for the authentication configuration. */ tenantId?: string; /** * The client ID for the authentication configuration. Required in production. */ clientId?: string; /** * The client secret for the authentication configuration. */ clientSecret?: string; /** * The path to the certificate PEM file. */ certPemFile?: string; /** * The path to the certificate key file. */ certKeyFile?: string; /** * Indicates whether to send the X5C param or not (for SNI authentication). */ sendX5C?: boolean; /** * A list of valid issuers for the authentication configuration. */ issuers?: string[]; /** * The connection name for the authentication configuration. */ connectionName?: string; /** * The FIC (First-Party Integration Channel) client ID. */ FICClientId?: string; /** * Entra Authentication Endpoint to use. * * @remarks * If not populated the Entra Public Cloud endpoint is assumed. * This example of Public Cloud Endpoint is https://login.microsoftonline.com * see also https://learn.microsoft.com/entra/identity-platform/authentication-national-cloud */ authority?: string; scope?: string; /** * A map of connection names to their respective authentication configurations. */ connections?: Map; /** * A list of connection map items to map service URLs to connection names. */ connectionsMap?: ConnectionMapItem[]; /** * An optional alternative blueprint Connection name used when constructing a connector client. */ altBlueprintConnectionName?: string; /** * The path to K8s provided token. */ WIDAssertionFile?: string; } /** * Loads the authentication configuration from environment variables. * * @returns The authentication configuration. * @throws Will throw an error if clientId is not provided in production. * * @remarks * - `clientId` is required * * @example * ``` * tenantId=your-tenant-id * clientId=your-client-id * clientSecret=your-client-secret * * certPemFile=your-cert-pem-file * certKeyFile=your-cert-key-file * sendX5C=false * * FICClientId=your-FIC-client-id * * connectionName=your-connection-name * authority=your-authority-endpoint * ``` * */ export declare const loadAuthConfigFromEnv: (cnxName?: string) => AuthConfiguration; /** * Loads the agent authentication configuration from previous version environment variables. * * @returns The agent authentication configuration. * @throws Will throw an error if MicrosoftAppId is not provided in production. * * @example * ``` * MicrosoftAppId=your-client-id * MicrosoftAppPassword=your-client-secret * MicrosoftAppTenantId=your-tenant-id * ``` * */ export declare const loadPrevAuthConfigFromEnv: () => AuthConfiguration; /** * Loads the authentication configuration from the provided config or from the environment variables * providing default values for authority and issuers. * * @returns The authentication configuration. * @throws Will throw an error if clientId is not provided in production. * * @example * ``` * tenantId=your-tenant-id * clientId=your-client-id * clientSecret=your-client-secret * * certPemFile=your-cert-pem-file * certKeyFile=your-cert-key-file * sendX5C=false * * FICClientId=your-FIC-client-id * * connectionName=your-connection-name * authority=your-authority-endpoint * ``` * */ export declare function getAuthConfigWithDefaults(config?: AuthConfiguration): AuthConfiguration; /** * Resolves the full authority URL including the tenant ID. * Supports both patterns: * - Tenant embedded in authority: https://login.microsoftonline.com/my-tenant * - Authority + separate tenantId: https://login.microsoftonline.com + tenantId * Also handles trailing slashes on authority. */ export declare function resolveAuthority(authority?: string, tenantId?: string): string; /** * A type representing a parser settings object. */ type ParserSettings = { [key in K]: (value: string) => { key?: string; value?: any; } | undefined; }; /** * Creates an environment variable parser that maps the variable keys to parsing functions. * @param settings An object where each key is an environment variable name and the value is a function * that takes the variable value as input and returns an object with optional `key` and `value` properties. * @remarks * The `key` property in the returned object can be used to rename the environment variable key, * while the `value` property contains the parsed value. * @returns An object with a `parse` method that takes an environment variable key and value, * and returns the parsed result. */ export declare function envParser(settings: ParserSettings & ThisType>): { /** * Parses the given environment variable key and value using the provided settings. * @param key The environment variable key. * @param value The environment variable value. * @returns The parsed result with optional renamed key and parsed value. */ parse(key: K, value: string): { key?: undefined; value?: undefined; } | { key: string; value: any; }; }; /** * Utility functions for environment variable parsers. */ export declare const envParserUtils: { /** * Bypass parser that returns the value as is. * @param value The environment variable value. * @returns An object with the original value. */ bypass: (value: string) => { value: string; }; /** * Redirects the parsing to another parser for a specific key. * @param parser The target parser to redirect to. * @param key The key to use in the target parser. * @returns A function that takes the environment variable value and returns the parsed result from the target parser. */ redirect: >(parser: Parser, key: Parameters[0]) => (value: string) => { key?: undefined; value?: undefined; } | { key: string; value: any; }; }; export {};