mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-11 18:48:36 -05:00
Enable column encryption setting (#908)
* Enable the Column Encryption advanced security connection setting and add supporting tests.
This commit is contained in:
@@ -1142,6 +1142,20 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
throw new ArgumentException(SR.ConnectionServiceConnStringInvalidAuthType(connectionDetails.AuthenticationType));
|
||||
}
|
||||
}
|
||||
if (!string.IsNullOrEmpty(connectionDetails.ColumnEncryptionSetting))
|
||||
{
|
||||
switch (connectionDetails.ColumnEncryptionSetting.ToUpper())
|
||||
{
|
||||
case "ENABLED":
|
||||
connectionBuilder.ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Enabled;
|
||||
break;
|
||||
case "DISABLED":
|
||||
connectionBuilder.ColumnEncryptionSetting = SqlConnectionColumnEncryptionSetting.Disabled;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException(SR.ConnectionServiceConnStringInvalidColumnEncryptionSetting(connectionDetails.ColumnEncryptionSetting));
|
||||
}
|
||||
}
|
||||
if (connectionDetails.Encrypt.HasValue)
|
||||
{
|
||||
connectionBuilder.Encrypt = connectionDetails.Encrypt.Value;
|
||||
@@ -1313,6 +1327,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection
|
||||
ConnectTimeout = builder.ConnectTimeout,
|
||||
CurrentLanguage = builder.CurrentLanguage,
|
||||
DatabaseName = builder.InitialCatalog,
|
||||
ColumnEncryptionSetting = builder.ColumnEncryptionSetting.ToString(),
|
||||
Encrypt = builder.Encrypt,
|
||||
FailoverPartner = builder.FailoverPartner,
|
||||
LoadBalanceTimeout = builder.LoadBalanceTimeout,
|
||||
|
||||
@@ -99,6 +99,22 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value that specifies that Always Encrypted functionality is enabled in a connection.
|
||||
/// </summary>
|
||||
public string ColumnEncryptionSetting
|
||||
{
|
||||
get
|
||||
{
|
||||
return GetOptionValue<string>("columnEncryptionSetting");
|
||||
}
|
||||
|
||||
set
|
||||
{
|
||||
SetOptionValue("columnEncryptionSetting", value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a Boolean value that indicates whether SQL Server uses SSL encryption for all data sent between the client and server if the server has a certificate installed.
|
||||
/// </summary>
|
||||
|
||||
@@ -22,6 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Connection.Contracts
|
||||
UserName = details.UserName,
|
||||
Password = details.Password,
|
||||
AuthenticationType = details.AuthenticationType,
|
||||
ColumnEncryptionSetting = details.ColumnEncryptionSetting,
|
||||
Encrypt = details.Encrypt,
|
||||
TrustServerCertificate = details.TrustServerCertificate,
|
||||
PersistSecurityInfo = details.PersistSecurityInfo,
|
||||
|
||||
@@ -2987,6 +2987,11 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
return Keys.GetString(Keys.ConnectionServiceConnStringInvalidAuthType, authType);
|
||||
}
|
||||
|
||||
public static string ConnectionServiceConnStringInvalidColumnEncryptionSetting(string columnEncryptionSetting)
|
||||
{
|
||||
return Keys.GetString(Keys.ConnectionServiceConnStringInvalidColumnEncryptionSetting, columnEncryptionSetting);
|
||||
}
|
||||
|
||||
public static string ConnectionServiceConnStringInvalidIntent(string intent)
|
||||
{
|
||||
return Keys.GetString(Keys.ConnectionServiceConnStringInvalidIntent, intent);
|
||||
@@ -3160,6 +3165,9 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
public const string ConnectionServiceConnStringInvalidAuthType = "ConnectionServiceConnStringInvalidAuthType";
|
||||
|
||||
|
||||
public const string ConnectionServiceConnStringInvalidColumnEncryptionSetting = "ConnectionServiceConnStringInvalidColumnEncryptionSetting";
|
||||
|
||||
|
||||
public const string ConnectionServiceConnStringInvalidIntent = "ConnectionServiceConnStringInvalidIntent";
|
||||
|
||||
|
||||
|
||||
@@ -139,7 +139,12 @@
|
||||
<value>Invalid value '{0}' for AuthenticationType. Valid values are 'Integrated' and 'SqlLogin'.</value>
|
||||
<comment>.
|
||||
Parameters: 0 - authType (string) </comment>
|
||||
</data>
|
||||
</data>
|
||||
<data name="ConnectionServiceConnStringInvalidColumnEncryptionSetting" xml:space="preserve">
|
||||
<value>Invalid value '{0}' for ComlumEncryption. Valid values are 'Enabled' and 'Disabled'.</value>
|
||||
<comment>.
|
||||
Parameters: 0 - columnEncryptionSetting (string) </comment>
|
||||
</data>
|
||||
<data name="ConnectionServiceConnStringInvalidIntent" xml:space="preserve">
|
||||
<value>Invalid value '{0}' for ApplicationIntent. Valid values are 'ReadWrite' and 'ReadOnly'.</value>
|
||||
<comment>.
|
||||
|
||||
@@ -33,6 +33,8 @@ ConnectionServiceDbErrorDefaultNotConnected(string uri) = Specified URI '{0}' do
|
||||
|
||||
ConnectionServiceConnStringInvalidAuthType(string authType) = Invalid value '{0}' for AuthenticationType. Valid values are 'Integrated' and 'SqlLogin'.
|
||||
|
||||
ConnectionServiceConnStringInvalidColumnEncryptionSetting(string columnEncryptionSetting) = Invalid value '{0}' for ComlumEncryption. Valid values are 'Enabled' and 'Disabled'.
|
||||
|
||||
ConnectionServiceConnStringInvalidIntent(string intent) = Invalid value '{0}' for ApplicationIntent. Valid values are 'ReadWrite' and 'ReadOnly'.
|
||||
|
||||
ConnectionServiceConnectionCanceled = Connection canceled
|
||||
|
||||
Reference in New Issue
Block a user