| | |
| | | public static final String REQ_METHOD_POST = "POST"; |
| | | public static final String REQ_METHOD_PUT = "PUT"; |
| | | public static final String REQ_METHOD_DELETE = "DELETE"; |
| | | // public static void main(String[] args) throws Exception { |
| | | // RequestEntity req = new RequestEntity(); |
| | | // req.setReqMethod(REQ_METHOD_POST); |
| | | // req.setUri("/open-web/rs/order/v1/add"); |
| | | // req.setReqTime("2015-04-14 13:21:00"); |
| | | // req.setContent("{\"senderProvince\":\"上海市\",\"senderCity\":\"上海市\",\"senderCounty\":\"闵行区\",\"senderAddress\":\"华翔路2239号\"}"); |
| | | // req.setEncryptKey("asd123"); |
| | | // System.out.println(generateToken(req)); |
| | | // } |
| | | |
| | | public static String generateToken(RequestEntity req) throws Exception{ |
| | | /** |
| | | * 将请求方式+uri+请求时间+请求参数进行签名生成token 1.对请求方式+uri+请求时间+请求参数进行HMAC-SHA1加密 |