mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 优化 !pr382 修复一些问题 完事流程逻辑
This commit is contained in:
		@@ -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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
@@ -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());
 | 
			
		||||
 
 | 
			
		||||
@@ -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 '用户邮箱';
 | 
			
		||||
 
 | 
			
		||||
@@ -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 '用户邮箱';
 | 
			
		||||
 
 | 
			
		||||
@@ -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'
 | 
			
		||||
 
 | 
			
		||||
@@ -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 '用户邮箱';
 | 
			
		||||
 
 | 
			
		||||
@@ -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 '用户邮箱';
 | 
			
		||||
 
 | 
			
		||||
@@ -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'
 | 
			
		||||
 
 | 
			
		||||
@@ -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 '用户邮箱',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user