Przeglądaj źródła

update 优化 !pr382 修复一些问题 完事流程逻辑

疯狂的狮子Li 1 rok temu
rodzic
commit
bb2836b6f1

+ 1 - 1
ruoyi-admin/src/main/java/org/dromara/web/controller/AuthController.java

@@ -99,7 +99,7 @@ public class AuthController {
         }
         AuthRequest authRequest = SocialUtils.getAuthRequest(source, socialProperties);
         String authorizeUrl = authRequest.authorize(AuthStateUtils.createState());
-        return R.ok(authorizeUrl);
+        return R.ok("操作成功", authorizeUrl);
     }
 
     /**

+ 14 - 13
ruoyi-admin/src/main/resources/application-dev.yml

@@ -182,60 +182,61 @@ sms:
 --- # 三方授权
 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

+ 14 - 13
ruoyi-admin/src/main/resources/application-prod.yml

@@ -184,60 +184,61 @@ sms:
 --- # 三方授权
 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

+ 1 - 2
ruoyi-common/ruoyi-common-social/src/main/java/org/dromara/common/social/utils/SocialUtils.java

@@ -44,8 +44,7 @@ public class SocialUtils  {
             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());
             // 支付宝在创建回调地址时,不允许使用localhost或者127.0.0.1,所以这儿的回调地址使用的局域网内的ip
-            // 使用支付宝需要提供alipay公钥
-            // 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());

+ 2 - 2
script/sql/oracle/oracle_ry_vue_5.X.sql

@@ -40,9 +40,9 @@ comment on table   sys_social                   is '社会化关系表';
 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 '用户邮箱';

+ 2 - 2
script/sql/postgres/postgres_ry_vue_5.X.sql

@@ -39,9 +39,9 @@ comment on table   sys_social                   is '社会化关系表';
 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 '用户邮箱';

+ 2 - 2
script/sql/sqlserver/sqlserver_ry_vue_5.X.sql

@@ -61,7 +61,7 @@ EXEC sys.sp_addextendedproperty
     '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 @@ EXEC sys.sp_addextendedproperty
     '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'

+ 2 - 2
script/sql/update/oracle/update_5.0-5.1.sql

@@ -46,9 +46,9 @@ comment on table   sys_social                   is '社会化关系表';
 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 '用户邮箱';

+ 2 - 2
script/sql/update/postgres/update_5.0-5.1.sql

@@ -45,9 +45,9 @@ comment on table   sys_social                   is '社会化关系表';
 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 '用户邮箱';

+ 2 - 2
script/sql/update/sqlserver/update_5.0-5.1.sql

@@ -74,7 +74,7 @@ EXEC sys.sp_addextendedproperty
     '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 @@ EXEC sys.sp_addextendedproperty
     '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'

+ 2 - 2
script/sql/update/update_5.0-5.1.sql

@@ -11,9 +11,9 @@ create table sys_social
     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 '用户邮箱',