|
@@ -1,13 +1,11 @@
|
|
|
package com.hichina.main.back.hichinamainback.utils;
|
|
|
|
|
|
import com.google.gson.JsonObject;
|
|
|
-import com.google.gson.JsonParser;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.core.env.Environment;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
-import java.io.IOException;
|
|
|
|
|
|
@Component
|
|
|
public class FacebookAccessTokenValidator {
|
|
@@ -23,23 +21,10 @@ public class FacebookAccessTokenValidator {
|
|
|
private Environment env;
|
|
|
|
|
|
public boolean validateAccessToken(String accessToken) {
|
|
|
-
|
|
|
String proxyHost = "127.0.0.1";
|
|
|
-
|
|
|
int proxyPort = Integer.parseInt(env.getProperty("gfw.proxy.port"));
|
|
|
-
|
|
|
String targetUrl = GRAPH_API_URL+accessToken;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- JsonObject response = HttpUtils.sendToWithProxyV2(targetUrl, proxyHost, proxyPort);
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return response!=null?response.has("id"):false;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ JsonObject response = HttpUtils.sendToWithProxyV2(targetUrl, proxyHost, proxyPort);
|
|
|
+ return response!=null?response.has("id"):false;
|
|
|
}
|
|
|
}
|