本文整理汇总了Java中org.hamster.weixinmp.dao.entity.auth.WxAuthReq类的典型用法代码示例。如果您正苦于以下问题:Java WxAuthReq类的具体用法?Java WxAuthReq怎么用?Java WxAuthReq使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
WxAuthReq类属于org.hamster.weixinmp.dao.entity.auth包,在下文中一共展示了WxAuthReq类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateAuth
import org.hamster.weixinmp.dao.entity.auth.WxAuthReq; //导入依赖的package包/类
public boolean validateAuth(String signature, String timestamp,
String nonce, String echostr) throws WxException {
WxAuthReq authReq = new WxAuthReq();
authReq.setCreatedDate(new Date());
authReq.setSignature(signature);
authReq.setTimestamp(timestamp);
authReq.setNonce(nonce);
authReq.setEchostr(echostr);
String excepted = hash(getStringToHash(timestamp, nonce,
config.getToken()));
if (signature == null || !signature.equals(excepted)) {
log.error("Authentication failed! excepted echostr ->" + excepted);
log.error(" actual ->" + signature);
return false;
}
return true;
}
示例2: getAuthReq
import org.hamster.weixinmp.dao.entity.auth.WxAuthReq; //导入依赖的package包/类
public static WxAuthReq getAuthReq(String signature, String timestamp,
String nonce, String echostr) {
WxAuthReq result = new WxAuthReq();
result.setSignature(signature);
result.setTimestamp(timestamp);
result.setNonce(nonce);
result.setEchostr(echostr);
return result;
}