return userDto;
}
String hql = "from UserStatus where username=? and userRepoRef=?";
UserStatus userStatus = userStatusManager.findUnique(hql,
apiUserDto.getUsername(), ScopeHolder.getUserRepoRef());
if (userStatus == null) {
logger.debug("user has no authorities : [{}]", userId);
logger.debug("find user : [{}]", apiUserDto.getUsername());
userDto.setUsername(apiUserDto.getUsername());
if ((userDto.getUsername() == null)
|| "".equals(userDto.getUsername())) {
userDto.setUsername(apiUserDto.getId());
}
userDto.setPassword("NO_PASSWORD");
userDto.setAuthorities(Collections.EMPTY_LIST);
userDto.setAttributes(Collections.EMPTY_LIST);
logger.debug("username : [{}]", userDto.getUsername());
logger.debug("password : [{}]", userDto.getPassword());
} else {
userDto.setUsername(userStatus.getUsername());
userDto.setPassword(userStatus.getPassword());
List<String> authorties = userStatusManager.find(HQL_AUTHORITY,
userStatus.getId(), ScopeHolder.getScopeId());
userDto.setAuthorities(authorties);
List<String> roles = userStatusManager.find(HQL_ATTRIBUTE,
userStatus.getId(), ScopeHolder.getScopeId());
List<String> attributes = new ArrayList<String>();
for (String role : roles) {
attributes.add("ROLE_" + role);
}