第4章 Elytron サブシステムの例

4.1. 初期状態

JBoss EAP はデフォルトで以下の事前設定されたコンポーネントを提供します。

ApplicationDomain
ApplicationDomain セキュリティードメインは認証に ApplicationRealm および groups-to-roles を使用します。また、ログインパーミッションの割り当てに default-permission-mapper も使用します。
ApplicationRealm
ApplicationRealm セキュリティーレルムは、application-users.properties を使用してプリンシパルを認証し、application-roles.properties を使用してロールを割り当てるセキュリティーレルムです。これらのファイルは、デフォルトで EAP_HOME/standalone/configuration にマップする jboss.server.config.dir の下にあります。これらのファイルは、レガシーのデフォルトセキュリティー設定で使用されるファイルと同じです。
application-http-authentication
application-http-authentication http-authentication-factory は HTTP 上の認証に使用できます。これは、global provider-http-server-mechanism-factory を使用して認証方法をフィルターし、認証するプリンシパルに ApplicationDomain を使用します。BASIC および FORM 認証を許可し、BASICApplication Realm としてアプリケーションに公開します。
application-sasl-authentication
application-sasl-authentication sasl-authentication-factory は SASL を使用した認証に使用できます。これは configured sasl-server-factory を使用して認証方法をフィルターし、また global provider-sasl-server-factory を使用してプロバイダー名をフィルターします。management-sasl-authentication は、プリンシパルの認証に ManagementDomain セキュリティードメインを使用します。
configured (configurable-sasl-server-factory)
これは、メカニズム名を基に使用される sasl-authentication-factory をフィルターするために使用されます。この場合、configuredJBOSS-LOCAL-USER および DIGEST-MD5 で一致します。また、 wildfly.sasl.local-user.default-user$local に設定します。
default-permission-mapper

default-permission-mapper は、default-permissions パーミッションセットを使用して、サーバー上のサービスへアクセスするのにアイデンティティーが必要とする完全セットのパーミッションを割り当てする、簡単なパーミッションマッパーです。

たとえば、default-permission-mapperdefault-permissions パーミッションセットによって指定される org.wildfly.extension.batch.jberet.deployment.BatchPermission を使用してバッチジョブのパーミッションを割り当てます。バッチパーミッションは起動、停止、再起動、破棄、および読み取りで、javax.batch.operations.JobOperator と一致します。

また、default-permission-mapperlogin-permission パーミッションセットによって指定された org.wildfly.security.auth.permission.LoginPermission を使用してログインパーミッションを割り当てます。

elytron (mechanism-provider-filtering-sasl-server-factor)
これは、プロバイダーを基に使用される sasl-authentication-factory をフィルターするために使用されます。この場合、elytronWildFlyElytron プロバイダー名で一致します。
global (provider-http-server-mechanism-factory)
HTTP 認証ファクトリーの作成時にサポートされる認証方法をリストするために使用される HTTP サーバーファクトリーのメカニズム定義です。
global (provider-sasl-server-factory)
これは、SASL 認証ファクトリーを作成するために使用される SASL サーバーファクトリー定義です。
groups-to-roles
groups-to-roles マッパーは、プリンシパルの groups 情報をデコードし、role 情報に使用する簡単なロールデコーダーです。
local (マッパー)
local マッパーは、local セキュリティーレルムにマップする定数ロールマッパーです。認証を local セキュリティーレルムにマップするのに使用されます。
local (セキュリティーレルム)
local セキュリティーレルムは認証を行わず、プリンシパルのアイデンティティーを $local に設定します。
ManagementDomain
ManagementDomain セキュリティードメインは認証に以下の 2 つのセキュリティーレルムを使用します。groups-to-roles による ManagementRealmsuper-user-mapper による local。また、ログインパーミッションの割り当てに default-permission-mapper も使用します。
ManagementRealm
ManagementRealm セキュリティーレルムは、mgmt-users.properties を使用してプリンシパルを認証し、mgmt-roles.properties を使用してロールを割り当てるセキュリティーレルムです。これらのファイルは、デフォルトで EAP_HOME/standalone/configuration にマップする jboss.server.config.dir の下にあります。これらのファイルは、レガシーのデフォルトセキュリティー設定で使用されるファイルと同じです。
management-http-authentication
management-http-authentication http-authentication-factory は、HTTP 上の認証に使用できます。これは global provider-http-server-mechanism-factory を使用して認証方法をフィルターし、ManagementDomain を認証するプリンシパルに使用します。DIGEST 認証を許可し、ManagementRealm としてアプリケーションに公開します。
management-sasl-authentication
management-sasl-authentication sasl-authentication-factory は SASL を使用した認証に使用できます。これは configured sasl-server-factory を使用して認証方法をフィルターし、また global provider-sasl-server-factory を使用してプロバイダー名をフィルターします。management-sasl-authentication は、プリンシパルの認証に ManagementDomain セキュリティードメインを使用します。また、local レルムマッパーを使用して JBOSS-LOCAL-USER を使った認証をマップし、DIGEST-MD5 を使った認証を ManagementRealm にマップします。
super-user-mapper
super-user-mapper マッパーは SuperUser ロールをプリンシパルにマップする定数ロールマッパーです。

