zoukankan      html  css  js  c++  java
  • 微信开发-SpringMVC开发者身份验证

    package com.medivh.web;
    
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.Date;
    import java.util.Map;
    
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    
    import org.springframework.stereotype.Controller;
    import org.springframework.web.bind.annotation.RequestMapping;
    
    import com.tgb.util.WxUtil;
    
    
    @Controller
    @RequestMapping("/wx")
    public class WxTokenController
    {
    	private static final String TOKEN = "myToken";
    
    	@RequestMapping(value = "/tokenTest")
    	public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
    	{
    		if("get".equalsIgnoreCase(request.getMethod()))//第一次验证腾讯会访问我们的这个GET方法
    		{
    			String signature = request.getParameter("signature");
    			
    			String echostr = request.getParameter("echostr");
    			
    			String timestamp = request.getParameter("timestamp");
    			
    			String nonce = request.getParameter("nonce");
    			
    			
    			response.getWriter().print(echostr);//只要把echostr原样返回即可验证通过,明文是最简单的一种方式
    		}
    	}
    
    }
    

  • 相关阅读:
    c++关于map的find和count的使用
    leetcode Two Sum
    leetcode Group Anagrams
    机器学习常见算法分类汇总
    KD树
    偏差与方差(未完)
    线性模型
    决策树
    Linux服务器配置---ftp用户黑名单
    Linux基础命令---mkdir
  • 原文地址:https://www.cnblogs.com/MedivhQ/p/4101265.html
Copyright © 2011-2022 走看看