From 54cad5e128f00e02ad742c059c94d0a7cce00099 Mon Sep 17 00:00:00 2001 From: "Yangkai.Shen" <237497819.com> Date: Sat, 29 Aug 2020 11:41:59 +0800 Subject: [PATCH] =?UTF-8?q?:ok=5Fhand:=20=E5=8E=BB=E9=99=A4=E4=B8=80?= =?UTF-8?q?=E4=BA=9B=20warning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 2 +- README.md | 28 +- pom.xml | 2 +- .../xkcoding/justauth/AuthRequestFactory.java | 4 +- ...itional-spring-configuration-metadata.json | 278 +++++++++--------- 5 files changed, 159 insertions(+), 155 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92b84e6..cf4eb4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 版本更新记录 -### 【1.3.4】2020-08-26 +### 【1.3.4.beta】2020-08-29 - 升级 `JustAuth` 版本:1.15.7-beta.3,支持自定义 http config diff --git a/README.md b/README.md index cc0eaf1..9e1b469 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ https://github.com/xkcoding/justauth-spring-boot-starter-demo com.xkcoding.justauth justauth-spring-boot-starter - 1.3.4 + 1.3.4.beta ``` @@ -537,9 +537,29 @@ justauth: 注:当项目中使用了自定义的第三方登录,并且需要使用代理时,也要在 `http-config` 节点下添加相关配置,格式参考上面示例 -## 5. 附录 +## 5. 自定义 Scopes -### 5.1. `justauth` 配置列表 +修改配置文件,增加如下配置: + +```yml +justauth: + enabled: true + type: + QQ: + client-id: 10**********6 + client-secret: 1f7d08**********5b7**********29e + redirect-uri: http://oauth.xkcoding.com/demo/oauth/qq/callback + union-id: false + scopes: + - get_user_info + - xxxx +``` + +注:你可以前往 `me.zhyd.oauth.enums.scope` 包下查看各个渠道所支持的 scopes,当然你可以不配置该项,JustAuth 会默认添加上一些基础 scope + +## 6. 附录 + +### 6.1. `justauth` 配置列表 | 属性名 | 类型 | 默认值 | 可选项 | 描述 | | ------------------ | ------------------------------------------------------------ | ------ | ---------- | ---------------------- | @@ -613,7 +633,7 @@ justauth: | `justauth.extend.config.keys` | `java.lang.String` | 无 | | key 必须在 `justauth.extend.enum-class` 配置的枚举类中声明 | | `justauth.extend.config.values` | `com.xkcoding.justauth.autoconfigure.ExtendProperties.ExtendRequestConfig` | 无 | | value 就是 `AuthConfig` 的子类,增加了一个 `request-class` 属性配置请求的全类名,具体参考类[`ExtendProperties.ExtendRequestConfig`](https://github.com/justauth/justauth-spring-boot-starter/blob/master/src/main/java/com/xkcoding/justauth/autoconfigure/ExtendProperties.java#L49-L54) | -### 5.2. SNAPSHOT版本 +### 6.2. SNAPSHOT版本 ![https://img.shields.io/badge/snapshots-1.4.0--SNAPSHOT-green](https://img.shields.io/badge/snapshots-1.4.0--SNAPSHOT-green)如果需要体验快照版本,可以在你的 `pom.xml`进行如下配置: diff --git a/pom.xml b/pom.xml index 84aed9e..9ada4eb 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ com.xkcoding.justauth justauth-spring-boot-starter - 1.3.4 + 1.3.4.beta justauth-spring-boot-starter https://github.com/xkcoding/justauth-spring-boot-starter diff --git a/src/main/java/com/xkcoding/justauth/AuthRequestFactory.java b/src/main/java/com/xkcoding/justauth/AuthRequestFactory.java index c1d304d..7f3a068 100644 --- a/src/main/java/com/xkcoding/justauth/AuthRequestFactory.java +++ b/src/main/java/com/xkcoding/justauth/AuthRequestFactory.java @@ -62,7 +62,7 @@ public class AuthRequestFactory { * * @return Oauth列表 */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) public List oauthList() { // 默认列表 List defaultList = new ArrayList<>(properties.getType().keySet()); @@ -118,7 +118,7 @@ public class AuthRequestFactory { * @param source {@link AuthSource} * @return {@link AuthRequest} */ - @SuppressWarnings("unchecked") + @SuppressWarnings({"unchecked", "rawtypes"}) private AuthRequest getExtendRequest(Class clazz, String source) { String upperSource = source.toUpperCase(); try { diff --git a/src/main/resources/META-INF/additional-spring-configuration-metadata.json b/src/main/resources/META-INF/additional-spring-configuration-metadata.json index 091e435..ff467cb 100644 --- a/src/main/resources/META-INF/additional-spring-configuration-metadata.json +++ b/src/main/resources/META-INF/additional-spring-configuration-metadata.json @@ -1,155 +1,139 @@ { - "properties": [ - { - "name": "justauth.type", - "type": "java.util.Map", - "description": "JustAuth 配置.", - "sourceType": "com.xkcoding.justauth.autoconfigure.JustAuthProperties" - } - ], "hints": [ { "name": "justauth.type.keys", - "providers": [ + "values": [ { - "name": "handle-as", - "values": [ - { - "value": "GITHUB", - "description": "GITHUB." - }, - { - "value": "WEIBO", - "description": "WEIBO." - }, - { - "value": "GITEE", - "description": "GITEE." - }, - { - "value": "DINGTALK", - "description": "DINGTALK." - }, - { - "value": "BAIDU", - "description": "BAIDU." - }, - { - "value": "CSDN", - "description": "CSDN." - }, - { - "value": "CODING", - "description": "CODING." - }, - { - "value": "OSCHINA", - "description": "OSCHINA." - }, - { - "value": "ALIPAY", - "description": "ALIPAY." - }, - { - "value": "QQ", - "description": "QQ." - }, - { - "value": "TAOBAO", - "description": "TAOBAO." - }, - { - "value": "GOOGLE", - "description": "GOOGLE." - }, - { - "value": "FACEBOOK", - "description": "FACEBOOK." - }, - { - "value": "DOUYIN", - "description": "DOUYIN." - }, - { - "value": "LINKEDIN", - "description": "LINKEDIN." - }, - { - "value": "MICROSOFT", - "description": "MICROSOFT." - }, - { - "value": "MI", - "description": "MI." - }, - { - "value": "TOUTIAO", - "description": "TOUTIAO." - }, - { - "value": "TEAMBITION", - "description": "TEAMBITION." - }, - { - "value": "RENREN", - "description": "RENREN." - }, - { - "value": "PINTEREST", - "description": "PINTEREST." - }, - { - "value": "STACK_OVERFLOW", - "description": "STACK_OVERFLOW." - }, - { - "value": "HUAWEI", - "description": "HUAWEI." - }, - { - "value": "WECHAT_OPEN", - "description": "WeChat open platform." - }, - { - "value": "WECHAT_ENTERPRISE", - "description": "WeChat enterprise platform." - }, - { - "value": "WECHAT_MP", - "description": "WeChat Official Platform." - }, - { - "value": "KUJIALE", - "description": "KUJIALE." - }, - { - "value": "GITLAB", - "description": "GITLAB." - }, - { - "value": "MEITUAN", - "description": "MEITUAN." - }, - { - "value": "ELEME", - "description": "ELEME." - }, - { - "value": "GITLAB", - "description": "GITLAB." - }, - { - "value": "TWITTER", - "description": "TWITTER." - }, - { - "value": "ALIYUN", - "description": "ALIYUN." - } - ], - "parameters": { - "target": "me.zhyd.oauth.config.AuthSource" - } + "value": "GITHUB", + "description": "GITHUB." + }, + { + "value": "WEIBO", + "description": "WEIBO." + }, + { + "value": "GITEE", + "description": "GITEE." + }, + { + "value": "DINGTALK", + "description": "DINGTALK." + }, + { + "value": "BAIDU", + "description": "BAIDU." + }, + { + "value": "CSDN", + "description": "CSDN." + }, + { + "value": "CODING", + "description": "CODING." + }, + { + "value": "OSCHINA", + "description": "OSCHINA." + }, + { + "value": "ALIPAY", + "description": "ALIPAY." + }, + { + "value": "QQ", + "description": "QQ." + }, + { + "value": "TAOBAO", + "description": "TAOBAO." + }, + { + "value": "GOOGLE", + "description": "GOOGLE." + }, + { + "value": "FACEBOOK", + "description": "FACEBOOK." + }, + { + "value": "DOUYIN", + "description": "DOUYIN." + }, + { + "value": "LINKEDIN", + "description": "LINKEDIN." + }, + { + "value": "MICROSOFT", + "description": "MICROSOFT." + }, + { + "value": "MI", + "description": "MI." + }, + { + "value": "TOUTIAO", + "description": "TOUTIAO." + }, + { + "value": "TEAMBITION", + "description": "TEAMBITION." + }, + { + "value": "RENREN", + "description": "RENREN." + }, + { + "value": "PINTEREST", + "description": "PINTEREST." + }, + { + "value": "STACK_OVERFLOW", + "description": "STACK_OVERFLOW." + }, + { + "value": "HUAWEI", + "description": "HUAWEI." + }, + { + "value": "WECHAT_OPEN", + "description": "WeChat open platform." + }, + { + "value": "WECHAT_ENTERPRISE", + "description": "WeChat enterprise platform." + }, + { + "value": "WECHAT_MP", + "description": "WeChat Official Platform." + }, + { + "value": "KUJIALE", + "description": "KUJIALE." + }, + { + "value": "GITLAB", + "description": "GITLAB." + }, + { + "value": "MEITUAN", + "description": "MEITUAN." + }, + { + "value": "ELEME", + "description": "ELEME." + }, + { + "value": "GITLAB", + "description": "GITLAB." + }, + { + "value": "TWITTER", + "description": "TWITTER." + }, + { + "value": "ALIYUN", + "description": "ALIYUN." } ] },