//package com.backendsys.modules.common.config.Security;
//
//import org.springframework.beans.factory.aspect.Autowired;
//import org.springframework.security.core.authority.AuthorityUtils;
//import org.springframework.security.core.userdetails.User;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import org.springframework.stereotype.Service;
//
///**
// * 登录鉴权的实现类
// */
//@Service
//public class CustomUserDetailsServiceImpl implements UserDetailsService {
//
//    @Autowired
//    private PasswordEncoder passwordEncoder;
//
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//
//        System.out.println("CustomUserDetailsServiceImpl!");
//
//        // 1.查询数据库，判断用户名是否存在，如果不存在就抛出 UsernameNotFoundException 异常
//        if (!"admin".equals(username)) {
//            throw new UsernameNotFoundException("用户名不存在");
//        }
//        // 2.把查询出来的密码 (注册时加密过) 进行解析，或者把密码放入构造方法
//        String password = passwordEncoder.encode("123456");
//
//        User u = new User(username, password,
//                AuthorityUtils.commaSeparatedStringToAuthorityList("admin, normal"));
//
//        // System.out.println("isCredentialsNonExpired: " + u.isCredentialsNonExpired());
//
//        return u;
//    }
//}
