mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-14 01:25:40 -05:00
dSTS Authentication (#1125)
* Refactored Kusto.ServiceLayer to pass ConnectionDetails to DataSourceFactory instead of connection string. Created KustoConnectionDetails to map needed details to KustoClient. * Removed unused ScriptingScriptOperation from KustoServiceLayer. * Created DstsAuthenticationManager and moved logic for getting DstsToken. Updated error message for failing to create KustoConnection. * Removed DstsAuthenticationManager.cs. Refactored DataSourceFactory to retrieve UserToken from ConnectionDetails. * Renamed AzureAccountToken in ConnectionDetails to AccountToken. Changed mapping to KustoConnectionDetails based on the AccountToken. * Removed Kusto.Data reference from ConnectionService and ScriptingListObjectsOperation. Moved creation of KustoConnectionStringBuilder to DataSourceFactory * Added accountToken validation to DataSourceFactory Create. * Renamed KustoConnectionDetails to DataSourceConnectionDetails. Renamed AzureToken to AuthToken.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.Kusto.ServiceLayer.Connection.Contracts;
|
||||
using Microsoft.Kusto.ServiceLayer.DataSource;
|
||||
using Microsoft.Kusto.ServiceLayer.DataSource.DataSourceIntellisense;
|
||||
using Microsoft.Kusto.ServiceLayer.LanguageServices.Completion;
|
||||
@@ -10,16 +11,19 @@ namespace Microsoft.Kusto.ServiceLayer.UnitTests.DataSource
|
||||
{
|
||||
public class DataSourceFactoryTests
|
||||
{
|
||||
[TestCase(typeof(ArgumentNullException), "", "AzureAccountToken")]
|
||||
[TestCase(typeof(ArgumentNullException), "ConnectionString", "")]
|
||||
[TestCase(typeof(ArgumentException), "ConnectionString", "AzureAccountToken")]
|
||||
public void Create_Throws_Exceptions_For_InvalidParams(Type exceptionType,
|
||||
string connectionString,
|
||||
string azureAccountToken)
|
||||
{
|
||||
var dataSourceFactory = new DataSourceFactory();
|
||||
var connectionDetails = new ConnectionDetails
|
||||
{
|
||||
ConnectionString = connectionString,
|
||||
AccountToken = azureAccountToken
|
||||
};
|
||||
Assert.Throws(exceptionType,
|
||||
() => dataSourceFactory.Create(DataSourceType.None, connectionString, azureAccountToken, ""));
|
||||
() => dataSourceFactory.Create(DataSourceType.None, connectionDetails, ""));
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
Reference in New Issue
Block a user