REM:
1. 设备登录密码进行加解密处理
This commit is contained in:
chenlinghy 2021-08-24 11:13:29 +08:00
parent 1278d69e87
commit bc0bbf2524
7 changed files with 96 additions and 90 deletions

View File

@ -14,6 +14,7 @@ import com.dispose.common.NetflowDirection;
import com.dispose.pojo.entity.ServiceInfo;
import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.dispose.security.arithmetic.CryptoHelper;
import com.dptech.dispose.AbnormalFlowCleaningServicePortType;
import com.dptech.dispose.ArrayOfProtectionObjectDataForService;
import com.dptech.dispose.NtcRequestResultInfo;
@ -101,7 +102,7 @@ public class DpTechAbilityImpl implements DisposeAbility {
this.cleanTypePort = (AbnormalFlowCleaningServicePortType) jaxWsProxyFactoryBean.create();
Map<String, Object> ctx = ((BindingProvider) this.cleanTypePort).getRequestContext();
ctx.put("password", password);
ctx.put("password", new String(CryptoHelper.base64Decryption(password)));
ctx.put("username", username);
// 配置连接访问超时时间
@ -275,7 +276,7 @@ public class DpTechAbilityImpl implements DisposeAbility {
*/
@Override
public Long toDeviceAttackType(Long ddosAttackTypeMask) {
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[] {DpTechAttackType.UDP_FLOOD});
return DpTechAttackType.getTypeMaskFromAttackType(new DpTechAttackType[]{DpTechAttackType.UDP_FLOOD});
}
/**

View File

@ -10,6 +10,7 @@ import com.dispose.common.NetflowDirection;
import com.dispose.pojo.entity.ServiceInfo;
import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.dispose.security.arithmetic.CryptoHelper;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.huawei.dispose.common.HuaWeiLoginResp;
import com.huawei.dispose.protocol.HuaWeiInterface;
@ -85,7 +86,7 @@ public class HuaWeiAbilityImpl implements DisposeAbility {
public void initDeviceEnv(String urlPath, String username, String password) {
this.urlRootPath = urlPath;
this.username = username;
this.password = password;
this.password = new String(CryptoHelper.base64Decryption(password));
upgradeToken();
}

View File

@ -85,7 +85,7 @@ public class HuaWeiFireWallAbilityImpl implements DisposeAbility {
public void initDeviceEnv(String urlPath, String username, String password) {
this.urlRootPath = urlPath;
this.username = username;
this.password = password;
this.password = new String(CryptoHelper.base64Decryption(password));
upgradeToken();
}

View File

@ -12,6 +12,7 @@ import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.dispose.pojo.entity.ServiceInfo;
import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.dispose.security.arithmetic.CryptoHelper;
import com.pengxin.dispose.common.PengXinDisposeAbilityRsp;
import com.pengxin.dispose.common.PengXinLoginRsp;
import com.pengxin.dispose.common.PengXinStartTaskItem;
@ -127,7 +128,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
public void initDeviceEnv(String urlPath, String username, String password) {
this.urlRootPath = urlPath;
this.username = username;
this.password = password;
this.password = new String(CryptoHelper.base64Decryption(password));
restfulInterface.setParams(1, 0);
upgradeToken();
@ -512,7 +513,7 @@ public class PengXinAbilityImpl implements DisposeAbility {
if (rspInfo.getCode() == HttpServletResponse.SC_OK &&
(status == ErrorCode.ERR_LOGOUT.getCode() || status == ErrorCode.ERR_TOKENTIMEOUT.getCode() ||
status == ErrorCode.ERR_TOKENNOTFOUND.getCode())){
status == ErrorCode.ERR_TOKENNOTFOUND.getCode())) {
upgradeToken();
return true;
}

View File

@ -8,6 +8,7 @@ import com.dispose.pojo.dto.protocol.base.ProtocolRespDTO;
import com.dispose.pojo.entity.ServiceInfo;
import com.dispose.pojo.po.MulReturnType;
import com.dispose.pojo.vo.DeviceFirewareInfo;
import com.dispose.security.arithmetic.CryptoHelper;
import com.pengxin.dispose.common.PengXinStartTaskItem;
import com.pengxin.dispose.common.PengXinStartTaskRsp;
import com.pengxin.dispose.common.PengXinStopTaskRsp;
@ -102,7 +103,7 @@ public class UpfAbilityImpl extends PengXinAbilityImpl {
public void initDeviceEnv(String urlPath, String username, String password) {
this.urlRootPath = urlPath;
this.username = username;
this.password = password;
this.password = new String(CryptoHelper.base64Decryption(password));
restfulInterface.setParams(1, 0);
//获取token值
upgradeToken();

View File

@ -28,6 +28,7 @@ import com.dispose.pojo.entity.DisposeDevice;
import com.dispose.pojo.po.MulReturnType;
import com.dispose.security.annotation.Decryption;
import com.dispose.security.annotation.Encryption;
import com.dispose.security.arithmetic.CryptoHelper;
import com.dispose.service.DisposeDeviceManagerService;
import com.dispose.validation.group.ValidGroups;
import com.github.pagehelper.PageInfo;
@ -45,6 +46,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
@ -70,7 +72,7 @@ public class DisposeDeviceManagerController {
private DisposeDeviceManagerService disposeDeviceManagerService;
/**
* Request to device list list.
* Request to device list.
*
* @param req the req
* @return the list
@ -98,7 +100,7 @@ public class DisposeDeviceManagerController {
.model(v.getModel())
.version(v.getVersion())
.userName(v.getUserName())
.password(v.getPassword())
.password(CryptoHelper.base64Encryption(v.getPassword().getBytes(StandardCharsets.UTF_8)))
.urlPath(v.getUrlPath())
.urlType(hType)
.readme(v.getReadme())