1

我正在尝试通过 LDAP 定义的角色启用对 Guvnor 的访问。我已经设法让 JBoss 连接到我的 LDAP 服务器并由用户进行身份验证,但我不知道如何通过角色来做到这一点。例如,我想要的是允许所有具有“Guvnor 管理员”角色的用户登录到 Guvnor 页面。

谁能帮我这个?我已经尝试了几种配置,包括修改 guvnor.war 中的 web.xml,但最接近基于角色的授权是通过在 Guvnor 管理页面中配置用户权限。

我的standalone.xml:

<security-domain name="drools-guvnor" cache-type="default">
                    <authentication>
                        <login-module code="LdapExtended" flag="required">
                            <module-option name="java.naming.factory.initial" value="com.sun.jndi.ldap.LdapCtxFactory"/>
                            <module-option name="java.naming.provider.url" value="ldap://myLDAPHost"/>
                            <module-option name="baseCtxDN" value="ou=Users,dc=proj,dc=com"/>
                            <module-option name="baseFilter" value="(uid={0})"/>
                            <module-option name="rolesCtxDN" value="ou=Roles, dc=flow,dc=com"/>
                            <module-option name="roleFilter" value="(member={1})"/>
                            <module-option name="roleAttributeID" value="cn"/>
                            <module-option name="throwValidateError" value="true"/>
                            <module-option name="searchScope" value="ONELEVEL_SCOPE"/>
                        </login-module>
                    </authentication>
                </security-domain>

豆类.xml:

    <security:IdentityImpl> <s:modifies/>
               <!-- JAAS based authentication -->
              <security:authenticatorName>jaasAuthenticator</security:authenticatorName>  
         </security:IdentityImpl>
         <security:jaas.JaasAuthenticator>
              <s:modifies/>
              <security:jaasConfigName>drools-guvnor</security:jaasConfigName>
         </security:jaas.JaasAuthenticator> 

    <!-- SECURITY AUTHORIZATION CONFIGURATION --> <!-- This is used to enable or disable role-based authorization. By default it is disabled. -->        
        <guvnorSecurity:RoleBasedPermissionResolver>
              <s:modifies/>
              <guvnorSecurity:enableRoleBasedAuthorization>true</guvnorSecurity:enableRoleBasedAuthorization>
         </guvnorSecurity:RoleBasedPermissionResolver>

  <weld:scan>
    <!-- Disable the seam-security by drools rules 
    <weld:exclude name="org.jboss.seam.security.permission.RuleBasedPermissionResolver"/>-->
    <!-- TODO remove me when GUVNOR-1196 is fixed -->
    <weld:exclude name="org.drools.guvnor.gwtutil.**"/>
    <weld:exclude name="org.drools.guvnor.client.**"/>
  </weld:scan>
4

0 回答 0