Class SimpleKdcServerUtil

java.lang.Object
org.apache.hadoop.hbase.util.SimpleKdcServerUtil

public final class SimpleKdcServerUtil extends Object
Utility for running SimpleKdcServer. Kerby KDC server is favored over Hadoop org.apache.hadoop.minikdc server which has support in the HBaseTestingUtility at #setupMiniKdc. The Kerby KDC Server came in with HBASE-5291. Its preferred. Less baggage.
See Also:
  • Field Details

    • LOG

      static final org.slf4j.Logger LOG
  • Constructor Details

  • Method Details

    • getRunningSimpleKdcServer

      public static org.apache.kerby.kerberos.kerb.server.SimpleKdcServer getRunningSimpleKdcServer(File testDir, Supplier<Integer> randomPortGenerator) throws org.apache.kerby.kerberos.kerb.KrbException, IOException
      Returns a running kdc server. Use this method rather than start the SimpleKdcServer yourself because it takes care of BindExceptions which can happen even though port-picking is random (between the choice of port number and bind, it could have been used elsewhere).
      Returns:
      A SimpleKdcServer on which 'start' has been called; be sure to call stop on this instance when done.
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException
      IOException
    • getRunningSimpleKdcServer

      static org.apache.kerby.kerberos.kerb.server.SimpleKdcServer getRunningSimpleKdcServer(File testDir, Supplier<Integer> randomPortGenerator, boolean portClash) throws org.apache.kerby.kerberos.kerb.KrbException, IOException
      Internal method for testing.
      Parameters:
      portClash - True if we want to generate BindException (for testing).
      Returns:
      A running SimpleKdcServer on loopback/'localhost' on a random port
      Throws:
      org.apache.kerby.kerberos.kerb.KrbException
      IOException
      See Also: