AccountUserDetailsService.java 文件源码

java
阅读 37 收藏 0 点赞 0 评论 0

项目:ds4p 作者:
@Override
public UserDetails loadUserByUsername(String username)
        throws UsernameNotFoundException {
    Users user=usersRepository.loadUserByUsername(username);
    if (user==null){
        throw new UsernameNotFoundException("Invalid username/password");
    }
    if (user.getFailedLoginAttempts()>=maxFailedAttempts){
        Calendar cal=Calendar.getInstance();
        if (user.getLockoutTime()!=null)
        if (cal.getTimeInMillis()-user.getLockoutTime().getTimeInMillis()>=autoUnlockInterval){
            user.setLockoutTime(null);
            user.setFailedLoginAttemptsToZero();
            return user;
        }
        throw new LockedException("Your account has excceded maximum failed athentication attempts. Please wait 5 minutes to retry.");
    }
    return user;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号