Browse Source

Pull request #2606: REPORT-38872 设计器https证书密码安全加强

Merge in DESIGN/design from ~HADES/design:final/10.0 to final/10.0

* commit '24d865d69176d673d4f48f88565f1f05b24f25a8':
  REPORT-38872 修改下变量名
  REPORT-38872 设计器https证书密码明文存储
final/10.0
Kara 4 years ago
parent
commit
47cb210b8a
  1. 17
      designer-base/src/main/java/com/fr/design/DesignerEnvManager.java
  2. 16
      designer-base/src/main/java/com/fr/env/RemoteEnvPane.java

17
designer-base/src/main/java/com/fr/design/DesignerEnvManager.java

@ -418,21 +418,10 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
this.isHttps = isHttps; this.isHttps = isHttps;
} }
public String getCertificatePath() {
return certificatePath;
}
public void setCertificatePath(String certificatePath) { public void setCertificatePath(String certificatePath) {
this.certificatePath = certificatePath; this.certificatePath = certificatePath;
} }
public String getCertificatePass() {
return certificatePass;
}
public void setCertificatePass(String certificatePass) { public void setCertificatePass(String certificatePass) {
this.certificatePass = certificatePass; this.certificatePass = certificatePass;
} }
@ -2015,11 +2004,13 @@ public class DesignerEnvManager implements XMLReadable, XMLWriter {
private void writeHttpsParas(XMLPrintWriter writer) { private void writeHttpsParas(XMLPrintWriter writer) {
writer.startTAG(CAS_PARAS); writer.startTAG(CAS_PARAS);
// 这边的密钥path和password没有用处了 当前已经全部储存在对应的WorkspaceConnectionInfo中
// 把历史遗留保存的全部置为空 防止显示明文密钥 后面删除 todo
if (StringUtils.isNotBlank(certificatePath)) { if (StringUtils.isNotBlank(certificatePath)) {
writer.attr(CAS_CERTIFICATE_PATH, certificatePath); writer.attr(CAS_CERTIFICATE_PATH, StringUtils.EMPTY);
} }
if (StringUtils.isNotBlank(certificatePass)) { if (StringUtils.isNotBlank(certificatePass)) {
writer.attr(CAS_CERTIFICATE_PASSWORD, certificatePass); writer.attr(CAS_CERTIFICATE_PASSWORD, StringUtils.EMPTY);
} }
if (isHttps) { if (isHttps) {
writer.attr("enable", true); writer.attr("enable", true);

16
designer-base/src/main/java/com/fr/env/RemoteEnvPane.java vendored

@ -143,6 +143,12 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
* https 证书路径输入框 * https 证书路径输入框
*/ */
private JPanel httpsCertFileInputPanel; private JPanel httpsCertFileInputPanel;
/**
* 当前远程工作目录是否为新创建的
*/
private boolean newCreated;
/** /**
* 主机名web应用Servlet端口监听器 * 主机名web应用Servlet端口监听器
*/ */
@ -327,7 +333,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.certPathInput.setText(certPath); this.certPathInput.setText(certPath);
this.certSecretKeyInput.setText(certSecretKey); this.certSecretKeyInput.setText(certSecretKey);
this.rememberPwdCheckbox.setSelected(rememberPwd); this.rememberPwdCheckbox.setSelected(rememberPwd);
this.newCreated = ob.isNewCreated();
} else { } else {
this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL(); this.remoteWorkspaceURL = RemoteWorkspaceURL.createDefaultURL();
this.usernameInput.setText(StringUtils.EMPTY); this.usernameInput.setText(StringUtils.EMPTY);
@ -335,6 +341,7 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
this.certPathInput.setText(StringUtils.EMPTY); this.certPathInput.setText(StringUtils.EMPTY);
this.certSecretKeyInput.setText(StringUtils.EMPTY); this.certSecretKeyInput.setText(StringUtils.EMPTY);
this.rememberPwdCheckbox.setSelected(true); this.rememberPwdCheckbox.setSelected(true);
this.newCreated = true;
} }
fillRemoteEnvURLField(); fillRemoteEnvURLField();
@ -366,7 +373,9 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
new String(this.certSecretKeyInput.getPassword()), new String(this.certSecretKeyInput.getPassword()),
rememberPwd); rememberPwd);
return RemoteDesignerWorkspaceInfo.create(connection); RemoteDesignerWorkspaceInfo info = RemoteDesignerWorkspaceInfo.create(connection);
info.setNewCreated(newCreated);
return info;
} }
@Override @Override
@ -567,9 +576,6 @@ public class RemoteEnvPane extends BasicBeanPane<RemoteDesignerWorkspaceInfo> {
@Override @Override
protected TestConnectionResult doInBackground() throws Exception { protected TestConnectionResult doInBackground() throws Exception {
DesignerEnvManager.getEnvManager().setCertificatePath(connection.getCertPath());
DesignerEnvManager.getEnvManager().setCertificatePass(connection.getCertSecretKey());
try { try {
return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection); return TestConnectionResult.parse(WorkContext.getConnector().testConnection(connection), connection);
} catch (WorkspaceAuthException ignored) { } catch (WorkspaceAuthException ignored) {

Loading…
Cancel
Save