我编辑了 user-mgt.xml 以尝试连接到新安装的 Apache DS LDAP。
我在 apache ds ldap 中创建了一个 ldap 用户人员对象:cn=admin,ou=users,o=southpark
我试过只读部分:
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadOnlyLDAPUserStoreManager">
<Property name="ReadOnly">true</Property>
<-Property name="MaxUserNameListLength">100</Property>
<Property name="ConnectionURL">ldap://localhost:10389</Property>
<Property name="ConnectionName">cn=admin,ou=users,o=acme</Property>
<Property name="ConnectionPassword">admin</Property>
<Property name="UserSearchBase">ou=users,o=acme</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserNameAttribute">cn</Property>
<Property name="ReadLDAPGroups">false</Property>
<Property name="GroupSearchBase">ou=groups,o=acme</Property>
<Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ReplaceEscapeCharactersAtUserLogin">true</Property>
<Property name="maxFailedLoginAttempt">0</Property>
</UserStoreManager>
...并获得以下堆栈跟踪:
[2013-02-06 04:33:23,905] INFO {org.wso2.carbon.databridge.agent.thrift.internal.AgentDS}
- Successfully deployed Agent Client
[2013-02-06 04:33:24,896] WARN {net.sf.ehcache.config.ConfigurationFactory}
- No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the
classpath: bundleresource://36.fwk1434669784/ehcache-failsafe.xml
[Fatal Error] :106:7: The content of elements must consist of well-formed character data or markup.
[2013-02-06 04:33:24,965] ERROR {org.wso2.carbon.user.core.internal.Activator} - Cannot start User Manager Core bundle
org.wso2.carbon.user.core.UserStoreException: Error in building Document
at org.wso2.carbon.user.core.common.DefaultRealmService.getConfigurationElement(DefaultRealmService.java:249)
....... 20 more
Caused by: org.xml.sax.SAXParseException; lineNumber: 106; columnNumber: 7; The content of elements must consist of well-formed character data or markup.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at javax.xml.parsers.DocumentBuilder.parse(Unknown Source)
at org.wso2.carbon.utils.CarbonUtils.replaceSystemVariablesInXml(CarbonUtils.java:1035)
... 21 more
我还尝试了读写外部 ldap 连接:
<UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
<Property name="ConnectionURL">ldap://localhost:10389</Property>
<Property name="ConnectionName">cn=admin,ou=users,o=acme</Property>
<Property name="ConnectionPassword">admin</Property>
<Property name="passwordHashMethod">SHA</Property>
<Property name="UserNameListFilter">(objectClass=person)</Property>
<Property name="UserEntryObjectClass">inetOrgPerson</Property>
<Property name="UserSearchBase">ou=users,o=acme</Property>
<Property name="UserNameSearchFilter">(&(objectClass=person)(uid=?))</Property>
<Property name="UserNameAttribute">cn</Property>
<Property name="UsernameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="UsernameJavaScriptRegEx">^[\\S]{3,30}$</Property>
<Property name="RolenameJavaScriptRegEx">^[\\S]{3,30}$</Property>
<Property name="RolenameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
<Property name="PasswordJavaScriptRegEx">^[\\S]{5,30}$</Property>
<Property name="ReadLDAPGroups">true</Property>
<Property name="WriteLDAPGroups">true</Property>
<Property name="EmptyRolesAllowed">false</Property>
<Property name="GroupSearchBase">ou=groups,o=acme</Property>
<Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
<Property name="GroupEntryObjectClass">groupOfNames</Property>
<Property name="GroupNameSearchFilter">(&(objectClass=groupOfNames)(cn=?))</Property>
<Property name="GroupNameAttribute">cn</Property>
<Property name="MembershipAttribute">member</Property>
<Property name="UserRolesCacheEnabled">true</Property>
<Property name="ReplaceEscapeCharactersAtUserLogin">true</Property>
<Property name="maxFailedLoginAttempt">0</Property>
</UserStoreManager>
...并且我在不存在的用户周围遇到以下异常:
[2013-02-06 05:36:13,142] INFO {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager} - LDAP connection created successfully in read-write mode
[2013-02-06 05:36:13,175] ERROR {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager} - There is no user with the user name: wso2.anonymous.user to be added to this role.
[2013-02-06 05:36:13,176] ERROR {org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager} - Role: wso2.anonymous.rolecould not be added.
org.wso2.carbon.user.core.UserStoreException: There is no user with the user name: wso2.anonymous.user to be added to this role.
at org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager.doAddRole(ReadWriteLDAPUserStoreManager.java:1014)
at org.wso2.carbon.user.core.common.AbstractUserStoreManager.addRole(AbstractUserStoreManager.java:1246)
at org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager.addInitialData(ReadWriteLDAPUserStoreManager.java:1834)
开始担心质量,如果开箱即用的安装不容易相互连接......
感谢您的任何帮助...