From bb2836b6f1789a60c30537444a3bd331f16b45e1 Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期日, 02 七月 2023 16:48:16 +0800
Subject: [PATCH] update 优化 !pr382 修复一些问题 完事流程逻辑

---
 script/sql/update/sqlserver/update_5.0-5.1.sql                                                  |    4 +-
 script/sql/update/oracle/update_5.0-5.1.sql                                                     |    4 +-
 ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java                        |    2 
 ruoyi-admin/src/main/resources/application-prod.yml                                             |   27 +++++++------
 script/sql/postgres/postgres_ry_vue_5.X.sql                                                     |    4 +-
 script/sql/update/postgres/update_5.0-5.1.sql                                                   |    4 +-
 ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java |    3 -
 script/sql/oracle/oracle_ry_vue_5.X.sql                                                         |    4 +-
 script/sql/sqlserver/sqlserver_ry_vue_5.X.sql                                                   |    4 +-
 script/sql/update/update_5.0-5.1.sql                                                            |    4 +-
 ruoyi-admin/src/main/resources/application-dev.yml                                              |   27 +++++++------
 11 files changed, 44 insertions(+), 43 deletions(-)

diff --git a/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java b/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java
index abbfae5..82779b1 100644
--- a/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java
+++ b/ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java
@@ -99,7 +99,7 @@
         }
         AuthRequest authRequest = SocialUtils.getAuthRequest(source, socialProperties);
         String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
