如何更改WSO2 IS 4.5.0的主LDAP域

时间:2013-11-14 23:29:29

标签: ldap wso2is apacheds ldap-client

我想修改主用户存储的域(基于LDAP),但我无法成功。

user-mgt.xml中的当前域名为dc=wso2,dc=org,我想更改为dc=foobar,dc=com

我修改后的user-mgt.xml是:

...
    <UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
            <Property name="TenantManager">org.wso2.carbon.user.core.tenant.CommonHybridLDAPTenantManager</Property>

            <Property name="defaultRealmName">FOOBAR.COM</Property>

            <Property name="kdcEnabled">false</Property>
            <Property name="Disabled">false</Property>                                   
            <Property name="ConnectionURL">ldap://localhost:${Ports.EmbeddedLDAP.LDAPServerPort}</Property>
            <Property name="ConnectionName">uid=admin,ou=system</Property>
            <Property name="ConnectionPassword">admin</Property>
            <Property name="passwordHashMethod">SHA</Property>
            <Property name="UserNameListFilter">(objectClass=person)</Property>
            <Property name="UserEntryObjectClass">identityPerson</Property>

            <Property name="UserSearchBase">ou=Users,dc=foobar,dc=com</Property>

            <Property name="UserNameSearchFilter">(&amp;(objectClass=person)(uid=?))</Property>
            <Property name="UserNameAttribute">uid</Property>
            <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
            <Property name="ServicePasswordJavaRegEx">^[\\S]{5,30}$</Property>
            <Property name="ServiceNameJavaRegEx">^[\\S]{2,30}/[\\S]{2,30}$</Property>
            <Property name="UsernameJavaScriptRegEx">^[\S]{3,30}$</Property>
            <Property name="UsernameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
            <Property name="RolenameJavaScriptRegEx">^[\S]{3,30}$</Property>
            <Property name="RolenameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
            <Property name="ReadGroups">true</Property>
            <Property name="WriteGroups">true</Property>
            <Property name="EmptyRolesAllowed">true</Property>

            <Property name="GroupSearchBase">ou=Groups,dc=foobar,dc=com</Property>

            <Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
            <Property name="GroupEntryObjectClass">groupOfNames</Property>
            <Property name="GroupNameSearchFilter">(&amp;(objectClass=groupOfNames)(cn=?))</Property>
            <Property name="GroupNameAttribute">cn</Property>
            <Property name="SharedGroupNameAttribute">cn</Property>

            <Property name="SharedGroupSearchBase">ou=SharedGroups,dc=foobar,dc=com</Property>

            <Property name="SharedGroupEntryObjectClass">groupOfNames</Property>
            <Property name="SharedGroupNameListFilter">(objectClass=groupOfNames)</Property>
            <Property name="SharedGroupNameSearchFilter">(&amp;(objectClass=groupOfNames)(cn=?))</Property>
            <Property name="SharedTenantNameListFilter">(objectClass=organizationalUnit)</Property>
            <Property name="SharedTenantNameAttribute">ou</Property>
            <Property name="SharedTenantObjectClass">organizationalUnit</Property>
            <Property name="MembershipAttribute">member</Property>
            <Property name="UserRolesCacheEnabled">true</Property>

            <Property name="UserDNPattern">uid={0},ou=Users,dc=foobar,dc=com</Property>
            <Property name="RoleDNPattern">cn={0},ou=Groups,dc=foobar,dc=com</Property>

            <Property name="SCIMEnabled">true</Property>
            <Property name="MaxRoleNameListLength">100</Property>
            <Property name="MaxUserNameListLength">100</Property>
        </UserStoreManager>
...

启动WSO2 IS时的错误是:

Caused by: org.wso2.carbon.user.core.UserStoreException: [LDAP: error code 32 - NO_SUCH_OBJECT: failed for     SearchRequest
        baseDn : 'ou=Groups,dc=foobar,dc=com'
        filter : '(&(2.5.4.0=groupofnames)(2.5.4.3=*))'
        scope : whole subtree
        typesOnly : false
        Size Limit : 100
        Time Limit : 11
        Deref Aliases : deref Always
        attributes : 'cn'
: ERR_268 Cannot find a partition for ou=Groups,dc=foobar,dc=com]
    at org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager.getLDAPRoleNames(ReadOnlyLDAPUserStoreManager.java:1024)
    at org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager.doGetRoleNames(ReadOnlyLDAPUserStoreManager.java:1134)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.getRoleNames(AbstractUserStoreManager.java:2485)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.getRoleNames(AbstractUserStoreManager.java:2382)
    at org.wso2.carbon.user.core.common.AbstractUserStoreManager.getRoleNames(AbstractUserStoreManager.java:2375)
    at org.wso2.carbon.event.core.internal.subscription.registry.RegistrySubscriptionManager.<init>(RegistrySubscriptionManager.java:91)
    ... 65 more

我应该缺少什么?

2 个答案:

答案 0 :(得分:2)

解决了!

我已在以下文件中替换旧域和defaultRealmName

  1. IS_HOME/repository/conf/user-mgt.xml
  2. IS_HOME/repository/conf/tenant-mgt.xml
  3. IS_HOME/repository/conf/embedded-ldap.xml
  4. 我已为dc=wso2,dc=org替换dc=foobar,dc=comdefaultRealmName=WSO2.ORG替换为FOOBAR.COM,然后我删除了root中名为IS_HOME/repository/data/org.wso2.carbon.directory的目录 ..因此,重新启动时将再次创建一个新的默认分区。

    现在,如果您使用任何LDAP客户端连接到WSO2IS的嵌入式LDAP(10389端口),您将看到新域FOOBAR.COM而不是WSO2.ORG

    我希望这很有用。

答案 1 :(得分:0)

我想,您正在尝试更改“dc = wso2,dc = org”值。您无法使用user-mgt.xml文件更改它。 user-mgt.xml文件用于将WSO2IS与LDAP或AD或JDBC用户存储连接。这意味着可以在外部运行LDAP,您需要配置user-mgt.xml文件以使用适当的配置连接该LDAP。默认情况下,WSO2IS附带嵌入式LDAP服务器,默认情况下,user-mgt.xml文件已配置为指向该嵌入式LDAP服务器。此嵌入式LDAP使用“dc = wso2,dc = org”值创建。您可以在“embedded-ldap.xml”文件中找到此嵌入式LDAP的配置。但是没有参数来配置域“”dc = wso2,dc = org“。这意味着,我们无法配置它。但您仍然可以使用ApacheDS,OpenDJ和OpenLDAP创建自己的LDAP服务器,并可以将其指向WSO2 Identity Server。