184 bugfix
This commit is contained in:
+16
-10
@@ -1,5 +1,10 @@
|
||||
`<cfcomponent extends="taffy.core.api">
|
||||
<cfcomponent extends="taffy.core.api">
|
||||
<!---<cfset this.name = "deck_api" />--->
|
||||
<!--- Способы передачи аргументов из Application.cfc
|
||||
В скоупе request (доступен всегда и отовсюду). Но там может возникнуть хаос. Плюс: достаточно явный способ
|
||||
onTaffyRequest.arguments.requestArguments - инжектируется в аргументы методов get/post/put etc/
|
||||
this - в Taffy не работает, a только при include шаблона в Application.cfc (есть такой способ условного вызова шаблона) --->
|
||||
|
||||
<cfset this.mappings["/resources"] = expandPath("./resources")/>
|
||||
<cfset this.mappings["/taffy"] = expandPath("./taffy")/>
|
||||
<cfset this.mappings["/lib"] = expandPath("./lib")/>
|
||||
@@ -52,7 +57,7 @@
|
||||
|
||||
//variables.framework.docs={};
|
||||
variables.framework.docs.APIName="svc-api";
|
||||
variables.framework.docs.APIVersion="0.183"; /*$ git config --global --unset user.password*/
|
||||
variables.framework.docs.APIVersion="0.184"; /*$ git config --global --unset user.password*/
|
||||
|
||||
variables.framework.globalHeaders = structNew();
|
||||
variables.framework.globalHeaders["Access-Control-Expose-Headers"] = "Location";
|
||||
@@ -162,13 +167,13 @@
|
||||
|
||||
<cfswitch expression=#stand#>
|
||||
<cfcase value=",dev">
|
||||
<cfreturn "https://auth-api-dev.ngcloud.ru/api/v1/auth/user"/>
|
||||
<cfreturn "https://auth-api-dev.ngcloud.ru/api/v1" />
|
||||
</cfcase>
|
||||
<cfcase value="test">
|
||||
<cfreturn "https://auth-api-test.ngcloud.ru/api/v1/auth/user"/>
|
||||
<cfreturn "https://auth-api-test.ngcloud.ru/api/v1" />
|
||||
</cfcase>
|
||||
<cfcase value="prod">
|
||||
<cfreturn "https://auth-api.ngcloud.ru/api/v1/auth/user"/>
|
||||
<cfreturn "https://auth-api.ngcloud.ru/api/v1" />
|
||||
</cfcase>
|
||||
<cfdefaultcase><!--- proceed to the legacy locator ---></cfdefaultcase>
|
||||
</cfswitch>
|
||||
@@ -179,7 +184,7 @@
|
||||
</cftry>
|
||||
|
||||
<!--- вот если ничего не прописано, попробуем по-старинке --->
|
||||
<cfloop list="https://auth-api-dev.ngcloud.ru/api/v1/auth/user,https://auth-api-test.ngcloud.ru/api/v1/auth/user,https://auth-api.ngcloud.ru/api/v1/auth/user" index="serviceUrl"><!--- *** начиная с девелоперского --->
|
||||
<cfloop list="https://auth-api-dev.ngcloud.ru/api/v1,https://auth-api-test.ngcloud.ru/api/v1,https://auth-api.ngcloud.ru/api/v1" index="serviceUrl"><!--- *** начиная с девелоперского --->
|
||||
<cftry>
|
||||
<cfhttp url=#serviceUrl# method="OPTIONS" result="resp" timeout=1/>
|
||||
|
||||
@@ -251,19 +256,20 @@
|
||||
}
|
||||
var result="";
|
||||
try {
|
||||
var httpService = new http(method = "GET", charset = "utf-8", url = #this.iamServiceUrl#, timeout="5");
|
||||
var authUrl = "#this.iamServiceUrl#/auth/user";
|
||||
var httpService = new http(method = "GET", charset = "utf-8", url = #authUrl#, timeout="5");
|
||||
httpService.addParam(type = "HEADER", name = "Accept", value = "application/json");
|
||||
httpService.addParam(type = "HEADER", name = "Authorization", value = "#request.auth_header#"); //passthrough
|
||||
//writedump(this.iamServiceUrl);abort;
|
||||
//writedump(authUrl);abort;
|
||||
var resp = httpService.send();
|
||||
//if (resp.status_code NEQ 200) throw("IDP response not OK");
|
||||
//writedump(resp);abort;
|
||||
var prefix = resp.getPrefix();
|
||||
if (prefix.status_code NEQ 200) {
|
||||
//writedump(this.iamServiceUrl);
|
||||
//writedump(authUrl);
|
||||
//writedump(resp);
|
||||
var iamStatusCode = (isValid("integer", prefix.status_code)) ? val(prefix.status_code) : 500;
|
||||
return representationOf( {"iamServiceUrl"=this.iamServiceUrl, "idpResponse"=resp} ).withStatus(iamStatusCode);
|
||||
return representationOf( {"IAM URL"=#authUrl#, "idpResponse"=resp} ).withStatus(iamStatusCode);
|
||||
//abort;
|
||||
//throw("IDP response not OK");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user