mirror of
https://github.com/Kingsrook/qqq.git
synced 2025-07-17 20:50:44 +00:00
CE-608: updated check for jsonObject when processing API GET request to consider the object being jsonObject.isNull(), added ability to use CUSTOM authorization in an API util override
This commit is contained in:
@ -519,7 +519,7 @@ public class BaseAPIActionUtil
|
||||
{
|
||||
String wrapperObjectName = getBackendDetails(table).getTableWrapperObjectName();
|
||||
jsonObject = JsonUtils.toJSONObject(resultString);
|
||||
if(jsonObject.has(wrapperObjectName))
|
||||
if(jsonObject.has(wrapperObjectName) && !jsonObject.isNull(wrapperObjectName))
|
||||
{
|
||||
Object o = jsonObject.get(wrapperObjectName);
|
||||
if(o instanceof JSONArray jsonArray)
|
||||
@ -750,6 +750,10 @@ public class BaseAPIActionUtil
|
||||
throw (new QException("Error setting authorization query parameter", e));
|
||||
}
|
||||
}
|
||||
case CUSTOM ->
|
||||
{
|
||||
handleCustomAuthorization(request);
|
||||
}
|
||||
default -> throw new IllegalArgumentException("Unexpected authorization type: " + backendMetaData.getAuthorizationType());
|
||||
}
|
||||
}
|
||||
@ -1398,4 +1402,16 @@ public class BaseAPIActionUtil
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
return (7 * 1024);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
**
|
||||
*******************************************************************************/
|
||||
protected void handleCustomAuthorization(HttpRequestBase request) throws QException
|
||||
{
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// nothing to do at this layer, meant to be overridden by subclasses //
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
}
|
||||
}
|
||||
|
@ -31,6 +31,7 @@ public enum AuthorizationType
|
||||
API_TOKEN,
|
||||
BASIC_AUTH_API_KEY,
|
||||
BASIC_AUTH_USERNAME_PASSWORD,
|
||||
CUSTOM,
|
||||
OAUTH2,
|
||||
API_KEY_QUERY_PARAM,
|
||||
}
|
||||
|
Reference in New Issue
Block a user