Browse Source

DEC-17499 feat: 适配新的传输加密接口

master
Roger.Chen 4 years ago
parent
commit
70be23f280
  1. 7
      plugin.xml
  2. 15
      src/main/java/com/fr/plugin/decision/transmission/decrypt/Base64Encryption.java
  3. 3
      src/main/resources/com/fr/plugin/decision/transmission/decrypt/plugin.js

7
plugin.xml

@ -3,16 +3,17 @@
<id>com.fr.plugin.decision.transmission.decrypt</id>
<name><![CDATA[自定义传输加解密]]></name>
<active>yes</active>
<version>1.0</version>
<version>1.1</version>
<env-version>10.0</env-version>
<jartime>2020-02-01</jartime>
<vendor>zed</vendor>
<description><![CDATA[自定义处理平台传输过程的加解密。]]></description>
<change-notes><![CDATA[
[2021-04-12]适配新的传输加密接口<br/>
[2020-02-11]提供demo。<br/>
]]></change-notes>
<function-recorder class="com.fr.plugin.decision.transmission.decrypt.Base64Decrypt"/>
<function-recorder class="com.fr.plugin.decision.transmission.decrypt.Base64Encryption"/>
<extra-decision>
<TransmissionDecryptProvider class="com.fr.plugin.decision.transmission.decrypt.Base64Decrypt"/>
<TransmissionEncryptionProvider class="com.fr.plugin.decision.transmission.decrypt.Base64Encryption"/>
</extra-decision>
</plugin>

15
src/main/java/com/fr/plugin/decision/transmission/decrypt/Base64Decrypt.java → src/main/java/com/fr/plugin/decision/transmission/decrypt/Base64Encryption.java

@ -2,7 +2,7 @@ package com.fr.plugin.decision.transmission.decrypt;
import com.fr.base.Base64;
import com.fr.base.ServerConfig;
import com.fr.decision.fun.impl.AbstractTransmissionDecryptProvider;
import com.fr.decision.fun.impl.AbstractTransmissionEncryptionProvider;
import com.fr.decision.web.CommonComponent;
import com.fr.log.FineLoggerFactory;
import com.fr.plugin.transform.FunctionRecorder;
@ -15,7 +15,7 @@ import com.fr.web.struct.Atom;
* Created by Zed on 2020/2/11
*/
@FunctionRecorder
public class Base64Decrypt extends AbstractTransmissionDecryptProvider {
public class Base64Encryption extends AbstractTransmissionEncryptionProvider {
@Override
public String decrypt(String encryptionInfo) {
@ -40,4 +40,15 @@ public class Base64Decrypt extends AbstractTransmissionDecryptProvider {
return Base64Component.KEY;
}
@Override
public String encrypt(String plainInfo) {
try {
if (StringUtils.isNotEmpty(plainInfo)) {
return Base64.encode(plainInfo.getBytes(ServerConfig.getInstance().getServerCharset()));
}
} catch (Exception e) {
FineLoggerFactory.getLogger().error(e.getMessage(), e);
}
return StringUtils.EMPTY;
}
}

3
src/main/resources/com/fr/plugin/decision/transmission/decrypt/plugin.js

@ -3,5 +3,8 @@
provider.encrypt(function (pwd) {
return BI.encode(pwd);
});
provider.decrypt(function (pwd) {
return BI.decode(pwd);
});
});
})();
Loading…
Cancel
Save