user.setName(username);
user.setPassword(null);
user.setEnabled(true);
// allow writing
List<Authority> authorities = new ArrayList<Authority>();
authorities.add(new WritePermission());
authorities.add(new ConcurrentLoginPermission(Integer.MAX_VALUE, Integer.MAX_VALUE));
user.setAuthorities(authorities);
return user;
}