本文整理匯總了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;
}