From 715275da6c5b6fe863a2b4fceb3ee25d6ceda0e9 Mon Sep 17 00:00:00 2001 From: "Yangkai.Shen" <237497819@qq.com> Date: Thu, 30 May 2019 09:00:24 +0800 Subject: [PATCH] =?UTF-8?q?:sparkles:=20spring-boot-demo-social=20?= =?UTF-8?q?=E5=B0=8F=E7=B1=B3=20=E7=99=BB=E5=BD=95=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkcoding/social/controller/OauthController.java | 9 ++++++++- .../java/com/xkcoding/social/props/OAuthProperties.java | 5 +++++ .../src/main/resources/application.yml | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/spring-boot-demo-social/src/main/java/com/xkcoding/social/controller/OauthController.java b/spring-boot-demo-social/src/main/java/com/xkcoding/social/controller/OauthController.java index 24738caa0..906bc08e9 100644 --- a/spring-boot-demo-social/src/main/java/com/xkcoding/social/controller/OauthController.java +++ b/spring-boot-demo-social/src/main/java/com/xkcoding/social/controller/OauthController.java @@ -44,7 +44,8 @@ public Dict loginType() { .set("GitHub登录", "http://oauth.xkcoding.com/demo/oauth/login/github") .set("微信登录", "http://oauth.xkcoding.com/demo/oauth/login/wechat") .set("Google登录", "http://oauth.xkcoding.com/demo/oauth/login/google") - .set("Microsoft 登录", "http://oauth.xkcoding.com/demo/oauth/login/microsoft"); + .set("Microsoft 登录", "http://oauth.xkcoding.com/demo/oauth/login/microsoft") + .set("小米登录", "http://oauth.xkcoding.com/demo/oauth/login/mi"); } /** @@ -86,6 +87,8 @@ private AuthRequest getAuthRequest(String oauthType) { return getGoogleAuthRequest(); case MICROSOFT: return getMicrosoftAuthRequest(); + case MI: + return getMiAuthRequest(); default: throw new RuntimeException("暂不支持的第三方登录"); } @@ -110,4 +113,8 @@ private AuthRequest getGoogleAuthRequest() { private AuthRequest getMicrosoftAuthRequest() { return new AuthMicrosoftRequest(properties.getMicrosoft()); } + + private AuthRequest getMiAuthRequest() { + return new AuthMiRequest(properties.getMi()); + } } diff --git a/spring-boot-demo-social/src/main/java/com/xkcoding/social/props/OAuthProperties.java b/spring-boot-demo-social/src/main/java/com/xkcoding/social/props/OAuthProperties.java index d5a52e2d5..45e562bcc 100644 --- a/spring-boot-demo-social/src/main/java/com/xkcoding/social/props/OAuthProperties.java +++ b/spring-boot-demo-social/src/main/java/com/xkcoding/social/props/OAuthProperties.java @@ -46,4 +46,9 @@ public class OAuthProperties { * Microsoft 配置 */ private AuthConfig microsoft; + + /** + * Mi 配置 + */ + private AuthConfig mi; } diff --git a/spring-boot-demo-social/src/main/resources/application.yml b/spring-boot-demo-social/src/main/resources/application.yml index 6537cb95f..b790f5313 100644 --- a/spring-boot-demo-social/src/main/resources/application.yml +++ b/spring-boot-demo-social/src/main/resources/application.yml @@ -24,3 +24,7 @@ oauth: client-id: 7bdce818-2c8e-4b************** client-secret: Iu0zZ43RQydo_FkD************** redirect-uri: https://oauth.xkcoding.com/demo/oauth/microsoft/callback + mi: + client-id: 2882303************** + client-secret: nFeTt89Yn************** + redirect-uri: http://oauth.xkcoding.com/demo/oauth/mi/callback