diff --git a/README.en-US.md b/README.en-US.md index 6cdde7fdfdf701675fa9b9180a2b57193ac53952..dd7a068176fc59773f83e3b5b7a7f366e40bce5e 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -83,7 +83,7 @@ Docs:[Reference Doc](https://docs.justauth.whnb.wang) ## Features -1. **Multiple platform**: Has integrated more than a dozen third-party platforms. +1. **Multiple platform**: Has integrated more than a dozen third-party platforms.([plan](https://gitee.com/yadong.zhang/JustAuth/issues/IUGRK)) 2. **Minimalist**: The minimalist design is very simple to use. ## Quick start @@ -122,6 +122,7 @@ authRequest.login(callback); **Springboot Starter** - [justauth-spring-boot-starter](https://github.com/xkcoding/justauth-spring-boot-starter): Spring Boot integrates best practices with JustAuth by [xkcoding](https://github.com/xkcoding) +- [justauth-spring-boot-starter-demo](https://github.com/justauth/justauth-spring-boot-starter-demo): Justauth-spring-boot-starter demo project by [xkcoding](https://github.com/xkcoding) #### API | :computer: platform | :coffee: API | :page_facing_up: Official document | diff --git a/README.md b/README.md index bd442e2e82482c05e248febeaba151dd9e831a04..9884fe1b631cff4da60f01f00fc139827eccf747 100644 --- a/README.md +++ b/README.md @@ -85,7 +85,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具 废话不多说,就俩字: -1. **全**:已集成十多家第三方平台(国内外常用的基本都已包含),后续依然还有扩展计划! +1. **全**:已集成十多家第三方平台(国内外常用的基本都已包含),仍然还在持续扩展中([开发计划](https://gitee.com/yadong.zhang/JustAuth/issues/IUGRK))! 2. **简**:API就是奔着最简单去设计的(见后面`快速开始`),尽量让您用起来没有障碍感! ## 快速开始 @@ -121,12 +121,14 @@ authRequest.login(callback); ## 插件 - [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) 具体的例子可以参考: - [实现Gitee授权登录](http://t.cn/ExDKxQs) - [实现Github授权登录](http://t.cn/EJ0Fxqo) -- [Spring Boot 快速集成第三方登录功能](http://t.cn/AiWWx5kH) +- [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) #### API列表 | :computer: 平台 | :coffee: API类 | :page_facing_up: SDK | diff --git a/docs/README.md b/docs/README.md index 8d9f7a672c30bd579ec470fd12c34ee65d292cf3..017fab189b789911543a7bab4c801486418015ff 100644 --- a/docs/README.md +++ b/docs/README.md @@ -51,7 +51,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具 废话不多说,就俩字: -1. **全**:已集成十多家第三方平台(国内外常用的基本都已包含),后续依然还有扩展计划! +1. **全**:已集成十多家第三方平台(国内外常用的基本都已包含),仍然还在持续扩展中([开发计划](https://gitee.com/yadong.zhang/JustAuth/issues/IUGRK))! 2. **简**:API就是奔着最简单去设计的,尽量让您用起来没有障碍感! ## 项目关注度趋势 diff --git a/docs/how-to-use.md b/docs/how-to-use.md index 0dff3f101ab1a484257379056d3308a11a6d9735..23f4ab2af4483d08c5dc6d43479d164981603a69 100644 --- a/docs/how-to-use.md +++ b/docs/how-to-use.md @@ -145,4 +145,11 @@ public Object revokeAuth(@PathVariable("source") String source, @PathVariable("t AuthRequest authRequest = getAuthRequest(source); return authRequest.revoke(AuthToken.builder().accessToken(token).build()); } -``` \ No newline at end of file +``` + +## 参考文章 + +- [实现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) diff --git a/docs/supporting.md b/docs/supporting.md index 58d2831ecb74e752858bfc5d830126d84cb9ac23..b9b10dafa2154e896ee6ef286a7b1dcb8a248ef6 100644 --- a/docs/supporting.md +++ b/docs/supporting.md @@ -6,3 +6,4 @@ ## 插件 - [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) diff --git a/src/test/java/me/zhyd/oauth/request/AuthRequestTest.java b/src/test/java/me/zhyd/oauth/request/AuthRequestTest.java deleted file mode 100644 index 06accb6196ca9a7417e8b27fc2d29ca33c0dc82c..0000000000000000000000000000000000000000 --- a/src/test/java/me/zhyd/oauth/request/AuthRequestTest.java +++ /dev/null @@ -1,309 +0,0 @@ -package me.zhyd.oauth.request; - -import me.zhyd.oauth.config.AuthConfig; -import me.zhyd.oauth.model.AuthCallback; -import me.zhyd.oauth.model.AuthResponse; -import me.zhyd.oauth.request.*; -import org.junit.Test; - -/** - * @author yadong.zhang (yadong.zhang0415(a)gmail.com) - */ -public class AuthRequestTest { - - @Test - public void giteeTest() { - AuthRequest authRequest = new AuthGiteeRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void githubTest() { - AuthRequest authRequest = new AuthGithubRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void weiboTest() { - AuthRequest authRequest = new AuthWeiboRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void dingdingTest() { - AuthRequest authRequest = new AuthDingTalkRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void baiduTest() { - AuthRequest authRequest = new AuthBaiduRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void codingTest() { - AuthRequest authRequest = new AuthCodingRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void tencentCloudTest() { - AuthRequest authRequest = new AuthTencentCloudRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void oschinaTest() { - AuthRequest authRequest = new AuthOschinaRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - authRequest.login(new AuthCallback()); - } - - @Test - public void alipayTest() { - AuthRequest authRequest = new AuthAlipayRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .alipayPublicKey("publicKey") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void qqTest() { - AuthRequest authRequest = new AuthQqRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void wechatTest() { - AuthRequest authRequest = new AuthWeChatRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void taobaoTest() { - AuthRequest authRequest = new AuthTaobaoRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void googleTest() { - AuthRequest authRequest = new AuthGoogleRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void facebookTest() { - AuthRequest authRequest = new AuthFacebookRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("https://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void douyinTest() { - AuthRequest authRequest = new AuthDouyinRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void linkedinTest() { - AuthRequest authRequest = new AuthLinkedinRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void microsoftTest() { - AuthRequest authRequest = new AuthMicrosoftRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void miTest() { - AuthRequest authRequest = new AuthMiRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void toutiaoTest() { - AuthRequest authRequest = new AuthToutiaoRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void huaweiTest() { - AuthRequest authRequest = new AuthHuaweiRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } - - @Test - public void weChatEnterpriseTest() { - AuthRequest authRequest = new AuthWeChatEnterpriseRequest(AuthConfig.builder() - .clientId("clientId") - .clientSecret("clientSecret") - .redirectUri("http://redirectUri") - .agentId("agentId") - .build()); - // 返回授权页面,可自行跳转 - authRequest.authorize("state"); - // 授权登录后会返回code(auth_code(仅限支付宝)、authorization_code(仅限华为))、state,1.8.0版本后,可以用AuthCallback类作为回调接口的入参 - // 注:JustAuth默认保存state的时效为3分钟,3分钟内未使用则会自动清除过期的state - AuthResponse login = authRequest.login(new AuthCallback()); - } -}