fix: 修改sercurity的UserDetailsService的实现类
Este commit está contenido en:
padre
62d1a761cc
commit
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);
|
||||
|
Cargando…
Referencia en una nueva incidencia
Block a user