Class HttpAuthConfig

java.lang.Object
com.norconex.crawler.web.fetch.impl.httpclient.HttpAuthConfig

public class HttpAuthConfig extends Object

Generic HTTP Fetcher authentication configuration.

Since:
3.0.0
  • Constructor Details

    • HttpAuthConfig

      public HttpAuthConfig()
  • Method Details

    • getCredentials

      public Credentials getCredentials()
    • setCredentials

      public void setCredentials(Credentials authCredentials)
    • setFormParam

      public void setFormParam(String name, String value)
      Sets an authentication form parameter (equivalent to "input" or other fields in HTML forms).
      Parameters:
      name - form parameter name
      value - form parameter value
    • setFormParams

      public void setFormParams(Map<String,String> params)
      Sets authentication form parameters (equivalent to "input" or other fields in HTML forms).
      Parameters:
      params - map of form parameter names and values
    • getFormParam

      public String getFormParam(String name)
      Gets an authentication form parameter (equivalent to "input" or other fields in HTML forms).
      Parameters:
      name - form parameter name
      Returns:
      form parameter value or null if no match is found
    • getFormParams

      public Map<String,String> getFormParams()
      Gets all authentication form parameters (equivalent to "input" or other fields in HTML forms).
      Returns:
      form parameters map (name and value)
    • getFormParamNames

      public List<String> getFormParamNames()
      Gets all authentication form parameter names. If no form parameters are set, it returns an empty array.
      Returns:
      HTTP request header names
    • getMethod

      public HttpAuthMethod getMethod()
      The authentication method.
    • getUrl

      public String getUrl()
      The URL for "form" authentication. The username and password will be POSTed to this URL unless setFormSelector(String) is set, then it is assumed to be the URL of the page containing the form. This is used only for "form" authentication.
    • getFormUsernameField

      public String getFormUsernameField()
      The name of the HTML field where the username is set. This is used only for "form" authentication.
    • getFormPasswordField

      public String getFormPasswordField()
      The name of the HTML field where the password is set. This is used only for "form" authentication.
    • getHost

      public Host getHost()
      The host for the current authentication scope. null (default value) indicates "any host" for the scope. Used for BASIC and DIGEST authentication.
    • getRealm

      public String getRealm()
      The realm name for the current authentication scope. null (default) indicates "any realm" for the scope. Used for BASIC and DIGEST authentication.
    • getFormCharset

      public Charset getFormCharset()
      The authentication form character set for the form field values. Default is UTF-8.
    • getFormSelector

      public String getFormSelector()
      The CSS selector that identifies the form in a login page. When set, requires getUrl() to be pointing to a login page containing a login form.
    • getWorkstation

      public String getWorkstation()
      The NTLM authentication workstation name.
    • getDomain

      public String getDomain()
      Gets the NTLM authentication domain.
    • getKerberosConfig

      public KerberosConfig getKerberosConfig()
      Kerberos/SPNEGO configuration. Required when using HttpAuthMethod.SPNEGO or HttpAuthMethod.KERBEROS.
    • isPreemptive

      public boolean isPreemptive()
      Whether to perform preemptive authentication (valid for "basic" authentication method).
    • setMethod

      public HttpAuthConfig setMethod(HttpAuthMethod method)
      The authentication method.
      Returns:
      this.
    • setUrl

      public HttpAuthConfig setUrl(String url)
      The URL for "form" authentication. The username and password will be POSTed to this URL unless setFormSelector(String) is set, then it is assumed to be the URL of the page containing the form. This is used only for "form" authentication.
      Returns:
      this.
    • setFormUsernameField

      public HttpAuthConfig setFormUsernameField(String formUsernameField)
      The name of the HTML field where the username is set. This is used only for "form" authentication.
      Returns:
      this.
    • setFormPasswordField

      public HttpAuthConfig setFormPasswordField(String formPasswordField)
      The name of the HTML field where the password is set. This is used only for "form" authentication.
      Returns:
      this.
    • setHost

      public HttpAuthConfig setHost(Host host)
      The host for the current authentication scope. null (default value) indicates "any host" for the scope. Used for BASIC and DIGEST authentication.
      Returns:
      this.
    • setRealm

      public HttpAuthConfig setRealm(String realm)
      The realm name for the current authentication scope. null (default) indicates "any realm" for the scope. Used for BASIC and DIGEST authentication.
      Returns:
      this.
    • setFormCharset

      public HttpAuthConfig setFormCharset(Charset formCharset)
      The authentication form character set for the form field values. Default is UTF-8.
      Returns:
      this.
    • setFormSelector

      public HttpAuthConfig setFormSelector(String formSelector)
      The CSS selector that identifies the form in a login page. When set, requires getUrl() to be pointing to a login page containing a login form.
      Returns:
      this.
    • setWorkstation

      public HttpAuthConfig setWorkstation(String workstation)
      The NTLM authentication workstation name.
      Returns:
      this.
    • setDomain

      public HttpAuthConfig setDomain(String domain)
      Gets the NTLM authentication domain.
      Returns:
      this.
    • setKerberosConfig

      public HttpAuthConfig setKerberosConfig(KerberosConfig kerberosConfig)
      Kerberos/SPNEGO configuration. Required when using HttpAuthMethod.SPNEGO or HttpAuthMethod.KERBEROS.
      Returns:
      this.
    • setPreemptive

      public HttpAuthConfig setPreemptive(boolean preemptive)
      Whether to perform preemptive authentication (valid for "basic" authentication method).
      Returns:
      this.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object