1
votes

I have a wso2 is 5.1.0 server runign on Debian. I have a simple servlet that is authenticating using Oauth2 and works perfectly with the users in the primary store.

I have created a secondary store pointing to an openldap server. I have some users and groups and are seen correctly from the IS. I see that when I try to see the User Profile i get the following error:

Error while loading user profile metadata

But when I try to authenticate using the users in the ldap server i get a Login Failed error. I have tried to use both username, DOMAIN/username and username@DOMAIN but none of the worked.

I am starting to think that it could be related to the Calim configuration as the users in the different stores have different values but I don't know how to solve it.

Any ideas on what I am doing wrong?

UPDATED:

This is how I have defined the secondary store.

<?xml version="1.0" encoding="UTF-8"?><UserStoreManager class="org.wso2.carbon.user.core.ldap.ReadWriteLDAPUserStoreManager">
      <Property name="ConnectionURL">ldap://xxxx:389</Property>
      <Property name="ConnectionName">cn=admin,dc=xx,dc=xx</Property>
      <Property encrypted="true" name="ConnectionPassword">xxxx</Property>
      <Property name="UserSearchBase">ou=users,dc=nextel,dc=es</Property>
      <Property name="UserEntryObjectClass">inetOrgPerson</Property>
      <Property name="UserNameAttribute">cn</Property>
      <Property name="UserNameSearchFilter">(&amp;(objectClass=person)cn=?))</Property>
      <Property name="UserNameListFilter">(objectClass=person)</Property>
      <Property name="UserDNPattern"/>
      <Property name="DisplayNameAttribute"/>
      <Property name="Disabled">false</Property>
      <Property name="ReadGroups">true</Property>
      <Property name="WriteGroups">true</Property>
      <Property name="GroupSearchBase">ou=groups,dc=xx,dc=xx</Property>
      <Property name="GroupEntryObjectClass">groupOfNames</Property>
      <Property name="GroupNameAttribute">cn</Property>
      <Property name="GroupNameSearchFilter">(&amp;(objectClass=groupOfNames)(cn=?))</Property>
      <Property name="GroupNameListFilter">(objectClass=groupOfNames)</Property>
      <Property name="RoleDNPattern"/>
      <Property name="MembershipAttribute">member</Property>
      <Property name="MemberOfAttribute"/>
      <Property name="BackLinksEnabled">false</Property>
      <Property name="UserNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
      <Property name="UserNameJavaScriptRegEx">^[\S]{3,30}$</Property>
      <Property name="UsernameJavaRegExViolationErrorMsg">Username pattern policy violated.</Property>
      <Property name="PasswordJavaRegEx">^[\S]{5,30}$</Property>
      <Property name="PasswordJavaScriptRegEx">^[\S]{5,30}$</Property>
      <Property name="PasswordJavaRegExViolationErrorMsg">Password pattern policy violated.</Property>
      <Property name="RoleNameJavaRegEx">[a-zA-Z0-9._-|//]{3,30}$</Property>
      <Property name="RoleNameJavaScriptRegEx">^[\S]{3,30}$</Property>
      <Property name="SCIMEnabled">false</Property>
      <Property name="BulkImportSupported">true</Property>
      <Property name="EmptyRolesAllowed">true</Property>
      <Property name="PasswordHashMethod">PLAIN_TEXT</Property>
      <Property name="MultiAttributeSeparator">,</Property>
      <Property name="MaxUserNameListLength">100</Property>
      <Property name="MaxRoleNameListLength">100</Property>
      <Property name="kdcEnabled">false</Property>
      <Property name="defaultRealmName">WSO2.ORG</Property>
      <Property name="UserRolesCacheEnabled">true</Property>
      <Property name="ConnectionPoolingEnabled">false</Property>
      <Property name="ReadTimeout">5000</Property>
      <Property name="LDAPConnectionTimeout">5000</Property>
      <Property name="RetryAttempts">0</Property>
      <Property name="DomainName">incloudLDAP</Property>
      <Property name="Description"/>
</UserStoreManager>

I can see the users in the list and even create a new one on the LDAP through WSO2 Is, but i cannot see the parameters.

UPDATED:

THe user structure in the LDAP is quite simple.

enter image description here

1

1 Answers

1
votes

For the authentication issue, you need to verify "UserNameSearchFilter" attribute is correctly configured. It must mapped to the user name attribute in your ladp server.

<Property name="UserNameSearchFilter">(&amp;(objectClass=user)(cn=?))</Property>

Also you can map attibutes from different user stores to a same wso2 claim. In the mapped attibute section use something like follows,

PRIMARY/attribute1;FOO/attribute2;BAR/attribute3

Also refer - https://docs.wso2.com/display/IS510/Adding+Claim+Mapping