|
|
|
@ -19,10 +19,10 @@ import com.fr.decision.webservice.bean.datasource.JDBCConnectionBean;
|
|
|
|
|
import com.fr.decision.webservice.utils.DecisionServiceConstants; |
|
|
|
|
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.ConnectionProcessorFactory; |
|
|
|
|
import com.fr.decision.webservice.v10.datasource.connection.processor.impl.JDBCConnectionProcessor; |
|
|
|
|
import com.fr.security.encryption.transmission.TransmissionEncryptors; |
|
|
|
|
import com.fr.security.encryption.transmission.TransmissionEncryptionManager; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.third.fasterxml.jackson.databind.ObjectMapper; |
|
|
|
|
|
|
|
|
|
import com.fr.workspace.server.repository.WorkplaceConstants; |
|
|
|
|
/** |
|
|
|
|
* 数据连接传输工具类 |
|
|
|
|
* |
|
|
|
@ -95,7 +95,7 @@ public class ConnectionInfoBeanHelper {
|
|
|
|
|
.user(jdbcConnection.getUser()) |
|
|
|
|
.driver(jdbcConnection.getDriver()) |
|
|
|
|
// 关键中的关键,由设计器发出的请求如果要携带密码,不能传明文,必须必须必须传加密后的密码
|
|
|
|
|
.password(withPassword ? TransmissionEncryptors.getInstance().encrypt(jdbcConnection.getPassword()) : DecisionServiceConstants.DEFAULT_PASSWORD) |
|
|
|
|
.password(withPassword ? encrypt(jdbcConnection.getPassword()) : DecisionServiceConstants.DEFAULT_PASSWORD) |
|
|
|
|
.schema(jdbcConnection.getSchema()) |
|
|
|
|
.url(jdbcConnection.getURL()) |
|
|
|
|
.creator(jdbcConnection.getCreator()) |
|
|
|
@ -126,4 +126,12 @@ public class ConnectionInfoBeanHelper {
|
|
|
|
|
.verifyCa(jdbcConnection.getSsl().getSslType() == SslType.NORMAL && ((NormalSsl) jdbcConnection.getSsl()).isVerifyCa()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private static String encrypt(String password) { |
|
|
|
|
// 如果是空密码或者默认密码,就返回默认的星号回去
|
|
|
|
|
if (StringUtils.isEmpty(password) || StringUtils.equals(password, DecisionServiceConstants.DEFAULT_PASSWORD)) { |
|
|
|
|
return DecisionServiceConstants.DEFAULT_PASSWORD; |
|
|
|
|
} |
|
|
|
|
return TransmissionEncryptionManager.getInstance().getEncryption(WorkplaceConstants.getEncryptionMode()).encrypt(password, WorkplaceConstants.getEncryptionKey()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|