Browse Source

spring-boot-demo-social 微软 登录完成

pull/1/head
Yangkai.Shen 6 years ago
parent
commit
f953f4792d
4 changed files with 18 additions and 2 deletions
  1. +1
    -1
      spring-boot-demo-social/pom.xml
  2. +8
    -1
      spring-boot-demo-social/src/main/java/com/xkcoding/social/controller/OauthController.java
  3. +5
    -0
      spring-boot-demo-social/src/main/java/com/xkcoding/social/props/OAuthProperties.java
  4. +4
    -0
      spring-boot-demo-social/src/main/resources/application.yml

+ 1
- 1
spring-boot-demo-social/pom.xml View File

@@ -39,7 +39,7 @@
<dependency>
<groupId>me.zhyd.oauth</groupId>
<artifactId>JustAuth</artifactId>
<version>1.3.2</version>
<version>1.4.0</version>
</dependency>

<dependency>


+ 8
- 1
spring-boot-demo-social/src/main/java/com/xkcoding/social/controller/OauthController.java View File

@@ -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());
}
}

+ 5
- 0
spring-boot-demo-social/src/main/java/com/xkcoding/social/props/OAuthProperties.java View File

@@ -41,4 +41,9 @@ public class OAuthProperties {
* Google 配置
*/
private AuthConfig google;

/**
* Microsoft 配置
*/
private AuthConfig microsoft;
}

+ 4
- 0
spring-boot-demo-social/src/main/resources/application.yml View File

@@ -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

Loading…
Cancel
Save