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 24738ca..906bc08 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 class OauthController { .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 @@ public class OauthController { return getGoogleAuthRequest(); case MICROSOFT: return getMicrosoftAuthRequest(); + case MI: + return getMiAuthRequest(); default: throw new RuntimeException("暂不支持的第三方登录"); } @@ -110,4 +113,8 @@ public class OauthController { 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 d5a52e2..45e562b 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 6537cb9..b790f53 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