我的项目是员工退出流程,一旦员工放心,预计会阻止员工登录而不是删除员工。
尝试:
userObject.isCredentialsNonExpired() = false
userObject.isAccountNonLocked() = false
userObject.isAccountNonExpired() = false
userObject.isEnabled() = false
即使我修改了所有这四个值,登录仍然适用于用户。
@Autowired
EmployeeRepository empRep;
@Override
public EmployeeEntity loadUserByUsername(String username) throws UsernameNotFoundException {
EmployeeEntity emp = empRep.findByUserId(username);
if (emp == null) {
throw new UsernameNotFoundException("User trapped in singularity");
}
return emp;
}