| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import cn.hutool.http.HttpUtil; |
| | | import cn.hutool.http.Method; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import me.zhyd.oauth.model.AuthResponse; |
| | |
| | | import org.dromara.common.social.config.properties.SocialProperties; |
| | | import org.dromara.common.social.utils.SocialUtils; |
| | | import org.dromara.common.tenant.helper.TenantHelper; |
| | | import org.dromara.system.domain.SysClient; |
| | | import org.dromara.system.domain.SysUser; |
| | | import org.dromara.system.domain.vo.SysClientVo; |
| | | import org.dromara.system.domain.vo.SysSocialVo; |
| | | import org.dromara.system.domain.vo.SysUserVo; |
| | |
| | | if (CollUtil.isEmpty(list)) { |
| | | throw new ServiceException("你还没有绑定第三方账号,绑定后才可以登录!"); |
| | | } |
| | | Optional<SysSocialVo> opt = list.stream().filter(x -> x.getTenantId().equals(loginBody.getTenantId())).findAny(); |
| | | if (opt.isEmpty()) { |
| | | throw new ServiceException("对不起,你没有权限登录当前租户!"); |
| | | SysSocialVo social; |
| | | if (TenantHelper.isEnable()) { |
| | | Optional<SysSocialVo> opt = list.stream().filter(x -> x.getTenantId().equals(loginBody.getTenantId())).findAny(); |
| | | if (opt.isEmpty()) { |
| | | throw new ServiceException("对不起,你没有权限登录当前租户!"); |
| | | } |
| | | social = opt.get(); |
| | | } else { |
| | | social = list.get(0); |
| | | } |
| | | SysSocialVo social = opt.get(); |
| | | // 查找用户 |
| | | SysUserVo user = loadUser(social.getTenantId(), social.getUserId()); |
| | | |