Class KerberosConnection

java.lang.Object
org.apache.calcite.avatica.remote.KerberosConnection

public class KerberosConnection extends Object
A utility to perform Kerberos logins and renewals.
  • Field Details

    • PERCENT_OF_LIFETIME_TO_RENEW

      public static final float PERCENT_OF_LIFETIME_TO_RENEW
      The percentage of the Kerberos ticket's lifetime which we should start trying to renew it
      See Also:
    • RENEWAL_PERIOD

      public static final long RENEWAL_PERIOD
      How long should we sleep between checks to renew the Kerberos ticket
      See Also:
  • Constructor Details

    • KerberosConnection

      public KerberosConnection(String principal, File keytab)
      Constructs an instance.
      Parameters:
      principal - The Kerberos principal
      keytab - The keytab containing keys for the Kerberos principal
  • Method Details

    • getSubject

      public Subject getSubject()
    • login

      public void login()
      Perform a Kerberos login and launch a daemon thread to periodically perfrom renewals of that Kerberos login. Exceptions are intentionally caught and rethrown as unchecked exceptions as there is nothing Avatica itself can do if the Kerberos login fails.
      Throws:
      RuntimeException - If the Kerberos login fails
    • stopRenewalThread

      public void stopRenewalThread()
      Stops the Kerberos renewal thread if it is still running. If the thread was already started or never started, this method does nothing.
    • isIbmJava

      public static boolean isIbmJava()
      Returns whether or not the current environment is IBM Java. Otherwise, assumed to be Oracle Java/OpenJDK.
      Returns:
      True if the environment is IBM Java, false otherwise.
    • getKrb5LoginModuleName

      public static String getKrb5LoginModuleName()
      Returns the KRB5 LoginModule implementation. This is JVM-vendor dependent.
      Returns:
      The class name of the KRB5 LoginModule