try {
encodedUsername = loginUserDto.getUserName() == null ? null :
URLEncoder.encode(loginUserDto.getUserName(), "UTF-8").replace("+", "%20");
} catch (UnsupportedEncodingException e) {
LOGGER.error("Could not encode username '{}'", loginUserDto.getUserName());
throw new UnexpectedErrorException(e);
}
Map<String, String> authInfo = authenticateByAvailablePlugin(encodedUsername, passwordHash);
if (authInfo.isEmpty() || !authInfo.containsKey("email") || !authInfo.containsKey("username")) {
LOGGER.info("Could not authenticate user '{}' by plugin.", loginUserDto.getUserName());
return false;