GateUserDetailsService.java 文件源码

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

项目:FCat 作者:
@Override
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
    if (StringUtils.isBlank(username)) {
        throw new UsernameNotFoundException("用户名为空");
    }
    String password;
    TUser tUser = iUserService.getByUsername(username);
    if(tUser==null){
        throw new UsernameNotFoundException("登录账号不存在");
    }else{
        password=tUser.getPassword();
    }

    Set<GrantedAuthority> authorities = new HashSet<>();
    authorities.add(new SimpleGrantedAuthority("USER"));
    return new org.springframework.security.core.userdetails.User(
            username, password,
            true,
            true,
            true,
            true,
            authorities);
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号