opt-code
This commit is contained in:
parent
c85c0636fd
commit
7d39894ff2
@ -65,13 +65,12 @@ public class CoreDispatcher {
|
||||
.writeTimeout(10, TimeUnit.SECONDS);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
String bearer = null;
|
||||
AuthSecretToken authSecretTokenOut;
|
||||
AuthSecretToken authSecretTokenOut = getAuthSecretTokenOut(operatorId3irdpty, operatorID);
|
||||
try {
|
||||
if (object.getClass().getSimpleName().equals("CommonRequest")) {
|
||||
CommonRequest commonRequest = (CommonRequest) object;
|
||||
if (operatorId3irdpty == null)
|
||||
operatorId3irdpty = commonRequest.getOperatorId();
|
||||
authSecretTokenOut = getAuthSecretTokenOut(operatorId3irdpty, operatorID);
|
||||
Date tokenExpiry = authSecretTokenOut.getTokenExpiry();
|
||||
String oData = commonRequest.getData();
|
||||
String tData;
|
||||
@ -87,7 +86,7 @@ public class CoreDispatcher {
|
||||
authSecretTokenOut.getSigSecret(), commonRequest);
|
||||
}
|
||||
Request request = new Request.Builder()
|
||||
.url(evcsSrvUrl + "/query_token")
|
||||
.url(authSecretTokenOut.getUrlPrefix() + "/query_token")
|
||||
.post(okhttp3.RequestBody.create(JSON, tData))
|
||||
.build();
|
||||
OkHttpClient client = builder.build();
|
||||
@ -116,7 +115,7 @@ public class CoreDispatcher {
|
||||
throw new ServerInternalException(msg);
|
||||
}
|
||||
final Request.Builder req = new Request.Builder()
|
||||
.url(evcsSrvUrl + url)
|
||||
.url(authSecretTokenOut.getUrlPrefix() + url)
|
||||
.header("Authorization", "Bearer " + bearer);
|
||||
Request request;
|
||||
assert body != null;
|
||||
|
||||
@ -40,12 +40,6 @@ public class QueryTokenController extends CoreDispatcher {
|
||||
tokenResponse.setOperatorId("MA6DFCTD5");
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
// if (operator == null) {
|
||||
// resp.setRet("4003");
|
||||
// resp.setMsg("Invalid OperatorID");
|
||||
// tokenResponse.setSuccStat(1);
|
||||
// tokenResponse.setFailReason(1);
|
||||
// } else {
|
||||
String data = null;
|
||||
AuthSecretToken authSecretToken = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, tokenRequest.getOperatorSecret()).orElse(null);
|
||||
@ -79,7 +73,6 @@ public class QueryTokenController extends CoreDispatcher {
|
||||
resp.setSig(encrypt.get("Sig").asText());
|
||||
log.debug("out.enc: {}", resp);
|
||||
}
|
||||
// }
|
||||
return resp;
|
||||
}
|
||||
|
||||
@ -90,9 +83,4 @@ public class QueryTokenController extends CoreDispatcher {
|
||||
return dt.toDate();
|
||||
}
|
||||
|
||||
private AuthSecretToken getAuthSecretToken(String operatorID, String tokenType) {
|
||||
|
||||
return authSecretTokenRepository.findByOperatorIdAndSecretTokenType(operatorID, tokenType).orElse(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user