diff --git a/pom.xml b/pom.xml index b20e7f05..a1e7524b 100644 --- a/pom.xml +++ b/pom.xml @@ -41,6 +41,7 @@ 1.72 2.7.0 + 1.15.6 1.33 @@ -291,6 +292,13 @@ ${snakeyaml.version} + + + me.zhyd.oauth + JustAuth + ${justauth.version} + + org.bouncycastle diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index af5f2396..dd4fc58e 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -75,6 +75,21 @@ spring-boot-starter-test test + + me.zhyd.oauth + JustAuth + + + org.dromara + ruoyi-common-auth + 5.1.0-SNAPSHOT + + + com.aliyun + credentials-java + 0.2.4 + compile + 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 bba6113d..6d0ef7bc 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 @@ -2,9 +2,21 @@ package org.dromara.web.controller; import cn.dev33.satoken.annotation.SaIgnore; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.json.JSONObject; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson.JSON; import jakarta.servlet.http.HttpServletRequest; import jakarta.validation.constraints.NotBlank; import lombok.RequiredArgsConstructor; +import me.zhyd.oauth.cache.AuthDefaultStateCache; +import me.zhyd.oauth.cache.AuthStateCache; +import me.zhyd.oauth.model.AuthCallback; +import me.zhyd.oauth.model.AuthResponse; +import me.zhyd.oauth.model.AuthUser; +import me.zhyd.oauth.request.AuthRequest; +import me.zhyd.oauth.utils.AuthStateUtils; +import org.dromara.common.auth.utils.AuthUtils; import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.model.EmailLoginBody; import org.dromara.common.core.domain.model.LoginBody; @@ -16,6 +28,8 @@ import org.dromara.common.core.utils.StringUtils; import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.system.domain.bo.SysTenantBo; import org.dromara.system.domain.vo.SysTenantVo; +import org.dromara.system.domain.vo.SysUserVo; +import org.dromara.system.mapper.SysUserMapper; import org.dromara.system.service.ISysConfigService; import org.dromara.system.service.ISysTenantService; import org.dromara.web.domain.vo.LoginTenantVo; @@ -26,8 +40,11 @@ import org.dromara.web.service.SysRegisterService; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.io.IOException; import java.net.URL; +import java.util.HashMap; import java.util.List; +import java.util.Map; /** * 认证 @@ -41,10 +58,18 @@ import java.util.List; @RequestMapping("/auth") public class AuthController { + private AuthStateCache authStateCache; private final SysLoginService loginService; private final SysRegisterService registerService; private final ISysConfigService configService; private final ISysTenantService tenantService; + private final SysUserMapper userMapper; + private final Map auths = new HashMap<>(); + { + auths.put("gitee", "{\"clientId\":\"38eaaa1b77b5e064313057a2f5745ce3a9f3e7686d9bd302c7df2f308ef6db81\",\"clientSecret\":\"2e633af8780cb9fe002c4c7291b722db944402e271efb99b062811f52d7da1ff\",\"redirectUri\":\"http://127.0.0.1:8888/social-login?source=gitee\"}"); + auths.put("github", "{\"clientId\":\"Iv1.1be0cdcd71aca63b\",\"clientSecret\":\"0d59d28b43152bc8906011624db37b0fed88d154\",\"redirectUri\":\"http://127.0.0.1:80/social-login?source=github\"}"); + authStateCache = AuthDefaultStateCache.INSTANCE;// 使用默认的缓存 + } /** * 登录方法 @@ -115,6 +140,64 @@ public class AuthController { return R.ok(loginVo); } + + + + /** + * 认证授权 + * @param source + * @throws IOException + */ + @GetMapping("/binding/{source}") + @ResponseBody + public R authBinding(@PathVariable("source") String source, HttpServletRequest request){ + SysUserVo userLoding = new SysUserVo(); + if (ObjectUtil.isNull(userLoding)) { + return R.fail("授权失败,请先登录再绑定"); + } + if (userMapper.checkAuthUser(userLoding.getUserId(),source) > 0) + { + return R.fail(source + "平台账号已经绑定"); + } + String obj = auths.get(source); + if (StringUtils.isEmpty(obj)) + { + return R.fail(source + "平台账号暂不支持"); + } + JSONObject json = JSONUtil.parseObj(obj); + AuthRequest authRequest = AuthUtils.getAuthRequest(source, + json.getStr("clientId"), + json.getStr("clientSecret"), + json.getStr("redirectUri"), authStateCache); + String authorizeUrl = authRequest.authorize(AuthStateUtils.createState()); + return R.ok(authorizeUrl); + } + + /** + * @param source + * @param callback + * @param request + * @return + */ + @SuppressWarnings("unchecked") + @GetMapping("/social-login/{source}") + public R socialLogin(@PathVariable("source") String source, AuthCallback callback, HttpServletRequest request) throws IOException { + String obj = auths.get(source); + if (StringUtils.isEmpty(obj)) + { + return R.fail("第三方平台系统不支持或未提供来源"); + } + JSONObject json = JSONUtil.parseObj(obj); + AuthRequest authRequest = AuthUtils.getAuthRequest(source, + json.getStr("clientId"), + json.getStr("clientSecret"), + json.getStr("redirectUri"), authStateCache); + AuthResponse response = authRequest.login(callback); + return loginService.socialLogin(source, response, request); + } + + + /** * 退出登录 */ diff --git a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java index 689a55de..b152710c 100644 --- a/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java +++ b/ruoyi-admin/src/main/java/org/dromara/web/service/SysLoginService.java @@ -6,11 +6,15 @@ import cn.dev33.satoken.stp.StpUtil; import cn.hutool.core.bean.BeanUtil; import cn.hutool.core.util.ObjectUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import jakarta.servlet.http.HttpServletRequest; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import me.zhyd.oauth.model.AuthResponse; +import me.zhyd.oauth.model.AuthUser; import org.dromara.common.core.constant.Constants; import org.dromara.common.core.constant.GlobalConstants; import org.dromara.common.core.constant.TenantConstants; +import org.dromara.common.core.domain.R; import org.dromara.common.core.domain.dto.RoleDTO; import org.dromara.common.core.domain.model.LoginUser; import org.dromara.common.core.domain.model.XcxLoginUser; @@ -28,6 +32,7 @@ import org.dromara.common.satoken.utils.LoginHelper; import org.dromara.common.tenant.exception.TenantException; import org.dromara.common.tenant.helper.TenantHelper; import org.dromara.common.web.config.properties.CaptchaProperties; +import org.dromara.system.domain.SysAuthUser; import org.dromara.system.domain.SysUser; import org.dromara.system.domain.vo.SysTenantVo; import org.dromara.system.domain.vo.SysUserVo; @@ -37,6 +42,7 @@ import org.dromara.system.service.ISysTenantService; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; +import java.io.IOException; import java.time.Duration; import java.util.Date; import java.util.List; @@ -154,6 +160,65 @@ public class SysLoginService { return StpUtil.getTokenValue(); } + + /** + * 认证授权登录 + * @param source + * @throws IOException + */ + /** + * 社交登录 + * @param source 登录来源 + * @param authUser 授权响应实体 + * @param request Http请求对象 + * @return 统一响应实体 + * @throws IOException + */ + public R socialLogin(String source, AuthResponse authUser, HttpServletRequest request) throws IOException { + // 判断授权响应是否成功 + if (!authUser.ok()) { + return R.fail("对不起,授权信息验证不通过,请联系管理员"); + } + AuthUser authUserData = authUser.getData(); + // 判断数据库中是否已存在该用户 + SysUserVo user = userMapper.selectAuthUserByUuid(source + authUserData.getUuid()); + if (ObjectUtil.isNotNull(user)) { + checkTenant(user.getTenantId()); + SysUserVo dbUser = loadUserByUsername(user.getTenantId(), user.getUserName()); + // 登录 + LoginHelper.loginByDevice(buildLoginUser(dbUser), DeviceType.auth); + recordLogininfor(dbUser.getTenantId(), user.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + recordLoginInfo(user.getUserId()); + return R.ok(StpUtil.getTokenValue()); + } else { + if (LoginHelper.getUserId() == null) { + return R.fail("授权失败,请先登录再绑定"); + } + // 组装授权用户信息 + SysAuthUser sysAuthUser = new SysAuthUser(); + sysAuthUser.setAvatar(authUserData.getAvatar()); + sysAuthUser.setUuid(source + authUserData.getUuid()); + sysAuthUser.setUserId(LoginHelper.getUserId()); + sysAuthUser.setUserName(authUserData.getUsername()); + sysAuthUser.setNickName(authUserData.getNickname()); + sysAuthUser.setEmail(authUserData.getEmail()); + sysAuthUser.setSource(source); + sysAuthUser.setCreateTime(new Date().toString()); + // 新用户,绑定第三方账号 + userMapper.insertAuthUser(sysAuthUser); + SysUserVo lodingData = loadUserByUsername(LoginHelper.getTenantId(), LoginHelper.getUsername()); + checkTenant(lodingData.getTenantId()); + LoginHelper.loginByDevice(buildLoginUser(lodingData), DeviceType.auth); + recordLogininfor(lodingData.getTenantId(), sysAuthUser.getUserName(), Constants.LOGIN_SUCCESS, MessageUtils.message("user.login.success")); + recordLoginInfo(sysAuthUser.getUserId()); + return R.ok(StpUtil.getTokenValue()); + } + } + + + + + /** * 退出登录 */ diff --git a/ruoyi-common/pom.xml b/ruoyi-common/pom.xml index 0428aea7..4813f798 100644 --- a/ruoyi-common/pom.xml +++ b/ruoyi-common/pom.xml @@ -11,6 +11,7 @@ ruoyi-common-bom + ruoyi-common-auth ruoyi-common-core ruoyi-common-doc ruoyi-common-excel diff --git a/ruoyi-common/ruoyi-common-auth/pom.xml b/ruoyi-common/ruoyi-common-auth/pom.xml new file mode 100644 index 00000000..9af89e61 --- /dev/null +++ b/ruoyi-common/ruoyi-common-auth/pom.xml @@ -0,0 +1,22 @@ + + + + org.dromara + ruoyi-common + ${revision} + ../pom.xml + + 4.0.0 + ruoyi-common-auth + + ruoyi-common-auth 认证模块 + + + + me.zhyd.oauth + JustAuth + + + diff --git a/ruoyi-common/ruoyi-common-auth/src/main/java/org.dromara.common.auth/utils/AuthUtils.java b/ruoyi-common/ruoyi-common-auth/src/main/java/org.dromara.common.auth/utils/AuthUtils.java new file mode 100644 index 00000000..981b3be6 --- /dev/null +++ b/ruoyi-common/ruoyi-common-auth/src/main/java/org.dromara.common.auth/utils/AuthUtils.java @@ -0,0 +1,112 @@ +package org.dromara.common.auth.utils; +import me.zhyd.oauth.cache.AuthStateCache; +import me.zhyd.oauth.config.AuthConfig; +import me.zhyd.oauth.exception.AuthException; +import me.zhyd.oauth.request.*; + +/** + * 认证授权工具类 + * + * @author ruoyi + */ +public class AuthUtils { + public static AuthRequest getAuthRequest(String source, String clientId, String clientSecret, String redirectUri, + AuthStateCache authStateCache) + { + AuthRequest authRequest = null; + switch (source.toLowerCase()) { + case "dingtalk" -> + authRequest = new AuthDingTalkRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "baidu" -> + authRequest = new AuthBaiduRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "github" -> + authRequest = new AuthGithubRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "gitee" -> + authRequest = new AuthGiteeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "weibo" -> + authRequest = new AuthWeiboRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "coding" -> + authRequest = new AuthCodingRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).codingGroupName("").build(), authStateCache); + case "oschina" -> + authRequest = new AuthOschinaRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "alipay" -> + // 支付宝在创建回调地址时,不允许使用localhost或者127.0.0.1,所以这儿的回调地址使用的局域网内的ip + authRequest = new AuthAlipayRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .alipayPublicKey("").redirectUri(redirectUri).build(), authStateCache); + case "qq" -> + authRequest = new AuthQqRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "wechat_open" -> authRequest = new AuthWeChatOpenRequest(AuthConfig.builder().clientId(clientId) + .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); + case "csdn" -> + authRequest = new AuthCsdnRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "taobao" -> + authRequest = new AuthTaobaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "douyin" -> + authRequest = new AuthDouyinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "linkedin" -> + authRequest = new AuthLinkedinRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "microsoft" -> authRequest = new AuthMicrosoftRequest(AuthConfig.builder().clientId(clientId) + .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); + case "mi" -> + authRequest = new AuthMiRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "toutiao" -> + authRequest = new AuthToutiaoRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "teambition" -> authRequest = new AuthTeambitionRequest(AuthConfig.builder().clientId(clientId) + .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); + case "pinterest" -> authRequest = new AuthPinterestRequest(AuthConfig.builder().clientId(clientId) + .clientSecret(clientSecret).redirectUri(redirectUri).build(), authStateCache); + case "renren" -> + authRequest = new AuthRenrenRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "stack_overflow" -> authRequest = new AuthStackOverflowRequest(AuthConfig.builder().clientId(clientId) + .clientSecret(clientSecret).redirectUri(redirectUri).stackOverflowKey("").build(), + authStateCache); + case "huawei" -> + authRequest = new AuthHuaweiRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "wechat_enterprise" -> + authRequest = new AuthWeChatEnterpriseRequest(AuthConfig.builder().clientId(clientId) + .clientSecret(clientSecret).redirectUri(redirectUri).agentId("").build(), authStateCache); + case "kujiale" -> + authRequest = new AuthKujialeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "gitlab" -> + authRequest = new AuthGitlabRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "meituan" -> + authRequest = new AuthMeituanRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "eleme" -> + authRequest = new AuthElemeRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build()); + case "wechat_mp" -> + authRequest = new AuthWeChatMpRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + case "aliyun" -> + authRequest = new AuthAliyunRequest(AuthConfig.builder().clientId(clientId).clientSecret(clientSecret) + .redirectUri(redirectUri).build(), authStateCache); + default -> { + } + } + if (null == authRequest) + { + throw new AuthException("未获取到有效的Auth配置"); + } + return authRequest; + } +} + diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java index 09bf44b6..7127bbb8 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/org/dromara/common/core/enums/DeviceType.java @@ -26,7 +26,9 @@ public enum DeviceType { /** * 小程序端 */ - XCX("xcx"); + XCX("xcx"), + + auth("auth"); private final String device; } diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysAuthUser.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysAuthUser.java new file mode 100644 index 00000000..5008786e --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/domain/SysAuthUser.java @@ -0,0 +1,40 @@ +package org.dromara.system.domain; + +import com.baomidou.mybatisplus.annotation.TableName; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@NoArgsConstructor +@TableName("sys_auth_user") +public class SysAuthUser { + + private static final long serialVersionUID = 1L; + + /** 授权ID */ + private Long authId; + + /** 第三方平台用户唯一ID */ + private String uuid; + + /** 系统用户ID */ + private Long userId; + + /** 登录账号 */ + private String userName; + + /** 用户昵称 */ + private String nickName; + + /** 头像地址 */ + private String avatar; + + /** 用户邮箱 */ + private String email; + + /** 用户来源 */ + private String source; + + private String createTime; + +} diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java index 81bd1ff3..94c9c1e7 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/mapper/SysUserMapper.java @@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import org.dromara.common.mybatis.annotation.DataColumn; import org.dromara.common.mybatis.annotation.DataPermission; import org.dromara.common.mybatis.core.mapper.BaseMapperPlus; +import org.dromara.system.domain.SysAuthUser; import org.dromara.system.domain.SysUser; import org.dromara.system.domain.vo.SysUserVo; import org.apache.ibatis.annotations.Param; @@ -123,8 +124,8 @@ public interface SysUserMapper extends BaseMapperPlus { * @return 用户对象信息 */ @DataPermission({ - @DataColumn(key = "deptName", value = "d.dept_id"), - @DataColumn(key = "userName", value = "u.user_id") + @DataColumn(key = "deptName", value = "d.dept_id"),// 部门权限 + @DataColumn(key = "userName", value = "u.user_id")// 用户权限 }) SysUserVo selectUserById(Long userId); @@ -142,4 +143,44 @@ public interface SysUserMapper extends BaseMapperPlus { }) int updateById(@Param(Constants.ENTITY) SysUser user); + /** + * 根据用户编号查询授权列表 + * + * @param userId 用户编号 + * @return 授权列表 + */ + public List selectAuthUserListByUserId(Long userId); + + /** + * 根据uuid查询用户信息 + * + * @param uuid 唯一信息 + * @return 结果 + */ + public SysUserVo selectAuthUserByUuid(String uuid); + + /** + * 校验source平台是否绑定 + * + * @param userId 用户编号 + * @param source 绑定平台 + * @return 结果 + */ + public int checkAuthUser(@Param("userId") Long userId, @Param("source") String source); + + /** + * 新增第三方授权信息 + * + * @param authUser 用户信息 + * @return 结果 + */ + public int insertAuthUser(SysAuthUser authUser); + + /** + * 根据编号删除第三方授权信息 + * + * @param authId 授权编号 + * @return 结果 + */ + public int deleteAuthUser(Long authId); } diff --git a/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysAuthUserMapper.xml b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysAuthUserMapper.xml new file mode 100644 index 00000000..864b3ba3 --- /dev/null +++ b/ruoyi-modules/ruoyi-system/src/main/resources/mapper/system/SysAuthUserMapper.xml @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + insert into sys_auth_user( + uuid, + user_id, + user_name, + nick_name, + avatar, + email, + source, + create_time + )values( + #{uuid}, + #{userId}, + #{userName}, + #{nickName}, + #{avatar}, + #{email}, + #{source}, + now() + ) + + + + delete from sys_auth_user where auth_id = #{authId} + + + diff --git a/script/AuthSQL/sys_auth_user.sql b/script/AuthSQL/sys_auth_user.sql new file mode 100644 index 00000000..4a416753 --- /dev/null +++ b/script/AuthSQL/sys_auth_user.sql @@ -0,0 +1,14 @@ +CREATE TABLE `sys_auth_user` ( + `auth_id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '授权ID', + `uuid` varchar(500) NOT NULL COMMENT '第三方平台用户唯一ID', + `user_id` bigint(20) unsigned NOT NULL COMMENT '系统用户ID', + `user_name` varchar(30) NOT NULL COMMENT '登录账号', + `nick_name` varchar(30) DEFAULT '' COMMENT '用户昵称', + `avatar` varchar(500) DEFAULT '' COMMENT '头像地址', + `email` varchar(255) DEFAULT '' COMMENT '用户邮箱', + `source` varchar(255) DEFAULT '' COMMENT '用户来源', + ` tenant_id` varchar(20) DEFAULT '000000' COMMENT '租户id', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `tenant_id` varchar(25) NOT NULL DEFAULT '000000', + PRIMARY KEY (`auth_id`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=102 DEFAULT CHARSET=utf8mb4 COMMENT='第三方平台授权用户信息表';