クラス MiniKdc

java.lang.ObjectSE
org.springframework.security.kerberos.test.MiniKdc

public class MiniKdc extends ObjectSE
Apache Directory サーバーに基づくミニ KDC。テストケースに埋め込むことも、スタンドアロン KDC としてコマンドラインから使用することもできます。

テストケース内から:

MiniKdc は起動時に 1 つのシステムプロパティを設定し、停止時に設定を解除します。

  • sun.security.krb5.debug: 構成で指定されたデバッグ値に設定します
このため、複数の MiniKdc インスタンスを並行して起動することはできません。例: それぞれ KDC を起動するテストケースを並行して実行します。これを実現するには、並行して実行されるすべてのテストケースに単一の MiniKdc を使用する必要があります。

MiniKdc のデフォルト設定値は次のとおりです。

  • org.name= 例 (used to create the REALM)
  • org.domain=COM (used to create the REALM)
  • kdc.bind.address= ローカルホスト
  • kdc. ポート =0 (ephemeral port)
  • インスタンス =DefaultKrbServer
  • チケットの有効期間最大 8640 万 (1 日)
  • 最大再生可能寿命 =604800000 (7 日)
  • トランスポート =TCP
  • デバッグ = 偽
生成された krb5.conf は TCP 接続を強制します。
  • フィールドの詳細

  • コンストラクターの詳細

    • MiniKdc

      public MiniKdc(PropertiesSE conf, FileSE workDir) throws ExceptionSE
      MiniKdc を作成します。
      パラメーター:
      conf - MiniKdc 構成。
      workDir - working directory, it should be the build directory. Under this directory an ApacheDS working directory will be created, this directory will be deleted when the MiniKdc stops.
      例外:
      ExceptionSE - thrown if the MiniKdc could not be created.
  • メソッドの詳細

    • main

      public static void main(StringSE[] args) throws ExceptionSE
      例外:
      ExceptionSE
    • createConf

      public static PropertiesSE createConf()
      MiniKdc のデフォルト設定を返す便利なメソッド。

      The returned configuration is a copy, it can be customized before using it to create a MiniKdc.

      戻り値:
      a MiniKdc default configuration.
    • setTransport

      public void setTransport(StringSE transport)
    • getPort

      public int getPort()
      Returns the port of the MiniKdc.
      戻り値:
      the port of the MiniKdc.
    • getHost

      public StringSE getHost()
      Returns the host of the MiniKdc.
      戻り値:
      the host of the MiniKdc.
    • getRealm

      public StringSE getRealm()
      Returns the realm of the MiniKdc.
      戻り値:
      the realm of the MiniKdc.
    • getKrb5conf

      public FileSE getKrb5conf()
    • start

      public void start() throws ExceptionSE
      Starts the MiniKdc.
      例外:
      ExceptionSE - thrown if the MiniKdc could not be started.
    • stop

      public void stop()
      Stops the MiniKdc
    • createPrincipal

      public void createPrincipal(StringSE principal, StringSE password) throws ExceptionSE
      Creates a principal in the KDC with the specified user and password.
      パラメーター:
      principal - principal name, do not include the domain.
      password - パスワード。
      例外:
      ExceptionSE - thrown if the principal could not be created.
    • createPrincipal

      public void createPrincipal(FileSE keytabFile, StringSE... principals) throws ExceptionSE
      KDC に複数のプリンシパルを作成し、キータブファイルに追加します。
      パラメーター:
      keytabFile - keytab file to add the created principals.
      principals - principals to add to the KDC, do not include the domain.
      例外:
      ExceptionSE - thrown if the principals or the keytab file could not be created.