LdapExtLoginModule与LdapLoginModule Jboss5.1

时间:2015-04-28 12:17:32

标签: jboss ldap

对于正在运行的LdapLoginModule ,我有这个conf。

beforeEach(function () {
    module('myModul');

    globVal = {
        customer: {why: 'idle'},
        goHome: 1,
        goHomeCounter:1
    };

    module(function ($provide) {
        $provide.value('globVal', globVal);
    });

    inject(function ($injector, $location) {
        $rootScope = $injector.get('$rootScope');
        $scope = $rootScope.$new();
        controller = $injector.get('$controller')("appCtrl", {$scope: $scope});
        location = $location;
    });
}); 

describe("init", function () {

    it('Should init', function () {
        expect($scope).toBeDefined();
    });

});

describe("globVal idle", function () {

    it('should globVal be idle', function () {
        expect(globVal.customer.why).toBe('idle');
    });

});

describe("startTimeout", function () {

    it('Should have method startTimeout ', function () {
        expect($scope.startTimeout).toBeDefined();
    });

});

现在,我必须通过使用Ext Module来建立与LDAP的连接,因为这一次搜索树的每个子文件夹。我不希望用户必须属于DEPT组。 Programari,就像上面的例子一样。所以我在login-conf.xml中进行了更改:

        <login-module code="org.jboss.security.auth.spi.LdapLoginModule" flag="required">
            <module-option name = "unauthenticatedIdentity">nobody</module-option>
            <module-option name="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</module-option>
            <module-option name="java.naming.provider.url">ldap://ldap.server:389/</module-option>
            <module-option name="java.naming.security.authentication">simple</module-option>
            <module-option name="principalDNPrefix">CN=</module-option>
            <module-option name="principalDNSuffix">,OU=DEPT. PROGRAMARI,OU=LIMIT - CECOMASA,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
            <module-option name="baseCtxDN">OU=LIMIT - CECOMASA,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>                                                                                                                                
            <module-option name="baseFilter">(sAMAccountName={0})</module-option>
            <module-option name="uidAttributeID">member</module-option>
            <module-option name="matchOnUserDN">true</module-option>
            <module-option name="rolesCtxDN">OU=LIMIT - CECOMASA,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
            <module-option name="roleFilter">(member={0})</module-option>                                                 
            <module-option name="roleAttributeID">cn</module-option>                                                               
            <module-option name="searchTimeLimit">10000</module-option>
            <module-option name="searchScope">SUBTREE_SCOPE</module-option>
        </login-module>

我也尝试了很多其他测试,但总是给我这个错误:

<login-module code="org.jboss.security.auth.spi.LdapExtLoginModule" flag="required">
      <module-option name="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</module-option>
      <module-option name="java.naming.provider.url">ldap://ldap.server:389/</module-option>
      <module-option name="bindDN">CN=Andreu Serra,OU=DEPT. PROGRAMARI,OU=LIMIT - CECOMASA,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
      <module-option name="bindCredential">secret</module-option>

      <module-option name="baseCtxDN">OU=people,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
      <module-option name="baseFilter">(sAMAccountName={0})</module-option>
      <module-option name="rolesCtxDN">OU=people,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
      <module-option name="roleFilter">(member={0})</module-option>
      <module-option name="roleAttributeID">cn</module-option>
      <module-option name="roleAttributeIsDN">false</module-option>
      <module-option name="searchScope">SUBTREE_SCOPE</module-option>
      <module-option name="allowEmptyPasswords">false</module-option>
</login-module>

任何帮助都会被贬低。

1 个答案:

答案 0 :(得分:1)

最后,解决方案是:

<login-module code="org.jboss.security.auth.spi.LdapExtLoginModule" flag="required">
      <module-option name="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</module-option>
      <module-option name="java.naming.provider.url">ldap://ldap.server:389/</module-option>
      <module-option name="bindDN">CN=Andreu Serra,OU=DEPT. PROGRAMARI,OU=LIMIT - CECOMASA,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
      <module-option name="bindCredential">trx$951</module-option>

      <module-option name="baseCtxDN">OU=LIMIT - CECOMASA,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
      <module-option name="baseFilter">(sAMAccountName={0})</module-option>
      <module-option name="rolesCtxDN">OU=LIMIT - CECOMASA,DC=LIMIT_CECOMASA,DC=LOCAL</module-option>
      <module-option name="roleFilter">(member={1})</module-option>
      <module-option name="roleAttributeID">cn</module-option>
      <module-option name="searchScope">SUBTREE_SCOPE</module-option>
</login-module>

我建议安装JXplorer或类似的程序来浏览LDAP目录并查看所有属性及其值。

希望这可以提供帮助。