/* * Copyright (c) 2013 Honyee Industry Group Co., Ltd * www.honyee.biz * All rights reserved. * * This software is the confidential and proprietary information of * Honyee Industry Group Co., Ltd ("Confidential Information"). * You shall not disclose such Confidential Information and shall use * it only in accordance with the terms of the license agreement you * entered into with Honyee Industry Group Co., Ltd. */ package cc.wdcy.service.impl; import cc.wdcy.domain.shared.security.HonyeeUserDetails; import cc.wdcy.domain.user.User; import cc.wdcy.domain.user.UserRepository; import cc.wdcy.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.core.userdetails.UserDetails; import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.stereotype.Service; /** * @author Shengzhao Li */ @Service("userService") public class UserServiceImpl implements UserService { @Autowired private UserRepository userRepository; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { User user = userRepository.findByUsername(username); if (user == null) { throw new UsernameNotFoundException("Not found any user for username[" + username + "]"); } return new HonyeeUserDetails(user); } }