diff --git a/spring-boot-demo-social/pom.xml b/spring-boot-demo-social/pom.xml index ffd6ba5..40beeec 100644 --- a/spring-boot-demo-social/pom.xml +++ b/spring-boot-demo-social/pom.xml @@ -39,7 +39,7 @@ me.zhyd.oauth JustAuth - 1.3.2 + 1.4.0 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 362fea0..24738ca 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 @@ -43,7 +43,8 @@ public class OauthController { .set("QQ登录", "http://oauth.xkcoding.com/demo/oauth/login/qq") .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("Google登录", "http://oauth.xkcoding.com/demo/oauth/login/google") + .set("Microsoft 登录", "http://oauth.xkcoding.com/demo/oauth/login/microsoft"); } /** @@ -83,6 +84,8 @@ public class OauthController { return getWechatAuthRequest(); case GOOGLE: return getGoogleAuthRequest(); + case MICROSOFT: + return getMicrosoftAuthRequest(); default: throw new RuntimeException("暂不支持的第三方登录"); } @@ -103,4 +106,8 @@ public class OauthController { private AuthRequest getGoogleAuthRequest() { return new AuthGoogleRequest(properties.getGoogle()); } + + private AuthRequest getMicrosoftAuthRequest() { + return new AuthMicrosoftRequest(properties.getMicrosoft()); + } } 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 7728a57..d5a52e2 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 @@ -41,4 +41,9 @@ public class OAuthProperties { * Google 配置 */ private AuthConfig google; + + /** + * Microsoft 配置 + */ + private AuthConfig microsoft; } diff --git a/spring-boot-demo-social/src/main/resources/application.yml b/spring-boot-demo-social/src/main/resources/application.yml index 1cfea0b..6537cb9 100644 --- a/spring-boot-demo-social/src/main/resources/application.yml +++ b/spring-boot-demo-social/src/main/resources/application.yml @@ -20,3 +20,7 @@ oauth: client-id: 716518501517-6dbdkapivhia806vqcjjh9nttj3************** client-secret: 9IBornd7w1A************** redirect-uri: http://oauth.xkcoding.com/demo/oauth/google/callback + microsoft: + client-id: 7bdce818-2c8e-4b************** + client-secret: Iu0zZ43RQydo_FkD************** + redirect-uri: https://oauth.xkcoding.com/demo/oauth/microsoft/callback