Add NO_SSL option to SSL authType to turn off SSL explicitly.

This commit is contained in:
Shrikant Kandula 2020-04-28 12:31:34 +00:00
parent 790a329581
commit 23bd4e1722
5 changed files with 19 additions and 2 deletions

View File

@ -14,6 +14,8 @@ import org.springframework.data.mongodb.core.mapping.Document;
public class SSLDetails {
public enum AuthType {
NO_SSL,
// Following for Postgres Connections.
ALLOW, PREFER, REQUIRE, DISABLE, VERIFY_CA, VERIFY_FULL,

View File

@ -7,6 +7,7 @@ import com.appsmith.external.models.Connection;
import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.DatasourceTestResult;
import com.appsmith.external.models.Endpoint;
import com.appsmith.external.models.SSLDetails;
import com.appsmith.external.pluginExceptions.AppsmithPluginError;
import com.appsmith.external.pluginExceptions.AppsmithPluginException;
import com.appsmith.external.plugins.BasePlugin;
@ -201,7 +202,8 @@ public class MongoPlugin extends BasePlugin {
List<String> queryParams = new ArrayList<>();
if (connection.getSsl() != null) {
final SSLDetails sslDetails = connection.getSsl();
if (sslDetails != null && !SSLDetails.AuthType.NO_SSL.equals(sslDetails.getAuthType())) {
queryParams.add("ssl=true");
}

View File

@ -110,6 +110,10 @@
"configProperty": "datasourceConfiguration.connection.ssl.authType",
"controlType": "DROP_DOWN",
"options": [
{
"label": "No SSL",
"value": "NO_SSL"
},
{
"label": "CA Certificate",
"value": "CA_CERTIFICATE"

View File

@ -6,6 +6,7 @@ import com.appsmith.external.models.AuthenticationDTO;
import com.appsmith.external.models.DatasourceConfiguration;
import com.appsmith.external.models.DatasourceTestResult;
import com.appsmith.external.models.Endpoint;
import com.appsmith.external.models.SSLDetails;
import com.appsmith.external.pluginExceptions.AppsmithPluginError;
import com.appsmith.external.pluginExceptions.AppsmithPluginException;
import com.appsmith.external.plugins.BasePlugin;
@ -135,12 +136,16 @@ public class PostgresPlugin extends BasePlugin {
com.appsmith.external.models.Connection configurationConnection = datasourceConfiguration.getConnection();
final boolean isSslEnabled = configurationConnection != null
&& configurationConnection.getSsl() != null
&& !SSLDetails.AuthType.NO_SSL.equals(configurationConnection.getSsl().getAuthType());
Properties properties = new Properties();
properties.putAll(Map.of(
USER, authentication.getUsername(),
PASSWORD, authentication.getPassword(),
// TODO: Set SSL connection parameters.
SSL, configurationConnection != null && configurationConnection.getSsl() != null
SSL, isSslEnabled
));
if (CollectionUtils.isEmpty(datasourceConfiguration.getEndpoints())) {

View File

@ -74,6 +74,10 @@
"configProperty": "datasourceConfiguration.connection.ssl.authType",
"controlType": "DROP_DOWN",
"options": [
{
"label": "No SSL",
"value": "NO_SSL"
},
{
"label": "Allow",
"value": "ALLOW"