By: Olivier Jeannin user 31 Jan 2019 at 7:03 p.m. CST

3 Responses
Olivier Jeannin gravatar
I all, I want try the "introspection_sample" custom script and I think there are some problems. The custom script is enable but when I try call the introspection endpoint with my access_token, I dont found the "key_from_script" element in the json response. I found some problems : 1. in ExternalIntrospectionService.java the first "executeExternalModifyResponse" function always return false. solution : I think the last return should return True. 2. in IntrospectionWebService.java (line 144) this line `return Response.status(Response.Status.OK).entity(responseAsJsonObject).build();` dont work, the error is something like "no driver found for the class JSONObject". solution : I change for : `return Response.status(Response.Status.OK).entity(responseAsJsonObject.toString()).build();` and now its ok. 3. in the "introspection_sample" custom script the line `responseAsJsonObject.put("key_from_script", "value_from_script")` dont work as expected, the result is : `"key_from_script":["v","a","l","u","e","_","f","r","o","m","_","s","c","r","i","p","t"]` in the json response. Its because jython use this function in the JSONObject class : ``` public JSONObject put(String key, Collection value) throws JSONException { put(key, new JSONArray(value)); return this; } ``` I think the String "value_from_script" is something like Collection in jython. solution : I use in the custom script : ``` responseAsJsonObject.accumulate("key_from_script", "value_from_script") ``` its ok if the key dont already exist. because if the key dont already exist the accumulate function call `put(key, value); ` and the value type is Object, not Collection, this function is used : ``` public JSONObject put(String key, Object value) throws JSONException { return doPut(key, value, -1, false); } ``` And after that the "introspection_sample" custom script work fine :)

By Yuriy Zabrovarnyy staff 01 Feb 2019 at 11:34 a.m. CST

Yuriy Zabrovarnyy gravatar
You are right, it's bug, fix will be available in 3.1.6 https://github.com/GluuFederation/oxAuth/issues/998 Thanks, Yuriy Z

By Yuriy Zabrovarnyy staff 01 Feb 2019 at 11:49 a.m. CST

Yuriy Zabrovarnyy gravatar
Olivier, Thanks for nice report, issue is fixed. Is there anything else you would like to address within this ticket? BR, Yuriy Z

By Olivier Jeannin user 04 Feb 2019 at 3:22 p.m. CST

Olivier Jeannin gravatar
You're welcome, nothing to add, just thanks for your efficiency :) Olivier.