package com.patzn.lims.security;//package ops.china.service.upms.security;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.authentication.BadCredentialsException;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.stereotype.Service;
//
//import com.patzn.lims.sys.entity.SysUser;
//import com.patzn.lims.sys.service.ISysUserService;
//
///**
// * <p>
// * 用户详情信息查询服务实现
// * </p>
// *
// * @author hubin
// * @since 2019-03-19
// */
//@Service
//public class UserDetailsServiceImpl implements UserDetailsService {
//
//    @Autowired
//    private ISysUserService sysUserService;
//
//    @Override
//    public UserDetails loadUserByUsername(final String username)
//            throws UsernameNotFoundException {
//        SysUser sysUser = sysUserService.getByUserName(username);
//        if (null == sysUser) {
//            throw new UsernameNotFoundException("User not found with username or email : " + username);
//        }
//        return UserPrincipal.create(sysUser);
//    }
//
//    public UserDetails loadUserById(final Long id) {
//        SysUser sysUser = sysUserService.getById(id);
//        if (null == sysUser) {
//            throw new BadCredentialsException("User not found with id : " + id);
//        }
//        return UserPrincipal.create(sysUser);
//    }
//}
