@Transactional(readOnly = true)
  @Override
  public UserDetails loadUserByUsername(final String username) throws UsernameNotFoundException {

    final net.menu.model.User user = userDao.findByUserName(username);
    List<GrantedAuthority> authorities = buildUserAuthority(user.getUserRole());

    return buildUserForAuthentication(user, authorities);
  }
 private User buildUserForAuthentication(
     net.menu.model.User user, List<GrantedAuthority> authorities) {
   return new User(
       user.getUsername(), user.getPassword(), user.isEnabled(), true, true, true, authorities);
 }