第2章 Elytron サブシステム
2.1. ファイルシステムベースのアイデンティティーストアを使用した認証の設定
JBoss EAP で
filesystem-realmを設定します。/subsystem=elytron/filesystem-realm=exampleFsRealm:add(path=fs-realm-users,relative-to=jboss.server.config.dir)
ディレクトリーが
jboss.server.config.dir外にある場合は、pathとrelative-toの値を適切に変更する 必要があります。ユーザーを追加します。
filesystem-realmを使用する場合は、管理 CLI を使用してユーザーを追加できます。/subsystem=elytron/filesystem-realm=exampleFsRealm:add-identity(identity=user1) /subsystem=elytron/filesystem-realm=exampleFsRealm:set-password(identity=user1, clear={password="password123"}) /subsystem=elytron/filesystem-realm=exampleFsRealm:add-identity-attribute(identity=user1, name=Roles, value=["Admin","Guest"])simple-role-decoderを追加します。/subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles)
この
simple-role-decoderは、Roles属性からのプリンシパルのロールをデコードします。ロールが別の属性にある場合はこの値を変更できます。security-domainを設定します。/subsystem=elytron/security-domain=exampleFsSD:add(realms=[{realm=exampleFsRealm,role-decoder=from-roles-attribute}],default-realm=exampleFsRealm,permission-mapper=default-permission-mapper)undertowサブシステムでapplication-security-domainを設定します。/subsystem=undertow/application-security-domain=exampleApplicationDomain:add(security-domain=exampleFsSD)
注記undertowサブシステムのapplication-security-domainは、Configuration → Subsystems → Web (Undertow) → Application Security Domain に移動して管理コンソールで設定できます。アプリケーションの
web.xmlおよびjboss-web.xmlを設定します。JBoss EAP で設定した
application-security-domain使用するように、アプリケーションのweb.xmlおよびjboss-web.xmlを更新する必要があります。この例については、Configure Web Applications to Use Elytron or Legacy Security for Authentication で参照できます。
アプリケーションは、認証にファイルシステムベースのアイデンティティーストアを使用しています。