From bb2836b6f1789a60c30537444a3bd331f16b45e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Sun, 2 Jul 2023 16:48:16 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E4=BC=98=E5=8C=96=20!pr382=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E9=97=AE=E9=A2=98=20?= =?UTF-8?q?=E5=AE=8C=E4=BA=8B=E6=B5=81=E7=A8=8B=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/AuthController.java | 2 +- .../src/main/resources/application-dev.yml | 27 ++++++++++--------- .../src/main/resources/application-prod.yml | 27 ++++++++++--------- .../common/social/utils/SocialUtils.java | 3 +-- script/sql/oracle/oracle_ry_vue_5.X.sql | 4 +-- script/sql/postgres/postgres_ry_vue_5.X.sql | 4 +-- script/sql/sqlserver/sqlserver_ry_vue_5.X.sql | 4 +-- script/sql/update/oracle/update_5.0-5.1.sql | 4 +-- script/sql/update/postgres/update_5.0-5.1.sql | 4 +-- .../sql/update/sqlserver/update_5.0-5.1.sql | 4 +-- script/sql/update/update_5.0-5.1.sql | 4 +-- 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 abbfae5d..82779b15 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 @@ public class AuthController { } 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 d2109ffa..122a6536 100644 --- a/ruoyi-admin/src/main/resources/application-dev.yml +++ b/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 diff --git a/ruoyi-admin/src/main/resources/application-prod.yml b/ruoyi-admin/src/main/resources/application-prod.yml index 0dc27b0b..2d62c4f1 100644 --- a/ruoyi-admin/src/main/resources/application-prod.yml +++ b/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 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 5ca2a5e5..a31ec6d5 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 @@ 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()); diff --git a/script/sql/oracle/oracle_ry_vue_5.X.sql b/script/sql/oracle/oracle_ry_vue_5.X.sql index 3be9990e..e8105ac8 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 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 '用户邮箱'; diff --git a/script/sql/postgres/postgres_ry_vue_5.X.sql b/script/sql/postgres/postgres_ry_vue_5.X.sql index 610834a3..0dba3e42 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 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 '用户邮箱'; diff --git a/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql b/script/sql/sqlserver/sqlserver_ry_vue_5.X.sql index 7e7df5f6..5e444fb6 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 @@ 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' 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 aa3ac6d1..e00c080d 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 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 '用户邮箱'; 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 7cf3ed61..60f9dea7 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 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 '用户邮箱'; 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 809f2d5a..b9994f81 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 @@ 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' diff --git a/script/sql/update/update_5.0-5.1.sql b/script/sql/update/update_5.0-5.1.sql index 9939d0e6..34a39664 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 @@ 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 '用户邮箱',