Browse Source

spring-boot-demo-social 小米 登录完成

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

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

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

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

@@ -46,4 +46,9 @@ public class OAuthProperties {
* Microsoft 配置
*/
private AuthConfig microsoft;

/**
* Mi 配置
*/
private AuthConfig mi;
}

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

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

Loading…
Cancel
Save