4.2.3. デフォルト設定の適用

デフォルト設定のアプローチは、Elytron Client によって提供される設定に完全に依存します。

//create your runnable for establishing a connection
Runnable runnable =
    new Runnable() {
      public void run() {
        try {
           //Establish your connection and do some work
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    };

// run runnable directly
runnable.run();

デフォルト設定を提供するために、Elytron クライアントはファイルシステム上の wildfly-config.xml ファイルの自動検出を試みます。以下の場所を探します。

  • クライアントコード外で設定された wildfly.config.url システムプロパティーで指定される場所
  • クラスパスルートディレクトリー
  • クラスパスの META-INF ディレクトリー。
  • 現在のユーザーのホームディレクトリー
  • 現在の作業ディレクトリー。

以下の例は、クライアントの wildfly-config.xml ファイルの基本設定として使用できます。

基本的な wildfly-config.xml

<configuration>
  <authentication-client xmlns="urn:elytron:client:1.2">
    <authentication-rules>
      <rule use-configuration="default" />
    </authentication-rules>
    <authentication-configurations>
      <configuration name="default">
        <sasl-mechanism-selector selector="#ALL" />
        <set-mechanism-properties>
          <property key="wildfly.sasl.local-user.quiet-auth" value="true" />
        </set-mechanism-properties>
        <providers>
          <use-service-loader/>
        </providers>
      </configuration>
    </authentication-configurations>
  </authentication-client>
</configuration>

注記

ANONYMOUS メカニズムは、non-anonymous ユーザーの承認をサポートしません。そのため、set-authorization-name は Elytron クライアント設定ファイルの set-anonymous では機能しません。set-authorization-name を設定する場合は、承認されたアイデンティティーの set-user-name も指定する必要があります。