提交 ca9d1266 编写于 作者: sq3536's avatar sq3536

解耦sysuser

上级 d21ee902
package cn.ibizlab.core.uaa.extensions.service; package cn.ibizlab.core.uaa.extensions.service;
import cn.ibizlab.core.uaa.domain.SysUser; import cn.ibizlab.core.uaa.domain.SysUser;
import cn.ibizlab.core.uaa.mapper.SysUserMapper;
import cn.ibizlab.core.uaa.service.ISysUserService;
import cn.ibizlab.core.uaa.service.impl.SysUserServiceImpl; import cn.ibizlab.core.uaa.service.impl.SysUserServiceImpl;
import cn.ibizlab.util.client.IBZOUFeignClient; import cn.ibizlab.util.client.IBZOUFeignClient;
import cn.ibizlab.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
...@@ -9,6 +11,7 @@ import cn.ibizlab.util.security.AuthenticationUser; ...@@ -9,6 +11,7 @@ import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.service.AuthenticationUserService; import cn.ibizlab.util.service.AuthenticationUserService;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -35,7 +38,11 @@ import java.util.*; ...@@ -35,7 +38,11 @@ import java.util.*;
@Slf4j @Slf4j
@Service("LdapUserService") @Service("LdapUserService")
@ConditionalOnExpression("'${ibiz.auth.service:SimpleUserService}'.equals('LdapUserService')") @ConditionalOnExpression("'${ibiz.auth.service:SimpleUserService}'.equals('LdapUserService')")
public class LdapUserService extends SysUserServiceImpl implements AuthenticationUserService { public class LdapUserService implements AuthenticationUserService {
@Autowired
private ISysUserService sysUserService;
@Value("${ibiz.auth.pwencrymode:0}") @Value("${ibiz.auth.pwencrymode:0}")
private int pwencrymode; private int pwencrymode;
...@@ -58,7 +65,7 @@ public class LdapUserService extends SysUserServiceImpl implements Authenticatio ...@@ -58,7 +65,7 @@ public class LdapUserService extends SysUserServiceImpl implements Authenticatio
conds.eq("loginname", loginname); conds.eq("loginname", loginname);
if (!StringUtils.isEmpty(domains)) if (!StringUtils.isEmpty(domains))
conds.eq("domains", domains); conds.eq("domains", domains);
SysUser user = this.getOne(conds); SysUser user = sysUserService.getOne(conds);
if (user == null) { if (user == null) {
throw new UsernameNotFoundException("用户" + username + "未找到"); throw new UsernameNotFoundException("用户" + username + "未找到");
} else { } else {
......
package cn.ibizlab.core.uaa.extensions.service; package cn.ibizlab.core.uaa.extensions.service;
import cn.ibizlab.core.uaa.domain.SysUser; import cn.ibizlab.core.uaa.domain.SysUser;
import cn.ibizlab.core.uaa.mapper.SysUserMapper;
import cn.ibizlab.core.uaa.service.ISysUserService;
import cn.ibizlab.core.uaa.service.impl.SysUserServiceImpl; import cn.ibizlab.core.uaa.service.impl.SysUserServiceImpl;
import cn.ibizlab.util.client.IBZOUFeignClient; import cn.ibizlab.util.client.IBZOUFeignClient;
import cn.ibizlab.util.service.AuthenticationUserService; import cn.ibizlab.util.service.AuthenticationUserService;
...@@ -9,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; ...@@ -9,6 +11,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.ibizlab.util.security.AuthenticationUser; import cn.ibizlab.util.security.AuthenticationUser;
import cn.ibizlab.util.errors.BadRequestAlertException; import cn.ibizlab.util.errors.BadRequestAlertException;
import cn.ibizlab.util.helper.CachedBeanCopier; import cn.ibizlab.util.helper.CachedBeanCopier;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy; import org.springframework.context.annotation.Lazy;
...@@ -28,7 +31,10 @@ import java.util.Set; ...@@ -28,7 +31,10 @@ import java.util.Set;
* 实体[IBZUSER] 服务对象接口实现 * 实体[IBZUSER] 服务对象接口实现
*/ */
@Service("UAAUserService") @Service("UAAUserService")
public class UAAUserService extends SysUserServiceImpl implements AuthenticationUserService { public class UAAUserService implements AuthenticationUserService {
@Autowired
private ISysUserService sysUserService;
@Value("${ibiz.auth.pwencrymode:0}") @Value("${ibiz.auth.pwencrymode:0}")
private int pwencrymode; private int pwencrymode;
...@@ -49,7 +55,7 @@ public class UAAUserService extends SysUserServiceImpl implements Authentication ...@@ -49,7 +55,7 @@ public class UAAUserService extends SysUserServiceImpl implements Authentication
conds.eq("loginname",loginname); conds.eq("loginname",loginname);
if(!StringUtils.isEmpty(domains)) if(!StringUtils.isEmpty(domains))
conds.eq("domains",domains); conds.eq("domains",domains);
SysUser user = this.getOne(conds); SysUser user = sysUserService.getOne(conds);
if (user == null) { if (user == null) {
throw new UsernameNotFoundException("用户" + username + "未找到"); throw new UsernameNotFoundException("用户" + username + "未找到");
} }
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册