UNPKG

azure-kusto-data

Version:
140 lines 5.8 kB
import { DeviceCodeInfo, InteractiveBrowserCredentialInBrowserOptions, InteractiveBrowserCredentialNodeOptions } from "@azure/identity"; import { TokenCredential } from "@azure/core-auth"; import { CloudInfo } from "./cloudSettings.js"; export declare type TokenResponse = { tokenType: string; accessToken: string; }; export interface TokenType { tokenType: string; accessToken: string; } /** * This base class abstracts token acquisition for all implementations. * The class is build for Lazy initialization, so that the first call, take on instantiation of 'heavy' long-lived class members */ export declare abstract class TokenProviderBase { kustoUri: string; scopes: string[]; abstract acquireToken(): Promise<TokenResponse>; context(): Record<string, any>; protected constructor(kustoUri: string); } /** * Basic Token Provider keeps and returns a token received on construction */ export declare class BasicTokenProvider extends TokenProviderBase { token: string; constructor(kustoUri: string, token: string); acquireToken(): Promise<TokenResponse>; } /** * Callback Token Provider generates a token based on a callback function provided by the caller */ export declare class CallbackTokenProvider extends TokenProviderBase { callback: () => Promise<string>; constructor(kustoUri: string, callback: () => Promise<string>); acquireToken(): Promise<TokenResponse>; } /** * Token providers that require cloud settings to be configured - msal and azure identity */ export declare abstract class CloudSettingsTokenProvider extends TokenProviderBase { protected cloudInfo: CloudInfo; protected initialized: boolean; abstract initClient(): void; abstract acquireTokenWithCloudSettings(): Promise<TokenType | null>; additionalCloudSettingsInit(): void; protected constructor(kustoUri: string); acquireToken(): Promise<TokenResponse>; context(): Record<string, any>; } export declare abstract class AzureIdentityProvider extends CloudSettingsTokenProvider { protected authorityId?: string | undefined; private timeoutMs?; private credential; constructor(kustoUri: string, authorityId?: string | undefined, timeoutMs?: number | undefined); initClient(): void; acquireTokenWithCloudSettings(): Promise<TokenType | null>; context(): Record<string, any>; abstract getCredential(): TokenCredential; } /** * TokenCredentialProvider receives any TokenCredential to create a token with. */ export declare class TokenCredentialProvider extends AzureIdentityProvider { private tokenCredential; constructor(kustoUri: string, tokenCredential: TokenCredential, timeoutMs?: number); getCredential(): TokenCredential; } /** * UserPromptProvider will pop up a login prompt to acquire a token. */ export declare class UserPromptProvider extends AzureIdentityProvider { private interactiveCredentialOptions?; readonly MinPort = 20000; readonly MaxPort = 65536; constructor(kustoUri: string, interactiveCredentialOptions?: (InteractiveBrowserCredentialInBrowserOptions | InteractiveBrowserCredentialNodeOptions) | undefined, timeoutMs?: number); getCredential(): TokenCredential; private getRandomPortInRange; context(): Record<string, any>; } /** * MSI Token Provider obtains a token from the MSI endpoint * The args parameter is a dictionary conforming with the ManagedIdentityCredential initializer API arguments */ export declare class MsiTokenProvider extends AzureIdentityProvider { protected clientId?: string | undefined; constructor(kustoUri: string, clientId?: string | undefined, authorityId?: string, timeoutMs?: number); getCredential(): TokenCredential; context(): Record<string, any>; } /** * AzCli Token Provider obtains a refresh token from the AzCli cache and uses it to authenticate with MSAL */ export declare class AzCliTokenProvider extends AzureIdentityProvider { getCredential(): TokenCredential; } /** * Acquire a token from MSAL with username and password */ export declare class UserPassTokenProvider extends AzureIdentityProvider { userName: string; password: string; homeAccountId?: string; constructor(kustoUri: string, userName: string, password: string, authorityId: string, timeoutMs?: number); getCredential(): TokenCredential; context(): Record<string, any>; } /** * Acquire a token from Device Login flow */ export declare class DeviceLoginTokenProvider extends AzureIdentityProvider { private deviceCodeCallback?; constructor(kustoUri: string, deviceCodeCallback?: ((response: DeviceCodeInfo) => void) | undefined, authorityId?: string, timeoutMs?: number); getCredential(): TokenCredential; } /** * Acquire a token from MSAL using application certificate * Passing the public certificate is optional and will result in Subject Name & Issuer Authentication */ export declare class ApplicationCertificateTokenProvider extends AzureIdentityProvider { private appClientId; private certPrivateKey?; private certPath?; private sendX5c?; constructor(kustoUri: string, appClientId: string, certPrivateKey?: string | undefined, certPath?: string | undefined, sendX5c?: boolean | undefined, authorityId?: string, timeoutMs?: number); getCredential(): TokenCredential; context(): Record<string, any>; } /** * Acquire a token from MSAL with application id and Key */ export declare class ApplicationKeyTokenProvider extends AzureIdentityProvider { private appClientId; private appKey; constructor(kustoUri: string, appClientId: string, appKey: string, authorityId: string, timeoutMs?: number); getCredential(): TokenCredential; context(): Record<string, any>; } //# sourceMappingURL=tokenProvider.d.ts.map