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

🔖 增加小米账号和微软的授权登陆。发布1.5.0版本

上级 e92f8961
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
<td align="center" width="200"><a href="#授权facebook"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/facebook.png" width="20"></a></td> <td align="center" width="200"><a href="#授权facebook"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/facebook.png" width="20"></a></td>
<td align="center" width="200"><a href="#授权抖音"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/douyin.png" width="20"></a></td> <td align="center" width="200"><a href="#授权抖音"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/douyin.png" width="20"></a></td>
<td align="center" width="200"><a href="#授权领英"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/linkedin.png" width="20"></a></td> <td align="center" width="200"><a href="#授权领英"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/linkedin.png" width="20"></a></td>
<td align="center" width="200"><a href="#授权微软"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/microsoft.png" width="20"></a></td>
<td align="center" width="200"><a href="#授权小米"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/mi.png" width="20"></a></td>
<td align="center" width="200"><a href="#授权csdn"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/csdn.png" width="20"></a></td> <td align="center" width="200"><a href="#授权csdn"><img src="https://gitee.com/yadong.zhang/static/raw/master/JustAuth/csdn.png" width="20"></a></td>
</tr> </tr>
</table> </table>
...@@ -61,7 +63,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具 ...@@ -61,7 +63,7 @@ JustAuth,如你所见,它仅仅是一个**第三方授权登录**的**工具
<dependency> <dependency>
<groupId>me.zhyd.oauth</groupId> <groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId> <artifactId>JustAuth</artifactId>
<version>1.4.0</version> <version>1.5.0</version>
</dependency> </dependency>
``` ```
- 调用api - 调用api
...@@ -104,8 +106,9 @@ authRequest.login("code"); ...@@ -104,8 +106,9 @@ authRequest.login("code");
| <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/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" 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" 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/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/csdn.png" width="20"> | [AuthCsdnRequest](https://gitee.com/yadong.zhang/JustAuth/blob/master/src/main/java/me/zhyd/oauth/request/AuthCsdnRequest.java) | 无 | | <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) | 无 |
| | [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> |
_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_
...@@ -197,6 +200,11 @@ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经 ...@@ -197,6 +200,11 @@ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经
![授权领英登录](https://images.gitee.com/uploads/images/2019/0527/152207_a6342979_784199.png "授权领英登录") ![授权领英登录](https://images.gitee.com/uploads/images/2019/0527/152207_a6342979_784199.png "授权领英登录")
#### 授权微软
#### 授权小米
#### 授权csdn #### 授权csdn
_请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_ _请知悉:经咨询CSDN官方客服得知,CSDN的授权开放平台已经下线。如果以前申请过的应用,可以继续使用,但是不再支持申请新的应用。so, 本项目中的CSDN登录只能针对少部分用户使用了_
......
...@@ -6,11 +6,14 @@ ...@@ -6,11 +6,14 @@
<groupId>me.zhyd.oauth</groupId> <groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId> <artifactId>JustAuth</artifactId>
<version>1.4.0</version> <version>1.5.0</version>
<name>JustAuth</name> <name>JustAuth</name>
<url>https://gitee.com/yadong.zhang/JustAuth</url> <url>https://gitee.com/yadong.zhang/JustAuth</url>
<description>史上最全的整合第三方登录的工具, Just Auth</description> <description>
史上最全的整合第三方登录的工具,目前已支持Github、Gitee、微博、钉钉、百度、Coding、腾讯云开发者平台、OSChina、支付宝、QQ、微信、淘宝、Google、Facebook、抖音、领英、小米和微软等第三方平台的授权登录。
Login, so easy!
</description>
<licenses> <licenses>
<license> <license>
...@@ -77,12 +80,6 @@ ...@@ -77,12 +80,6 @@
<artifactId>fastjson</artifactId> <artifactId>fastjson</artifactId>
<version>${fastjson-version}</version> <version>${fastjson-version}</version>
</dependency> </dependency>
<!--<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>${google-api-version}</version>
</dependency>-->
<dependency> <dependency>
<groupId>com.alipay.sdk</groupId> <groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId> <artifactId>alipay-sdk-java</artifactId>
...@@ -117,12 +114,10 @@ ...@@ -117,12 +114,10 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Javadoc -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
</plugin> </plugin>
<!-- GPG -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
...@@ -134,7 +129,6 @@ ...@@ -134,7 +129,6 @@
<id>release</id> <id>release</id>
<build> <build>
<plugins> <plugins>
<!-- Source -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId> <artifactId>maven-source-plugin</artifactId>
...@@ -149,7 +143,6 @@ ...@@ -149,7 +143,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- Javadoc -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-javadoc-plugin</artifactId>
...@@ -162,7 +155,6 @@ ...@@ -162,7 +155,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<!-- GPG -->
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId> <artifactId>maven-gpg-plugin</artifactId>
......
...@@ -77,12 +77,27 @@ public class UrlBuilder { ...@@ -77,12 +77,27 @@ public class UrlBuilder {
private static final String DOUYIN_USER_INFO_PATTERN = "{0}?access_token={1}&open_id={2}"; private static final String DOUYIN_USER_INFO_PATTERN = "{0}?access_token={1}&open_id={2}";
private static final String DOUYIN_REFRESH_TOKEN_PATTERN = "{0}?client_key={1}&refresh_token={2}&grant_type=refresh_token"; private static final String DOUYIN_REFRESH_TOKEN_PATTERN = "{0}?client_key={1}&refresh_token={2}&grant_type=refresh_token";
private static final String LINKEDIN_AUTHORIZE_PATTERN = "{0}?client_id={1}&redirect_uri={2}&state={3}&response_type=code&scope=r_liteprofile%20r_emailaddress%20w_member_social";
private static final String LINKEDIN_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&code={3}&redirect_uri={4}&grant_type=authorization_code";
private static final String LINKEDIN_USER_INFO_PATTERN = "{0}?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))";
private static final String LINKEDIN_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&refresh_token={3}&grant_type=refresh_token";
private static final String MICROSOFT_AUTHORIZE_PATTERN = "{0}?client_id={1}&response_type=code&redirect_uri={2}&response_mode=query&scope=offline_access%20user.read%20mail.read&state={3}";
private static final String MICROSOFT_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&scope=user.read%20mail.read&redirect_uri={3}&code={4}&grant_type=authorization_code";
private static final String MICROSOFT_USER_INFO_PATTERN = "{0}";
private static final String MICROSOFT_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&scope=user.read%20mail.read&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token";
private static final String MI_AUTHORIZE_PATTERN = "{0}?client_id={1}&redirect_uri={2}&response_type=code&scope=user/profile%20user/openIdV2%20user/phoneAndEmail&state={3}&skip_confirm=false";
private static final String MI_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&code={4}&grant_type=authorization_code";
private static final String MI_USER_INFO_PATTERN = "{0}?clientId={1}&token={2}";
private static final String MI_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token";
/** /**
* 获取githubtoken的接口地址 * 获取githubtoken的接口地址
* *
* @param clientId github应用的Client ID * @param clientId github 应用的Client ID
* @param clientSecret github应用的Client Secret * @param clientSecret github 应用的Client Secret
* @param code github授权前的code,用来换token * @param code github 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -114,9 +129,9 @@ public class UrlBuilder { ...@@ -114,9 +129,9 @@ public class UrlBuilder {
/** /**
* 获取weibo token的接口地址 * 获取weibo token的接口地址
* *
* @param clientId weibo应用的App Key * @param clientId weibo 应用的App Key
* @param clientSecret weibo应用的App Secret * @param clientSecret weibo 应用的App Secret
* @param code weibo授权前的code,用来换token * @param code weibo 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -148,9 +163,9 @@ public class UrlBuilder { ...@@ -148,9 +163,9 @@ public class UrlBuilder {
/** /**
* 获取gitee token的接口地址 * 获取gitee token的接口地址
* *
* @param clientId gitee应用的Client ID * @param clientId gitee 应用的Client ID
* @param clientSecret gitee应用的Client Secret * @param clientSecret gitee 应用的Client Secret
* @param code gitee授权前的code,用来换token * @param code gitee 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -205,9 +220,9 @@ public class UrlBuilder { ...@@ -205,9 +220,9 @@ public class UrlBuilder {
/** /**
* 获取baidu token的接口地址 * 获取baidu token的接口地址
* *
* @param clientId baidu应用的API Key * @param clientId baidu 应用的API Key
* @param clientSecret baidu应用的Secret Key * @param clientSecret baidu 应用的Secret Key
* @param code baidu授权前的code,用来换token * @param code baidu 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -239,7 +254,7 @@ public class UrlBuilder { ...@@ -239,7 +254,7 @@ public class UrlBuilder {
/** /**
* 获取收回baidu授权的地址 * 获取收回baidu授权的地址
* *
* @param accessToken baidu授权登录后的token * @param accessToken baidu 授权登录后的token
* @return json * @return json
*/ */
public static String getBaiduRevokeUrl(String accessToken) { public static String getBaiduRevokeUrl(String accessToken) {
...@@ -249,9 +264,9 @@ public class UrlBuilder { ...@@ -249,9 +264,9 @@ public class UrlBuilder {
/** /**
* 获取csdn token的接口地址 * 获取csdn token的接口地址
* *
* @param clientId csdn应用的App Key * @param clientId csdn 应用的App Key
* @param clientSecret csdn应用的App Secret * @param clientSecret csdn 应用的App Secret
* @param code csdn授权前的code,用来换token * @param code csdn 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -283,9 +298,9 @@ public class UrlBuilder { ...@@ -283,9 +298,9 @@ public class UrlBuilder {
/** /**
* 获取coding token的接口地址 * 获取coding token的接口地址
* *
* @param clientId coding应用的App Key * @param clientId coding 应用的App Key
* @param clientSecret coding应用的App Secret * @param clientSecret coding 应用的App Secret
* @param code coding授权前的code,用来换token * @param code coding 授权前的code,用来换token
* @return full url * @return full url
*/ */
public static String getCodingAccessTokenUrl(String clientId, String clientSecret, String code) { public static String getCodingAccessTokenUrl(String clientId, String clientSecret, String code) {
...@@ -316,9 +331,9 @@ public class UrlBuilder { ...@@ -316,9 +331,9 @@ public class UrlBuilder {
/** /**
* 获取腾讯云开发者平台 token的接口地址 * 获取腾讯云开发者平台 token的接口地址
* *
* @param clientId coding应用的App Key * @param clientId coding 应用的App Key
* @param clientSecret coding应用的App Secret * @param clientSecret coding 应用的App Secret
* @param code coding授权前的code,用来换token * @param code coding 授权前的code,用来换token
* @return full url * @return full url
*/ */
public static String getTencentCloudAccessTokenUrl(String clientId, String clientSecret, String code) { public static String getTencentCloudAccessTokenUrl(String clientId, String clientSecret, String code) {
...@@ -349,9 +364,9 @@ public class UrlBuilder { ...@@ -349,9 +364,9 @@ public class UrlBuilder {
/** /**
* 获取oschina token的接口地址 * 获取oschina token的接口地址
* *
* @param clientId oschina应用的App Key * @param clientId oschina 应用的App Key
* @param clientSecret oschina应用的App Secret * @param clientSecret oschina 应用的App Secret
* @param code oschina授权前的code,用来换token * @param code oschina 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -383,9 +398,9 @@ public class UrlBuilder { ...@@ -383,9 +398,9 @@ public class UrlBuilder {
/** /**
* 获取qq token的接口地址 * 获取qq token的接口地址
* *
* @param clientId qq应用的App Key * @param clientId qq 应用的App Key
* @param clientSecret qq应用的App Secret * @param clientSecret qq 应用的App Secret
* @param code qq授权前的code,用来换token * @param code qq 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -440,8 +455,8 @@ public class UrlBuilder { ...@@ -440,8 +455,8 @@ public class UrlBuilder {
/** /**
* 获取微信 授权地址 * 获取微信 授权地址
* *
* @param clientId 微信应用的appid * @param clientId 微信 应用的appid
* @param redirectUrl 微信应用授权成功后的回调地址 * @param redirectUrl 微信 应用授权成功后的回调地址
* @return full url * @return full url
*/ */
public static String getWeChatAuthorizeUrl(String clientId, String redirectUrl) { public static String getWeChatAuthorizeUrl(String clientId, String redirectUrl) {
...@@ -451,9 +466,9 @@ public class UrlBuilder { ...@@ -451,9 +466,9 @@ public class UrlBuilder {
/** /**
* 获取微信 token的接口地址 * 获取微信 token的接口地址
* *
* @param clientId 微信应用的appid * @param clientId 微信 应用的appid
* @param clientSecret 微信应用的secret * @param clientSecret 微信 应用的secret
* @param code 微信授权前的code,用来换token * @param code 微信 授权前的code,用来换token
* @return full url * @return full url
*/ */
public static String getWeChatAccessTokenUrl(String clientId, String clientSecret, String code) { public static String getWeChatAccessTokenUrl(String clientId, String clientSecret, String code) {
...@@ -463,8 +478,8 @@ public class UrlBuilder { ...@@ -463,8 +478,8 @@ public class UrlBuilder {
/** /**
* 获取微信 用户详情的接口地址 * 获取微信 用户详情的接口地址
* *
* @param token 微信应用返回的 access token * @param token 微信 应用返回的 access token
* @param openId 微信应用返回的openId * @param openId 微信 应用返回的openId
* @return full url * @return full url
*/ */
public static String getWeChatUserInfoUrl(String token, String openId) { public static String getWeChatUserInfoUrl(String token, String openId) {
...@@ -474,8 +489,8 @@ public class UrlBuilder { ...@@ -474,8 +489,8 @@ public class UrlBuilder {
/** /**
* 获取微信 刷新令牌 地址 * 获取微信 刷新令牌 地址
* *
* @param clientId 微信应用的appid * @param clientId 微信 应用的appid
* @param refreshToken 微信应用返回的刷新token * @param refreshToken 微信 应用返回的刷新token
* @return full url * @return full url
*/ */
public static String getWeChatRefreshUrl(String clientId, String refreshToken) { public static String getWeChatRefreshUrl(String clientId, String refreshToken) {
...@@ -485,9 +500,9 @@ public class UrlBuilder { ...@@ -485,9 +500,9 @@ public class UrlBuilder {
/** /**
* 获取Taobao token的接口地址: 淘宝的授权登录,在这一步就会返回用户信息 * 获取Taobao token的接口地址: 淘宝的授权登录,在这一步就会返回用户信息
* *
* @param clientId taobao应用的App Key * @param clientId taobao 应用的App Key
* @param clientSecret taobao应用的App Secret * @param clientSecret taobao 应用的App Secret
* @param code taobao授权前的code,用来换token * @param code taobao 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -520,9 +535,9 @@ public class UrlBuilder { ...@@ -520,9 +535,9 @@ public class UrlBuilder {
/** /**
* 获取Google token的接口地址 * 获取Google token的接口地址
* *
* @param clientId google应用的Client ID * @param clientId google 应用的Client ID
* @param clientSecret google应用的Client Secret * @param clientSecret google 应用的Client Secret
* @param code google授权前的code,用来换token * @param code google 授权前的code,用来换token
* @param redirectUri 待跳转的页面 * @param redirectUri 待跳转的页面
* @return full url * @return full url
*/ */
...@@ -612,19 +627,14 @@ public class UrlBuilder { ...@@ -612,19 +627,14 @@ public class UrlBuilder {
/** /**
* 获取Douyin 刷新令牌 地址 * 获取Douyin 刷新令牌 地址
* *
* @param clientId Douyin应用的client_key * @param clientId Douyin 应用的client_key
* @param refreshToken Douyin应用返回的refresh_token * @param refreshToken Douyin 应用返回的refresh_token
* @return full url * @return full url
*/ */
public static String getDouyinRefreshUrl(String clientId, String refreshToken) { public static String getDouyinRefreshUrl(String clientId, String refreshToken) {
return MessageFormat.format(DOUYIN_REFRESH_TOKEN_PATTERN, ApiUrl.DOUYIN.refresh(), clientId, refreshToken); return MessageFormat.format(DOUYIN_REFRESH_TOKEN_PATTERN, ApiUrl.DOUYIN.refresh(), clientId, refreshToken);
} }
private static final String LINKEDIN_AUTHORIZE_PATTERN = "{0}?client_id={1}&redirect_uri={2}&state={3}&response_type=code&scope=r_liteprofile%20r_emailaddress%20w_member_social";
private static final String LINKEDIN_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&code={3}&redirect_uri={4}&grant_type=authorization_code";
private static final String LINKEDIN_USER_INFO_PATTERN = "{0}?projection=(id,firstName,lastName,profilePicture(displayImage~:playableStreams))";
private static final String LINKEDIN_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&refresh_token={3}&grant_type=refresh_token";
/** /**
* 获取Linkedin授权地址 * 获取Linkedin授权地址
* *
...@@ -643,7 +653,7 @@ public class UrlBuilder { ...@@ -643,7 +653,7 @@ public class UrlBuilder {
* @param clientId Linkedin 应用的Client ID * @param clientId Linkedin 应用的Client ID
* @param clientSecret Linkedin 应用的Client Secret * @param clientSecret Linkedin 应用的Client Secret
* @param code Linkedin 授权前的code,用来换token * @param code Linkedin 授权前的code,用来换token
* @param redirectUrl google 应用授权成功后的回调地址 * @param redirectUrl Linkedin 应用授权成功后的回调地址
* @return full url * @return full url
*/ */
public static String getLinkedinAccessTokenUrl(String clientId, String clientSecret, String code, String redirectUrl) { public static String getLinkedinAccessTokenUrl(String clientId, String clientSecret, String code, String redirectUrl) {
...@@ -662,20 +672,15 @@ public class UrlBuilder { ...@@ -662,20 +672,15 @@ public class UrlBuilder {
/** /**
* 获取Linkedin 刷新令牌 地址 * 获取Linkedin 刷新令牌 地址
* *
* @param clientId Linkedin应用的client_key * @param clientId Linkedin 应用的client_key
* @param clientSecret Linkedin 应用的Client Secret * @param clientSecret Linkedin 应用的Client Secret
* @param refreshToken Linkedin应用返回的refresh_token * @param refreshToken Linkedin 应用返回的refresh_token
* @return full url * @return full url
*/ */
public static String getLinkedinRefreshUrl(String clientId, String clientSecret, String refreshToken) { public static String getLinkedinRefreshUrl(String clientId, String clientSecret, String refreshToken) {
return MessageFormat.format(LINKEDIN_REFRESH_TOKEN_PATTERN, ApiUrl.LINKEDIN.refresh(), clientId, clientSecret, refreshToken); return MessageFormat.format(LINKEDIN_REFRESH_TOKEN_PATTERN, ApiUrl.LINKEDIN.refresh(), clientId, clientSecret, refreshToken);
} }
private static final String MICROSOFT_AUTHORIZE_PATTERN = "{0}?client_id={1}&response_type=code&redirect_uri={2}&response_mode=query&scope=offline_access%20user.read%20mail.read&state={3}";
private static final String MICROSOFT_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&scope=user.read%20mail.read&redirect_uri={3}&code={4}&grant_type=authorization_code";
private static final String MICROSOFT_USER_INFO_PATTERN = "{0}";
private static final String MICROSOFT_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&scope=user.read%20mail.read&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token";
/** /**
* 获取微软授权地址 * 获取微软授权地址
* *
...@@ -713,21 +718,16 @@ public class UrlBuilder { ...@@ -713,21 +718,16 @@ public class UrlBuilder {
/** /**
* 获取微软 刷新令牌 地址 * 获取微软 刷新令牌 地址
* *
* @param clientId 微软应用的client_key * @param clientId 微软 应用的client_key
* @param clientSecret 微软 应用的Client Secret * @param clientSecret 微软 应用的Client Secret
* @param redirectUrl 微软 应用授权成功后的回调地址 * @param redirectUrl 微软 应用授权成功后的回调地址
* @param refreshToken 微软应用返回的refresh_token * @param refreshToken 微软 应用返回的refresh_token
* @return full url * @return full url
*/ */
public static String getMicrosoftRefreshUrl(String clientId, String clientSecret, String redirectUrl, String refreshToken) { public static String getMicrosoftRefreshUrl(String clientId, String clientSecret, String redirectUrl, String refreshToken) {
return MessageFormat.format(MICROSOFT_REFRESH_TOKEN_PATTERN, ApiUrl.MICROSOFT.refresh(), clientId, clientSecret, redirectUrl, refreshToken); return MessageFormat.format(MICROSOFT_REFRESH_TOKEN_PATTERN, ApiUrl.MICROSOFT.refresh(), clientId, clientSecret, redirectUrl, refreshToken);
} }
private static final String MI_AUTHORIZE_PATTERN = "{0}?client_id={1}&redirect_uri={2}&response_type=code&scope=user/profile%20user/openIdV2%20user/phoneAndEmail&state={3}&skip_confirm=false";
private static final String MI_ACCESS_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&code={4}&grant_type=authorization_code";
private static final String MI_USER_INFO_PATTERN = "{0}?clientId={1}&token={2}";
private static final String MI_REFRESH_TOKEN_PATTERN = "{0}?client_id={1}&client_secret={2}&redirect_uri={3}&refresh_token={4}&grant_type=refresh_token";
/** /**
* 获取小米授权地址 * 获取小米授权地址
* *
......
### 2019/05/28
1. 增加小米账号和微软的授权登陆
2. 发布1.5.0版本
### 2019/05/26 ### 2019/05/26
1. 增加抖音和Linkedin的授权登陆 1. 增加抖音和Linkedin的授权登陆
2. 修改部分图片命名 2. 修改部分图片命名
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册