diff --git a/CHANGELOGS.md b/CHANGELOGS.md index 88161d1b4faeb46ca47645cfbfed3243af9df0bf..ace41caab65e033cd28ecd1950e1c6eae7f7b082 100644 --- a/CHANGELOGS.md +++ b/CHANGELOGS.md @@ -1,3 +1,14 @@ +## 1.15.9 + +### 2020/12/20 + +- 发布 v1.15.9 +- PR + - 合并 [Github#101](https://gitee.com/yadong.zhang/JustAuth/pulls/101) +- 修改 + - 修改喜马拉雅配置参数,将`ClientOsType`参数提到 AuthConfig 中 + - AuthChecker 中增加对喜马拉雅平台的校验 + ## 1.15.8 ### 2020/10/25 diff --git a/README.en-US.md b/README.en-US.md index 087a3c7bd8c852d1d3295e2d1f0faa6f1c4fcb08..4d18425d3c41861528d037d2016204210a60f7b3 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -6,7 +6,7 @@

- + @@ -15,7 +15,7 @@ - + @@ -97,7 +97,7 @@ These artifacts are available from Maven Central: me.zhyd.oauth JustAuth - 1.15.8-beta.2 + 1.15.9 ``` - Using JustAuth diff --git a/README.md b/README.md index 95d1ded5e2d342bcd9fb5cb617a2785a690171f4..aff22d77bf08fb99ad3ee2fc51ee5924847fc294 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@

- + @@ -15,7 +15,7 @@ - + @@ -107,7 +107,7 @@ JustAuth 集成了诸如:Github、Gitee、支付宝、新浪微博、微信、 me.zhyd.oauth JustAuth - 1.15.8 + 1.15.9 ``` - 调用api diff --git a/bin/version.txt b/bin/version.txt index 98e863cdf81f0ea6a2d78abf78b40ecc38f1f1f8..30a88ea45a4fcfa9d53f8c344af1e86e6b76d1ef 100644 --- a/bin/version.txt +++ b/bin/version.txt @@ -1 +1 @@ -1.15.8 +1.15.9 diff --git a/pom.xml b/pom.xml index e7e37cf2de162bdfca195014da1d686bdc4a8748..c7d74771599fbf849f24343781aa43e5c679c7ca 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ me.zhyd.oauth JustAuth - 1.15.8 + 1.15.9 JustAuth https://gitee.com/yadong.zhang/JustAuth @@ -52,7 +52,7 @@ 1.8 2.2.1 3.8.1 - 3.1.0 + 2.9.1 2.7 2.20 1.6 @@ -133,6 +133,10 @@ jar + + + -Xdoclint:none + diff --git a/src/main/java/me/zhyd/oauth/config/AuthConfig.java b/src/main/java/me/zhyd/oauth/config/AuthConfig.java index a153c7876ac4931d1914ad1818c9865bc4267462..339d6fa09b744f5a8ececbe7916562a5086ce6fc 100644 --- a/src/main/java/me/zhyd/oauth/config/AuthConfig.java +++ b/src/main/java/me/zhyd/oauth/config/AuthConfig.java @@ -119,9 +119,16 @@ public class AuthConfig { private String deviceId; /** - * 喜马拉雅:客户端包名,如果client_os_type为1或2时必填。对Android客户端是包名,对IOS客户端是Bundle ID + * 喜马拉雅:客户端操作系统类型,1-iOS系统,2-Android系统,3-Web * - * @since 1.15.8 + * @since 1.15.9 + */ + private Integer clientOsType; + + /** + * 喜马拉雅:客户端包名,如果 {@link AuthConfig#clientOsType} 为1或2时必填。对Android客户端是包名,对IOS客户端是Bundle ID + * + * @since 1.15.9 */ private String packId; } diff --git a/src/main/java/me/zhyd/oauth/request/AuthXmlyRequest.java b/src/main/java/me/zhyd/oauth/request/AuthXmlyRequest.java index 877c77a1c274754cbc075c6e408c70bb5bf5a2c4..9c6e1cf2eed9314f174a66c2fe6cb50178670f15 100644 --- a/src/main/java/me/zhyd/oauth/request/AuthXmlyRequest.java +++ b/src/main/java/me/zhyd/oauth/request/AuthXmlyRequest.java @@ -12,14 +12,17 @@ import me.zhyd.oauth.model.AuthToken; import me.zhyd.oauth.model.AuthUser; import me.zhyd.oauth.utils.GlobalAuthUtils; import me.zhyd.oauth.utils.UrlBuilder; + import java.util.HashMap; import java.util.Map; +import java.util.Optional; import java.util.TreeMap; + /** * 喜马拉雅登录 * * @author zwzch (zwzch4j@gmail.com) - * @since 1.15.8 + * @since 1.15.9 */ public class AuthXmlyRequest extends AuthDefaultRequest { @@ -89,7 +92,7 @@ public class AuthXmlyRequest extends AuthDefaultRequest { public AuthUser getUserInfo(AuthToken authToken) { Map map = new TreeMap<>(); map.put("app_key", config.getClientId()); - map.put("client_os_type", "2"); + map.put("client_os_type", Optional.ofNullable(config.getClientOsType()).orElse(3).toString()); map.put("device_id", config.getDeviceId()); map.put("pack_id", config.getPackId()); map.put("access_token", authToken.getAccessToken()); @@ -113,7 +116,7 @@ public class AuthXmlyRequest extends AuthDefaultRequest { * * @param object 接口返回的结果 */ - private void checkResponse(JSONObject object){ + private void checkResponse(JSONObject object) { if (object.containsKey("errcode")) { throw new AuthException(object.getIntValue("error_no"), object.getString("error_desc")); } diff --git a/src/main/java/me/zhyd/oauth/utils/AuthChecker.java b/src/main/java/me/zhyd/oauth/utils/AuthChecker.java index 703729ed7439d11176fed4c05ab1eb7e04d7a155..13a292ac4a0216680d221ffd53e48af7251f5485 100644 --- a/src/main/java/me/zhyd/oauth/utils/AuthChecker.java +++ b/src/main/java/me/zhyd/oauth/utils/AuthChecker.java @@ -38,6 +38,12 @@ public class AuthChecker { if (isSupported && AuthDefaultSource.CODING == source) { isSupported = StringUtils.isNotEmpty(config.getCodingGroupName()); } + if (isSupported && AuthDefaultSource.XMLY == source) { + isSupported = StringUtils.isNotEmpty(config.getDeviceId()) && null != config.getClientOsType(); + if (isSupported) { + isSupported = config.getClientOsType() == 3 || StringUtils.isNotEmpty(config.getPackId()); + } + } return isSupported; } diff --git a/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtils.java b/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtils.java index f6dbf80b91cd74cc534681ab72a72b3bc04ca161..af3c4ca7a6e0c8bed40f4084669420484eda8b1e 100644 --- a/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtils.java +++ b/src/main/java/me/zhyd/oauth/utils/GlobalAuthUtils.java @@ -227,6 +227,7 @@ public class GlobalAuthUtils { * @param params 加密参数 * @param clientSecret 平台应用的授权key * @return Signature + * @since 1.15.9 */ public static String generateXmlySignature(Map params, String clientSecret) { TreeMap map = new TreeMap<>(params);