UNPKG

azure-kusto-data

Version:
76 lines 3.93 kB
// Copyright (c) Microsoft Corporation. // Licensed under the MIT License. import KustoConnectionStringBuilderBase from "./connectionBuilderBase.js"; /* eslint-disable @typescript-eslint/no-unused-vars */ export class KustoConnectionStringBuilder extends KustoConnectionStringBuilderBase { static withAadUserPasswordAuthentication(_connectionString, _userId, _password, _authorityId) { throw new Error("Not supported in browser - use withUserPrompt instead"); } static withAadApplicationKeyAuthentication(_connectionString, _aadAppId, _appKey, _authorityId) { throw new Error("Not supported in browser - use withUserPrompt instead"); } static withAadApplicationCertificateAuthentication(_connectionString, _aadAppId, _applicationCertificatePrivateKey, _authorityId, _applicationCertificateSendX5c, _applicationCertificatePath) { throw new Error("Not supported in browser - use withUserPrompt instead"); } static withAadDeviceAuthentication(_connectionString, _authorityId, _deviceCodeCallback) { throw new Error("Not supported in browser - use withUserPrompt instead"); } static withSystemManagedIdentity(_connectionString, _authorityId, _timeoutMs) { throw new Error("Not supported in browser - use withUserPrompt instead"); } static withUserManagedIdentity(_connectionString, _msiClientId, _authorityId, _timeoutMs) { throw new Error("Not supported in browser - use withUserPrompt instead"); } static withAzLoginIdentity(_connectionString, _authorityId, _timeoutMs) { throw new Error("Not supported in browser - use withUserPrompt instead"); } static withAccessToken(connectionString, accessToken) { const kcsb = new KustoConnectionStringBuilder(connectionString); kcsb.aadFederatedSecurity = true; kcsb.accessToken = accessToken; return kcsb; } static withTokenProvider(connectionString, tokenProvider) { const kcsb = new KustoConnectionStringBuilder(connectionString); kcsb.aadFederatedSecurity = true; kcsb.tokenProvider = tokenProvider; return kcsb; } static withUserPrompt(connectionString, interactiveCredentialOptions, timeoutMs) { if (!interactiveCredentialOptions) { throw new Error("Invalid parameters - You must provide interactiveCredentialOptions={clientId: string, redirectUri:string} to authenticate with user prompt in browser."); } const kcsb = new KustoConnectionStringBuilder(connectionString); const { redirectUri, clientId, tenantId } = interactiveCredentialOptions; if (!clientId) { throw new Error("Invalid parameters - You must provide your SPA application client id to authenticate against"); } if (!redirectUri) { throw new Error("Invalid parameters - You must provide a redirectUri registered on the SPA app"); } if (tenantId) { kcsb.authorityId = tenantId; } else { interactiveCredentialOptions.tenantId = kcsb.authorityId; } kcsb.interactiveCredentialOptions = interactiveCredentialOptions; kcsb.aadFederatedSecurity = true; kcsb.applicationClientId = clientId; kcsb.useUserPromptAuth = true; kcsb.timeoutMs = timeoutMs; return kcsb; } static withTokenCredential(connectionString, credential) { const kcsb = new KustoConnectionStringBuilder(connectionString); kcsb.tokenCredential = credential; return kcsb; } static fromExisting(other) { return Object.assign(new KustoConnectionStringBuilder(other.toString(false)), other); } } KustoConnectionStringBuilder.DefaultDatabaseName = "NetDefaultDB"; KustoConnectionStringBuilder.SecretReplacement = "****"; export default KustoConnectionStringBuilder; //# sourceMappingURL=connectionBuilder.browser.js.map