log.error("Username {} already exist, can not create user.", new Object[] {username});
throw new CaseboxException("error.user.alreadyexist");
}
user = new User(username, password, true, firstName, lastName);
Authority authority = new Authority(user, AuthorityRole.ROLE_USER);
user.getAuthorities().add(authority);
log.debug("Create user {}.", new Object[]{user});
user = userRepository.store(user);