Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed: null value for ppbNumber #73

Merged
merged 2 commits into from
Mar 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions examples/configs/config-dev.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
{
"id": "iudx.rs.proxy.authenticator.AuthenticationVerticle",
"verticleInstances": 1,
"keystore": "",
"keystorePassword": "",
"audience": "",
"authServerHost": "",
"jwtIgnoreExpiry": true
Expand Down Expand Up @@ -59,7 +61,10 @@
"verticleInstances": 1,
"dataBrokerIP": "",
"dataBrokerPort": 1234,
"prodVhost": "",
"internalVhost": "",
"externalVhost": "",
"adapterQueryPublishExchange": "",
"dataBrokerUserName": "",
"dataBrokerPassword": "",
"dataBrokerManagementPort": 30042,
Expand All @@ -68,13 +73,10 @@
"handshakeTimeout": 6000,
"requestedChannelMax": 5,
"networkRecoveryInterval": 500,
"automaticRecoveryEnabled": "",
"adapterQueryPublishExchange": "",
"adapterQueryReplyQueue": ""
"automaticRecoveryEnabled": ""
},
{
"id": "iudx.rs.proxy.optional.consentlogs.ConsentLoggingVerticle",
"isWorkerVerticle": true,
"verticleInstances": 1,
"certFileName": "",
"password": ""
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/iudx/rs/proxy/apiserver/AsyncRestApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ private Future<Void> logConsentResponse(RoutingContext routingContext) {
consentLog = "DATA_DENIED";
break;
}
default:
consentLog = "DATA_DENIED";
}
LOGGER.info("response ended : {}", routingContext.response());
LOGGER.info("consent log : {}", consentLog);
Expand Down Expand Up @@ -320,6 +322,8 @@ private void adapterResponseForSearchQuery(RoutingContext context, JsonObject js
if (isAdexInstance) {
json.put("ppbNumber", extractPPBNo(authInfo)); // this is exclusive for ADeX deployment.
}

LOGGER.debug("publishing async query into rmq :" + json);
databrokerService.executeAdapterQueryRPC(json, handler -> {
if (handler.succeeded()) {
JsonObject adapterResponse = handler.result();
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/iudx/rs/proxy/apiserver/ParamsValidator.java
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,8 @@ private Future<Boolean> isValidQueryWithFilters(MultiMap paramsMap) {
filtersFuture.onComplete(handler -> {
if (handler.succeeded()) {
JsonObject catItemJson = filtersFuture.result();
List<String> filters = new ArrayList<>(catItemJson.getJsonArray("iudxResourceAPIs").getList());
LOGGER.debug("for filters:: "+catItemJson);
List<String> filters = new ArrayList<>(catItemJson.getJsonArray("iudxResourceAPIs",new JsonArray()).getList());
if (isTemporalQuery(paramsMap) && !filters.contains("TEMPORAL")) {
promise.fail("Temporal parameters are not supported by RS group/Item.");
return;
Expand Down
31 changes: 22 additions & 9 deletions src/main/java/iudx/rs/proxy/apiserver/handlers/AuthHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,14 @@ public void handle(RoutingContext context) {

LOGGER.debug("Info :" + context.request().path());
String id = getId(context, ID);
LOGGER.debug("ID : {}", id);

if (isAdexInstance) {
String ppbNumber = getId(context, NGSLILDQUERY_Q);
authInfo.put(PPB_NUMBER, ppbNumber);
String ppbNumber = getId(context, NGSLILDQUERY_Q);
LOGGER.debug("ppbNumber :{}", ppbNumber);
if(ppbNumber!=null){
authInfo.put(PPB_NUMBER, ppbNumber);
}
}

authInfo.put(ID, id);
Expand All @@ -91,6 +96,7 @@ public void handle(RoutingContext context) {
for (String i : idArray) {
ids.add(i);
}
LOGGER.debug("authInfo: "+authInfo);
requestJson.put(IDS, ids);
authenticator.tokenIntrospect(
requestJson,
Expand Down Expand Up @@ -162,7 +168,7 @@ private String getId(RoutingContext context, String option) {

private String getId4rmRequest(String option) {
if (option.equalsIgnoreCase(NGSLILDQUERY_Q)) {
String ppbnoValue = null;
String ppbnoValue = "";
try {
ppbnoValue = extractPpbno(request.getParam(option));

Expand All @@ -177,7 +183,7 @@ private String getId4rmRequest(String option) {
private String getId4rmBody(RoutingContext context, String option) {
JsonObject body = context.body().asJsonObject();
if (option.equalsIgnoreCase(NGSLILDQUERY_Q) && body != null) {
String ppbnoValue = null;
String ppbnoValue = "";
try {
ppbnoValue = extractPpbno(body.getString(NGSLILDQUERY_Q));

Expand All @@ -201,11 +207,18 @@ private String getId4rmBody(RoutingContext context, String option) {

private String extractPpbno(String q) {
LOGGER.info("q: " + q);
int PpbIndex = q.indexOf("Ppbno==");
int firstSemiIndex = q.indexOf(';', PpbIndex);
firstSemiIndex = firstSemiIndex == -1 ? q.length() : firstSemiIndex;
String ppbno = q.substring(PpbIndex + 7, firstSemiIndex);
return ppbno;
try{
int PpbIndex = q.indexOf("Ppbno==");
int firstSemiIndex = q.indexOf(';', PpbIndex);
firstSemiIndex = firstSemiIndex == -1 ? q.length() : firstSemiIndex;
String ppbno = q.substring(PpbIndex + 7, firstSemiIndex);
LOGGER.debug("ppbno:: "+ppbno);
return ppbno;
}catch (Exception e){
e.printStackTrace();
return null;
}

}


Expand Down