generated from gCubeCI/Pipeline-Docker-Template
Add stripLegacyToken property in config.js to avoid passing the legacy token to subrequests
This commit is contained in:
parent
2dece4c576
commit
5e42773344
|
@ -4,6 +4,7 @@ var config = {
|
||||||
"pep_credentials": "pep_credentials",
|
"pep_credentials": "pep_credentials",
|
||||||
"debug": true,
|
"debug": true,
|
||||||
"legacy": true,
|
"legacy": true,
|
||||||
|
"stripLegacyToken": false,
|
||||||
"accounting": {
|
"accounting": {
|
||||||
"scopes": ["authorized_scope1", "authorizeed_scope2"],
|
"scopes": ["authorized_scope1", "authorizeed_scope2"],
|
||||||
"service_name": "docker_stack_name",
|
"service_name": "docker_stack_name",
|
||||||
|
|
|
@ -73,7 +73,13 @@ function enforce_legacy(r) {
|
||||||
// debug(context, "Context again:\n" + njs.dump(context));
|
// debug(context, "Context again:\n" + njs.dump(context));
|
||||||
context.userinfo = userinfo
|
context.userinfo = userinfo
|
||||||
context.record = buildAccountingRecord_legacy(context)
|
context.record = buildAccountingRecord_legacy(context)
|
||||||
return context.request.subrequest("/_backend", { method: context.request.method, args: JSON.stringify(context.request.args), headers: context.request.headersIn })
|
if (context.config["stripLegacyToken"] == true) {
|
||||||
|
var subreq_args = JSON.parse(JSON.stringify(context.request.args));
|
||||||
|
delete subreq_args["gcube-token"];
|
||||||
|
} else {
|
||||||
|
var subreq_args = context.request.args;
|
||||||
|
}
|
||||||
|
return context.request.subrequest("/_backend", { method: context.request.method, args: JSON.stringify(subreq_args), headers: context.request.headersIn })
|
||||||
}).then(reply => {
|
}).then(reply => {
|
||||||
// debug(context, "response from backend\n" + reply.responseText);
|
// debug(context, "response from backend\n" + reply.responseText);
|
||||||
debug(context, "Response status from backend: " + reply.status)
|
debug(context, "Response status from backend: " + reply.status)
|
||||||
|
|
Loading…
Reference in New Issue