Closed abhi4578 closed 2 years ago
whereas file-server inserts audit to rsaduitingtable
https://github.com/datakaveri/iudx-file-server/blob/4687733ced40f957dc493bccef18d02373a847dd/src/main/java/iudx/file/server/auditing/util/Constants.java#L25 and so its api-calls audit can be obtained from resource access server apis https://rs.iudx.org.in/apis#operation/consumer%20search .
Issue patched with :
deployed image ghcr.io/datakaveri/rs-depl:3.5.0-6613e6b
in rs-test server
Not able to get consumer audit details for open resource with open token:
curl --location --request GET 'https://rs.iudx.org.in/ngsi-ld/v1/consumer/audit?id=datakaveri.org/04a15c9960ffda227e9546f3f46e629e1fe4132b/rs.iudx.org.in/pune-env-aqm/184ba502-22a8-ad15-a8f1-c966cd3aa7a7&timerel=during&time=2022-03-10T14:20:00Z&endtime=2022-03-16T14:20:00Z' --header 'token: <open-resource-token>' --header 'options: count'
curl response:{"type":"urn:dx:rs:invalidAuthorizationToken","title":"Not Authorized","detail":"Not Authorized"}
The failure logs at the resource server :
With secure token with "/api" access for a secure resource, the metering api fails in production. The curl
curl response
{"type":"urn:dx:rs:backend","title":"Bad Request","detail":"Bad Request"}
The failure logs:
Reason: In production, the rs uses different immudb db than
metering
. possible solution: In the code it has to take the db name from config https://github.com/datakaveri/iudx-resource-server/blob/850a287159127d0645e636e19cc00679bb461000/configs/config-example.json#L118 to form exact column name . See at https://github.com/datakaveri/iudx-resource-server/blob/850a287159127d0645e636e19cc00679bb461000/src/main/java/iudx/resource/server/metering/util/Constants.java#L65The current logic in the code would not allow that i feel. Because the gis inserts audit data to a different table called
gisauditingtable
https://github.com/datakaveri/iudx-gis-interface/blob/71888173aadf6a7f25e7fcf8702c26648c5a4249/src/main/java/iudx/gis/server/metering/util/Constants.java#L25 and resource access server consumer/provider search audit api just reads data fromrsauditingtable
. Similarly for di https://github.com/datakaveri/iudx-data-ingestion-server/blob/5d17699c39faf5d23aac7e6681607ac99fd76b95/src/main/java/iudx/data/ingestion/server/metering/util/Constants.java#L20.