微信公众平台-服务器配置

/**
* 服务器配置(微信公众平台)
* @param request
* @param response
* @throws IOException
*/
@GetMapping(value = "/conf")
public void wxconf(HttpServletRequest request, HttpServletResponse response) throws IOException {
String signature=request.getParameter("signature");
String timestamp=request.getParameter("timestamp");
String nonce=request.getParameter("nonce");
String echostr=request.getParameter("echostr");
String token = "abc";//这里填基本配置中的token
String jiami = "";
try {
jiami=SHA1.getSHA1(token, timestamp, nonce,"");//这里是对三个参数进行加密
} catch (AesException e) {
e.printStackTrace();
}
System.out.println("加密"+jiami);
System.out.println("本身"+signature);
PrintWriter out=response.getWriter();
if(jiami.equals(signature))
out.print(echostr);
}


图片.png

你可能感兴趣的:(微信公众平台-服务器配置)