2.4. LDAPベースのアイデンティティーストアを使用した認証の設定

  1. ユーザー名、パスワード、およびロールのLDAP形式を決定します。

    アイデンティティーストアのLDAPサーバーを使用して認証を設定するには、ユーザー名、パスワード、およびロールが保存される方法を決定する必要があります。この例では、以下の構造を使用します。

    dn: dc=wildfly,dc=org
    dc: wildfly
    objectClass: top
    objectClass: domain
    
    dn: ou=Users,dc=wildfly,dc=org
    objectClass: organizationalUnit
    objectClass: top
    ou: Users
    
    dn: uid=jsmith,ou=Users,dc=wildfly,dc=org
    objectClass: top
    objectClass: person
    objectClass: inetOrgPerson
    cn: John Smith
    sn: smith
    uid: jsmith
    userPassword: password123
    
    dn: ou=Roles,dc=wildfly,dc=org
    objectclass: top
    objectclass: organizationalUnit
    ou: Roles
    
    dn: cn=Admin,ou=Roles,dc=wildfly,dc=org
    objectClass: top
    objectClass: groupOfNames
    cn: Admin
    member: uid=jsmith,ou=Users,dc=wildfly,dc=org
  2. dir-context を設定します。

    JBoss EAP から LDAP サーバーに接続するには、URL を指定する dir-context と、サーバーへの接続に使用するプリンシパルを設定する必要があります。

    /subsystem=elytron/dir-context=exampleDC:add(url="ldap://127.0.0.1:10389",principal="uid=admin,ou=system",credential-reference={clear-text="secret"})
    注記

    Jakarta Management ObjectName を使用して LDAP 認証情報を復号化することはできません。代わりに、JBoss EAP の サーバーセキュリティーの設定方法 で説明されているように、クレデンシャルストア を使用して認証情報のセキュリティーを確保できます。

  3. JBoss EAP で ldap-realm を設定します。

    /subsystem=elytron/ldap-realm=exampleLR:add(dir-context=exampleDC,identity-mapping={search-base-dn="ou=Users,dc=wildfly,dc=org",rdn-identifier="uid",user-password-mapper={from="userPassword"},attribute-mapping=[{filter-base-dn="ou=Roles,dc=wildfly,dc=org",filter="(&(objectClass=groupOfNames)(member={0}))",from="cn",to="Roles"}]})
    警告

    参照される LDAP サーバーの紹介にループが含まれる場合は、JBoss EAP サーバーで java.lang.OutOfMemoryError エラーが発生することがあります。

  4. simple-role-decoder を追加します。

    /subsystem=elytron/simple-role-decoder=from-roles-attribute:add(attribute=Roles)
  5. security-domain を設定します。

    /subsystem=elytron/security-domain=exampleLdapSD:add(realms=[{realm=exampleLR,role-decoder=from-roles-attribute}],default-realm=exampleLR,permission-mapper=default-permission-mapper)
  6. undertow サブシステムで application-security-domain を設定します。

    /subsystem=undertow/application-security-domain=exampleApplicationDomain:add(security-domain=exampleLdapSD)
    注記

    undertow サブシステムの application-security-domain は、ConfigurationSubsystemsWeb (Undertow)Application Security Domain に移動して管理コンソールで設定できます。

  7. アプリケーションの 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 で参照できます。

重要

elytron サブシステムが LDAP サーバーを使用して認証を実行する場合、JBoss EAP は 500または内部サーバーエラー (LDAP サーバーにアクセスできない場合) を返します。この動作は、同じ条件下で 401 または非承認のエラーコードを返すレガシー security サブシステムを使用して JBoss EAP の以前のバージョンとは異なります。