/** {@inheritDoc} */
  @Override
  protected void initOptions() {
    options.addOption(new Option(OPT_DSMLV1, false, "output results in DSML v1"));

    final Map<String, String> desc =
        getArgDesc(
            ConnectionConfig.class,
            Authenticator.class,
            SearchDnResolver.class,
            AuthenticationRequest.class);
    for (String s : ConnectionConfigPropertySource.getProperties()) {
      options.addOption(new Option(s, true, desc.get(s)));
    }
    for (String s : AuthenticatorPropertySource.getProperties()) {
      options.addOption(new Option(s, true, desc.get(s)));
    }
    for (String s : SearchDnResolverPropertySource.getProperties()) {
      // ignore connection config property
      if (!s.equalsIgnoreCase(ConnectionConfig.class.getSimpleName())) {
        options.addOption(new Option(s, true, desc.get(s)));
      }
    }
    for (String s : AuthenticationRequestPropertySource.getProperties()) {
      options.addOption(new Option(s, true, desc.get(s)));
    }
    super.initOptions();
  }
  /**
   * Initialize an authentication request with command line options.
   *
   * @param line parsed command line arguments
   * @return authentication request that has been initialized
   * @throws Exception if an authentication request cannot be created
   */
  protected AuthenticationRequest initAuthenticationRequest(final CommandLine line)
      throws Exception {
    final AuthenticationRequest request = new AuthenticationRequest();
    final AuthenticationRequestPropertySource arSource =
        new AuthenticationRequestPropertySource(
            request, getPropertiesFromOptions(PropertyDomain.AUTH.value(), line));
    arSource.initialize();
    if (request.getUser() == null) {
      // prompt for a user name
      final String user = System.console().readLine("[Enter user name]: ");
      request.setUser(user);
    }

    if (request.getCredential() == null) {
      // prompt the user to enter a password
      final char[] pass =
          System.console().readPassword("[Enter password for %s]: ", request.getUser());
      request.setCredential(new Credential(pass));
    }

    return request;
  }