JSSDKHelper rename to JSSDKConfigurator & 重构了token类
This commit is contained in:
parent
ab0619ac38
commit
8da3fab8b8
@ -5,7 +5,7 @@
|
|||||||
<parent>
|
<parent>
|
||||||
<groupId>com.foxinmy</groupId>
|
<groupId>com.foxinmy</groupId>
|
||||||
<artifactId>weixin4j</artifactId>
|
<artifactId>weixin4j</artifactId>
|
||||||
<version>1.6.5</version>
|
<version>1.6.6</version>
|
||||||
</parent>
|
</parent>
|
||||||
<artifactId>weixin4j-base</artifactId>
|
<artifactId>weixin4j-base</artifactId>
|
||||||
<name>weixin4j-base</name>
|
<name>weixin4j-base</name>
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
package com.foxinmy.weixin4j.util;
|
package com.foxinmy.weixin4j.jssdk;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSSDK接口列表
|
* JSSDK接口列表
|
||||||
@ -243,7 +243,17 @@ public enum JSSDKAPI {
|
|||||||
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82"
|
* "http://mp.weixin.qq.com/wiki/11/74ad127cc054f6b80759c40f77ec03db.html#.E5.8F.91.E8.B5.B7.E4.B8.80.E4.B8.AA.E5.BE.AE.E4.BF.A1.E6.94.AF.E4.BB.98.E8.AF.B7.E6.B1.82"
|
||||||
* >微信支付-发起一个微信支付请求</a>
|
* >微信支付-发起一个微信支付请求</a>
|
||||||
*/
|
*/
|
||||||
chooseWXPay;
|
chooseWXPay,
|
||||||
|
/**
|
||||||
|
* <a href=
|
||||||
|
* "http://qydev.weixin.qq.com/wiki/index.php?title=%E5%BE%AE%E4%BF%A1JS-SDK%E6%8E%A5%E5%8F%A3#.E5.88.9B.E5.BB.BA.E4.BC.81.E4.B8.9A.E5.8F.B7.E4.BC.9A.E8.AF.9D"
|
||||||
|
* >企业号会话-创建企业号会话</a>
|
||||||
|
*/
|
||||||
|
openEnterpriseChat,
|
||||||
|
/**
|
||||||
|
* 企业号-选取联系人(内测)
|
||||||
|
*/
|
||||||
|
openEnterpriseContact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分享接口集合
|
* 分享接口集合
|
||||||
@ -302,4 +312,8 @@ public enum JSSDKAPI {
|
|||||||
* 微信支付接口集合
|
* 微信支付接口集合
|
||||||
*/
|
*/
|
||||||
public final static JSSDKAPI[] PAY_APIS = { chooseWXPay };
|
public final static JSSDKAPI[] PAY_APIS = { chooseWXPay };
|
||||||
|
/**
|
||||||
|
* 企业号会话接口集合
|
||||||
|
*/
|
||||||
|
public final static JSSDKAPI[] CHAT_APIS = { openEnterpriseChat };
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.foxinmy.weixin4j.util;
|
package com.foxinmy.weixin4j.jssdk;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -8,17 +8,23 @@ import java.util.Set;
|
|||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||||
import com.foxinmy.weixin4j.token.TokenHolder;
|
import com.foxinmy.weixin4j.token.TokenHolder;
|
||||||
|
import com.foxinmy.weixin4j.util.DateUtil;
|
||||||
|
import com.foxinmy.weixin4j.util.DigestUtil;
|
||||||
|
import com.foxinmy.weixin4j.util.MapUtil;
|
||||||
|
import com.foxinmy.weixin4j.util.RandomUtil;
|
||||||
|
import com.foxinmy.weixin4j.util.StringUtil;
|
||||||
|
import com.foxinmy.weixin4j.util.Weixin4jConfigUtil;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSSDK帮助类
|
* JSSDK帮助类
|
||||||
*
|
*
|
||||||
* @className JSSDKHelper
|
* @className JSSDKConfigurator
|
||||||
* @author jy
|
* @author jy
|
||||||
* @date 2015年12月23日
|
* @date 2015年12月23日
|
||||||
* @since JDK 1.6
|
* @since JDK 1.6
|
||||||
* @see
|
* @see
|
||||||
*/
|
*/
|
||||||
public class JSSDKHelper {
|
public class JSSDKConfigurator {
|
||||||
private final TokenHolder ticketTokenHolder;
|
private final TokenHolder ticketTokenHolder;
|
||||||
private JSONObject config;
|
private JSONObject config;
|
||||||
private Set<JSSDKAPI> apis;
|
private Set<JSSDKAPI> apis;
|
||||||
@ -28,7 +34,7 @@ public class JSSDKHelper {
|
|||||||
*
|
*
|
||||||
* @param ticketTokenHolder
|
* @param ticketTokenHolder
|
||||||
*/
|
*/
|
||||||
public JSSDKHelper(TokenHolder ticketTokenHolder) {
|
public JSSDKConfigurator(TokenHolder ticketTokenHolder) {
|
||||||
this.ticketTokenHolder = ticketTokenHolder;
|
this.ticketTokenHolder = ticketTokenHolder;
|
||||||
this.config = new JSONObject();
|
this.config = new JSONObject();
|
||||||
this.apis = new HashSet<JSSDKAPI>();
|
this.apis = new HashSet<JSSDKAPI>();
|
||||||
@ -40,7 +46,7 @@ public class JSSDKHelper {
|
|||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSSDKHelper debugMode() {
|
public JSSDKConfigurator debugMode() {
|
||||||
config.put("debug", true);
|
config.put("debug", true);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -51,7 +57,7 @@ public class JSSDKHelper {
|
|||||||
* @param appId
|
* @param appId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSSDKHelper appId(String appId) {
|
public JSSDKConfigurator appId(String appId) {
|
||||||
config.put("appId", appId);
|
config.put("appId", appId);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
@ -63,7 +69,7 @@ public class JSSDKHelper {
|
|||||||
* @param apis
|
* @param apis
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSSDKHelper apis(JSSDKAPI... apis) {
|
public JSSDKConfigurator apis(JSSDKAPI... apis) {
|
||||||
for (JSSDKAPI api : apis) {
|
for (JSSDKAPI api : apis) {
|
||||||
this.apis.add(api);
|
this.apis.add(api);
|
||||||
}
|
}
|
||||||
@ -77,7 +83,7 @@ public class JSSDKHelper {
|
|||||||
* @param apis
|
* @param apis
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public JSSDKHelper apis(JSSDKAPI[]... apis) {
|
public JSSDKConfigurator apis(JSSDKAPI[]... apis) {
|
||||||
for (JSSDKAPI[] api : apis) {
|
for (JSSDKAPI[] api : apis) {
|
||||||
for (JSSDKAPI apii : api) {
|
for (JSSDKAPI apii : api) {
|
||||||
this.apis.add(apii);
|
this.apis.add(apii);
|
||||||
@ -32,9 +32,13 @@ public class Token implements Serializable {
|
|||||||
@JSONField(name = "expires_in")
|
@JSONField(name = "expires_in")
|
||||||
private int expiresIn;
|
private int expiresIn;
|
||||||
/**
|
/**
|
||||||
* token创建的时间 只在FileTokenStorager模式下有效
|
* token创建的时间
|
||||||
*/
|
*/
|
||||||
private long time;
|
private long createTime;
|
||||||
|
/**
|
||||||
|
* 请求返回的原始结果
|
||||||
|
*/
|
||||||
|
private String originalResult;
|
||||||
|
|
||||||
public Token() {
|
public Token() {
|
||||||
|
|
||||||
@ -60,17 +64,25 @@ public class Token implements Serializable {
|
|||||||
this.expiresIn = expiresIn;
|
this.expiresIn = expiresIn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getTime() {
|
public long getCreateTime() {
|
||||||
return time;
|
return createTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setTime(long time) {
|
public void setCreateTime(long createTime) {
|
||||||
this.time = time;
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalResult() {
|
||||||
|
return originalResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalResult(String originalResult) {
|
||||||
|
this.originalResult = originalResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Token [accessToken=" + accessToken + ", expiresIn=" + expiresIn
|
return "Token [accessToken=" + accessToken + ", expiresIn=" + expiresIn
|
||||||
+ ", time=" + time + "]";
|
+ ", createTime=" + createTime + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,10 +33,10 @@ public class FileTokenStorager implements TokenStorager {
|
|||||||
if (token_file.exists()) {
|
if (token_file.exists()) {
|
||||||
Token token = XmlStream.fromXML(
|
Token token = XmlStream.fromXML(
|
||||||
new FileInputStream(token_file), Token.class);
|
new FileInputStream(token_file), Token.class);
|
||||||
if (token.getTime() < 0) {
|
if (token.getCreateTime() < 0) {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
if ((token.getTime() + (token.getExpiresIn() * 1000l) - 2) > System
|
if ((token.getCreateTime() + (token.getExpiresIn() * 1000l) - 2) > System
|
||||||
.currentTimeMillis()) {
|
.currentTimeMillis()) {
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,12 +1,14 @@
|
|||||||
package com.foxinmy.weixin4j.token;
|
package com.foxinmy.weixin4j.token;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import redis.clients.jedis.Jedis;
|
import redis.clients.jedis.Jedis;
|
||||||
import redis.clients.jedis.JedisPool;
|
import redis.clients.jedis.JedisPool;
|
||||||
import redis.clients.jedis.JedisPoolConfig;
|
import redis.clients.jedis.JedisPoolConfig;
|
||||||
|
|
||||||
import com.foxinmy.weixin4j.exception.WeixinException;
|
import com.foxinmy.weixin4j.exception.WeixinException;
|
||||||
import com.foxinmy.weixin4j.model.Token;
|
import com.foxinmy.weixin4j.model.Token;
|
||||||
import com.foxinmy.weixin4j.util.StringUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 用REDIS保存TOKEN
|
* 用REDIS保存TOKEN
|
||||||
@ -54,9 +56,9 @@ public class RedisTokenStorager implements TokenStorager {
|
|||||||
Jedis jedis = null;
|
Jedis jedis = null;
|
||||||
try {
|
try {
|
||||||
jedis = jedisPool.getResource();
|
jedis = jedisPool.getResource();
|
||||||
String accessToken = jedis.get(cacheKey);
|
Map<String, String> map = jedis.hgetAll(cacheKey);
|
||||||
if (!StringUtil.isBlank(accessToken)) {
|
if (map != null && !map.isEmpty()) {
|
||||||
return new Token(accessToken);
|
return map2token(map);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (jedis != null) {
|
if (jedis != null) {
|
||||||
@ -71,11 +73,9 @@ public class RedisTokenStorager implements TokenStorager {
|
|||||||
Jedis jedis = null;
|
Jedis jedis = null;
|
||||||
try {
|
try {
|
||||||
jedis = jedisPool.getResource();
|
jedis = jedisPool.getResource();
|
||||||
|
jedis.hmset(cacheKey, token2map(token));
|
||||||
if (token.getExpiresIn() > 0) {
|
if (token.getExpiresIn() > 0) {
|
||||||
jedis.setex(cacheKey, (int) token.getExpiresIn(),
|
jedis.expire(cacheKey, token.getExpiresIn());
|
||||||
token.getAccessToken());
|
|
||||||
} else {
|
|
||||||
jedis.set(cacheKey, token.getAccessToken());
|
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if (jedis != null) {
|
if (jedis != null) {
|
||||||
@ -83,4 +83,21 @@ public class RedisTokenStorager implements TokenStorager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected Map<String, String> token2map(Token token) {
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
map.put("accessToken", token.getAccessToken());
|
||||||
|
map.put("originalResult", token.getOriginalResult());
|
||||||
|
map.put("createTime", Long.toString(token.getCreateTime()));
|
||||||
|
map.put("expiresIn", Integer.toString(token.getExpiresIn()));
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Token map2token(Map<String, String> map) {
|
||||||
|
Token token = new Token(map.get("accessToken"));
|
||||||
|
token.setCreateTime(Long.parseLong(map.get("createTime")));
|
||||||
|
token.setExpiresIn(Integer.parseInt(map.get("expiresIn")));
|
||||||
|
token.setOriginalResult(map.get("originalResult"));
|
||||||
|
return token;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -72,8 +72,8 @@ public class OauthToken extends Token {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "OauthToken [openId=" + openId + ", unionId=" + unionId
|
return "OauthToken [openId=" + openId + ", unionId=" + unionId
|
||||||
+ ", refreshToken=" + refreshToken + ", scope=" + scope
|
+ ", refreshToken=" + refreshToken + ", scope=" + scope
|
||||||
+ ", getAccessToken()=" + getAccessToken()
|
+ ", accessToken=" + getAccessToken()
|
||||||
+ ", getExpiresIn()=" + getExpiresIn() + ", getTime()="
|
+ ", expiresIn=" + getExpiresIn() + ", createTime="
|
||||||
+ getTime() + "]";
|
+ getCreateTime() + "]";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,8 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
|||||||
JSONObject result = response.getAsJson();
|
JSONObject result = response.getAsJson();
|
||||||
Token token = new Token(result.getString("ticket"));
|
Token token = new Token(result.getString("ticket"));
|
||||||
token.setExpiresIn(result.getIntValue("expires_in"));
|
token.setExpiresIn(result.getIntValue("expires_in"));
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,8 @@ public class WeixinTokenCreator implements TokenCreator {
|
|||||||
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
||||||
Token token = response.getAsObject(new TypeReference<Token>() {
|
Token token = response.getAsObject(new TypeReference<Token>() {
|
||||||
});
|
});
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,7 +17,7 @@ public class XmlstreamTest {
|
|||||||
Token token = new Token();
|
Token token = new Token();
|
||||||
token.setAccessToken("accessToken");
|
token.setAccessToken("accessToken");
|
||||||
token.setExpiresIn(12);
|
token.setExpiresIn(12);
|
||||||
token.setTime(13l);
|
token.setCreateTime(13l);
|
||||||
String content = XmlStream.toXML(token);
|
String content = XmlStream.toXML(token);
|
||||||
System.err.println(content);
|
System.err.println(content);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -184,7 +184,7 @@ public class SuiteApi extends QyApi {
|
|||||||
suitePerCodeHolder, suiteTokenHolder);
|
suitePerCodeHolder, suiteTokenHolder);
|
||||||
Token token = new Token(obj.getString("access_token"));
|
Token token = new Token(obj.getString("access_token"));
|
||||||
token.setExpiresIn(obj.getIntValue("expires_in"));
|
token.setExpiresIn(obj.getIntValue("expires_in"));
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
suiteTicketHolder.getTokenStorager().caching(
|
suiteTicketHolder.getTokenStorager().caching(
|
||||||
tokenCreator.getCacheKey(), token);
|
tokenCreator.getCacheKey(), token);
|
||||||
// 缓存微信企业号永久授权码
|
// 缓存微信企业号永久授权码
|
||||||
|
|||||||
@ -54,7 +54,8 @@ public class WeixinSuitePreCodeCreator implements TokenCreator {
|
|||||||
JSONObject result = response.getAsJson();
|
JSONObject result = response.getAsJson();
|
||||||
Token token = new Token(result.getString("pre_auth_code"));
|
Token token = new Token(result.getString("pre_auth_code"));
|
||||||
token.setExpiresIn(result.getIntValue("expires_in"));
|
token.setExpiresIn(result.getIntValue("expires_in"));
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,8 @@ public class WeixinSuiteTokenCreator implements TokenCreator {
|
|||||||
obj = response.getAsJson();
|
obj = response.getAsJson();
|
||||||
Token token = new Token(obj.getString("suite_access_token"));
|
Token token = new Token(obj.getString("suite_access_token"));
|
||||||
token.setExpiresIn(obj.getIntValue("expires_in"));
|
token.setExpiresIn(obj.getIntValue("expires_in"));
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -60,7 +60,8 @@ public class WeixinTokenSuiteCreator implements TokenCreator {
|
|||||||
obj = response.getAsJson();
|
obj = response.getAsJson();
|
||||||
Token token = new Token(obj.getString("access_token"));
|
Token token = new Token(obj.getString("access_token"));
|
||||||
token.setExpiresIn(obj.getIntValue("expires_in"));
|
token.setExpiresIn(obj.getIntValue("expires_in"));
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -52,7 +52,8 @@ public class WeixinJSTicketCreator implements TokenCreator {
|
|||||||
JSONObject result = response.getAsJson();
|
JSONObject result = response.getAsJson();
|
||||||
Token token = new Token(result.getString("ticket"));
|
Token token = new Token(result.getString("ticket"));
|
||||||
token.setExpiresIn(result.getIntValue("expires_in"));
|
token.setExpiresIn(result.getIntValue("expires_in"));
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -53,7 +53,8 @@ public class WeixinProviderTokenCreator implements TokenCreator {
|
|||||||
obj = response.getAsJson();
|
obj = response.getAsJson();
|
||||||
Token token = new Token(obj.getString("provider_access_token"));
|
Token token = new Token(obj.getString("provider_access_token"));
|
||||||
token.setExpiresIn(obj.getIntValue("expires_in"));
|
token.setExpiresIn(obj.getIntValue("expires_in"));
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,8 @@ public class WeixinTokenCreator implements TokenCreator {
|
|||||||
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
WeixinResponse response = weixinExecutor.get(tokenUrl);
|
||||||
Token token = response.getAsObject(new TypeReference<Token>() {
|
Token token = response.getAsObject(new TypeReference<Token>() {
|
||||||
});
|
});
|
||||||
token.setTime(System.currentTimeMillis());
|
token.setCreateTime(System.currentTimeMillis());
|
||||||
|
token.setOriginalResult(response.getAsString());
|
||||||
return token;
|
return token;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -29,6 +29,11 @@ public final class URLConsts {
|
|||||||
*/
|
*/
|
||||||
public static final String JS_TICKET_URL = BASE_URL
|
public static final String JS_TICKET_URL = BASE_URL
|
||||||
+ "/get_jsapi_ticket?access_token=%s";
|
+ "/get_jsapi_ticket?access_token=%s";
|
||||||
|
/**
|
||||||
|
* 企业号获取ticket的url
|
||||||
|
*/
|
||||||
|
public static final String TICKET_URL = BASE_URL
|
||||||
|
+ "/ticket/get?access_token=%s&type=%s";
|
||||||
/**
|
/**
|
||||||
* 企业号第三方应用套件获取token的url
|
* 企业号第三方应用套件获取token的url
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
* @since JDK 1.6
|
* @since JDK 1.6
|
||||||
* @see
|
* @see
|
||||||
*/
|
*/
|
||||||
public final class DigestUtil {
|
public final class DigestUtils {
|
||||||
|
|
||||||
private static MessageDigest getDigest(final String algorithm) {
|
private static MessageDigest getDigest(final String algorithm) {
|
||||||
try {
|
try {
|
||||||
@ -35,7 +35,7 @@ public final class MessageUtil {
|
|||||||
for (String str : para) {
|
for (String str : para) {
|
||||||
sb.append(str);
|
sb.append(str);
|
||||||
}
|
}
|
||||||
return DigestUtil.SHA1(sb.toString());
|
return DigestUtils.SHA1(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user