|
@ -127,7 +127,7 @@ public class GatewayProcessor implements Processor {
|
|
|
private boolean checkAuthorized(Map<String, Object> params) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
//TODO 设置固定的验证入口地址
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApiAuth?appId=" + params.get("appKey") + "&apiName=" + params.get("api"));
|
|
|
HTTPResponse response = HttpClientKit.get("http://192.168.1.221:10000/api/v1.0/admin/appApiAuth?appId=" + params.get("appKey") + "&apiName=" + params.get("api"));
|
|
|
if (response.getStatusCode() != 200) {
|
|
|
System.out.println("验证API权限,请求失败!");
|
|
|
return false;
|
|
@ -184,9 +184,10 @@ public class GatewayProcessor implements Processor {
|
|
|
endPoint[0] = endPoint[0].replaceAll("\\{[^}]*\\}", value);
|
|
|
} else if (p.getType().equals("2")) { //head param
|
|
|
exchange.getOut().setHeader(p.getName(), value);
|
|
|
}else {
|
|
|
body[0] += ("&" + p.getName() + "=" + value);
|
|
|
}
|
|
|
|
|
|
body[0] += ("&" + p.getName() + "=" + value);
|
|
|
});
|
|
|
|
|
|
if (body[0].length() != 0) {
|
|
@ -205,7 +206,7 @@ public class GatewayProcessor implements Processor {
|
|
|
return appApi;
|
|
|
}
|
|
|
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApi/search?filters=methodName%3D" + api + "&size=15&page=1");
|
|
|
HTTPResponse response = HttpClientKit.get("http://192.168.1.221:10000/api/v1.0/admin/appApi/search?filters=methodName%3D" + api + "&size=15&page=1");
|
|
|
if (response.getStatusCode() != 200) {
|
|
|
return null;
|
|
|
}
|
|
@ -225,7 +226,7 @@ public class GatewayProcessor implements Processor {
|
|
|
private String getSecret(String appKey) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
//TODO 设置固定的验证入口地址
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/apps/" + appKey);
|
|
|
HTTPResponse response = HttpClientKit.get("http://192.168.1.221:10000/api/v1.0/admin/apps/" + appKey);
|
|
|
if (response.getStatusCode() != 200) {
|
|
|
System.out.println("获取app的secret请求失败!");
|
|
|
return "";
|