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

This commit is contained in:
疯狂的狮子Li 2023-07-02 16:48:16 +08:00
parent 06588f3ad4
commit bb2836b6f1
11 changed files with 44 additions and 43 deletions

View File

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

View File

@ -182,60 +182,61 @@ sms:
--- # 三方授权 --- # 三方授权
justauth: justauth:
enabled: true enabled: true
address: http://localhost:80
type: type:
qq: qq:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 union-id: false
weibo: weibo:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=weibo redirect-uri: ${justauth.address}/social-callback?source=weibo
gitee: gitee:
client-id: 914******************98 client-id: 914******************98
client-secret: 02*****************ac client-secret: 02*****************ac
redirect-uri: http://localhost:80/social-login?source=gitee redirect-uri: ${justauth.address}/social-callback?source=gitee
dingtalk: dingtalk:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=dingtalk redirect-uri: ${justauth.address}/social-callback?source=dingtalk
baidu: baidu:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=baidu redirect-uri: ${justauth.address}/social-callback?source=baidu
csdn: csdn:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=csdn redirect-uri: ${justauth.address}/social-callback?source=csdn
coding: coding:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 coding-group-name: xx
oschina: oschina:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=oschina redirect-uri: ${justauth.address}/social-callback?source=oschina
alipay: alipay:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 alipay-public-key: MIIB**************DAQAB
wechat_open: wechat_open:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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: wechat_mp:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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: wechat_enterprise:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 agent-id: 1000002
gitlab: gitlab:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=gitlab redirect-uri: ${justauth.address}/social-callback?source=gitlab

View File

@ -184,60 +184,61 @@ sms:
--- # 三方授权 --- # 三方授权
justauth: justauth:
enabled: true enabled: true
address: http://localhost:80
type: type:
qq: qq:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 union-id: false
weibo: weibo:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=weibo redirect-uri: ${justauth.address}/social-callback?source=weibo
gitee: gitee:
client-id: 914******************98 client-id: 914******************98
client-secret: 02*****************ac client-secret: 02*****************ac
redirect-uri: http://localhost:80/social-login?source=gitee redirect-uri: ${justauth.address}/social-callback?source=gitee
dingtalk: dingtalk:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=dingtalk redirect-uri: ${justauth.address}/social-callback?source=dingtalk
baidu: baidu:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=baidu redirect-uri: ${justauth.address}/social-callback?source=baidu
csdn: csdn:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=csdn redirect-uri: ${justauth.address}/social-callback?source=csdn
coding: coding:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 coding-group-name: xx
oschina: oschina:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=oschina redirect-uri: ${justauth.address}/social-callback?source=oschina
alipay: alipay:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 alipay-public-key: MIIB**************DAQAB
wechat_open: wechat_open:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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: wechat_mp:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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: wechat_enterprise:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e 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 agent-id: 1000002
gitlab: gitlab:
client-id: 10**********6 client-id: 10**********6
client-secret: 1f7d08**********5b7**********29e client-secret: 1f7d08**********5b7**********29e
redirect-uri: http://localhost:80/social-login?source=gitlab redirect-uri: ${justauth.address}/social-callback?source=gitlab

View File

@ -44,8 +44,7 @@ public class SocialUtils {
case "coding" -> new AuthCodingRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build()); 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()); case "oschina" -> new AuthOschinaRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());
// 支付宝在创建回调地址时不允许使用localhost或者127.0.0.1所以这儿的回调地址使用的局域网内的ip // 支付宝在创建回调地址时不允许使用localhost或者127.0.0.1所以这儿的回调地址使用的局域网内的ip
// 使用支付宝需要提供alipay公钥 case "alipay" -> new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build(), socialProperties.getType().get("alipay").getAlipayPublicKey());
// case "alipay" -> new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build(), alipayPublicKey);
case "qq" -> new AuthQqRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build()); 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 "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()); case "taobao" -> new AuthTaobaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret).redirectUri(redirectUri).build());

View File

@ -40,9 +40,9 @@ comment on table sys_social is '社会化关系表';
comment on column sys_social.id is '主键'; comment on column sys_social.id is '主键';
comment on column sys_social.user_id is '用户ID'; comment on column sys_social.user_id is '用户ID';
comment on column sys_social.tenant_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.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.user_name is '登录账号';
comment on column sys_social.nick_name is '用户昵称'; comment on column sys_social.nick_name is '用户昵称';
comment on column sys_social.email is '用户邮箱'; comment on column sys_social.email is '用户邮箱';

View File

