diff --git a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/provider/HswebResponseJudgeSupport.java b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/provider/HswebResponseJudgeSupport.java index 5a1e5b441..7675ef2f5 100644 --- a/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/provider/HswebResponseJudgeSupport.java +++ b/hsweb-authorization/hsweb-authorization-oauth2/hsweb-authorization-oauth2-client/src/main/java/org/hswebframework/web/authorization/oauth2/client/simple/provider/HswebResponseJudgeSupport.java @@ -44,19 +44,24 @@ public class HswebResponseJudgeSupport implements ResponseJudgeForProviderDefini if (!result.trim().startsWith("{")) { return null; } - JSONObject jsonRes = JSON.parseObject(result); - Integer status = jsonRes.getInteger("status"); - if (status == null && response.status() == 200) { - return null; - } - if (status != null) { - if (status == 200) { + try { + JSONObject jsonRes = JSON.parseObject(result); + if (jsonRes.size() > 5) return null; + Integer status = jsonRes.getInteger("status"); + if (status == null && response.status() == 200) { return null; } - return ErrorType.fromCode(status).orElse(ErrorType.OTHER); - } - if (jsonRes.get("message") != null) { - return ErrorType.valueOf(jsonRes.getString("message")); + if (status != null) { + if (status == 200) { + return null; + } + return ErrorType.fromCode(status).orElse(ErrorType.OTHER); + } + if (jsonRes.get("message") != null) { + return ErrorType.valueOf(jsonRes.getString("message")); + } + } catch (Exception ignore) { + } return null; }