1
0

fix: 修改sercurity的UserDetailsService的实现类

Dieser Commit ist enthalten in:
weihongyang 2022-06-21 17:01:28 +08:00
Ursprung 62d1a761cc
Commit 2bf099ee6d

Datei anzeigen

@ -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);