Commit acba4819 by carrieyzzhang

openid

parent c14d14a5
...@@ -10,13 +10,7 @@ import com.reyun.security.TokenManager; ...@@ -10,13 +10,7 @@ import com.reyun.security.TokenManager;
import com.reyun.security.annotation.CurrentAccount; import com.reyun.security.annotation.CurrentAccount;
import com.reyun.security.interceptor.AuthorizationInterceptor; import com.reyun.security.interceptor.AuthorizationInterceptor;
import com.reyun.service.*; import com.reyun.service.*;
import com.reyun.util.CipherUtil; import com.reyun.util.*;
import com.reyun.util.Constant;
import com.reyun.util.DateUtil;
import com.reyun.util.ResultModel;
import com.reyun.util.StringUtil;
import com.reyun.util.ValidateCodeUtil;
import com.reyun.util.ValidateUtil;
import net.sf.json.JSONObject; import net.sf.json.JSONObject;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -288,4 +282,15 @@ public class LoginController ...@@ -288,4 +282,15 @@ public class LoginController
logger.error(e.getMessage()); logger.error(e.getMessage());
} }
} }
@RequestMapping(value = "getopenid", method = RequestMethod.GET)
@ResponseBody
public String getOpenid(HttpServletRequest request, HttpServletResponse response) {
String code = request.getParameter("js_code");
String appId = "wxd7411c633c54c5ab";
String appSecret = "69834fabd641256ec29b052743616308";
String url = "https://api.weixin.qq.com/sns/jscode2session?appid="+appId+"&secret="+appSecret+"&grant_type=authorization_code&js_code="+code;
String responseStr = HttpClientUtil.doHttpGetRequest(url, "");
return responseStr;
}
} }
...@@ -78,6 +78,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter { ...@@ -78,6 +78,7 @@ public class AuthorizationInterceptor extends HandlerInterceptorAdapter {
if (request.getRequestURL().indexOf("login/login") != -1 if (request.getRequestURL().indexOf("login/login") != -1
|| request.getRequestURL().indexOf("login/loginweb") != -1 || request.getRequestURL().indexOf("login/loginweb") != -1
|| request.getRequestURL().indexOf("login/getvalidcode") != -1 || request.getRequestURL().indexOf("login/getvalidcode") != -1
|| request.getRequestURL().indexOf("login/getopenid") != -1
|| request.getRequestURL().indexOf("external/download") != -1 || request.getRequestURL().indexOf("external/download") != -1
|| request.getRequestURL().indexOf("openapi/toutiao") != -1 || request.getRequestURL().indexOf("openapi/toutiao") != -1
// || request.getRequestURL().indexOf("event/find") != -1 // || request.getRequestURL().indexOf("event/find") != -1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment