|
@ -120,7 +120,26 @@ public class GatewayProcessor implements Processor {
|
|
|
}
|
|
|
|
|
|
private boolean checkAuthorized(Map<String, Object> params) {
|
|
|
return true;
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApiAuth?appId=" + params.get("appKey") + "&apiName="+ apiMap.get("api"));
|
|
|
if (response.getStatusCode() != 200) {
|
|
|
System.out.println("请求失败!");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
Map map = objectMapper.readValue(response.getBody(), Map.class);
|
|
|
if ((Boolean) map.get("successFlg")){
|
|
|
return true;
|
|
|
}else {
|
|
|
System.out.println("验证失败:"+map.get("errorMsg"));
|
|
|
return false;
|
|
|
}
|
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
private Map<String, String> parseBody(String body) throws IOException {
|