Class KerberosConnection
java.lang.Object
org.apache.calcite.avatica.remote.KerberosConnection
A utility to perform Kerberos logins and renewals.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final floatThe percentage of the Kerberos ticket's lifetime which we should start trying to renew itstatic final longHow long should we sleep between checks to renew the Kerberos ticket -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the KRB5 LoginModule implementation.static booleanReturns whether or not the current environment is IBM Java.voidlogin()Perform a Kerberos login and launch a daemon thread to periodically perfrom renewals of that Kerberos login.voidStops the Kerberos renewal thread if it is still running.
-
Field Details
-
PERCENT_OF_LIFETIME_TO_RENEW
public static final float PERCENT_OF_LIFETIME_TO_RENEWThe percentage of the Kerberos ticket's lifetime which we should start trying to renew it- See Also:
-
RENEWAL_PERIOD
public static final long RENEWAL_PERIODHow long should we sleep between checks to renew the Kerberos ticket- See Also:
-
-
Constructor Details
-
KerberosConnection
Constructs an instance.- Parameters:
principal- The Kerberos principalkeytab- The keytab containing keys for the Kerberos principal
-
-
Method Details
-
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
Returns the KRB5 LoginModule implementation. This is JVM-vendor dependent.- Returns:
- The class name of the KRB5 LoginModule
-