From f953f4792da157b65fa95b75749381031f59aa4d Mon Sep 17 00:00:00 2001
From: "Yangkai.Shen" <237497819@qq.com>
Date: Tue, 28 May 2019 16:10:34 +0800
Subject: [PATCH] =?UTF-8?q?:sparkles:=20spring-boot-demo-social=20?=
=?UTF-8?q?=E5=BE=AE=E8=BD=AF=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
---
spring-boot-demo-social/pom.xml | 2 +-
.../java/com/xkcoding/social/controller/OauthController.java | 9 ++++++++-
.../src/main/java/com/xkcoding/social/props/OAuthProperties.java | 5 +++++
spring-boot-demo-social/src/main/resources/application.yml | 4 ++++
4 files changed, 18 insertions(+), 2 deletions(-)
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