提交 e84bd7cd 编写于 作者: 智布道's avatar 智布道 👁

🔖 merge #101

上级 dce2bd1e
## 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 ## 1.15.8
### 2020/10/25 ### 2020/10/25
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</p> </p>
<p align="center"> <p align="center">
<a target="_blank" href="https://search.maven.org/search?q=JustAuth"> <a target="_blank" href="https://search.maven.org/search?q=JustAuth">
<img src="https://img.shields.io/badge/Maven%20Central-1.15.8-blue" ></img> <img src="https://img.shields.io/badge/Maven%20Central-1.15.9-blue" ></img>
</a> </a>
<a target="_blank" href="https://gitee.com/yadong.zhang/JustAuth/blob/master/LICENSE"> <a target="_blank" href="https://gitee.com/yadong.zhang/JustAuth/blob/master/LICENSE">
<img src="https://img.shields.io/apm/l/vim-mode.svg?color=yellow" ></img> <img src="https://img.shields.io/apm/l/vim-mode.svg?color=yellow" ></img>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img> <img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img>
</a> </a>
<a target="_blank" href="https://apidoc.gitee.com/yadong.zhang/JustAuth/" title="API文档"> <a target="_blank" href="https://apidoc.gitee.com/yadong.zhang/JustAuth/" title="API文档">
<img src="https://img.shields.io/badge/Api%20Docs-1.15.8-orange" ></img> <img src="https://img.shields.io/badge/Api%20Docs-1.15.9-orange" ></img>
</a> </a>
<a target="_blank" href="https://justauth.wiki" title="参考文档"> <a target="_blank" href="https://justauth.wiki" title="参考文档">
<img src="https://img.shields.io/badge/Docs-latest-blueviolet.svg" ></img> <img src="https://img.shields.io/badge/Docs-latest-blueviolet.svg" ></img>
...@@ -97,7 +97,7 @@ These artifacts are available from Maven Central: ...@@ -97,7 +97,7 @@ These artifacts are available from Maven Central:
<dependency> <dependency>
<groupId>me.zhyd.oauth</groupId> <groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId> <artifactId>JustAuth</artifactId>
<version>1.15.8-beta.2</version> <version>1.15.9</version>
</dependency> </dependency>
``` ```
- Using JustAuth - Using JustAuth
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
</p> </p>
<p align="center"> <p align="center">
<a target="_blank" href="https://search.maven.org/search?q=JustAuth"> <a target="_blank" href="https://search.maven.org/search?q=JustAuth">
<img src="https://img.shields.io/badge/Maven%20Central-1.15.8-blue" ></img> <img src="https://img.shields.io/badge/Maven%20Central-1.15.9-blue" ></img>
</a> </a>
<a target="_blank" href="https://gitee.com/yadong.zhang/JustAuth/blob/master/LICENSE"> <a target="_blank" href="https://gitee.com/yadong.zhang/JustAuth/blob/master/LICENSE">
<img src="https://img.shields.io/apm/l/vim-mode.svg?color=yellow" ></img> <img src="https://img.shields.io/apm/l/vim-mode.svg?color=yellow" ></img>
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img> <img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img>
</a> </a>
<a target="_blank" href="https://apidoc.gitee.com/yadong.zhang/JustAuth/" title="API文档"> <a target="_blank" href="https://apidoc.gitee.com/yadong.zhang/JustAuth/" title="API文档">
<img src="https://img.shields.io/badge/Api%20Docs-1.15.8-orange" ></img> <img src="https://img.shields.io/badge/Api%20Docs-1.15.9-orange" ></img>
</a> </a>
<a target="_blank" href="https://justauth.wiki" title="参考文档"> <a target="_blank" href="https://justauth.wiki" title="参考文档">
<img src="https://img.shields.io/badge/Docs-latest-blueviolet.svg" ></img> <img src="https://img.shields.io/badge/Docs-latest-blueviolet.svg" ></img>
...@@ -107,7 +107,7 @@ JustAuth 集成了诸如:Github、Gitee、支付宝、新浪微博、微信、 ...@@ -107,7 +107,7 @@ JustAuth 集成了诸如:Github、Gitee、支付宝、新浪微博、微信、
<dependency> <dependency>
<groupId>me.zhyd.oauth</groupId> <groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId> <artifactId>JustAuth</artifactId>
<version>1.15.8</version> <version>1.15.9</version>
</dependency> </dependency>
``` ```
- 调用api - 调用api
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>me.zhyd.oauth</groupId> <groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId> <artifactId>JustAuth</artifactId>
<version>1.15.8</version> <version>1.15.9</version>
<name>JustAuth</name> <name>JustAuth</name>
<url>https://gitee.com/yadong.zhang/JustAuth</url> <url>https://gitee.com/yadong.zhang/JustAuth</url>
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<maven.compiler.target>1.8</maven.compiler.target> <maven.compiler.target>1.8</maven.compiler.target>
<maven-source.version>2.2.1</maven-source.version> <maven-source.version>2.2.1</maven-source.version>
<maven-compiler.version>3.8.1</maven-compiler.version> <maven-compiler.version>3.8.1</maven-compiler.version>
<maven-javadoc.version>3.1.0</maven-javadoc.version> <maven-javadoc.version>2.9.1</maven-javadoc.version>
<cobertura-version>2.7</cobertura-version> <cobertura-version>2.7</cobertura-version>
<maven-surefire-version>2.20</maven-surefire-version> <maven-surefire-version>2.20</maven-surefire-version>
<maven-gpg-version>1.6</maven-gpg-version> <maven-gpg-version>1.6</maven-gpg-version>
...@@ -133,6 +133,10 @@ ...@@ -133,6 +133,10 @@
<goals> <goals>
<goal>jar</goal> <goal>jar</goal>
</goals> </goals>
<configuration>
<!-- add this to disable checking -->
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
......
...@@ -119,9 +119,16 @@ public class AuthConfig { ...@@ -119,9 +119,16 @@ public class AuthConfig {
private String deviceId; 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; private String packId;
} }
...@@ -12,14 +12,17 @@ import me.zhyd.oauth.model.AuthToken; ...@@ -12,14 +12,17 @@ import me.zhyd.oauth.model.AuthToken;
import me.zhyd.oauth.model.AuthUser; import me.zhyd.oauth.model.AuthUser;
import me.zhyd.oauth.utils.GlobalAuthUtils; import me.zhyd.oauth.utils.GlobalAuthUtils;
import me.zhyd.oauth.utils.UrlBuilder; import me.zhyd.oauth.utils.UrlBuilder;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Optional;
import java.util.TreeMap; import java.util.TreeMap;
/** /**
* 喜马拉雅登录 * 喜马拉雅登录
* *
* @author zwzch (zwzch4j@gmail.com) * @author zwzch (zwzch4j@gmail.com)
* @since 1.15.8 * @since 1.15.9
*/ */
public class AuthXmlyRequest extends AuthDefaultRequest { public class AuthXmlyRequest extends AuthDefaultRequest {
...@@ -89,7 +92,7 @@ public class AuthXmlyRequest extends AuthDefaultRequest { ...@@ -89,7 +92,7 @@ public class AuthXmlyRequest extends AuthDefaultRequest {
public AuthUser getUserInfo(AuthToken authToken) { public AuthUser getUserInfo(AuthToken authToken) {
Map<String, String> map = new TreeMap<>(); Map<String, String> map = new TreeMap<>();
map.put("app_key", config.getClientId()); 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("device_id", config.getDeviceId());
map.put("pack_id", config.getPackId()); map.put("pack_id", config.getPackId());
map.put("access_token", authToken.getAccessToken()); map.put("access_token", authToken.getAccessToken());
...@@ -113,7 +116,7 @@ public class AuthXmlyRequest extends AuthDefaultRequest { ...@@ -113,7 +116,7 @@ public class AuthXmlyRequest extends AuthDefaultRequest {
* *
* @param object 接口返回的结果 * @param object 接口返回的结果
*/ */
private void checkResponse(JSONObject object){ private void checkResponse(JSONObject object) {
if (object.containsKey("errcode")) { if (object.containsKey("errcode")) {
throw new AuthException(object.getIntValue("error_no"), object.getString("error_desc")); throw new AuthException(object.getIntValue("error_no"), object.getString("error_desc"));
} }
......
...@@ -38,6 +38,12 @@ public class AuthChecker { ...@@ -38,6 +38,12 @@ public class AuthChecker {
if (isSupported && AuthDefaultSource.CODING == source) { if (isSupported && AuthDefaultSource.CODING == source) {
isSupported = StringUtils.isNotEmpty(config.getCodingGroupName()); 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; return isSupported;
} }
......
...@@ -227,6 +227,7 @@ public class GlobalAuthUtils { ...@@ -227,6 +227,7 @@ public class GlobalAuthUtils {
* @param params 加密参数 * @param params 加密参数
* @param clientSecret 平台应用的授权key * @param clientSecret 平台应用的授权key
* @return Signature * @return Signature
* @since 1.15.9
*/ */
public static String generateXmlySignature(Map<String, String> params, String clientSecret) { public static String generateXmlySignature(Map<String, String> params, String clientSecret) {
TreeMap<String, String> map = new TreeMap<>(params); TreeMap<String, String> map = new TreeMap<>(params);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册