Compare commits
83 Commits
v1.13.1
...
1.15.3-alpha
| Author | SHA1 | Date | |
|---|---|---|---|
| c6bd5d9e5d | |||
| d0ae0f2c7a | |||
| 521a423e26 | |||
| 1f1d61fe4e | |||
| ec87ea145c | |||
| b1121ba545 | |||
| 41d0d01329 | |||
| 77603cf7db | |||
| 7be51f1d33 | |||
| e71af6b2e6 | |||
| 54779ab26a | |||
| be1e23e2ab | |||
| 739e7dfd39 | |||
| 58c8aa9010 | |||
| 93aae33f0a | |||
| 268a9b477b | |||
| adaf9d59cd | |||
| 7f0f1e17d2 | |||
| 65b2db32b5 | |||
| 9e79dd7cb3 | |||
| 30f29a49d1 | |||
| 129d1d57ed | |||
| 3da90736c4 | |||
| 05891e48e9 | |||
| 9ef19b1d54 | |||
| 2de19a3824 | |||
| bccf3279af | |||
| 6b4a8b78b1 | |||
| 5a94ff82c1 | |||
| 7b03751a8d | |||
| 823a43b1e2 | |||
| db6e88173a | |||
| c6481a681e | |||
| 1e1038fbd4 | |||
| 7cb0f8dbb6 | |||
| 65c60a61b3 | |||
| d5a8ffcab2 | |||
| c95c118f88 | |||
| fec9a3c214 | |||
| 6439058bda | |||
| a1d31018d3 | |||
| 2a9d8e81a1 | |||
| dda873ca11 | |||
| 8dc4b5d7d6 | |||
| 2038f24b3b | |||
| f8f13fdb10 | |||
| 697c07cccc | |||
| e868d43ca3 | |||
| 0700d7ee25 | |||
| 822b4806a1 | |||
| ab8c24ee5c | |||
| cd24cbdd58 | |||
| 4bc9c09610 | |||
| 4d2518e21a | |||
| f47dc074e7 | |||
| b7f01549c1 | |||
| 264294caee | |||
| 19ec565004 | |||
| 028924ecbf | |||
| d2d3232501 | |||
| 1206847576 | |||
| 2490c0f1ff | |||
| 2fd7255ad4 | |||
| f7873d71b2 | |||
| 602b1eaf58 | |||
| 7c2bc82814 | |||
| 28b764f0d2 | |||
| 2442661291 | |||
| abb121a57c | |||
| 51603e18ad | |||
| 77c9680333 | |||
| 525c406c92 | |||
| e65d87daa3 | |||
| 8639359f53 | |||
| 9eda5aaf2b | |||
| 9d6ceb3898 | |||
| 7bb9864799 | |||
| 95e4db2315 | |||
| fc4606dad3 | |||
| 31330a366d | |||
| 7364c203ab | |||
| 469558bddc | |||
| d9952968d1 |
@@ -25,6 +25,12 @@ hs_err_pid*
|
||||
# exclude idea files
|
||||
.idea
|
||||
*.iml
|
||||
*.sh
|
||||
bin/codecov.sh
|
||||
bin/deploy.sh
|
||||
bin/docsify-cli.sh
|
||||
bin/push.sh
|
||||
bin/push-dev.sh
|
||||
|
||||
target
|
||||
target
|
||||
/pom.xml.versionsBackup
|
||||
/gpg
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<p align="center">
|
||||
<a href="https://docs.justauth.whnb.wang"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/logo.png" width="400"></a>
|
||||
<a href="https://docs.justauth.whnb.wang"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/Justauth.png" width="400"></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<strong>Login, so easy.</strong>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://search.maven.org/search?q=JustAuth">
|
||||
<img src="https://img.shields.io/badge/Maven Central-1.13.1-blue.svg" ></img>
|
||||
<img src="https://img.shields.io/badge/Maven%20Central--1.15.3-alpha-blue" ></img>
|
||||
</a>
|
||||
<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>
|
||||
@@ -15,7 +15,7 @@
|
||||
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img>
|
||||
</a>
|
||||
<a target="_blank" href="https://apidoc.gitee.com/yadong.zhang/JustAuth/" title="API文档">
|
||||
<img src="https://img.shields.io/badge/Api Docs-1.13.1-orange.svg" ></img>
|
||||
<img src="https://img.shields.io/badge/Api%20Docs--1.15.3-alpha-latest-orange" ></img>
|
||||
</a>
|
||||
<a target="_blank" href="https://docs.justauth.whnb.wang" title="参考文档">
|
||||
<img src="https://img.shields.io/badge/Docs-latest-blueviolet.svg" ></img>
|
||||
@@ -44,7 +44,7 @@
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/oschina.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/alipay.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/qq.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20" title="微信开放平台"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/taobao.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/google.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/facebook.png" width="20"></td>
|
||||
@@ -97,7 +97,7 @@ These artifacts are available from Maven Central:
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>1.13.1</version>
|
||||
<version>1.15.3-alpha</version>
|
||||
</dependency>
|
||||
```
|
||||
- Using JustAuth
|
||||
@@ -115,6 +115,40 @@ authRequest.authorize("state");
|
||||
authRequest.login(callback);
|
||||
```
|
||||
|
||||
Note, that since [v1.14.0](https://gitee.com/yadong.zhang/JustAuth/releases/v1.14.0) JustAuth has been integrated by default with [simple-http](https://github.com/xkcoding/simple-http) as the HTTP general interface (see the update [JustAuth 1.14.0 release! Perfect decoupling of HTTP tools](https://mp.weixin.qq.com/s?__biz=MzA3NDk3OTIwMg==&mid=2450633197&idx=1&sn=11e625b307db62b2f1c4e82f7744b2a2&chksm=88929300bfe51a16562b45592a264482ae2c74c6dbfa4a3aa9611ad4fea4a9be5b1f0545527d&token=1093833287&lang=zh_CN#rd)). Since most projects already integrate HTTP tools such as OkHttp3, apache HttpClient, and hutool-http), in order to reduce unnecessary dependencies,Starting from [v1.14.0](https://gitee.com/yadong.zhang/JustAuth/releases/v1.14.0), JustAuth will not integrate hutool-http by default. If the developer's project is new or there is no integrated HTTP implementation tool in the project, please add the corresponding HTTP implementation class by yourself. Alternative dependencies are as follows:
|
||||
|
||||
|
||||
- hutool-http
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- httpclient
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.12</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- okhttp
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
**Examples**:
|
||||
- [Springboot Example](https://github.com/justauth/JustAuth-demo)
|
||||
- [jFinal Example](https://github.com/xkcoding/jfinal-justauth-demo): by [xkcoding](https://github.com/xkcoding)
|
||||
@@ -140,7 +174,9 @@ authRequest.login(callback);
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/oschina.png" width="20"> | [AuthOschinaRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java) | <a href="https://www.oschina.net/openapi/docs/oauth2_authorize" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/alipay.png" width="20"> | [AuthAlipayRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java) | <a href="https://alipay.open.taobao.com/docs/doc.htm?spm=a219a.7629140.0.0.336d4b70GUKXOl&treeId=193&articleId=105809&docType=1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/qq.png" width="20"> | [AuthQqRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthQqRequest.java) | <a href="https://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"> | [AuthWeChatRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java) | <a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20" title="微信开放平台"> | [AuthWeChatOpenRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatOpenRequest.java) | <a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20" title="微信公众平台"> | [AuthWeChatMpRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatMpRequest.java) | <a href="https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_webpage_authorization.html" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20" title="企业微信"> | [AuthWeChatEnterpriseRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatEnterpriseRequest.java) | <a href="https://open.work.weixin.qq.com/api/doc#90000/90135/90664" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/taobao.png" width="20"> | [AuthTaobaoRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java) | <a href="https://open.taobao.com/doc.htm?spm=a219a.7386797.0.0.4e00669acnkQy6&source=search&docId=105590&docType=1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/google.png" width="20"> | [AuthGoogleRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java) | <a href="https://developers.google.com/identity/protocols/OpenIDConnect" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/facebook.png" width="20"> | [AuthFacebookRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java) | <a href="https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow" target="_blank">参考文档</a> |
|
||||
@@ -154,7 +190,6 @@ authRequest.login(callback);
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/pinterest.png" width="20"> | [AuthPinterestRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java) | <a href="https://developers.pinterest.com/docs/api/overview/?" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/stackoverflow.png" width="20"> | [AuthStackOverflowRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthStackOverflowRequest.java) | <a href="https://api.stackexchange.com/docs/authentication" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/huawei.png" width="20"> | [AuthHuaweiRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java) | <a href="https://developer.huawei.com/consumer/cn/devservice/doc/30101" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"> | [AuthWeChatEnterpriseRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatEnterpriseRequest.java) | <a href="https://open.work.weixin.qq.com/api/doc#90000/90135/90664" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/kujiale.png" width="20"> | [AuthKujialeRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java) | <a href="https://open.kujiale.com/open/apps/2/docs?doc_id=95" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/gitlab.png" width="20"> | [AuthGitlabRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGitlabRequest.java) | <a href="https://docs.gitlab.com/ee/api/oauth2.html" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/meituan.png" width="20"> | [AuthMeituanRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMeituanRequest.java) | <a href="http://open.waimai.meituan.com/openapi_docs/oauth/" target="_blank">参考文档</a> |
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<p align="center">
|
||||
<a href="https://docs.justauth.whnb.wang"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/logo.png" width="400"></a>
|
||||
<a href="https://docs.justauth.whnb.wang"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/Justauth.png" width="400"></a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<strong>Login, so easy.</strong>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://search.maven.org/search?q=JustAuth">
|
||||
<img src="https://img.shields.io/badge/Maven Central-1.13.1-blue.svg" ></img>
|
||||
<img src="https://img.shields.io/badge/Maven%20Central--1.15.3-alpha-blue" ></img>
|
||||
</a>
|
||||
<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>
|
||||
@@ -15,7 +15,7 @@
|
||||
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img>
|
||||
</a>
|
||||
<a target="_blank" href="https://apidoc.gitee.com/yadong.zhang/JustAuth/" title="API文档">
|
||||
<img src="https://img.shields.io/badge/Api Docs-1.13.1-orange.svg" ></img>
|
||||
<img src="https://img.shields.io/badge/Api%20Docs--1.15.3-alpha-latest-orange" ></img>
|
||||
</a>
|
||||
<a target="_blank" href="https://docs.justauth.whnb.wang" title="参考文档">
|
||||
<img src="https://img.shields.io/badge/Docs-latest-blueviolet.svg" ></img>
|
||||
@@ -44,7 +44,7 @@
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/oschina.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/alipay.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/qq.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20" title="微信开放平台"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/taobao.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/google.png" width="20"></td>
|
||||
<td align="center" width="200"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/facebook.png" width="20"></td>
|
||||
@@ -77,7 +77,6 @@
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具类库**,它可以让我们脱离繁琐的第三方登录SDK,让登录变得**So easy!**
|
||||
|
||||
项目开源地址:[gitee](https://gitee.com/yadong.zhang/JustAuth) | [github](https://github.com/zhangyd-c/JustAuth)
|
||||
@@ -97,7 +96,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>1.13.1</version>
|
||||
<version>1.15.3-alpha</version>
|
||||
</dependency>
|
||||
```
|
||||
- 调用api
|
||||
@@ -115,60 +114,37 @@ authRequest.authorize("state");
|
||||
authRequest.login(callback);
|
||||
```
|
||||
|
||||
**配套Demo**:
|
||||
- [JustAuth-demo](https://github.com/justauth/JustAuth-demo)
|
||||
- [jFinal版](https://github.com/xkcoding/jfinal-justauth-demo): Jfinal集成JustAuth的demo by [xkcoding](https://github.com/xkcoding)
|
||||
- [ActFramework版](https://github.com/xkcoding/act-justauth-demo): ActFramework 集成 JustAuth 的 demo by [xkcoding](https://github.com/xkcoding)
|
||||
- [Nutzboot版](https://github.com/EggsBlue/nutzboot-justauth-demo): NutzBoot集成JustAuth的demo by [蛋蛋](https://github.com/EggsBlue)
|
||||
- [Blade版](https://github.com/justauth/blade-justauth-demo): Blade集成JustAuth的demo
|
||||
如下**任选一种** HTTP 工具 依赖,_项目内如果已有,请忽略_
|
||||
|
||||
## 插件
|
||||
- [justauth-spring-boot-starter](https://github.com/xkcoding/justauth-spring-boot-starter): Spring Boot 集成 JustAuth 的最佳实践 by [xkcoding](https://github.com/xkcoding)
|
||||
- [justauth-spring-boot-starter-demo](https://github.com/justauth/justauth-spring-boot-starter-demo): Spring Boot 使用 justauth-spring-boot-starter 快速集成 JustAuth by [xkcoding](https://github.com/xkcoding)
|
||||
- hutool-http
|
||||
|
||||
具体的例子可以参考:
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- [实现Gitee授权登录](http://t.cn/ExDKxQs)
|
||||
- [实现Github授权登录](http://t.cn/EJ0Fxqo)
|
||||
- [Spring Boot 快速集成第三方登录功能](http://t.cn/AiWWx5kH) : QQ、Github、微信、谷歌、微软、小米、企业微信
|
||||
- [集成企业微信](https://mp.weixin.qq.com/s?__biz=MzA3NDk3OTIwMg==&mid=2450633170&idx=2&sn=456b70742a86948a193c691f3e47b72e&chksm=8892933fbfe51a29c1da386a2252d4bf91bfbd14e1ac0b99b783763a0d12e2e4b2d7c4369933&token=482455242&lang=zh_CN#rd)
|
||||
- httpclient
|
||||
|
||||
#### API列表
|
||||
| :computer: 平台 | :coffee: API类 | :page_facing_up: SDK |
|
||||
|:------:|:-------:|:-------:|
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/gitee.png" width="20"> | [AuthGiteeRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java) | <a href="https://gitee.com/api/v5/oauth_doc#list_1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/github.png" width="20"> | [AuthGithubRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGithubRequest.java) | <a href="https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/weibo.png" width="20"> | [AuthWeiboRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeiboRequest.java) | <a href="https://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/dingtalk.png" width="20"> | [AuthDingTalkRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java) | <a href="https://open-doc.dingtalk.com/microapp/serverapi2/kymkv6" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/baidu.png" width="20"> | [AuthBaiduRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java) | <a href="http://developer.baidu.com/wiki/index.php?title=docs/oauth" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/coding.png" width="25"> | [AuthCodingRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java) | <a href="https://open.coding.net/references/oauth/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/tencentCloud.png" width="25"> | [AuthTencentCloudRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java) | <a href="https://dev.tencent.com/help/doc/faq/b4e5b7aee786/oauth" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/oschina.png" width="20"> | [AuthOschinaRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java) | <a href="https://www.oschina.net/openapi/docs/oauth2_authorize" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/alipay.png" width="20"> | [AuthAlipayRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java) | <a href="https://alipay.open.taobao.com/docs/doc.htm?spm=a219a.7629140.0.0.336d4b70GUKXOl&treeId=193&articleId=105809&docType=1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/qq.png" width="20"> | [AuthQqRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthQqRequest.java) | <a href="https://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"> | [AuthWeChatRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java) | <a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/taobao.png" width="20"> | [AuthTaobaoRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java) | <a href="https://open.taobao.com/doc.htm?spm=a219a.7386797.0.0.4e00669acnkQy6&source=search&docId=105590&docType=1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/google.png" width="20"> | [AuthGoogleRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java) | <a href="https://developers.google.com/identity/protocols/OpenIDConnect" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/facebook.png" width="20"> | [AuthFacebookRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java) | <a href="https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/douyin.png" width="20"> | [AuthDouyinRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java) | <a href="https://www.douyin.com/platform/doc/m-2-1-1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/linkedin.png" width="20"> | [AuthLinkedinRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java) | <a href="https://docs.microsoft.com/zh-cn/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/microsoft.png" width="20"> | [AuthMicrosoftRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java) | <a href="https://docs.microsoft.com/zh-cn/graph/auth/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/mi.png" width="20"> | [AuthMiRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMiRequest.java) | <a href="https://dev.mi.com/console/doc/detail?pId=711" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/toutiao.png" width="20"> | [AuthToutiaoRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java) | <a href="https://open.mp.toutiao.com/#/resource?_k=y7mfgk" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/teambition.png" width="20"> | [AuthTeambitionRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTeambitionRequest.java) | <a href="https://docs.teambition.com/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/renren.png" width="20"> | [AuthRenrenRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java) | <a href="http://open.renren.com/wiki/OAuth2.0" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/pinterest.png" width="20"> | [AuthPinterestRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java) | <a href="https://developers.pinterest.com/docs/api/overview/?" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/stackoverflow.png" width="20"> | [AuthStackOverflowRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthStackOverflowRequest.java) | <a href="https://api.stackexchange.com/docs/authentication" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/huawei.png" width="20"> | [AuthHuaweiRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java) | <a href="https://developer.huawei.com/consumer/cn/devservice/doc/30101" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"> | [AuthWeChatEnterpriseRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatEnterpriseRequest.java) | <a href="https://open.work.weixin.qq.com/api/doc#90000/90135/90664" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/kujiale.png" width="20"> | [AuthKujialeRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java) | <a href="https://open.kujiale.com/open/apps/2/docs?doc_id=95" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/gitlab.png" width="20"> | [AuthGitlabRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGitlabRequest.java) | <a href="https://docs.gitlab.com/ee/api/oauth2.html" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/meituan.png" width="20"> | [AuthMeituanRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMeituanRequest.java) | <a href="http://open.waimai.meituan.com/openapi_docs/oauth/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/eleme.png" width="20"> | [AuthElemeRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthElemeRequest.java) | <a href="https://open.shop.ele.me/openapi/documents/khd001" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/twitter.png" width="20"> | [AuthTwitterRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTwitterRequest.java) | <a href="https://developer.twitter.com/en/docs/twitter-for-websites/log-in-with-twitter/guides/implementing-sign-in-with-twitter" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/csdn.png" width="20"> | [AuthCsdnRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java) | 无 |
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.12</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_
|
||||
- okhttp
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## 后续开发计划
|
||||
|
||||
@@ -197,22 +173,20 @@ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经
|
||||
- [阿里妈妈MUX倾力打造的矢量图标库-iconfont](https://www.iconfont.cn/search/index): 本文档中的图标大部分取自该平台
|
||||
- [mica](https://github.com/lets-mica/mica):Spring Cloud 微服务开发核心包,支持 `web `和 `webflux`。注:JustAuth项目中的[UuidUtils](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/utils/UuidUtils.java)就是直接使用的mica提供的高性能的uuid创建工具类源码[StringUtil.java](https://github.com/lets-mica/mica/blob/master/mica-core/src/main/java/net/dreamlu/mica/core/utils/StringUtil.java#L335)
|
||||
- 感谢 JetBrains 提供的免费开源 License:
|
||||
<img src="https://github.com/lets-mica/mica/raw/c251e176b81518a6a570bf4eb21f525c4f582a81/docs/img/jetbrains.png" alt="图片引用自lets-mica" style="float:left;">
|
||||
<img src="https://images.gitee.com/uploads/images/2020/0406/220236_f5275c90_5531506.png" alt="图片引用自lets-mica" style="float:left;">
|
||||
|
||||
<a href="https://www.producthunt.com/posts/justauth?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-justauth" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=196886&theme=dark" alt="JustAuth - Login, so easy! | Product Hunt Embed" style="width: 250px; height: 54px;" width="250px" height="54px" /></a>
|
||||
|
||||
## 开源推荐
|
||||
- `spring-boot-demo` 深度学习并实战 spring boot 的项目: [https://github.com/xkcoding/spring-boot-demo](https://github.com/xkcoding/spring-boot-demo)
|
||||
- `mica` SpringBoot 微服务高效开发工具集: [https://github.com/lets-mica/mica](https://github.com/lets-mica/mica)
|
||||
- `pig` 宇宙最强微服务认证授权脚手架(架构师必备): [https://gitee.com/log4j/pig](https://gitee.com/log4j/pig)
|
||||
- `SpringBlade` 完整的线上解决方案(企业开发必备): https://gitee.com/smallc/SpringBlade
|
||||
|
||||
## 关于OAuth
|
||||
|
||||
- [The OAuth 2.0 Authorization Framework](https://tools.ietf.org/html/rfc6749)
|
||||
- [OAuth 2.0](https://oauth.net/2/)
|
||||
- `MaxKey` 马克思的钥匙,寓意是最大钥匙,是用户单点登录认证系统(Sigle Sign On System),OAuth 2.0/OpenID Connect、SAML 2.0、JWT、CAS等标准化的开放协议,使用JustAuth集成OAuth第三方认证。: [https://shimingxy.github.io/MaxKey/](https://shimingxy.github.io/MaxKey/)
|
||||
|
||||
## 关注&交流
|
||||
|
||||
| 公众号 | 微信(备注:加群) |
|
||||
| 公众号 | 微信(备注:JustAuth) |
|
||||
| :------------: | :------------: |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/wx/wechat_account.jpg" width="200" /> | <img src="https://gitee.com/yadong.zhang/static/raw/master/wx/wx.png" width="170"/> |
|
||||
|
||||
@@ -220,10 +194,10 @@ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经
|
||||
|
||||
- JustAuth交流群 (230017570):专业交流该项目
|
||||
|
||||
- 开源总群 (190886500):各个开源项目的都有,也有博客建设等方面的朋友。
|
||||
|
||||
## 请喝咖啡
|
||||
|
||||
| 支付宝 | 微信 |
|
||||
| :------------: | :------------: |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/qrcode/zfb_code.png" width="200"/> | <img src="https://gitee.com/yadong.zhang/static/raw/master/qrcode/wx_code.png" width="200" /> |
|
||||
|
||||
通过“[爱发电](https://afdian.net/@zhangyadong)”赞助,感谢您的支持
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
#-----------------------------------------------------------
|
||||
# 参考自 hutool 工具
|
||||
# 此脚本用于每次升级justauth时替换相应位置的版本号
|
||||
#-----------------------------------------------------------
|
||||
pwd=$(pwd)
|
||||
echo "当前路径:$pwd"
|
||||
|
||||
if [ -n "$1" ];then
|
||||
new_version="$1"
|
||||
old_version=`cat $pwd/bin/version.txt`
|
||||
echo "$old_version 替换为新版本 $new_version"
|
||||
else
|
||||
# 参数错误,退出
|
||||
echo "ERROR: 请指定新版本!"
|
||||
exit
|
||||
fi
|
||||
|
||||
if [ ! -n "$old_version" ]; then
|
||||
echo "ERROR: 旧版本不存在,请确认bin/version.txt中信息正确"
|
||||
exit
|
||||
fi
|
||||
|
||||
# 替换README.md等文件中的版本
|
||||
sed -i "s/${old_version}/${new_version}/g" $pwd/README.md
|
||||
sed -i "s/${old_version}/${new_version}/g" $pwd/README.en-US.md
|
||||
sed -i "s/${old_version}/${new_version}/g" $pwd/docs/README.md
|
||||
sed -i "s/${old_version}/${new_version}/g" $pwd/docs/_coverpage.md
|
||||
|
||||
# 替换pom.xml中的版本
|
||||
sed -i "s/${old_version}/${new_version}/g" $pwd/pom.xml
|
||||
|
||||
# 保留新版本号
|
||||
echo "$new_version" > $pwd/bin/version.txt
|
||||
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
#------------------------------------------------
|
||||
# 参考自 hutool 工具
|
||||
# 升级justauth版本,包括:
|
||||
# 1. 升级pom.xml中的版本号
|
||||
# 2. 替换README.md中的版本号
|
||||
#------------------------------------------------
|
||||
|
||||
if [ ! -n "$1" ]; then
|
||||
echo "ERROR: 新版本不存在,请指定参数1"
|
||||
exit
|
||||
fi
|
||||
|
||||
# 替换所有模块pom.xml中的版本
|
||||
mvn versions:set -DnewVersion=$1
|
||||
|
||||
# 替换其它地方的版本
|
||||
source $(pwd)/bin/repVersion.sh "$1"
|
||||
@@ -0,0 +1 @@
|
||||
1.15.3-alpha
|
||||
@@ -9,7 +9,7 @@
|
||||
</p>
|
||||
<p align="center">
|
||||
<a target="_blank" href="https://search.maven.org/search?q=JustAuth">
|
||||
<img src="https://img.shields.io/badge/Maven Central-1.13.1-blue.svg" ></img>
|
||||
<img src="https://img.shields.io/badge/Maven%20Central--1.15.3-alpha-blue" ></img>
|
||||
</a>
|
||||
<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>
|
||||
@@ -18,7 +18,7 @@
|
||||
<img src="https://img.shields.io/badge/JDK-1.8+-green.svg" ></img>
|
||||
</a>
|
||||
<a target="_blank" href="https://apidoc.gitee.com/yadong.zhang/JustAuth/" title="API文档">
|
||||
<img src="https://img.shields.io/badge/Api Docs-1.13.1-orange.svg" ></img>
|
||||
<img src="https://img.shields.io/badge/Api%20Docs--1.15.3-alpha-latest-orange" ></img>
|
||||
</a>
|
||||
<a target="_blank" href="https://docs.justauth.whnb.wang" title="参考文档">
|
||||
<img src="https://img.shields.io/badge/Docs-latest-blueviolet.svg" ></img>
|
||||
@@ -58,67 +58,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具
|
||||
|
||||
[](https://starchart.cc/justauth/JustAuth)
|
||||
|
||||
## 已集成的平台
|
||||
|
||||
| :computer: 平台 | :coffee: API类 | :page_facing_up: SDK |
|
||||
|:------:|:-------:|:-------:|
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/gitee.png" width="20"> | [AuthGiteeRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java) | <a href="https://gitee.com/api/v5/oauth_doc#list_1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/github.png" width="20"> | [AuthGithubRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java) | <a href="https://developer.github.com/apps/building-oauth-apps/authorizing-oauth-apps/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/weibo.png" width="20"> | [AuthWeiboRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGiteeRequest.java) | <a href="https://open.weibo.com/wiki/%E6%8E%88%E6%9D%83%E6%9C%BA%E5%88%B6%E8%AF%B4%E6%98%8E" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/dingtalk.png" width="20"> | [AuthDingTalkRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthDingTalkRequest.java) | <a href="https://open-doc.dingtalk.com/microapp/serverapi2/kymkv6" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/baidu.png" width="20"> | [AuthBaiduRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthBaiduRequest.java) | <a href="http://developer.baidu.com/wiki/index.php?title=docs/oauth" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/coding.png" width="25"> | [AuthCodingRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthCodingRequest.java) | <a href="https://open.coding.net/references/oauth/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/tencentCloud.png" width="25"> | [AuthTencentCloudRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTencentCloudRequest.java) | <a href="https://dev.tencent.com/help/doc/faq/b4e5b7aee786/oauth" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/oschina.png" width="20"> | [AuthOschinaRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthOschinaRequest.java) | <a href="https://www.oschina.net/openapi/docs/oauth2_authorize" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/alipay.png" width="20"> | [AuthAlipayRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthAlipayRequest.java) | <a href="https://alipay.open.taobao.com/docs/doc.htm?spm=a219a.7629140.0.0.336d4b70GUKXOl&treeId=193&articleId=105809&docType=1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/qq.png" width="20"> | [AuthQqRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthQqRequest.java) | <a href="https://wiki.connect.qq.com/%E4%BD%BF%E7%94%A8authorization_code%E8%8E%B7%E5%8F%96access_token" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"> | [AuthWeChatRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatRequest.java) | <a href="https://open.weixin.qq.com/cgi-bin/showdocument?action=dir_list&t=resource/res_list&verify=1&id=open1419316505&token=&lang=zh_CN" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/taobao.png" width="20"> | [AuthTaobaoRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTaobaoRequest.java) | <a href="https://open.taobao.com/doc.htm?spm=a219a.7386797.0.0.4e00669acnkQy6&source=search&docId=105590&docType=1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/google.png" width="20"> | [AuthGoogleRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGoogleRequest.java) | <a href="https://developers.google.com/identity/protocols/OpenIDConnect" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/facebook.png" width="20"> | [AuthFacebookRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthFacebookRequest.java) | <a href="https://developers.facebook.com/docs/facebook-login/manually-build-a-login-flow" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/douyin.png" width="20"> | [AuthDouyinRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthDouyinRequest.java) | <a href="https://www.douyin.com/platform/doc/m-2-1-1" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/linkedin.png" width="20"> | [AuthLinkedinRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthLinkedinRequest.java) | <a href="https://docs.microsoft.com/zh-cn/linkedin/shared/authentication/authorization-code-flow?context=linkedin/context" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/microsoft.png" width="20"> | [AuthMicrosoftRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMicrosoftRequest.java) | <a href="https://docs.microsoft.com/zh-cn/graph/auth/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/mi.png" width="20"> | [AuthMiRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMiRequest.java) | <a href="https://dev.mi.com/console/doc/detail?pId=711" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/toutiao.png" width="20"> | [AuthToutiaoRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthToutiaoRequest.java) | <a href="https://open.mp.toutiao.com/#/resource?_k=y7mfgk" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/teambition.png" width="20"> | [AuthTeambitionRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTeambitionRequest.java) | <a href="https://docs.teambition.com/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/renren.png" width="20"> | [AuthRenrenRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthRenrenRequest.java) | <a href="http://open.renren.com/wiki/OAuth2.0" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/pinterest.png" width="20"> | [AuthPinterestRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthPinterestRequest.java) | <a href="https://developers.pinterest.com/docs/api/overview/?" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/stackoverflow.png" width="20"> | [AuthStackOverflowRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthStackOverflowRequest.java) | <a href="https://api.stackexchange.com/docs/authentication" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/huawei.png" width="20"> | [AuthHuaweiRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthHuaweiRequest.java) | <a href="https://developer.huawei.com/consumer/cn/devservice/doc/30101" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/wechat.png" width="20"> | [AuthWeChatEnterpriseRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthWeChatEnterpriseRequest.java) | <a href="https://open.work.weixin.qq.com/api/doc#90000/90135/90664" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/kujiale.png" width="20"> | [AuthKujialeRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthKujialeRequest.java) | <a href="https://open.kujiale.com/open/apps/2/docs?doc_id=95" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/gitlab.png" width="20"> | [AuthGitlabRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthGitlabRequest.java) | <a href="https://docs.gitlab.com/ee/api/oauth2.html" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/meituan.png" width="20"> | [AuthMeituanRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthMeituanRequest.java) | <a href="http://open.waimai.meituan.com/openapi_docs/oauth/" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/eleme.png" width="20"> | [AuthElemeRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthElemeRequest.java) | <a href="https://open.shop.ele.me/openapi/documents/khd001" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/twitter.png" width="20"> | [AuthTwitterRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthTwitterRequest.java) | <a href="https://developer.twitter.com/en/docs/twitter-for-websites/log-in-with-twitter/guides/implementing-sign-in-with-twitter" target="_blank">参考文档</a> |
|
||||
| <img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/csdn.png" width="20"> | [AuthCsdnRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java) | 无 |
|
||||
|
||||
|
||||
## 快速开始
|
||||
|
||||
- 引入依赖
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>${latest.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
- 调用api
|
||||
```java
|
||||
// 创建授权request
|
||||
AuthRequest authRequest = new AuthGiteeRequest(AuthConfig.builder()
|
||||
.clientId("clientId")
|
||||
.clientSecret("clientSecret")
|
||||
.redirectUri("redirectUri")
|
||||
.build());
|
||||
// 生成授权页面
|
||||
authRequest.authorize("state");
|
||||
// 授权登录后会返回code(auth_code(仅限支付宝))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的参数
|
||||
// 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state
|
||||
authRequest.login(callback);
|
||||
```
|
||||
<a href="https://www.producthunt.com/posts/justauth?utm_source=badge-featured&utm_medium=badge&utm_souce=badge-justauth" target="_blank"><img src="https://api.producthunt.com/widgets/embed-image/v1/featured.svg?post_id=196886&theme=dark" alt="JustAuth - Login, so easy! | Product Hunt Embed" style="width: 250px; height: 54px;" width="250px" height="54px" /></a>
|
||||
|
||||
## 参与&贡献
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
# :alien: 404:alien:
|
||||
|
||||
**非常感谢您对JustAuth的关注**,您现在查询的内容,作者正在补充中!
|
||||
|
||||
您可能对以下文章感兴趣:
|
||||
|
||||
- [OAuth的授权流程是什么样的?](https://docs.justauth.whnb.wang/#/oauth)
|
||||
- [如何使用JustAuth?](https://docs.justauth.whnb.wang/#/how-to-use)
|
||||
- [提问与回答?](https://docs.justauth.whnb.wang/#/Q&A)
|
||||
- [如何集成Github?](https://docs.justauth.whnb.wang/#/oauth/github)
|
||||
- [如何集成Gitee?](https://docs.justauth.whnb.wang/#/oauth/gitee)
|
||||
- [如何集成支付宝?](https://docs.justauth.whnb.wang/#/oauth/alipay)
|
||||
- [如何自定义state?](https://docs.justauth.whnb.wang/#/customize-the-state-cache)
|
||||
- [如何自定义接入自己搭建的oauth平台?](https://docs.justauth.whnb.wang/#/customize-the-oauth)
|
||||
- [有哪些配套项目?](https://docs.justauth.whnb.wang/#/supporting)
|
||||
|
||||
### 想使用JustAuth集成第三方OAuth登录?
|
||||
|
||||
- [Gitee登录](oauth/gitee.md)
|
||||
- [Github登录](oauth/github.md)
|
||||
- [qq登录](oauth/qq.md)
|
||||
- [微信开放平台登录](oauth/wechat_open.md)
|
||||
- [微博登录](oauth/weibo.md)
|
||||
- [支付宝登录](oauth/alipay.md)
|
||||
- [酷家乐登录](oauth/kujiale.md)
|
||||
- 更多文章,正在补充中...
|
||||
|
||||
|
||||
### 如果还是没有您想要的内容,您可以:
|
||||
|
||||
1. (建议) 提Issue: 【[github](https://github.com/justauth/JustAuth/issues)】 | 【[gitee](https://gitee.com/yadong.zhang/JustAuth/issues)】
|
||||
2. 点击本页面右下角【OPEN CHAT】开始在线聊天
|
||||
3. 本页面底部直接留言
|
||||
4. 关注公众号(公众号会不定期推送相关内容),扫下方二维码关注公众号:
|
||||
|
||||
<img src="https://gitee.com/yadong.zhang/static/raw/master/wx/wechat_account.jpg" width="200" />
|
||||
|
||||
4. 加微信群(群内有各个优秀开源项目的作者和技术大神),微信扫下方二维码后加我好友(**注:一定要备注JustAUth,无备注的一律不加**):
|
||||
|
||||
<img src="https://gitee.com/yadong.zhang/static/raw/master/wx/wx.png" width="170"/>
|
||||
|
||||
5. 加QQ群:QQ搜索`230017570`(该QQ群为JustAuth官方技术讨论群,禁止群内打广告!)
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||

|
||||
# JustAuth <small>1.13.1</small>
|
||||

|
||||
# JustAuth <small>1.15.3-alpha</small>
|
||||
|
||||
<strong>史上最全的整合第三方登录的开源库</strong>
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 59 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 882 KiB |
|
Before Width: | Height: | Size: 6.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 377 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 86 KiB |
|
After Width: | Height: | Size: 38 KiB |
|
After Width: | Height: | Size: 97 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 9.9 KiB |
|
After Width: | Height: | Size: 33 KiB |
|
After Width: | Height: | Size: 46 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 54 KiB |
|
After Width: | Height: | Size: 74 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 30 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 29 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 34 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 183 KiB |
|
After Width: | Height: | Size: 84 KiB |
|
After Width: | Height: | Size: 43 KiB |
|
After Width: | Height: | Size: 27 KiB |
@@ -7,17 +7,21 @@
|
||||
- [Q&A](Q&A.md)
|
||||
- 集成第三方
|
||||
- [√ Gitee登录](oauth/gitee.md)
|
||||
- [Github登录](oauth/github.md)
|
||||
- [qq登录](oauth/qq.md)
|
||||
- [微信登录](oauth/wechat.md)
|
||||
- [微博登录](oauth/weibo.md)
|
||||
- [支付宝登录](oauth/alipay.md)
|
||||
- [√ Github登录](oauth/github.md)
|
||||
- [√ qq登录](oauth/qq.md)
|
||||
- [√ 微信开放平台登录](oauth/wechat_open.md)
|
||||
- [√ 微博登录](oauth/weibo.md)
|
||||
- [√ 支付宝登录](oauth/alipay.md)
|
||||
- [√ 酷家乐登录](oauth/kujiale.md)
|
||||
- [CSDN登录](oauth/csdn.md)
|
||||
- [微信企业版登录](oauth/wechatEnterprise.md)
|
||||
- [微信公众平台登录](oauth/wechat_mp.md)
|
||||
- [百度登录](oauth/baidu.md)
|
||||
- [Coding登录](oauth/coding.md)
|
||||
- [钉钉登录](oauth/dingtalk.md)
|
||||
- [开源中国登录](oauth/oschina.md)
|
||||
- [淘宝登录](oauth/taobao.md)
|
||||
- [腾讯云登录](oauth/tenchentCloud.md)
|
||||
- [腾讯云登录](oauth/tencentCloud.md)
|
||||
- [Google登录](oauth/google.md)
|
||||
- [Facebook登录](oauth/facebook.md)
|
||||
- [抖音登录](oauth/douyin.md)
|
||||
@@ -30,17 +34,16 @@
|
||||
- [Pinterest登录](oauth/pinterest.md)
|
||||
- [Stackoverflow登录](oauth/stackoverflow.md)
|
||||
- [华为登录](oauth/huawei.md)
|
||||
- [微信企业版登录](oauth/wechatEnterprise.md)
|
||||
- [√ 酷家乐登录](oauth/kujiale.md)
|
||||
- [Gitlab登录](oauth/gitlab.md)
|
||||
- [美团登录](oauth/meituan.md)
|
||||
- [饿了么登录](oauth/eleme.md)
|
||||
- [CSDN登录](oauth/csdn.md)
|
||||
- [飞书登录](oauth/feishu.md)
|
||||
- 高级特性
|
||||
- [使用State](using-state.md)
|
||||
- [自定义state缓存](customize-the-state-cache.md)
|
||||
- [自定义第三方平台的OAuth](customize-the-oauth.md)
|
||||
- [配套项目](supporting.md)
|
||||
- 扩展内容
|
||||
- [JustAuth与现有用户系统整合](extended/justauth_integrated_with_the_existing_account_system.md)
|
||||
- [Who is using](users.md)
|
||||
- [致谢](thx.md)
|
||||
- [更新记录](update.md)
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
(敬请期待...)
|
||||
|
||||
### 声明:
|
||||
此文档适用于**微信公众平台**!
|
||||
|
||||
## 1. 申请应用
|
||||
|
||||
## 2. 集成JustAuth
|
||||
|
||||
## 3. 授权结果
|
||||
@@ -18,6 +18,7 @@
|
||||
- 升级fastjson版本至1.2.58
|
||||
- <img src="https://gitee.com/uploads/22/4981222_harryleexyz.png?1556524275" width="20"> · harrylee : <a href="https://gitee.com/harryleexyz" target="_blank">[Gitee]</a>
|
||||
- 升级fastjson依赖到1.2.60
|
||||
- 集成京东登录
|
||||
- <img src="https://avatars3.githubusercontent.com/u/32814990?s=460&v=4" width="20"> · Veigar : <a href="https://github.com/wuweiqi1993" target="_blank">[Github]</a>
|
||||
- 集成酷家乐登录
|
||||
- <img src="https://avatar.gitee.com/uploads/24/1280924_TopCoderMyDream.png!avatar200?1523763232" width="20"> · 蛋蛋 : <a href="https://gitee.com/TopCoderMyDream" target="_blank">[Gitee]</a> | <a href="https://github.com/EggsBlue" target="_blank">[Github]</a>
|
||||
@@ -26,6 +27,10 @@
|
||||
- 添加测试用例:UrlBuilder 、GlobalAuthUtil
|
||||
- <img src="https://avatars0.githubusercontent.com/u/283483?s=180&v=4" width="20"> · Chris Smowton : <a href="https://github.com/smowton" target="_blank">[Github]</a>
|
||||
- 添加测试用例:StringUtils
|
||||
- <img src="https://avatars1.githubusercontent.com/u/31759178?s=88&v=4" width="20"> · githubeacon : <a href="https://github.com/githubeacon" target="_blank">[Github]</a>
|
||||
- 增加飞书授权登录
|
||||
- <img src="https://avatars3.githubusercontent.com/u/20242284?s=88&u=2aeb7576bd61392e9fd94227d2b3048a9aea6f73&v=4" width="20"> · runningzyp : <a href="https://github.com/runningzyp" target="_blank">[Github]</a>
|
||||
- 修改文案错误
|
||||
- 千年等一回,我只为等你...
|
||||
|
||||
ps: 如有遗漏,请告知
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
之前在群里经常会看到小伙伴有以下几点疑问:
|
||||
|
||||
- JustAuth如何与现有用户系统整合?
|
||||
- JustAuth如何实现用户绑定?
|
||||
|
||||
我就此需求,整理了一份**JustAuth与现有用户系统整合逻辑图**
|
||||
|
||||
在线版: [JustAuth与现有用户系统整合](https://www.processon.com/view/link/5e71db29e4b015182029a567)
|
||||
|
||||

|
||||
|
||||
|
Before Width: | Height: | Size: 1021 B |
@@ -1,5 +1,3 @@
|
||||
# 如何使用
|
||||
|
||||
在前面有介绍到,JustAuth的特点之一就是**简**,极简主义,不给使用者造成不必要的障碍。
|
||||
|
||||
既然牛皮吹下了, 那么如何才能用JustAuth实现第三方登录呢?
|
||||
@@ -22,6 +20,9 @@
|
||||
<version>${latest.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
获取最新版本:[JustAuth](https://search.maven.org/search?q=g:me.zhyd.oauth%20AND%20a:JustAuth)
|
||||
|
||||
- 调用api
|
||||
```java
|
||||
// 创建授权request
|
||||
@@ -37,6 +38,40 @@ authRequest.authorize("state");
|
||||
authRequest.login(callback);
|
||||
```
|
||||
|
||||
|
||||
注意,JustAuth从[v1.14.0](https://gitee.com/yadong.zhang/JustAuth/releases/v1.14.0)开始默认集成了的[simple-http](https://github.com/xkcoding/simple-http)作为HTTP通用接口(更新说明见[JustAuth 1.14.0版本正式发布!完美解耦HTTP工具](https://mp.weixin.qq.com/s?__biz=MzA3NDk3OTIwMg==&mid=2450633197&idx=1&sn=11e625b307db62b2f1c4e82f7744b2a2&chksm=88929300bfe51a16562b45592a264482ae2c74c6dbfa4a3aa9611ad4fea4a9be5b1f0545527d&token=1093833287&lang=zh_CN#rd)),鉴于一般项目中都已经集成了HTTP工具,比如OkHttp3、apache HttpClient、hutool-http,因此为了减少不必要的依赖,从[v1.14.0](https://gitee.com/yadong.zhang/JustAuth/releases/v1.14.0)开始JustAuth将不会默认集成hutool-http,如果开发者的项目是全新的或者项目内没有集成HTTP实现工具,请自行添加对应的HTTP实现类,备选依赖如下:
|
||||
|
||||
- hutool-http
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- httpclient
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.12</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- okhttp
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>com.squareup.okhttp3</groupId>
|
||||
<artifactId>okhttp</artifactId>
|
||||
<version>4.4.1</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
|
||||
## API分解
|
||||
|
||||
**JustAuth**的核心就是一个个的`request`,每个平台都对应一个具体的`request`类,所以在使用之前,需要就具体的授权平台创建响应的`request`
|
||||
@@ -156,13 +191,12 @@ public Object revokeAuth(@PathVariable("source") String source, @PathVariable("t
|
||||
|
||||
## 配套项目
|
||||
|
||||
**配套Demo**:
|
||||
- [JustAuth-demo](https://github.com/justauth/JustAuth-demo):普通版springboot项目demo
|
||||
- [jFinal版](https://github.com/xkcoding/jfinal-justauth-demo): Jfinal集成JustAuth的demo by [xkcoding](https://github.com/xkcoding)
|
||||
- [ActFramework版](https://github.com/xkcoding/act-justauth-demo): ActFramework 集成 JustAuth 的 demo by [xkcoding](https://github.com/xkcoding)
|
||||
- [Nutzboot版](https://github.com/EggsBlue/nutzboot-justauth-demo): NutzBoot集成JustAuth的demo by [蛋蛋](https://github.com/EggsBlue)
|
||||
- [Blade版](https://github.com/justauth/blade-justauth-demo): Blade集成JustAuth的demo
|
||||
|
||||
## springboot starter插件
|
||||
## SpringBoot插件
|
||||
- [justauth-spring-boot-starter](https://github.com/xkcoding/justauth-spring-boot-starter): Spring Boot 集成 JustAuth 的最佳实践 by [xkcoding](https://github.com/xkcoding)
|
||||
- [justauth-spring-boot-starter-demo](https://github.com/justauth/justauth-spring-boot-starter-demo): Spring Boot 使用 justauth-spring-boot-starter 快速集成 JustAuth by [xkcoding](https://github.com/xkcoding)
|
||||
- [justauth-spring-security-starter](https://github.com/justauth/justauth-spring-security-starter): JustAuth整合Spring security的 starter依赖 by [luoqiz](https://github.com/luoqiz)
|
||||
|
||||
@@ -14,15 +14,20 @@
|
||||
<meta itemprop="description" content="JustAuth,如你所见,它仅仅是一个第三方授权登录的工具类库,它可以让我们脱离繁琐的第三方登录SDK,让登录变得So easy!" />
|
||||
<meta itemprop="image" content="./_media/cover.png" />
|
||||
|
||||
<link rel="shortcut icon" href="favicon.ico">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
|
||||
<link rel="shortcut icon" href="_media/justauth@0,1x.png">
|
||||
<link rel="stylesheet" href="//unpkg.com/docsify/themes/vue.css">
|
||||
<link rel="stylesheet" href="//unpkg.com/gitalk/dist/gitalk.css">
|
||||
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">Please wait...</div>
|
||||
<div data-app id="app">Please wait...</div>
|
||||
<script>
|
||||
var num = 0;
|
||||
window.$docsify = {
|
||||
name: '<img src="./_media/cover.png" width="200"><br>Login, so easy',
|
||||
el: '#app',
|
||||
name: 'JustAuth',
|
||||
// logo: '_media/Justauth-横向@0,5x.png',
|
||||
search: {
|
||||
maxAge: 86400000,
|
||||
noData: {
|
||||
@@ -30,7 +35,7 @@
|
||||
},
|
||||
paths: 'auto',
|
||||
placeholder: {
|
||||
'/': '搜索'
|
||||
'/': '输入您的关键词进行搜索'
|
||||
}
|
||||
},
|
||||
repo: 'https://gitee.com/yadong.zhang/JustAuth',
|
||||
@@ -39,7 +44,9 @@
|
||||
subMaxLevel: 2,
|
||||
auto2top: true,
|
||||
coverpage: true,
|
||||
autoHeader: true,
|
||||
formatUpdated: '{YYYY}/{MM}/{DD} {HH}:{mm}:{ss}',
|
||||
notFoundPage: '_404.md',
|
||||
plugins: [
|
||||
function (hook, vm) {
|
||||
var footer = [
|
||||
@@ -58,17 +65,54 @@
|
||||
|
||||
return html
|
||||
+ '\n----\n'
|
||||
+ 'Last modified {docsify-updated} '
|
||||
+ '最后更新时间: {docsify-updated} '
|
||||
+ editHtml
|
||||
})
|
||||
}
|
||||
]
|
||||
],
|
||||
markdown: {
|
||||
renderer: {
|
||||
code: function(code, lang) {
|
||||
if (lang === "mermaid") {
|
||||
return (
|
||||
'<div class="mermaid">' + mermaid.render('mermaid-svg-' + num++, code) + "</div>"
|
||||
);
|
||||
}
|
||||
return this.origin.code.apply(this, arguments);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@7.1.0/dist/mermaid.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
|
||||
<script src="//unpkg.com/docsify-copy-code"></script>
|
||||
<script src="//cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||||
<script>mermaid.initialize({startOnLoad:true});</script>
|
||||
<script src="//unpkg.com/prismjs/components/prism-java.min.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/emoji.js"></script>
|
||||
<script src="//unpkg.com/docsify/lib/plugins/gitalk.min.js"></script>
|
||||
<script src="//unpkg.com/gitalk/dist/gitalk.min.js"></script>
|
||||
|
||||
<script>
|
||||
const gitalk = new Gitalk({
|
||||
clientID: 'e58f172df200e88e266b',
|
||||
clientSecret: 'ee22ce68934616f7de043a950cbdb7d613a03202',
|
||||
repo: 'justauth-talk',
|
||||
owner: 'zhangyd-c',
|
||||
admin: ['zhangyd-c'],
|
||||
id: location.hash,
|
||||
// facebook-like distraction free mode
|
||||
distractionFreeMode: false
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
((window.gitter = {}).chat = {}).options = {
|
||||
room: 'yadong-zhang/justauth'
|
||||
};
|
||||
</script>
|
||||
<script src="https://sidecar.gitter.im/dist/sidecar.v1.js" async defer></script>
|
||||
|
||||
<!-- 百度统计 -->
|
||||
<script>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
- 网站B:可以理解成 Oschina
|
||||
- 第三方C:可以理解成 Github
|
||||
|
||||
需求:你想通过Github第三方登录Oschina
|
||||
需求:你想通过Github第三方登录Oschina。(_注:下面的内容为流程图,如果您在阅读的时候显示为纯文字,请刷新页面_)
|
||||
|
||||
<div class="mermaid">
|
||||
sequenceDiagram
|
||||
|
||||
@@ -1,7 +1,215 @@
|
||||
(敬请期待...)
|
||||
## 1. 配置应用
|
||||
|
||||
## 1. 申请应用
|
||||
### 1.1 创建应用
|
||||
|
||||
#### 1. 进入支付宝开放平台([open.alipay.com](https://open.alipay.com))并登录
|
||||
#### 2. 点击“进入我的开放平台”
|
||||

|
||||
#### 3. 通过 **开发者中心-网页&移动应用** 进入应用管理列表页
|
||||

|
||||

|
||||
#### 4. 选择创建 **自定义接入** 应用
|
||||

|
||||
#### 5. 填入相关信息确认创建
|
||||

|
||||
#### 6. 进入应用详情后,点击【功能列表】中的【**+添加功能**】按钮,选择【获取会员信息】
|
||||

|
||||

|
||||
|
||||
### 1.2 配置密钥
|
||||
开发者调用接口前需要先生成RSA密钥,RSA密钥包含应用私钥(APP_PRIVATE_KEY)、应用公钥(APP_PUBLIC_KEY)。生成密钥后在开放平台开发者中心进行密钥配置,配置完成后可以获取支付宝公钥(ALIPAY_PUBLIC_KEY)。
|
||||
|
||||
接下来我们要在【应用详情】最下面的【开发设置】中,配置密钥相关的内容
|
||||
#### 1. 接口加签方式
|
||||
此处生成密钥的详细说明可以参考:[生成 RSA 密钥 ](https://docs.open.alipay.com/291/105971/)
|
||||
|
||||
我们这儿简单介绍一种使用“公钥”加签的方式
|
||||
|
||||
a. 首先下载密钥生成工具:[Windows版](https://ideservice.alipay.com/ide/getPluginUrl.htm?clientType=assistant&platform=win&channelType=WEB)(请不要安装在含有空格的目录路径下) | [MAC_OS版](https://ideservice.alipay.com/ide/getPluginUrl.htm?clientType=assistant&platform=mac&channelType=WEB)
|
||||
|
||||
b. 点击 【生成密钥】 后,工具会自动生成商户应用公钥(public key)和应用私钥(private key),如下图所示:
|
||||
|
||||

|
||||
|
||||
点击工具界面下方的 【打开文件位置】,即可找到生成的公私钥文件,这儿需要注意!
|
||||
|
||||
工具默认打开的是CSR目录,并不是我们生成的密钥的目录,如下图:
|
||||
|
||||

|
||||
|
||||
我们只需要往前返回一级目录,就可看到 RSA密钥 文件夹,进入 RSA密钥 目录后就可看到我们刚刚生成的密钥文件,如下图所示:
|
||||
|
||||

|
||||
|
||||
注意:应用私钥需要在JustAuth中配置。
|
||||
|
||||
c. 回到应用详情页面,点击【接口加签方式】后面的【设置】按钮,【加签模式】中选择【公钥】,然后在下方输入框中输入之前生成的【应用公钥2048.txt】文件内容
|
||||
|
||||

|
||||
|
||||
保存设置后,将会生成一份【支付宝公钥】,注意:这个公钥会在OAuth中使用!
|
||||
|
||||

|
||||
|
||||
**注意:**
|
||||
|
||||
生成的私钥需**妥善保管,避免遗失,不要泄露**。应用私钥需填写到代码中供签名时使用。应用公钥需提供给支付宝账号管理者上传到支付宝开放平台。
|
||||
|
||||
#### 2. 接口加签方式
|
||||
|
||||
关于IP白名单的配置方式,请参考:[开放平台 IP 白名单接入指南 ](https://docs.open.alipay.com/200/ipwhitelist)
|
||||
|
||||
#### 3. 支付宝网关
|
||||
|
||||
使用默认的即可:https://openapi.alipay.com/gateway.do
|
||||
|
||||
#### 4. 应用网关
|
||||
|
||||
这是选填字段,主要用来接收支付宝的异步通知。请开发者视个人情况选择使用
|
||||
|
||||
#### 5. 授权回调地址
|
||||
|
||||
这是关键内容,JustAuth中需要用到。比如本例配置的回调地址为:https://www.zhyd.me/oauth/callback/alipay
|
||||
|
||||
|
||||
以上步骤比较繁杂,主要需要注意保存的信息为:
|
||||
- 使用【支付宝开放平台开发助手】生成的【应用私钥】(应用私钥2048.txt)
|
||||
- 配置【接口加签方式】时生成的【支付宝公钥】
|
||||
- 授权回调地址
|
||||
- APPID(应用详情左侧应用名称下方有标注)
|
||||
|
||||
### 1.3 应用提交审核
|
||||
|
||||
通过应用详情上方的【提交审核】按钮,将应用提交审核,大约需要1天左右。(ps:本例的应用,我从提交审核到审核完成,大约用了两个小时)
|
||||
|
||||
## 2. 集成JustAuth
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
### 2.1 引入依赖
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>${latest.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
`${latest.version}`表示当前最新的版本,可以在[这儿](https://github.com/justauth/JustAuth/releases)获取最新的版本信息。
|
||||
|
||||
### 2.2 创建Request
|
||||
|
||||
```java
|
||||
AuthRequest authRequest = new AuthAlipayRequest(AuthConfig.builder()
|
||||
.clientId("APPID")
|
||||
.clientSecret("应用私钥")
|
||||
.alipayPublicKey("支付宝公钥")
|
||||
.redirectUri("https://www.zhyd.me/oauth/callback/alipay")
|
||||
.build());
|
||||
```
|
||||
|
||||
### 2.3 生成授权地址
|
||||
|
||||
我们可以直接使用以下方式生成第三方平台的授权链接:
|
||||
```java
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
```
|
||||
这个链接我们可以直接后台重定向跳转,也可以返回到前端后,前端控制跳转。前端控制的好处就是,可以将第三方的授权页嵌入到iframe中,适配网站设计。
|
||||
|
||||
|
||||
### 2.4 以上完整代码如下
|
||||
|
||||
```java
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.request.AuthAlipayRequest;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/oauth")
|
||||
public class RestAuthController {
|
||||
|
||||
@RequestMapping("/render")
|
||||
public void renderAuth(HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
public Object login(AuthCallback callback) {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return authRequest.login(callback);
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
return new AuthAlipayRequest(AuthConfig.builder()
|
||||
.clientId("APPID")
|
||||
.clientSecret("应用私钥")
|
||||
.alipayPublicKey("支付宝公钥")
|
||||
.redirectUri("https://www.zhyd.me/oauth/callback/alipay")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
```
|
||||
授权链接访问成功后会看到以下页面内容:
|
||||

|
||||
|
||||
手机扫码后会进去确认页面
|
||||
|
||||

|
||||
|
||||
手机端点击确认后,web端将会跳转到授权认证页面
|
||||
|
||||

|
||||
|
||||
点击同意授权即可完成支付宝的oauth登录。
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 2000,
|
||||
"msg": null,
|
||||
"data": {
|
||||
"uuid": "208xxxxx37",
|
||||
"username": "张",
|
||||
"nickname": "张",
|
||||
"avatar": "https://tfs.alipayobjects.com/images/partner/T1vzlgXj8cXXXXXXXX",
|
||||
"blog": null,
|
||||
"company": null,
|
||||
"location": "北京 北京市",
|
||||
"email": null,
|
||||
"remark": null,
|
||||
"gender": "MALE",
|
||||
"source": "ALIPAY",
|
||||
"token": {
|
||||
"accessToken": "authxxxx2d5b0a182A53",
|
||||
"expireIn": 1296000,
|
||||
"refreshToken": "authuxxxx4c1b0edb2X53",
|
||||
"uid": "208xxxxx37",
|
||||
"openId": null,
|
||||
"accessCode": null,
|
||||
"unionId": null,
|
||||
"scope": null,
|
||||
"tokenType": null,
|
||||
"idToken": null,
|
||||
"macAlgorithm": null,
|
||||
"macKey": null,
|
||||
"code": null,
|
||||
"oauthToken": null,
|
||||
"oauthTokenSecret": null,
|
||||
"userId": null,
|
||||
"screenName": null,
|
||||
"oauthCallbackConfirmed": null
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,7 +1 @@
|
||||
(敬请期待...)
|
||||
|
||||
## 1. 申请应用
|
||||
|
||||
## 2. 集成JustAuth
|
||||
|
||||
## 3. 授权结果
|
||||
_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_
|
||||
@@ -55,7 +55,7 @@ AuthRequest authRequest = new AuthGiteeRequest(AuthConfig.builder()
|
||||
|
||||
我们可以直接使用以下方式生成第三方平台的授权链接:
|
||||
```java
|
||||
String authorizeUrl = authRequest.authorize();
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
```
|
||||
这个链接我们可以直接后台重定向跳转,也可以返回到前端后,前端控制跳转。前端控制的好处就是,可以将第三方的授权页嵌入到iframe中,适配网站设计。
|
||||
|
||||
@@ -65,7 +65,9 @@ String authorizeUrl = authRequest.authorize();
|
||||
```java
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.request.AuthGiteeRequest;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -81,13 +83,13 @@ public class RestAuthController {
|
||||
@RequestMapping("/render")
|
||||
public void renderAuth(HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
response.sendRedirect(authRequest.authorize());
|
||||
response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
public Object login(String code) {
|
||||
public Object login(AuthCallback callback) {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return authRequest.login(code);
|
||||
return authRequest.login(callback);
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
@@ -106,7 +108,7 @@ public class RestAuthController {
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
注:数据以脱敏
|
||||
注:数据已脱敏
|
||||
|
||||
```json
|
||||
{
|
||||
@@ -141,4 +143,4 @@ public class RestAuthController {
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
```
|
||||
|
||||
@@ -52,7 +52,7 @@ AuthRequest authRequest = new AuthGithubRequest(AuthConfig.builder()
|
||||
|
||||
我们可以直接使用以下方式生成第三方平台的授权链接:
|
||||
```java
|
||||
String authorizeUrl = authRequest.authorize();
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
```
|
||||
这个链接我们可以直接后台重定向跳转,也可以返回到前端后,前端控制跳转。前端控制的好处就是,可以将第三方的授权页嵌入到iframe中,适配网站设计。
|
||||
|
||||
@@ -61,8 +61,10 @@ String authorizeUrl = authRequest.authorize();
|
||||
|
||||
```java
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.request.AuthGiteeRequest;
|
||||
import me.zhyd.oauth.request.AuthGithubRequest;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -78,13 +80,13 @@ public class RestAuthController {
|
||||
@RequestMapping("/render")
|
||||
public void renderAuth(HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
response.sendRedirect(authRequest.authorize());
|
||||
response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
public Object login(String code) {
|
||||
public Object login(AuthCallback callback) {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return authRequest.login(code);
|
||||
return authRequest.login(callback);
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
|
||||
@@ -81,6 +81,7 @@ String authorizeUrl = authRequest.authorize(String state, String scopeStr);
|
||||
```java
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.request.AuthKujialeRequest;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -101,10 +102,10 @@ public class RestAuthController {
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
public Object login(String code, String state) {
|
||||
public Object login(AuthCallback callback) {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
//此处如果对安全性有要求,请校验state参数
|
||||
return authRequest.login(code);
|
||||
return authRequest.login(callback);
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
|
||||
@@ -1,7 +1,97 @@
|
||||
(敬请期待...)
|
||||
|
||||
## 1. 申请应用
|
||||
|
||||
### 1.登录QQ互联平台
|
||||
https://connect.qq.com/
|
||||
### 2.申请开发者
|
||||
进入“应用管理”页面:[https://connect.qq.com/manage.html#/](https://connect.qq.com/manage.html#/)
|
||||
如果是第一次使用,并且未进行过开发者认证,需要提交一下个人资料,待认证通过后方可创建应用。
|
||||
|
||||
### 3. 添加应用
|
||||
|
||||
依次点击:应用管理 -> 网站应用 -> 创建应用,应用信息提交后,等待审核通过即可
|
||||
|
||||
应用审核通过后如下:
|
||||
|
||||

|
||||
|
||||
copy以下三个信息:`App ID`、`App Key`和`网站回调域`。
|
||||
|
||||
## 2. 集成JustAuth
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
### 2.1 引入依赖
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>${latest.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
`${latest.version}`表示当前最新的版本,可以在[这儿](https://github.com/justauth/JustAuth/releases)获取最新的版本信息。
|
||||
|
||||
### 2.2 创建Request
|
||||
|
||||
```java
|
||||
AuthRequest authRequest = new AuthQqRequest(AuthConfig.builder()
|
||||
.clientId("App ID")
|
||||
.clientSecret("App Key")
|
||||
.redirectUri("网站回调域")
|
||||
.build());
|
||||
```
|
||||
|
||||
### 2.3 生成授权地址
|
||||
|
||||
我们可以直接使用以下方式生成第三方平台的授权链接:
|
||||
```java
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
```
|
||||
这个链接我们可以直接后台重定向跳转,也可以返回到前端后,前端控制跳转。前端控制的好处就是,可以将第三方的授权页嵌入到iframe中,适配网站设计。
|
||||
|
||||
|
||||
### 2.4 以上完整代码如下
|
||||
|
||||
```java
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.request.AuthQqRequest;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/oauth")
|
||||
public class RestAuthController {
|
||||
|
||||
@RequestMapping("/render")
|
||||
public void renderAuth(HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
public Object login(AuthCallback callback) {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return authRequest.login(callback);
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
return new AuthQqRequest(AuthConfig.builder()
|
||||
.clientId("App ID")
|
||||
.clientSecret("App Key")
|
||||
.redirectUri("网站回调域")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
暂无
|
||||
@@ -0,0 +1,168 @@
|
||||
### 声明:
|
||||
此文档适用于**微信开放平台**!
|
||||
|
||||
## 1. 申请应用
|
||||
|
||||
### 1.注册微信开放平台账号
|
||||
[https://open.weixin.qq.com/](https://open.weixin.qq.com/)。如果已有则忽略该步骤,直接进入第二步。
|
||||
### 2. 申请开发者资质认证
|
||||
|
||||
这儿需要重点说明的是, 微信开放平台创建应用,需要申请**开发者资质认证**
|
||||
|
||||

|
||||
|
||||
如上图:账号中心->开发者资质认证
|
||||
|
||||
但是微信**不支持**个人开发者认证,必须要企业信息才能提交认证。
|
||||
|
||||
对于个人开发者来说,我们提供三种解决方案:
|
||||
- 用自己公司的信息做认证(请确保合法合规)
|
||||
- 找朋友帮忙认证
|
||||
- 去TB或者其他平台花钱找人认证,这种方式一般支持:短期租、长期认证
|
||||
|
||||
### 3.创建第三方应用
|
||||
|
||||
认证通过后切换到“网站应用”标签页,点击“创建网站应用”按钮
|
||||

|
||||
|
||||
|
||||

|
||||
|
||||
创建完成后,就能在“网站应用”列表中看到相关信息
|
||||
|
||||

|
||||
|
||||
点击“查看”进入应用详情,可以看到 “OAuth三大件”:`Client ID`、`Client Secret`和`Callback URL`。
|
||||
|
||||

|
||||
|
||||
**注意:**
|
||||
- “授权回调域”填写对应域名即可。比如我想给我的博客 [https://www.zhyd.me](https://www.zhyd.me) 增加微信第三方登录,那么我在配回调地址时,就只需要填写 `www.zhyd.me`即可,实际我们自己开发程序时, 可以随便配置具体的回调地址,只要确保是在 `www.zhyd.me` 下的地址就行。本例中, 我在程序中配置的回调地址为:`https://www.zhyd.me/oauth/callback/wechat`
|
||||
- 重要的事情说三遍:**一定要确保应用详情页的“接口信息”中的“微信登录”接口的状态为“已获得”!** **一定要确保应用详情页的“接口信息”中的“微信登录”接口的状态为“已获得”!** **一定要确保应用详情页的“接口信息”中的“微信登录”接口的状态为“已获得”!**否则一定会遇到这个问题:[“Scope参数错误或者Scope没有权限”是怎么回事?](../Q&A.md?id=_7scope参数错误或者scope没有权限是怎么回事?)
|
||||
|
||||
|
||||
## 2. 集成JustAuth
|
||||
|
||||
|
||||
### 2.1 引入依赖
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>${latest.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
`${latest.version}`表示当前最新的版本,可以在[这儿](https://github.com/justauth/JustAuth/releases)获取最新的版本信息。
|
||||
|
||||
### 2.2 创建Request
|
||||
|
||||
```java
|
||||
AuthRequest authRequest = new AuthWeChatRequest(AuthConfig.builder()
|
||||
.clientId("Client ID")
|
||||
.clientSecret("Client Secret")
|
||||
.redirectUri("https://www.zhyd.me/oauth/callback/wechat")
|
||||
.build());
|
||||
```
|
||||
|
||||
### 2.3 生成授权地址
|
||||
|
||||
我们可以直接使用以下方式生成第三方平台的授权链接:
|
||||
```java
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
```
|
||||
这个链接我们可以直接后台重定向跳转,也可以返回到前端后,前端控制跳转。前端控制的好处就是,可以将第三方的授权页嵌入到iframe中,适配网站设计。
|
||||
|
||||
|
||||
### 2.4 以上完整代码如下
|
||||
|
||||
```java
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.request.AuthWeChatOpenRequest;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/oauth")
|
||||
public class RestAuthController {
|
||||
|
||||
@RequestMapping("/render")
|
||||
public void renderAuth(HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
public Object login(AuthCallback callback) {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return authRequest.login(callback);
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
return new AuthWeChatOpenRequest(AuthConfig.builder()
|
||||
.clientId("Client ID")
|
||||
.clientSecret("Client Secret")
|
||||
.redirectUri("https://www.zhyd.me/oauth/callback/wechat")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
```
|
||||
授权链接访问成功后会看到以下页面内容:
|
||||

|
||||
|
||||
使用手机扫码后,将会进入确认授权页面
|
||||
|
||||

|
||||
|
||||
点击同意授权即可完成微信的oauth登录。
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 2000,
|
||||
"msg": null,
|
||||
"data": {
|
||||
"uuid": "xxxxxxx",
|
||||
"username": "RD",
|
||||
"nickname": "RD",
|
||||
"avatar": "http://thirdwx.qlogo.cn/mmopen/vi_32/DYAIOgq83ereNicKErbtBVnraCnzjGia2ZWPSkI9Ok4ScrmkdiacgPN6D5qeYBf3iba2lXknE7YaMMHHRrMW6Op8eQ/132",
|
||||
"blog": null,
|
||||
"company": null,
|
||||
"location": "中国-北京-",
|
||||
"email": null,
|
||||
"remark": null,
|
||||
"gender": "MALE",
|
||||
"source": "WECHAT_OPEN",
|
||||
"token": {
|
||||
"accessToken": "28_Bzvt4UxxxxFElOxxxxgTqIJmSE5LxB2Az7stFqYVnFoIhL7RbevA0Urc",
|
||||
"expireIn": 7200,
|
||||
"refreshToken": "28_vtarjUxxxxfKh0Axxxxe_vy7E62hAYkMJ5M_JT4gMXM7r1kT_SeKAQz8Ojow",
|
||||
"uid": null,
|
||||
"openId": "xxxxxxx",
|
||||
"accessCode": null,
|
||||
"unionId": "xxxxxxx",
|
||||
"scope": null,
|
||||
"tokenType": null,
|
||||
"idToken": null,
|
||||
"macAlgorithm": null,
|
||||
"macKey": null,
|
||||
"code": null,
|
||||
"oauthToken": null,
|
||||
"oauthTokenSecret": null,
|
||||
"userId": null,
|
||||
"screenName": null,
|
||||
"oauthCallbackConfirmed": null
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,7 +1,155 @@
|
||||
(敬请期待...)
|
||||
|
||||
## 1. 申请应用
|
||||
|
||||
### 1.注册微博开放平台账号
|
||||
https://open.weibo.com/apps。如果已有则忽略该步骤,直接进入第二步。
|
||||
### 2.创建应用
|
||||
通过顶部菜单栏的【微连接-网站接入】或者直接点击【[网站接入](https://open.weibo.com/connect)】进入网站接入界面
|
||||
|
||||

|
||||
|
||||
点击【立即接入】按钮进入创建应用页面,填入**应用名称**,**应用分类**选择默认的“网页应用”即可
|
||||
|
||||

|
||||
|
||||
创建完成后会自动跳转到应用信息页面,如下图,根据提示完善应用即可
|
||||
|
||||

|
||||
|
||||
注:全部填写完成后,需要提交审核。
|
||||
|
||||
提交审核完成后,将Oauth需要用到的数据copy下来(下面截图取自我已经审核通过的应用):
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
微博平台的OAuth支持revoke操作,所以会有一个【取消授权回调页】配置。
|
||||
|
||||
## 2. 集成JustAuth
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
### 2.1 引入依赖
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>${latest.version}</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
`${latest.version}`表示当前最新的版本,可以在[这儿](https://github.com/justauth/JustAuth/releases)获取最新的版本信息。
|
||||
|
||||
### 2.2 创建Request
|
||||
|
||||
```java
|
||||
AuthRequest authRequest = new AuthWeiboRequest(AuthConfig.builder()
|
||||
.clientId("App Key")
|
||||
.clientSecret("App Secret")
|
||||
.redirectUri("授权回调页")
|
||||
.build());
|
||||
```
|
||||
|
||||
### 2.3 生成授权地址
|
||||
|
||||
我们可以直接使用以下方式生成第三方平台的授权链接:
|
||||
```java
|
||||
String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
|
||||
```
|
||||
这个链接我们可以直接后台重定向跳转,也可以返回到前端后,前端控制跳转。前端控制的好处就是,可以将第三方的授权页嵌入到iframe中,适配网站设计。
|
||||
|
||||
|
||||
### 2.4 以上完整代码如下
|
||||
|
||||
```java
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.request.AuthWeiboRequest;
|
||||
import me.zhyd.oauth.model.AuthCallback;
|
||||
import me.zhyd.oauth.model.AuthToken;
|
||||
import me.zhyd.oauth.request.AuthRequest;
|
||||
import me.zhyd.oauth.utils.AuthStateUtils;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/oauth")
|
||||
public class RestAuthController {
|
||||
|
||||
@RequestMapping("/render")
|
||||
public void renderAuth(HttpServletResponse response) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
response.sendRedirect(authRequest.authorize(AuthStateUtils.createState()));
|
||||
}
|
||||
|
||||
@RequestMapping("/callback")
|
||||
public Object login(AuthCallback callback) {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return authRequest.login(callback);
|
||||
}
|
||||
|
||||
@RequestMapping("/revoke/{token}")
|
||||
public Object revokeAuth(@PathVariable("token") String token) throws IOException {
|
||||
AuthRequest authRequest = getAuthRequest();
|
||||
return authRequest.revoke(AuthToken.builder().accessToken(token).build());
|
||||
}
|
||||
|
||||
private AuthRequest getAuthRequest() {
|
||||
return new AuthWeiboRequest(AuthConfig.builder()
|
||||
.clientId("App Key")
|
||||
.clientSecret("App Secret")
|
||||
.redirectUri("授权回调页")
|
||||
.build());
|
||||
}
|
||||
}
|
||||
```
|
||||
授权链接访问成功后会看到以下页面内容:
|
||||

|
||||
|
||||
网页登录或者手机扫码登录并授权第三方应用的登录请求后,将会获取到用户的信息
|
||||
|
||||
## 3. 授权结果
|
||||
|
||||
```json
|
||||
{
|
||||
"code": 2000,
|
||||
"msg": null,
|
||||
"data": {
|
||||
"uuid": "xxxxxxx",
|
||||
"username": "七彩狼丿",
|
||||
"nickname": "七彩狼丿",
|
||||
"avatar": "https://tva3.sinaimg.cn/crop.0.0.1424.1424.50/649b9a6fjw8ezwz4inarqj213k13kwjh.jpg?KID=imgbed,tva&Expires=1577025808&ssig=Q7m4jDuwUt",
|
||||
"blog": "https://www.zhyd.me",
|
||||
"company": null,
|
||||
"location": "北京 朝阳区",
|
||||
"email": null,
|
||||
"remark": "长大了,不得不接受一些事实",
|
||||
"gender": "MALE",
|
||||
"source": "WEIBO",
|
||||
"token": {
|
||||
"accessToken": "2.xxxxxCNUC",
|
||||
"expireIn": 157679999,
|
||||
"refreshToken": null,
|
||||
"uid": "xxxxxxx",
|
||||
"openId": "xxxxxxx",
|
||||
"accessCode": null,
|
||||
"unionId": null,
|
||||
"scope": null,
|
||||
"tokenType": null,
|
||||
"idToken": null,
|
||||
"macAlgorithm": null,
|
||||
"macKey": null,
|
||||
"code": null,
|
||||
"oauthToken": null,
|
||||
"oauthTokenSecret": null,
|
||||
"userId": null,
|
||||
"screenName": null,
|
||||
"oauthCallbackConfirmed": null
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
@@ -1,10 +0,0 @@
|
||||
**配套Demo**:
|
||||
- [simple版](https://github.com/justauth/JustAuth-demo)
|
||||
- [jFinal版](https://github.com/xkcoding/jfinal-justauth-demo): Jfinal集成JustAuth的demo by [xkcoding](https://github.com/xkcoding)
|
||||
- [ActFramework版](https://github.com/xkcoding/act-justauth-demo): ActFramework 集成 JustAuth 的 demo by [xkcoding](https://github.com/xkcoding)
|
||||
- [Nutzboot版](https://github.com/EggsBlue/nutzboot-justauth-demo): NutzBoot集成JustAuth的demo by [蛋蛋](https://github.com/EggsBlue)
|
||||
- [Blade版](https://github.com/justauth/blade-justauth-demo): Blade集成JustAuth的demo
|
||||
|
||||
## 插件
|
||||
- [justauth-spring-boot-starter](https://github.com/xkcoding/justauth-spring-boot-starter): Spring Boot 集成 JustAuth 的最佳实践 by [xkcoding](https://github.com/xkcoding)
|
||||
- [justauth-spring-boot-starter-demo](https://github.com/justauth/justauth-spring-boot-starter-demo): Spring Boot 使用 justauth-spring-boot-starter 快速集成 JustAuth by [xkcoding](https://github.com/xkcoding)
|
||||
@@ -1,3 +1,81 @@
|
||||
## 1.15.2-alpha
|
||||
### 2020/05/10
|
||||
- 修改
|
||||
- 修复使用领英登录时无法获取token的问题
|
||||
- 解决Gitee [Issue-I1GPIB](https://gitee.com/yadong.zhang/JustAuth/issues/I1GPIB)
|
||||
|
||||
【声明】:当引用 OkHttp 时,无法调用领英的授权登录,可能会抛出 400 异常。如遇此问题,请先切换到 hutool 或者 httpclient 依赖。
|
||||
该问题尚在修复中,给各位带来的不便,深表歉意。
|
||||
|
||||
- hutool-http
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>5.2.5</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
- httpclient
|
||||
|
||||
```xml
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.12</version>
|
||||
</dependency>
|
||||
```
|
||||
|
||||
## v1.15.1(~~v1.15.0~~)
|
||||
### 2020/04/10
|
||||
- 修改
|
||||
- 更新开发文档
|
||||
- 合并Gitee [PR-10](https://gitee.com/yadong.zhang/JustAuth/pulls/10),集成京东登录
|
||||
- 合并Gitee [PR-14](https://gitee.com/yadong.zhang/JustAuth/pulls/14),修改帮助文档,加入JA的使用者信息
|
||||
- 合并Github [PR-69](https://github.com/justauth/JustAuth/pull/69),升级fastjson的最新版本
|
||||
- 解决使用apache-httpclient时的403bug,升级simple-http,感谢QQ群的`不瘦十斤不改名字`反馈该问题
|
||||
- 修复其他一些问题
|
||||
|
||||
【声明】:由于本人的失误,发布了一个错误的版本(1.15.0),目前1.15.0已发布,但是请不要使用,请直接升级到`1.15.1`。
|
||||
|
||||
给各位造成的不便,深表歉意。
|
||||
|
||||
## v1.14.0
|
||||
### 2020/03/17
|
||||
- 修改
|
||||
- 合并[PR-59](https://github.com/justauth/JustAuth/pull/59),抽取HTTP,具体实现交给开发者,解耦 hutool-http,开发者可以视自己项目的依赖决定使用何种HTTP方式。详情请参考:https://github.com/xkcoding/simple-http
|
||||
- 合并[PR-65](https://github.com/justauth/JustAuth/pull/65),修改错误文案
|
||||
- 修复其他一些问题
|
||||
|
||||
## v1.14.0
|
||||
### 2020/03/17
|
||||
- 修改
|
||||
- 合并[PR-59](https://github.com/justauth/JustAuth/pull/59),抽取HTTP,具体实现交给开发者,解耦 hutool-http,开发者可以视自己项目的依赖决定使用何种HTTP方式。详情请参考:https://github.com/xkcoding/simple-http
|
||||
- 合并[PR-65](https://github.com/justauth/JustAuth/pull/65),修改错误文案
|
||||
- 修复其他一些问题
|
||||
|
||||
## v1.13.2
|
||||
### 2019/12/24
|
||||
- 新增
|
||||
- 增加微信、QQ、支付宝、微博授权登录的帮助文档
|
||||
- 合并[PR#57](https://github.com/justauth/JustAuth/pull/57),增加微信公众号登录 by [@xkcoding](https://github.com/xkcoding)
|
||||
- [帮助文档](https://docs.justauth.whnb.wang)中增加自定义的404页面
|
||||
- [帮助文档](https://docs.justauth.whnb.wang)中增加Gittalk插件
|
||||
- [帮助文档](https://docs.justauth.whnb.wang)中增加Java代码高亮的插件
|
||||
- 增加`AuthUserGender#getWechatRealGender`方法,兼容获取微信平台的用户性别
|
||||
- 修改
|
||||
- 修复抖音登录取值取错层级的问题([issue#I15SIG@Gitee](https://gitee.com/yadong.zhang/JustAuth/issues/I15SIG))
|
||||
- 完善异常提示的逻辑,支持传入Source(平台),发生异常时显示对应的source(平台)
|
||||
- `checkState`方法从`AuthDefaultRequest`中提出到`AuthChecker`中
|
||||
- `AuthResponseStatus`枚举类中增加`ILLEGAL_STATUS`、`REQUIRED_REFRESH_TOKEN`两个枚举值
|
||||
- `AuthSource`接口中增加`getName`方法,用来对外提供实际`source`的字符串值
|
||||
- `AuthWeiboRequest`微博授权登录中实现`revoke`方法,支持手动回收授权
|
||||
- [帮助文档](https://docs.justauth.whnb.wang)中修复[腾讯云登录]链接错误的问题
|
||||
- 升级
|
||||
- 升级相关依赖:lombok@v1.18.10,hutool@5.0.5,fastjson@1.2.62,alipay@4.8.10.ALL([PR#11@Gitee](https://gitee.com/yadong.zhang/JustAuth/pulls/11))
|
||||
|
||||
|
||||
## v1.13.1
|
||||
### 2019/11/12
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
- [Shiro-Action](https://github.com/zhaojun1998/Shiro-Action): 基于 Shiro 的权限管理系统,支持 restful url 授权
|
||||
- [project-template](https://github.com/HobbyBear/project-template): 作为前后端分离项目的后端模板整个项目基于springboot2.1.3,集jsr303框架做参数校验,spring security 做权限管理,并实现限制同一账号登陆会话数量功能,spring mail 发送邮件,justAuth做的第三方登陆, spring session做session共享,orm框架采用jpa,集成七牛云实现图片上传,redis实现分布式锁
|
||||
- [mica](https://github.com/lets-mica/mica/tree/master/mica-social):mica是Spring Cloud 微服务开发核心包。采用源码形式(保留了作者名)另加改了一些代码。
|
||||
- [MaxKey](https://shimingxy.github.io/MaxKey):马克思的钥匙,寓意是最大钥匙,是用户单点登录认证系统(Sigle Sign On System),OAuth 2.0/OpenID Connect、SAML 2.0、JWT、CAS等标准化的开放协议,使用JustAuth集成OAuth第三方认证。
|
||||
...
|
||||
|
||||
我在这儿等你 >>> :alien:
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 参考自 hutool 工具
|
||||
help(){
|
||||
echo "--------------------------------------------------------------------------"
|
||||
echo ""
|
||||
echo "usage: ./ja.sh [updv]"
|
||||
echo ""
|
||||
echo "-updv [version num] Update all justauth related versions."
|
||||
echo ""
|
||||
echo "--------------------------------------------------------------------------"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
'updv')
|
||||
bin/updVersion.sh $2
|
||||
;;
|
||||
*)
|
||||
help
|
||||
esac
|
||||
@@ -6,13 +6,13 @@
|
||||
|
||||
<groupId>me.zhyd.oauth</groupId>
|
||||
<artifactId>JustAuth</artifactId>
|
||||
<version>1.13.1</version>
|
||||
<version>1.15.3-alpha</version>
|
||||
|
||||
<name>JustAuth</name>
|
||||
<url>https://gitee.com/yadong.zhang/JustAuth</url>
|
||||
<description>
|
||||
史上最全的整合第三方登录的开源库。目前已支持Github、Gitee、微博、钉钉、百度、Coding、腾讯云开发者平台、OSChina、支付宝、
|
||||
QQ、微信、淘宝、Google、Facebook、抖音、领英、小米、微软、今日头条、Teambition、StackOverflow、Pinterest、人人、华为、
|
||||
QQ、微信开放平台、微信公众平台、淘宝、Google、Facebook、抖音、领英、小米、微软、今日头条、Teambition、StackOverflow、Pinterest、人人、华为、
|
||||
企业微信、酷家乐、Gitlab、美团、饿了么和推特等第三方平台的授权登录。
|
||||
Login, so easy!
|
||||
</description>
|
||||
@@ -60,11 +60,11 @@
|
||||
<maven-surefire-version>2.20</maven-surefire-version>
|
||||
<maven-gpg-version>1.6</maven-gpg-version>
|
||||
<maven.test.skip>false</maven.test.skip>
|
||||
<hutool-version>4.6.1</hutool-version>
|
||||
<lombok-version>1.18.4</lombok-version>
|
||||
<simple-http.version>1.0.1</simple-http.version>
|
||||
<lombok-version>1.18.10</lombok-version>
|
||||
<junit-version>4.11</junit-version>
|
||||
<fastjson-version>1.2.60</fastjson-version>
|
||||
<alipay-sdk-version>3.7.4.ALL</alipay-sdk-version>
|
||||
<fastjson-version>1.2.68</fastjson-version>
|
||||
<alipay-sdk-version>4.8.10.ALL</alipay-sdk-version>
|
||||
<jacoco-version>0.8.2</jacoco-version>
|
||||
</properties>
|
||||
|
||||
@@ -76,9 +76,9 @@
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-http</artifactId>
|
||||
<version>${hutool-version}</version>
|
||||
<groupId>com.xkcoding.http</groupId>
|
||||
<artifactId>simple-http</artifactId>
|
||||
<version>${simple-http.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
@@ -161,65 +161,65 @@
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source.version}</version>
|
||||
<inherited>true</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${cobertura-version}</version>
|
||||
<configuration>
|
||||
<formats>
|
||||
<format>html</format>
|
||||
<format>xml</format>
|
||||
</formats>
|
||||
<check/>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>${jacoco-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>report</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${maven-gpg-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven-source.version}</version>
|
||||
<inherited>true</inherited>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${cobertura-version}</version>
|
||||
<configuration>
|
||||
<formats>
|
||||
<format>html</format>
|
||||
<format>xml</format>
|
||||
</formats>
|
||||
<check/>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
<version>${jacoco-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>prepare-agent</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>report</id>
|
||||
<phase>test</phase>
|
||||
<goals>
|
||||
<goal>report</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${maven-gpg-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
@@ -237,20 +237,20 @@
|
||||
<id>nexus</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${maven-gpg-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${maven-gpg-version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
|
||||
@@ -47,6 +47,11 @@ public enum AuthDefaultSource implements AuthSource {
|
||||
public String userInfo() {
|
||||
return "https://api.weibo.com/2/users/show.json";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String revoke() {
|
||||
return "https://api.weibo.com/oauth2/revokeoauth2";
|
||||
}
|
||||
},
|
||||
/**
|
||||
* gitee
|
||||
@@ -235,9 +240,9 @@ public enum AuthDefaultSource implements AuthSource {
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 微信
|
||||
* 微信开放平台
|
||||
*/
|
||||
WECHAT {
|
||||
WECHAT_OPEN {
|
||||
@Override
|
||||
public String authorize() {
|
||||
return "https://open.weixin.qq.com/connect/qrconnect";
|
||||
@@ -258,6 +263,30 @@ public enum AuthDefaultSource implements AuthSource {
|
||||
return "https://api.weixin.qq.com/sns/oauth2/refresh_token";
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 微信公众平台
|
||||
*/
|
||||
WECHAT_MP {
|
||||
@Override
|
||||
public String authorize() {
|
||||
return "https://open.weixin.qq.com/connect/oauth2/authorize";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String accessToken() {
|
||||
return "https://api.weixin.qq.com/sns/oauth2/access_token";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String userInfo() {
|
||||
return "https://api.weixin.qq.com/sns/userinfo";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String refresh() {
|
||||
return "https://api.weixin.qq.com/sns/oauth2/refresh_token";
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 淘宝
|
||||
*/
|
||||
@@ -694,6 +723,59 @@ public enum AuthDefaultSource implements AuthSource {
|
||||
public String userInfo() {
|
||||
return "https://api.twitter.com/1.1/users/show.json";
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 飞书
|
||||
* 注意:该平台暂时存在问题,请不要使用。待修复完成后会重新发版
|
||||
*
|
||||
* @since 1.14.0
|
||||
*/
|
||||
FEISHU {
|
||||
@Override
|
||||
public String authorize() {
|
||||
return "https://open.feishu.cn/connect/qrconnect/page/sso/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String accessToken() {
|
||||
return "https://open.feishu.cn/connect/qrconnect/oauth2/access_token/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String userInfo() {
|
||||
return "https://open.feishu.cn/connect/qrconnect/oauth2/user_info/";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String refresh() {
|
||||
return "https://open.feishu.cn/connect/qrconnect/oauth2/access_token/";
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 京东
|
||||
*
|
||||
* @since 1.15.0
|
||||
*/
|
||||
JD {
|
||||
@Override
|
||||
public String authorize() {
|
||||
return "https://open-oauth.jd.com/oauth2/to_login";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String accessToken() {
|
||||
return "https://open-oauth.jd.com/oauth2/access_token";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String userInfo() {
|
||||
return "https://api.jd.com/routerjson";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String refresh() {
|
||||
return "https://open-oauth.jd.com/oauth2/refresh_token";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,4 +61,16 @@ public interface AuthSource {
|
||||
default String refresh() {
|
||||
throw new AuthException(AuthResponseStatus.UNSUPPORTED);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取Source的字符串名字
|
||||
*
|
||||
* @return name
|
||||
*/
|
||||
default String getName() {
|
||||
if (this instanceof Enum) {
|
||||
return String.valueOf(this);
|
||||
}
|
||||
return this.getClass().getSimpleName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ public enum AuthResponseStatus {
|
||||
ILLEGAL_REDIRECT_URI(5006, "Illegal redirect uri"),
|
||||
ILLEGAL_REQUEST(5007, "Illegal request"),
|
||||
ILLEGAL_CODE(5008, "Illegal code"),
|
||||
ILLEGAL_STATUS(5009, "Illegal state"),
|
||||
REQUIRED_REFRESH_TOKEN(5010, "The refresh token is required; it must not be null"),
|
||||
;
|
||||
|
||||
private int code;
|
||||
|
||||
@@ -2,6 +2,7 @@ package me.zhyd.oauth.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import me.zhyd.oauth.utils.StringUtils;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
@@ -18,25 +19,41 @@ public enum AuthUserGender {
|
||||
* MALE/FAMALE为正常值,通过{@link AuthUserGender#getRealGender(String)}方法获取真实的性别
|
||||
* UNKNOWN为容错值,部分平台不会返回用户性别,为了方便统一,使用UNKNOWN标记所有未知或不可测的用户性别信息
|
||||
*/
|
||||
MALE(1, "男"),
|
||||
FEMALE(0, "女"),
|
||||
UNKNOWN(-1, "未知");
|
||||
MALE("1", "男"),
|
||||
FEMALE("0", "女"),
|
||||
UNKNOWN("-1", "未知");
|
||||
|
||||
private int code;
|
||||
private String code;
|
||||
private String desc;
|
||||
|
||||
public static AuthUserGender getRealGender(String code) {
|
||||
if (code == null) {
|
||||
/**
|
||||
* 获取用户的实际性别,常规网站
|
||||
*
|
||||
* @param originalGender 用户第三方标注的原始性别
|
||||
* @return 用户性别
|
||||
*/
|
||||
public static AuthUserGender getRealGender(String originalGender) {
|
||||
if (null == originalGender || UNKNOWN.getCode().equals(originalGender)) {
|
||||
return UNKNOWN;
|
||||
}
|
||||
String[] males = {"m", "男", "1", "male"};
|
||||
if (Arrays.asList(males).contains(code.toLowerCase())) {
|
||||
if (Arrays.asList(males).contains(originalGender.toLowerCase())) {
|
||||
return MALE;
|
||||
}
|
||||
String[] females = {"f", "女", "0", "female"};
|
||||
if (Arrays.asList(females).contains(code.toLowerCase())) {
|
||||
return FEMALE;
|
||||
return FEMALE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信平台用户的实际性别,0表示未定义,1表示男性,2表示女性
|
||||
*
|
||||
* @param originalGender 用户第三方标注的原始性别
|
||||
* @return 用户性别
|
||||
* @since 1.13.2
|
||||
*/
|
||||
public static AuthUserGender getWechatRealGender(String originalGender) {
|
||||
if (StringUtils.isEmpty(originalGender) || "0".equals(originalGender)) {
|
||||
return AuthUserGender.UNKNOWN;
|
||||
}
|
||||
return UNKNOWN;
|
||||
return getRealGender(originalGender);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package me.zhyd.oauth.exception;
|
||||
|
||||
import me.zhyd.oauth.config.AuthSource;
|
||||
import me.zhyd.oauth.enums.AuthResponseStatus;
|
||||
|
||||
/**
|
||||
@@ -17,6 +18,10 @@ public class AuthException extends RuntimeException {
|
||||
this(AuthResponseStatus.FAILURE.getCode(), errorMsg);
|
||||
}
|
||||
|
||||
public AuthException(String errorMsg, AuthSource source) {
|
||||
this(AuthResponseStatus.FAILURE.getCode(), errorMsg, source);
|
||||
}
|
||||
|
||||
public AuthException(int errorCode, String errorMsg) {
|
||||
super(errorMsg);
|
||||
this.errorCode = errorCode;
|
||||
@@ -24,7 +29,15 @@ public class AuthException extends RuntimeException {
|
||||
}
|
||||
|
||||
public AuthException(AuthResponseStatus status) {
|
||||
super(status.getMsg());
|
||||
this(status.getCode(), status.getMsg());
|
||||
}
|
||||
|
||||
public AuthException(int errorCode, String errorMsg, AuthSource source) {
|
||||
this(errorCode, String.format("%s [%s]", errorMsg, source.getName()));
|
||||
}
|
||||
|
||||
public AuthException(AuthResponseStatus status, AuthSource source) {
|
||||
this(status.getCode(), status.getMsg(), source);
|
||||
}
|
||||
|
||||
public AuthException(String message, Throwable cause) {
|
||||
|
||||
@@ -48,12 +48,13 @@ public class AuthCallback implements Serializable {
|
||||
*
|
||||
* @since 1.13.0
|
||||
*/
|
||||
private String oauthToken;
|
||||
private String oauth_token;
|
||||
|
||||
/**
|
||||
* Twitter回调后返回的oauth_verifier
|
||||
*
|
||||
* @since 1.13.0
|
||||
*/
|
||||
private String oauthVerifier;
|
||||
private String oauth_verifier;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package me.zhyd.oauth.model;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.*;
|
||||
import me.zhyd.oauth.enums.AuthResponseStatus;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -12,7 +12,10 @@ import java.io.Serializable;
|
||||
* @since 1.8
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AuthResponse<T> implements Serializable {
|
||||
/**
|
||||
* 授权响应状态码
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package me.zhyd.oauth.model;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import lombok.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -14,6 +13,8 @@ import java.io.Serializable;
|
||||
@Getter
|
||||
@Setter
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AuthToken implements Serializable {
|
||||
private String accessToken;
|
||||
private int expireIn;
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
package me.zhyd.oauth.request;
|
||||
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xkcoding.http.HttpUtil;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
import me.zhyd.oauth.config.AuthDefaultSource;
|
||||
@@ -34,14 +33,13 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
|
||||
|
||||
@Override
|
||||
protected AuthToken getAccessToken(AuthCallback authCallback) {
|
||||
HttpResponse response = doPostAuthorizationCode(authCallback.getCode());
|
||||
String response = doPostAuthorizationCode(authCallback.getCode());
|
||||
return getAuthToken(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
HttpResponse response = doGetUserInfo(authToken);
|
||||
String userInfo = response.body();
|
||||
String userInfo = doGetUserInfo(authToken);
|
||||
JSONObject object = JSONObject.parseObject(userInfo);
|
||||
this.checkResponse(object);
|
||||
return AuthUser.builder()
|
||||
@@ -63,8 +61,8 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
|
||||
|
||||
@Override
|
||||
public AuthResponse revoke(AuthToken authToken) {
|
||||
HttpResponse response = doGetRevoke(authToken);
|
||||
JSONObject object = JSONObject.parseObject(response.body());
|
||||
String response = doGetRevoke(authToken);
|
||||
JSONObject object = JSONObject.parseObject(response);
|
||||
this.checkResponse(object);
|
||||
// 返回1表示取消授权成功,否则失败
|
||||
AuthResponseStatus status = object.getIntValue("result") == 1 ? AuthResponseStatus.SUCCESS : AuthResponseStatus.FAILURE;
|
||||
@@ -79,7 +77,7 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
|
||||
.queryParam("client_id", this.config.getClientId())
|
||||
.queryParam("client_secret", this.config.getClientSecret())
|
||||
.build();
|
||||
HttpResponse response = HttpRequest.get(refreshUrl).execute();
|
||||
String response = HttpUtil.get(refreshUrl);
|
||||
return AuthResponse.builder()
|
||||
.code(AuthResponseStatus.SUCCESS.getCode())
|
||||
.data(this.getAuthToken(response))
|
||||
@@ -116,8 +114,8 @@ public class AuthBaiduRequest extends AuthDefaultRequest {
|
||||
}
|
||||
}
|
||||
|
||||
private AuthToken getAuthToken(HttpResponse response) {
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response.body());
|
||||
private AuthToken getAuthToken(String response) {
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response);
|
||||
this.checkResponse(accessTokenObject);
|
||||
return AuthToken.builder()
|
||||
.accessToken(accessTokenObject.getString("access_token"))
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package me.zhyd.oauth.request;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
@@ -30,8 +29,8 @@ public class AuthCodingRequest extends AuthDefaultRequest {
|
||||
|
||||
@Override
|
||||
protected AuthToken getAccessToken(AuthCallback authCallback) {
|
||||
HttpResponse response = doGetAuthorizationCode(authCallback.getCode());
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response.body());
|
||||
String response = doGetAuthorizationCode(authCallback.getCode());
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response);
|
||||
this.checkResponse(accessTokenObject);
|
||||
return AuthToken.builder()
|
||||
.accessToken(accessTokenObject.getString("access_token"))
|
||||
@@ -42,8 +41,8 @@ public class AuthCodingRequest extends AuthDefaultRequest {
|
||||
|
||||
@Override
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
HttpResponse response = doGetUserInfo(authToken);
|
||||
JSONObject object = JSONObject.parseObject(response.body());
|
||||
String response = doGetUserInfo(authToken);
|
||||
JSONObject object = JSONObject.parseObject(response);
|
||||
this.checkResponse(object);
|
||||
|
||||
object = object.getJSONObject("data");
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package me.zhyd.oauth.request;
|
||||
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import me.zhyd.oauth.cache.AuthStateCache;
|
||||
import me.zhyd.oauth.config.AuthConfig;
|
||||
@@ -30,16 +29,16 @@ public class AuthCsdnRequest extends AuthDefaultRequest {
|
||||
|
||||
@Override
|
||||
protected AuthToken getAccessToken(AuthCallback authCallback) {
|
||||
HttpResponse response = doPostAuthorizationCode(authCallback.getCode());
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response.body());
|
||||
String response = doPostAuthorizationCode(authCallback.getCode());
|
||||
JSONObject accessTokenObject = JSONObject.parseObject(response);
|
||||
this.checkResponse(accessTokenObject);
|
||||
return AuthToken.builder().accessToken(accessTokenObject.getString("access_token")).build();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AuthUser getUserInfo(AuthToken authToken) {
|
||||
HttpResponse response = doGetUserInfo(authToken);
|
||||
JSONObject object = JSONObject.parseObject(response.body());
|
||||
String response = doGetUserInfo(authToken);
|
||||
JSONObject object = JSONObject.parseObject(response);
|
||||
this.checkResponse(object);
|
||||
return AuthUser.builder()
|
||||
.uuid(object.getString("username"))
|
||||
|
||||