141 auth_header

This commit is contained in:
msyu
2025-09-18 18:24:53 +03:00
parent ccf2231657
commit fd0f77806e
2 changed files with 9 additions and 5 deletions
+7 -5
View File
@@ -51,7 +51,7 @@
//variables.framework.docs={};
variables.framework.docs.APIName="svc-api";
variables.framework.docs.APIVersion="0.140"; /*dependencies*/ /*$ git config --global --unset user.password*/
variables.framework.docs.APIVersion="0.141"; /*auth_header*/ /*$ git config --global --unset user.password*/
variables.framework.globalHeaders = structNew();
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
@@ -62,7 +62,7 @@
request.UNDEFINED_USR_ID=-1;
request.ANONYMOUS_USR_ID=2;
request.GUEST_USR_ID=3;
request.USER_AGENT="#variables.framework.docs.APIName# #variables.framework.docs.APIVersion# stand:#this.getStand()#";
request.USER_AGENT="#variables.framework.docs.APIName# #variables.framework.docs.APIVersion# stand:#this.getStand()#";
////////////////////////////////////////////////////////
request.ORCHESTRATOR_AUTH = createObject("java", "java.lang.System").getEnv("ORCHESTRATOR_AUTH");
@@ -71,6 +71,8 @@
}
//*** почему-то scope this ведет себя совершенно не так, как request и variables
// в нем, когда переменная получает значение Empty:null, можно выполнить writedump, а в других получаем ошибку, что такой переменной нет
request.auth_header="";
request.locateIamService=locateIamService; //for possible debug
//request.IAM_SERVICE_URL=this.iamServiceUrl;
</cfscript>
@@ -230,9 +232,9 @@
if (lCase(arguments.cfc) EQ 'err') return true;
if (lCase(arguments.cfc) EQ 'throw') return true;
var auth="";
if (structKeyExists(headers,"Authorization")) {
auth=headers.Authorization;
request.auth_header=headers.Authorization;
} else {
return representationOf("Authorization header expected").withStatus(401);
}
@@ -240,7 +242,7 @@
try {
var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="5");
httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
httpService.addParam(type = "HEADER", name = "Authorization", value = "#auth#"); //passthrough
httpService.addParam(type = "HEADER", name = "Authorization", value = "#request.auth_header#"); //passthrough
//writedump(this.iamServiceUrl);abort;
var resp = httpService.send();
//if (resp.status_code NEQ 200) throw("IDP response not OK");
+2
View File
@@ -218,7 +218,9 @@
<cfhttpparam type="HEADER" name="Authorization" value="#request.ORCHESTRATOR_AUTH#"/>
<cfhttpparam type="HEADER" name="Accept" value="application/json"/>
<cfhttpparam type="HEADER" name="User-Agent" value="#request.USER_AGENT#"/>
<!--- <cfhttpparam type="HEADER" name="X-Auth-Token" value="#request.auth_header#"/> --->
<cfhttpparam type="formfield" name="delay" value="0sec"/>
<cfhttpparam type="formfield" name="auth_header" value="request.auth_header"/>
<cfloop query="qInstanceOperationParam">
<cfhttpparam type="formfield" name="#param#" value="#param_value#"/>
</cfloop>