簡體   English   中英

在 Wildfly Elytron 安全中使用 2authorization 領域

[英]Using 2authorization realm in Wildfly Elytron Security

我想通過 ldap 使用身份驗證領域。 這工作正常。 其次,我想將我的應用程序的 UserRoles 存儲在 Roles 表中,這也很好。 (下面的示例,帶有聚合領域)

但我不知道如何獲得這兩個角色。 來自 LDAP 和我的 Roles 表的角色放在一起。

我錯過了什么?

         <security-domain name="securtiyDomain" default-realm="my-realm" permission-mapper="default-permission-mapper">
                <realm name=jdbc-realm"   role-decoder="from-roles-attribute"/>
            </security-domain>
   
        <security-realms>
            <aggregate-realm name="my-realm" authentication-realm="ldap-realm" authorization-realms="jdbc-realm ldap-realm"/>

            <jdbc-realm name="jdbc-realm">
                <principal-query .... >
                    <attribute-mapping>
                        <attribute to="roles" index="1"/>
                    </attribute-mapping>
                </principal-query>
            </jdbc-realm>

            <ldap-realm name="ldap-realm" dir-context="ldap-connection" direct-verification="true">
                <identity-mapping ...>
                    <attribute-mapping>
                        <attribute from="cn" to="Roles" .../>
                    </attribute-mapping>
                    <user-password-mapper from="userPassword"/>
                </identity-mapping>
            </ldap-realm>

            <simple-role-decoder name="from-roles-attribute" attribute="roles"/>

您的安全域配置在其域列表中沒有聚合域my-realm 試試下面的方法:

<security-domain name="securtiyDomain" default-realm="my-realm" permission-mapper="default-permission-mapper">
    <realm name=my-realm"   role-decoder="from-roles-attribute"/>
</security-domain>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM