public void validate(Login login, String url) {

    if (StringUtils.isEmpty(url)) {
      return;
    }
    AuthenticationInfo.Type type = null;
    if (url.startsWith("ftp")) {
      type = Type.FTP;
    } else if (url.startsWith("http")) {
      type = Type.HTTP;
    } else {
      Log.L.info("Unknown Protocoll: " + url);
      return;
    }

    String urlHost = Browser.getHost(url, true);
    for (AuthenticationInfo info : list) {
      if (!info.isEnabled()) {
        continue;
      }
      String authHost = info.getHostmask();
      if (info.getType().equals(type) && !StringUtils.isEmpty(authHost)) {
        boolean contains = false;
        if (authHost.length() > urlHost.length()) {
          /* hostMask of AuthenticationInfo is longer */
          contains = authHost.contains(urlHost);
        } else {
          /* hostMask of urlHost is longer */
          contains = urlHost.contains(authHost);
        }
        if (contains) {
          if (StringUtils.equals(info.getUsername(), login.getUsername())
              && StringUtils.equals(info.getPassword(), login.getPassword())) {
            info.setLastValidated(System.currentTimeMillis());
          }
        }
      }
    }
  }