fix: 修改sercurity的UserDetailsService的实现类

这个提交包含在:
weihongyang 2022-06-21 17:01:28 +08:00
父节点 62d1a761cc
当前提交 2bf099ee6d

查看文件

@ -11,6 +11,7 @@ import com.cnbm.admin.service.SysMenuService;
import com.cnbm.common.utils.ConvertUtils;
import lombok.extern.log4j.Log4j2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.authentication.DisabledException;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
@ -46,6 +47,9 @@ public class UserDetailsServiceImpl implements UserDetailsService {
if (Objects.isNull(sysUserEntity)) {
throw new UsernameNotFoundException("用户名不存在");
}
if (sysUserEntity.getStatus() == 0) {
throw new DisabledException("该账户已被禁用,请联系管理员");
}
log.info("sysUserEntity的值是"+sysUserEntity.toString());
log.info("sysUserEntity.getSuperAdmin()=="+sysUserEntity.getSuperAdmin());
Set<String> userPermissions = sysMenuService.getUserPermissions(sysUserEntity);