-        return R.ok(authorizeUrl);
+        return R.ok("鎿嶄綔鎴愬姛", authorizeUrl);
     }
 
     /**
diff --git a/ruoyi-admin/src/main/resources/application-dev.yml b/ruoyi-admin/src/main/resources/application-dev.yml
index d2109ff..122a653 100644
--- a/ruoyi-admin/src/main/resources/application-dev.yml
+++ b/ruoyi-admin/src/main/resources/application-dev.yml
@@ -182,60 +182,61 @@
 --- # 涓夋柟鎺堟潈
 justauth:
   enabled: true
+  address: http://localhost:80
   type:
     qq:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=qq
+      redirect-uri: ${justauth.address}/social-callback?source=qq
       union-id: false
     weibo:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=weibo
+      redirect-uri: ${justauth.address}/social-callback?source=weibo
     gitee:
       client-id: 914******************98
       client-secret: 02*****************ac
-      redirect-uri: http://localhost:80/social-login?source=gitee
+      redirect-uri: ${justauth.address}/social-callback?source=gitee
     dingtalk:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=dingtalk
+      redirect-uri: ${justauth.address}/social-callback?source=dingtalk
     baidu:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=baidu
+      redirect-uri: ${justauth.address}/social-callback?source=baidu
     csdn:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=csdn
+      redirect-uri: ${justauth.address}/social-callback?source=csdn
     coding:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=coding
+      redirect-uri: ${justauth.address}/social-callback?source=coding
       coding-group-name: xx
     oschina:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=oschina
+      redirect-uri: ${justauth.address}/social-callback?source=oschina
     alipay:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=alipay
+      redirect-uri: ${justauth.address}/social-callback?source=alipay
       alipay-public-key: MIIB**************DAQAB
     wechat_open:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=wechat_open
+      redirect-uri: ${justauth.address}/social-callback?source=wechat_open
     wechat_mp:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=wechat_mp
+      redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
     wechat_enterprise:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=wechat_enterprise
+      redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
       agent-id: 1000002
     gitlab:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=gitlab
+      redirect-uri: ${justauth.address}/social-callback?source=gitlab
diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml
index 0dc27b0..2d62c4f 100644
--- a/ruoyi-admin/src/main/resources/application-prod.yml
+++ b/ruoyi-admin/src/main/resources/application-prod.yml
@@ -184,60 +184,61 @@
 --- # 涓夋柟鎺堟潈
 justauth:
   enabled: true
+  address: http://localhost:80
   type:
     qq:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=qq
+      redirect-uri: ${justauth.address}/social-callback?source=qq
       union-id: false
     weibo:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=weibo
+      redirect-uri: ${justauth.address}/social-callback?source=weibo
     gitee:
       client-id: 914******************98
       client-secret: 02*****************ac
-      redirect-uri: http://localhost:80/social-login?source=gitee
+      redirect-uri: ${justauth.address}/social-callback?source=gitee
     dingtalk:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=dingtalk
+      redirect-uri: ${justauth.address}/social-callback?source=dingtalk
     baidu:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=baidu
+      redirect-uri: ${justauth.address}/social-callback?source=baidu
     csdn:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=csdn
+      redirect-uri: ${justauth.address}/social-callback?source=csdn
     coding:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=coding
+      redirect-uri: ${justauth.address}/social-callback?source=coding
       coding-group-name: xx
     oschina:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=oschina
+      redirect-uri: ${justauth.address}/social-callback?source=oschina
     alipay:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=alipay
+      redirect-uri: ${justauth.address}/social-callback?source=alipay
       alipay-public-key: MIIB**************DAQAB
     wechat_open:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=wechat_open
+      redirect-uri: ${justauth.address}/social-callback?source=wechat_open
     wechat_mp:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=wechat_mp
+      redirect-uri: ${justauth.address}/social-callback?source=wechat_mp
     wechat_enterprise:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=wechat_enterprise
+      redirect-uri: ${justauth.address}/social-callback?source=wechat_enterprise
       agent-id: 1000002
     gitlab:
       client-id: 10**********6
       client-secret: 1f7d08**********5b7**********29e
-      redirect-uri: http://localhost:80/social-login?source=gitlab
+      redirect-uri: ${justauth.address}/social-callback?source=gitlab
diff --git a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
index 5ca2a5e..a31ec6d 100644
--- a/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
+++ b/ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java
@@ -44,8 +44,7 @@
             case "coding" -> new AuthCodingRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
             case "oschina" -> new AuthOschinaRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
             // 鏀粯瀹濆湪鍒涘缓鍥炶皟鍦板潃鏃讹紝涓嶅厑璁镐娇鐢╨ocalhost鎴栬��127.0.0.1锛屾墍浠ヨ繖鍎跨殑鍥炶皟鍦板潃浣跨敤鐨勫眬鍩熺綉鍐呯殑ip
-            // 浣跨敤鏀粯瀹濋渶瑕佹彁渚沘lipay鍏挜
-            // case "alipay" -> new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build(), alipayPublicKey);
+            case "alipay" -> new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build(), socialProperties.getType().get("alipay").getAlipayPublicKey());
             case "qq" -> new AuthQqRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
             case "wechat_open" -> new AuthWeChatOpenRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
             case "taobao" -> new AuthTaobaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
diff --git a/script/sql/oracle/oracle_ry_vue_5.X.sql b/script/sql/oracle/oracle_ry_vue_5.X.sql
index 3be9990..e8105ac 100644
--- a/script/sql/oracle/oracle_ry_vue_5.X.sql
+++ b/script/sql/oracle/oracle_ry_vue_5.X.sql
@@ -40,9 +40,9 @@
 comment on column  sys_social.id                is '涓婚敭';
 comment on column  sys_social.user_id           is '鐢ㄦ埛ID';
 comment on column  sys_social.tenant_id         is '绉熸埛id';
-comment on column  sys_social.auth_id           is '鎺堟潈+鎺堟潈openid';
+comment on column  sys_social.auth_id           is '骞冲彴+骞冲彴鍞竴id';
 comment on column  sys_social.source            is '鐢ㄦ埛鏉ユ簮';
-comment on column  sys_social.open_id           is '鍘熺敓openid';
+comment on column  sys_social.open_id           is '骞冲彴缂栧彿鍞竴id';
 comment on column  sys_social.user_name         is '鐧诲綍璐﹀彿';
 comment on column  sys_social.nick_name         is '鐢ㄦ埛鏄电О';
 comment on column  sys_social.email             is '鐢ㄦ埛閭';
diff --git a/script/sql/postgres/postgres_ry_vue_5.X.sql b/script/sql/postgres/postgres_ry_vue_5.X.sql
index 610834a..0dba3e4 100644
--- a/script/sql/postgres/postgres_ry_vue_5.X.sql
+++ b/script/sql/postgres/postgres_ry_vue_5.X.sql
@@ -39,9 +39,9 @@
 comment on column  sys_social.id                is '涓婚敭';
 comment on column  sys_social.user_id           is '鐢ㄦ埛ID';
 comment on column  sys_social.tenant_id         is '绉熸埛id';
-comment on column  sys_social.auth_id           is '鎺堟潈+鎺堟潈openid';
+comment on column  sys_social.auth_id           is '骞冲彴+骞冲彴鍞竴id';
 comment on column  sys_social.source            is '鐢ㄦ埛鏉ユ簮';
-comment on column  sys_social.open_id           is '鍘熺敓openid';
+comment on column  sys_social.open_id           is '骞冲彴缂栧彿鍞竴id';
 comment on column  sys_social.user_name         is '鐧诲綍璐﹀彿';
 comment on column  sys_social.nick_name         is '鐢ㄦ埛鏄电О';
 comment on column  sys_social.email             is '鐢ㄦ埛閭';
diff --git a/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql
index 7e7df5f..5e444fb 100644
--- a/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql
+++ b/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql
@@ -61,7 +61,7 @@
     'COLUMN', N'tenant_id'
 GO
 EXEC sys.sp_addextendedproperty
-    'MS_Description', N'鎺堟潈+鎺堟潈openid' ,
+    'MS_Description', N'骞冲彴+骞冲彴鍞竴id' ,
     'SCHEMA', N'dbo',
     'TABLE', N'sys_social',
     'COLUMN', N'auth_id'
@@ -73,7 +73,7 @@
     'COLUMN', N'source'
 GO
 EXEC sys.sp_addextendedproperty
-    'MS_Description', N'鍘熺敓openid' ,
+    'MS_Description', N'骞冲彴缂栧彿鍞竴id' ,
     'SCHEMA', N'dbo',
     'TABLE', N'sys_social',
     'COLUMN', N'open_id'
diff --git a/script/sql/update/oracle/update_5.0-5.1.sql b/script/sql/update/oracle/update_5.0-5.1.sql
index aa3ac6d..e00c080 100644
--- a/script/sql/update/oracle/update_5.0-5.1.sql
+++ b/script/sql/update/oracle/update_5.0-5.1.sql
@@ -46,9 +46,9 @@
 comment on column  sys_social.id                is '涓婚敭';
 comment on column  sys_social.user_id           is '鐢ㄦ埛ID';
 comment on column  sys_social.tenant_id         is '绉熸埛id';
-comment on column  sys_social.auth_id           is '鎺堟潈+鎺堟潈openid';
+comment on column  sys_social.auth_id           is '骞冲彴+骞冲彴鍞竴id';
 comment on column  sys_social.source            is '鐢ㄦ埛鏉ユ簮';
-comment on column  sys_social.open_id           is '鍘熺敓openid';
+comment on column  sys_social.open_id           is '骞冲彴缂栧彿鍞竴id';
 comment on column  sys_social.user_name         is '鐧诲綍璐﹀彿';
 comment on column  sys_social.nick_name         is '鐢ㄦ埛鏄电О';
 comment on column  sys_social.email             is '鐢ㄦ埛閭';
diff --git a/script/sql/update/postgres/update_5.0-5.1.sql b/script/sql/update/postgres/update_5.0-5.1.sql
index 7cf3ed6..60f9dea 100644
--- a/script/sql/update/postgres/update_5.0-5.1.sql
+++ b/script/sql/update/postgres/update_5.0-5.1.sql
@@ -45,9 +45,9 @@
 comment on column  sys_social.id                is '涓婚敭';
 comment on column  sys_social.user_id           is '鐢ㄦ埛ID';
 comment on column  sys_social.tenant_id         is '绉熸埛id';
-comment on column  sys_social.auth_id           is '鎺堟潈+鎺堟潈openid';
+comment on column  sys_social.auth_id           is '骞冲彴+骞冲彴鍞竴id';
 comment on column  sys_social.source            is '鐢ㄦ埛鏉ユ簮';
-comment on column  sys_social.open_id           is '鍘熺敓openid';
+comment on column  sys_social.open_id           is '骞冲彴缂栧彿鍞竴id';
 comment on column  sys_social.user_name         is '鐧诲綍璐﹀彿';
 comment on column  sys_social.nick_name         is '鐢ㄦ埛鏄电О';
 comment on column  sys_social.email             is '鐢ㄦ埛閭';
diff --git a/script/sql/update/sqlserver/update_5.0-5.1.sql b/script/sql/update/sqlserver/update_5.0-5.1.sql
index 809f2d5..b9994f8 100644
--- a/script/sql/update/sqlserver/update_5.0-5.1.sql
+++ b/script/sql/update/sqlserver/update_5.0-5.1.sql
@@ -74,7 +74,7 @@
     'COLUMN', N'tenant_id'
 GO
 EXEC sys.sp_addextendedproperty
-    'MS_Description', N'鎺堟潈+鎺堟潈openid' ,
+    'MS_Description', N'骞冲彴+骞冲彴鍞竴id' ,
     'SCHEMA', N'dbo',
     'TABLE', N'sys_social',
     'COLUMN', N'auth_id'
@@ -86,7 +86,7 @@
     'COLUMN', N'source'
 GO
 EXEC sys.sp_addextendedproperty
-    'MS_Description', N'鍘熺敓openid' ,
+    'MS_Description', N'骞冲彴缂栧彿鍞竴id' ,
     'SCHEMA', N'dbo',
     'TABLE', N'sys_social',
     'COLUMN', N'open_id'
diff --git a/script/sql/update/update_5.0-5.1.sql b/script/sql/update/update_5.0-5.1.sql
index 9939d0e..34a3966 100644
--- a/script/sql/update/update_5.0-5.1.sql
+++ b/script/sql/update/update_5.0-5.1.sql
@@ -11,9 +11,9 @@
     id                 bigint           not null        comment '涓婚敭',
     user_id            bigint           not null        comment '鐢ㄦ埛ID',
     tenant_id          varchar(20)      default null    comment '绉熸埛id',
-    auth_id            varchar(255)     not null        comment '鎺堟潈+鎺堟潈openid',
+    auth_id            varchar(255)     not null        comment '骞冲彴+骞冲彴鍞竴id',
     source             varchar(255)     not null        comment '鐢ㄦ埛鏉ユ簮',
-    open_id            varchar(255)     default null    comment '鍘熺敓open id',
+    open_id            varchar(255)     default null    comment '骞冲彴缂栧彿鍞竴id',
     user_name          varchar(30)      not null        comment '鐧诲綍璐﹀彿',
     nick_name          varchar(30)      default ''      comment '鐢ㄦ埛鏄电О',
     email              varchar(255)     default ''      comment '鐢ㄦ埛閭',

--
Gitblit v1.9.3