Class KerberosConfig

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

public class KerberosConfig extends Object

Configuration for Kerberos and SPNEGO authentication. When using either HttpAuthMethod.SPNEGO or HttpAuthMethod.KERBEROS, this configuration provides the necessary Kerberos settings.

Typical usage

At a minimum, you need a valid Kerberos configuration file (krb5.conf) and either a keytab file or access to the system ticket cache. Set the servicePrincipalName to the SPN of the target service (e.g., HTTP/server.example.com).

Since:
4.0.0
  • Constructor Details

    • KerberosConfig

      public KerberosConfig()
  • Method Details

    • getServicePrincipalName

      public String getServicePrincipalName()
      The Kerberos service principal name (SPN) for the target service. Typically in the form HTTP/hostname@REALM or HTTP/hostname.
    • getKrb5ConfigPath

      public Path getKrb5ConfigPath()
      Path to the Kerberos configuration file (krb5.conf). If null, the JVM default is used (e.g., /etc/krb5.conf on Linux or the value of java.security.krb5.conf).
    • getKeytabPath

      public Path getKeytabPath()
      Path to a keytab file containing the principal's key. When set, authentication uses this keytab instead of requiring a password or ticket cache.
    • getPrincipal

      public String getPrincipal()
      The Kerberos principal name used for login (e.g., user@REALM). Required when using a keytab file. When not using a keytab, the credentials from HttpAuthConfig.getCredentials() are used.
    • isUseTicketCache

      public boolean isUseTicketCache()
      Whether to use the system ticket cache for authentication. When true, an existing ticket obtained via kinit (or OS-level SSO) is used and no password or keytab is required. Default is false.
    • getLoginModuleName

      public String getLoginModuleName()
      The JAAS login module name. When null (default), a built-in JAAS configuration is created automatically based on the other properties in this class. Set this only if you have a custom JAAS login configuration file and entry name.
    • setServicePrincipalName

      public KerberosConfig setServicePrincipalName(String servicePrincipalName)
      The Kerberos service principal name (SPN) for the target service. Typically in the form HTTP/hostname@REALM or HTTP/hostname.
      Returns:
      this.
    • setKrb5ConfigPath

      public KerberosConfig setKrb5ConfigPath(Path krb5ConfigPath)
      Path to the Kerberos configuration file (krb5.conf). If null, the JVM default is used (e.g., /etc/krb5.conf on Linux or the value of java.security.krb5.conf).
      Returns:
      this.
    • setKeytabPath

      public KerberosConfig setKeytabPath(Path keytabPath)
      Path to a keytab file containing the principal's key. When set, authentication uses this keytab instead of requiring a password or ticket cache.
      Returns:
      this.
    • setPrincipal

      public KerberosConfig setPrincipal(String principal)
      The Kerberos principal name used for login (e.g., user@REALM). Required when using a keytab file. When not using a keytab, the credentials from HttpAuthConfig.getCredentials() are used.
      Returns:
      this.
    • setUseTicketCache

      public KerberosConfig setUseTicketCache(boolean useTicketCache)
      Whether to use the system ticket cache for authentication. When true, an existing ticket obtained via kinit (or OS-level SSO) is used and no password or keytab is required. Default is false.
      Returns:
      this.
    • setLoginModuleName

      public KerberosConfig setLoginModuleName(String loginModuleName)
      The JAAS login module name. When null (default), a built-in JAAS configuration is created automatically based on the other properties in this class. Set this only if you have a custom JAAS login configuration file and entry name.
      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