4.1.1. セキュリティー

アプリケーションをセキュアにするため、JBoss EAP には事前設定された HTTP 用の application-http-authentication と SASL 用の application-sasl-authentication が同梱されています。application-http-authentication http-authentication-factory は、認証に ApplicationRealmgroups-to-roles を使用する ApplicationDomain を使用します。ApplicationRealm は、ユーザー名、パスワード、およびロール情報に対して application-users.properties および application-roles.properties が関係する properties-realm です。

管理インターフェイスをセキュアにするため、JBoss EAP には事前設定された HTTP 用の management-http-authentication と SASL 用の management-sasl-authentication が同梱されています。management-http-authentication http-authentication-factory は、認証に ManagementRealmgroups-to-roles を使用する ManagementDomain を使用します。ManagementRealm は、ユーザー名、パスワード、およびロール情報に対して mgmt-users.properties および mgmt-roles.properties が関係する properties-realm です。management-sasl-authentication sasl-authentication-factory は JBOSS-LOCAL-USER 認証に local を使用し、DIGEST-MD5 認証に ManagementRealm を使用する ManagementDomain を使用します。

4.1.2. 仕組み

デフォルトでは JBoss EAP のユーザーは存在しませんが、この例の目的で以下のユーザーが追加されています。

表4.1 ユーザー

ユーザー名パスワードロールセキュリティーレルム

Susan

Testing123!

 

ManagementRealm

Sarah

Testing123!

sample

ApplicationRealm

Frank

Testing123!

 

ApplicationRealm

JBoss EAP インスタンスは起動時に、4 つの認証ファクトリーとそれらに関連するセキュリティードメイン、セキュリティーレルム、およびその他設定済みのコンポーネントをロードします。

JBOSS-LOCAL-USER を使用して管理 CLI で管理インターフェイスにアクセスしようとするユーザーがいる場合 (JBoss EAP インスタンスと同じホストから管理 CLI を実行している)、そのユーザーは local セキュリティーレルムを使用して ManagementDomain でユーザーを認証しようとする management-sasl-authentication sasl-authentication-factory に転送されます。

Susan が異なるホストから管理 CLI を使用して管理インターフェイスにアクセスしようとする場合、SASL で DIGEST-MD5 認証を使用します。Susan は、 ManagementRealm セキュリティーレルムを使用して ManagementDomain でユーザーを認証しようとする management-sasl-authentication sasl-authentication-factory に転送されます。

Susan が web ベースの管理コンソールを使用して管理インターフェイスにアクセスしようとする場合、HTTP で DIGEST 認証を使用することになります。Susan は、ManagementRealm セキュリティーレルムを使用して ManagementDomain でユーザーを認証しようとする management-http-authentication http-authentication-factory に転送されます。

アプリケーション sampleApp1.war には /hello.html/secure/hello.html の 2 つの HTML ファイルがあり、BASIC HTTP 認証を使用してパス /secure/* をセキュアにします。Application Realm を使用し、sample ロールが必要です。ユーザーが sampleApp1.war にアクセスしようとすると、application-http-authentication http-authentication-factory に転送されます。ApplicationRealm セキュリティーレルムを使用して ApplicationDomain でユーザーを認証しようとします。

Sarah が /hello.html を要求すると、認証なしでページを閲覧できます。Sarah が /secure/hello.html を要求すると、ユーザー名とパスワードの入力が求められます。ログインに成功した後、Sarah は /secure/hello.html を閲覧できます。Frank や Susan を含むすべてのユーザーが /hello.html にアクセスできますが、Frank と Susan は /secure/hello.html にはアクセスできません。Frank は sample ロールを持たず、Susan は ApplicationRealm セキュリティーレルムに存在しません。