@ -39,9 +39,9 @@ comment on table sys_social is '社会化关系表';
comment on column sys_social.id is '主键'; comment on column sys_social.id is '主键';
comment on column sys_social.user_id is '用户ID'; comment on column sys_social.user_id is '用户ID';
comment on column sys_social.tenant_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.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.user_name is '登录账号';
comment on column sys_social.nick_name is '用户昵称'; comment on column sys_social.nick_name is '用户昵称';
comment on column sys_social.email is '用户邮箱'; comment on column sys_social.email is '用户邮箱';

View File

@ -61,7 +61,7 @@ EXEC sys.sp_addextendedproperty
'COLUMN', N'tenant_id' 'COLUMN', N'tenant_id'
GO GO
EXEC sys.sp_addextendedproperty EXEC sys.sp_addextendedproperty
'MS_Description', N'授权+授权openid' , 'MS_Description', N'平台+平台唯一id' ,
'SCHEMA', N'dbo', 'SCHEMA', N'dbo',
'TABLE', N'sys_social', 'TABLE', N'sys_social',
'COLUMN', N'auth_id' 'COLUMN', N'auth_id'
@ -73,7 +73,7 @@ EXEC sys.sp_addextendedproperty
'COLUMN', N'source' 'COLUMN', N'source'
GO GO
EXEC sys.sp_addextendedproperty EXEC sys.sp_addextendedproperty
'MS_Description', N'原生openid' , 'MS_Description', N'平台编号唯一id' ,
'SCHEMA', N'dbo', 'SCHEMA', N'dbo',
'TABLE', N'sys_social', 'TABLE', N'sys_social',
'COLUMN', N'open_id' 'COLUMN', N'open_id'

View File

@ -46,9 +46,9 @@ comment on table sys_social is '社会化关系表';
comment on column sys_social.id is '主键'; comment on column sys_social.id is '主键';
comment on column sys_social.user_id is '用户ID'; comment on column sys_social.user_id is '用户ID';
comment on column sys_social.tenant_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.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.user_name is '登录账号';
comment on column sys_social.nick_name is '用户昵称'; comment on column sys_social.nick_name is '用户昵称';
comment on column sys_social.email is '用户邮箱'; comment on column sys_social.email is '用户邮箱';

View File

@ -45,9 +45,9 @@ comment on table sys_social is '社会化关系表';
comment on column sys_social.id is '主键'; comment on column sys_social.id is '主键';
comment on column sys_social.user_id is '用户ID'; comment on column sys_social.user_id is '用户ID';
comment on column sys_social.tenant_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.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.user_name is '登录账号';
comment on column sys_social.nick_name is '用户昵称'; comment on column sys_social.nick_name is '用户昵称';
comment on column sys_social.email is '用户邮箱'; comment on column sys_social.email is '用户邮箱';

View File

@ -74,7 +74,7 @@ EXEC sys.sp_addextendedproperty
'COLUMN', N'tenant_id' 'COLUMN', N'tenant_id'
GO GO
EXEC sys.sp_addextendedproperty EXEC sys.sp_addextendedproperty
'MS_Description', N'授权+授权openid' , 'MS_Description', N'平台+平台唯一id' ,
'SCHEMA', N'dbo', 'SCHEMA', N'dbo',
'TABLE', N'sys_social', 'TABLE', N'sys_social',
'COLUMN', N'auth_id' 'COLUMN', N'auth_id'
@ -86,7 +86,7 @@ EXEC sys.sp_addextendedproperty
'COLUMN', N'source' 'COLUMN', N'source'
GO GO
EXEC sys.sp_addextendedproperty EXEC sys.sp_addextendedproperty
'MS_Description', N'原生openid' , 'MS_Description', N'平台编号唯一id' ,
'SCHEMA', N'dbo', 'SCHEMA', N'dbo',
'TABLE', N'sys_social', 'TABLE', N'sys_social',
'COLUMN', N'open_id' 'COLUMN', N'open_id'

View File

@ -11,9 +11,9 @@ create table sys_social
id bigint not null comment '主键', id bigint not null comment '主键',
user_id bigint not null comment '用户ID', user_id bigint not null comment '用户ID',
tenant_id varchar(20) default 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 '用户来源', 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 '登录账号', user_name varchar(30) not null comment '登录账号',
nick_name varchar(30) default '' comment '用户昵称', nick_name varchar(30) default '' comment '用户昵称',
email varchar(255) default '' comment '用户邮箱', email varchar(255) default '' comment '用户邮箱',