|
@ -34,7 +34,7 @@ public class GatewayProcessor implements Processor {
|
|
|
public String secret(@Body String body, Exchange exchange) throws IOException, ParseException {
|
|
|
System.out.println(body);
|
|
|
String appKey = exchange.getIn().getHeaders().get("appKey").toString();
|
|
|
return "restlet:http://sdw2:10000/api/v1.0/admin/apps/" + appKey;
|
|
|
return "restlet:http://192.168.1.221:10000/api/v1.0/admin/apps/" + appKey;
|
|
|
}
|
|
|
|
|
|
public String route(Exchange exchange) throws IOException, ParseException {
|
|
@ -127,9 +127,9 @@ public class GatewayProcessor implements Processor {
|
|
|
private boolean checkAuthorized(Map<String, Object> params) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
//TODO 设置固定的验证入口地址
|
|
|
HTTPResponse response = HttpClientKit.get("http://192.168.131.109:10000/api/v1.0/admin/appApiAuth?appId=" + params.get("appKey") + "&apiName=" + params.get("api"));
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/appApiAuth?appId=" + params.get("appKey") + "&apiName=" + params.get("api"));
|
|
|
if (response.getStatusCode() != 200) {
|
|
|
System.out.println("请求失败!");
|
|
|
System.out.println("验证API权限,请求失败!");
|
|
|
return false;
|
|
|
}
|
|
|
|
|
@ -225,9 +225,9 @@ public class GatewayProcessor implements Processor {
|
|
|
private String getSecret(String appKey) {
|
|
|
ObjectMapper objectMapper = new ObjectMapper();
|
|
|
//TODO 设置固定的验证入口地址
|
|
|
HTTPResponse response = HttpClientKit.get("http://192.168.131.109:10000/api/v1.0/admin/apps/" + appKey);
|
|
|
HTTPResponse response = HttpClientKit.get("http://localhost:10000/api/v1.0/admin/apps/" + appKey);
|
|
|
if (response.getStatusCode() != 200) {
|
|
|
System.out.println("请求失败!");
|
|
|
System.out.println("获取app的secret请求失败!");
|
|
|
return "";
|
|
|
}
|
|
|
|