Skip to content

Commit

Permalink
Merge pull request #173 from yg3630536/bugfix/remove-weidauth
Browse files Browse the repository at this point in the history
* remove weidAuth
  • Loading branch information
chaoxinhu committed Apr 24, 2020
2 parents 83da944 + 3444fb8 commit ac21454
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 16 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.6.2
1.6.2
6 changes: 5 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ if (!gradle.startParameter.isOffline()) {

group 'com.webank'

version = new File("./VERSION").getText('UTF-8').trim()
version = "0.0.0"
def versionFile = file("VERSION")
versionFile.eachLine { line ->
version = line
}
println 'Current product version: ' + version

// Specify JDK version - may vary in different scenarios
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

package com.webank.weid.service.impl.callback;

import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -31,11 +30,6 @@
import com.webank.weid.rpc.callback.AmopCallback;
import com.webank.weid.service.impl.base.AmopCommonArgs;
import com.webank.weid.service.impl.inner.DownTransDataService;
import com.webank.weid.suite.auth.impl.WeIdAuthImpl;
import com.webank.weid.suite.auth.inf.WeIdAuth;
import com.webank.weid.suite.auth.protocol.WeIdAuthObj;
import com.webank.weid.suite.crypto.CryptServiceFactory;
import com.webank.weid.suite.entity.CryptType;
import com.webank.weid.suite.transmission.TransmissionService;
import com.webank.weid.suite.transmission.TransmissionServiceCenter;
import com.webank.weid.util.DataToolUtils;
Expand All @@ -49,20 +43,21 @@ public class CommonCallback extends AmopCallback {

private static final Logger logger = LoggerFactory.getLogger(CommonCallback.class);

private static WeIdAuth weIdAuthService;
//private static WeIdAuth weIdAuthService;

static {
// 初始化默认的服务处理
initDefaultService();
}

/*
private WeIdAuth getweIdAuthService() {
if (weIdAuthService == null) {
weIdAuthService = new WeIdAuthImpl();
}
return weIdAuthService;
}

*/
private static void initDefaultService() {
register(ServiceType.SYS_GET_TRANS_DATA.name(), new DownTransDataService());
}
Expand All @@ -86,6 +81,8 @@ public AmopResponse onPush(AmopCommonArgs arg) {
);
return super.onPush(arg);
}
// 此处暂时不走认证模式
/*
String channelId = arg.getChannelId();
if (StringUtils.isBlank(channelId)) {
logger.error("[CommonCallBack] the channelId is null, messageId:{}.", messageId);
Expand All @@ -101,16 +98,19 @@ public AmopResponse onPush(AmopCommonArgs arg) {
CryptServiceFactory
.getCryptService(CryptType.AES)
.decrypt(arg.getMessage(), weIdAuth.getSymmetricKey());
*/
logger.info("[CommonCallBack] begin request the service, messageId : {}", messageId);
AmopResponse amopResponse = buildAmopResponse(service.service(message), arg);
AmopResponse amopResponse = buildAmopResponse(service.service(arg.getMessage()), arg);
logger.info("[CommonCallBack] begin encrypt the data, messageId : {}", messageId);
/*
// 数据暂时不走认证模式
//加密响应数据
String originalData =
CryptServiceFactory
.getCryptService(CryptType.AES)
.encrypt(amopResponse.getResult(), weIdAuth.getSymmetricKey());

amopResponse.setResult(originalData);
*/
logger.info("[CommonCallBack] onPush finish and the reponse : {}", amopResponse);
return amopResponse;
} catch (WeIdBaseException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,29 +83,35 @@ private ResponseData<String> sendLocal(TransmissionRequest<?> request) {

private ResponseData<String> sendAmop(TransmissionRequest<?> request) {
logger.info("[AmopTransmission.sendAmop] request by AMOP.");
TransmissionlRequestWarp<?> requestWarp = super.authTransmission(request);
AmopCommonArgs amopCommonArgs = buildAmopCommonArgs(requestWarp);
// 此处由于集群环境下的bug,暂时不走认证通道
// TransmissionlRequestWarp<?> requestWarp = super.authTransmission(request);
AmopCommonArgs amopCommonArgs = buildAmopCommonArgs(request);
logger.info("[AmopTransmission.sendAmop] messageId:{}, request: {}",
amopCommonArgs.getMessageId(), amopCommonArgs);
ResponseData<AmopResponse> amopResponse = amopTransmissionPoxy.send(amopCommonArgs);
logger.info("[AmopTransmission.sendAmop] messageId:{}, response: {}.",
amopResponse.getResult().getMessageId(), amopResponse);
ResponseData<String> response = processResult(amopResponse);
/*
// 数据不走认证通道 不需要解密
if (response.getErrorCode().intValue() == ErrorCode.SUCCESS.getCode()) {
//请求成功解密数据
String original = super.decryptData(response.getResult(), requestWarp.getWeIdAuthObj());
response.setResult(original);
}
*/
return response;
}


/*
private AmopCommonArgs buildAmopCommonArgs(TransmissionlRequestWarp<?> requestWarp) {
AmopCommonArgs amopCommonArgs = buildAmopCommonArgs(requestWarp.getRequest());
amopCommonArgs.setChannelId(requestWarp.getWeIdAuthObj().getChannelId());
amopCommonArgs.setMessage(requestWarp.getEncodeData());
return amopCommonArgs;
}

*/

private AmopCommonArgs buildAmopCommonArgs(TransmissionRequest<?> request) {
AmopCommonArgs args = new AmopCommonArgs();
args.setServiceType(request.getServiceType());
Expand Down

0 comments on commit ac21454

Please sign in to comment.