@Override
  public UserInformation login(
      final String username, final String password, final boolean rememberMe)
      throws LoginException {
    final Collection<UserService> services = this.userServiceTracker.getTracked().values();

    if (services == null || services.isEmpty()) {
      throw new LoginException("No login service available");
    }

    for (final UserService service : services) {
      try {
        // pass on to the next user service
        final UserInformation user = service.checkCredentials(username, password, rememberMe);
        if (user != null) {
          // got a login
          return user;
        }
      } catch (final Exception e) {
        if (ExceptionHelper.getRootCause(e) instanceof LoginException) {
          // this failure is ok
          throw e;
        }
        // this one it not and so we continue afterwards
        logger.warn("UserService failed", e);
      }
    }

    // end of the service list, nobody knowns this user
    throw new LoginException("Login error!", "Invalid username or password.");
  }
  public static ErrorInformation createFrom(final Throwable e) {
    if (e == null) {
      return null;
    }

    return new ErrorInformation(
        ExceptionHelper.getMessage(e),
        ExceptionHelper.formatted(e),
        ExceptionHelper.formatted(ExceptionHelper.getRootCause(e)));
  }