第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)
注記Configuration → Subsystems → Web (Undertow) → Application Security Domain に移動して、管理コンソールを使用して
undertow
サブシステムのapplication-security-domain
を設定できます。アプリケーションの
web.xml
およびjboss-web.xml
を設定します。アプリケーションの
web.xml
およびjboss-web.xml
は、JBoss EAP で設定したapplication-security-domain
を使用するように更新する必要があります。このサンプルは、Configure Web Applications to use Elytron or Legacy Security for Authentication で確認できます。
これで、お使いのアプリケーションでファイルシステムベースのアイデンティティーストアを使用して認証を行えるようになりました。