diff --git a/spring-boot-demo-oauth/pom.xml b/spring-boot-demo-oauth/pom.xml
index 1b4b2ac7d..8448b0b1a 100644
--- a/spring-boot-demo-oauth/pom.xml
+++ b/spring-boot-demo-oauth/pom.xml
@@ -49,7 +49,7 @@
me.zhyd.oauth
JustAuth
- 1.0.1
+ 1.2.0
diff --git a/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/config/props/OAuthProperties.java b/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/config/props/OAuthProperties.java
index bddaf6df6..181cf21a6 100644
--- a/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/config/props/OAuthProperties.java
+++ b/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/config/props/OAuthProperties.java
@@ -26,4 +26,5 @@ public class OAuthProperties {
* github 配置
*/
private CommonProperties github;
+ private CommonProperties wechat;
}
diff --git a/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/controller/OauthController.java b/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/controller/OauthController.java
index 87a6d1c92..cc1eb0fdc 100644
--- a/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/controller/OauthController.java
+++ b/spring-boot-demo-oauth/src/main/java/com/xkcoding/oauth/controller/OauthController.java
@@ -8,6 +8,7 @@
import me.zhyd.oauth.model.AuthSource;
import me.zhyd.oauth.request.AuthGithubRequest;
import me.zhyd.oauth.request.AuthRequest;
+import me.zhyd.oauth.request.AuthWeChatRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -66,6 +67,8 @@ private AuthRequest getAuthRequest(String oauthType) {
switch (authSource) {
case GITHUB:
return getGithubAuthRequest();
+ case WECHAT:
+ return getWechatAuthRequest();
default:
throw new RuntimeException("暂不支持的第三方登录");
}
@@ -75,6 +78,10 @@ private AuthRequest getGithubAuthRequest() {
return new AuthGithubRequest(buildAuthConfig(properties.getGithub()));
}
+ private AuthRequest getWechatAuthRequest() {
+ return new AuthWeChatRequest(buildAuthConfig(properties.getWechat()));
+ }
+
private AuthConfig buildAuthConfig(CommonProperties properties) {
return AuthConfig.builder()
.clientId(properties.getClientId())
diff --git a/spring-boot-demo-oauth/src/main/resources/application.yml b/spring-boot-demo-oauth/src/main/resources/application.yml
index d5b79ff60..376262cf6 100644
--- a/spring-boot-demo-oauth/src/main/resources/application.yml
+++ b/spring-boot-demo-oauth/src/main/resources/application.yml
@@ -7,4 +7,8 @@ oauth:
github:
client-id: 2d25a70d12e3d5f01086
client-secret: 5a2919b5fe911567343aea2ccc7a5ad7871306d1
- redirect-uri: http://oauth.xkcoding.com/demo/oauth/github/callback
\ No newline at end of file
+ redirect-uri: http://oauth.xkcoding.com/demo/oauth/github/callback
+ wechat:
+ client-id:
+ client-secret:
+ redirect-uri: http://oauth.xkcoding.com/demo/oauth/wechat/callback
\ No newline at end of file