I have two kinds of user in our Active Directory: technical user and user user.
With LDAP filter (&(objectclass=person)(uid=%v))
I get for both some results.
But for my application I need a more detailed filter or else there will be no results (checkPassword method of com.ibm.websphere.security.UserRegistry). So I thought of this filter:
(&(|(objectcategory=person)(objectclass=person))(uid=%v))
This works fine for technical users, but for the other I get EntryNotFoundException: CWIML4001E:
Why is that? Shouldn't it at least give me the result of the simple filter? Is it not processing the filter combinations because of the OR?:
- 1. uid=%v AND objectclass=person
- 2. uid=%v AND objectcategory=person
I also tried the following filter to be on the save side:
(|(&(objectclass=person)(uid=%v))(&(objectcategory=person)(uid=%v)))
But the result is the same.
Some background:
I use Liberty and run the following simple servlet on it for testing:
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
try {
if (WSSecurityHelper.isServerSecurityEnabled()) {
String testuser = "myuser";
String password = "mypassword";
UserRegistry registry = RegistryHelper.getUserRegistry("LdapRegistry");
response.getWriter().append("<p>Output: " + registry.getUserSecurityName(testuser) +"</p>");
response.getWriter().append("<p>Output: " + registry.isValidUser(testuser) +"</p>");
response.getWriter().append("<p>Output: " + registry.isValidUser(registry.getUserSecurityName(testuser)) +"</p>");
}else{
response.getWriter().append("<p>Output: No Sec Enabled</p>");
}
} catch (Exception e) {
response.getWriter().print("<p>Exception caught: " + e + " </p>");
}
}
The application fails at getUserSecurityName(testuser)
when testuser is not a technical user.
EDIT:
LDIF techuser:
>> Dn: uid=techuser,ou=technical,ou=people,o=appsdir
1> someWorkingOrgAlias:
1> someHomeOrgAlias:
1> someWorkingOrg:
1> someUserSuspended:
1> mail:
1> givenName:
1> cn:
1> c:
1> someIsUserEnabledIntra:
1> someSupervisor:
1> someSourceProcess:
1> someAppResp:
2> someAncestors:
1> someHomeOrg:
1> someOrgs:
1> someAuthMode:
1> uid: techuser;
7> objectClass: someTechPerson; somePerson; sPerson; inetOrgPerson; organizationalPerson; person; top;
1> someUserEnabled:
1> sn:
LDIF user user:
>> Dn: uid=useruser,ou=employees,ou=people,o=appsdir
2> appsOrgs:
1> departmentNumber:
1> someLocationCode:
1> somePlant2:
1> ou:
1> someCompanyID:
1> somePlant1:
1> someHomeOrg:
6> someEntGrps:
4> someAuthGrps:
3> someScopedEntitlements:
1> telephoneNumber:
1> mail:
2> someAncestors:
1> c:
1> sn:
1> someCostCenter:
1> uid: useruser;
1> givenName:
1> cn:
8> objectClass: organizationalPerson; person; sEmployeePerson; sInternalEmployee; sPerson; inetOrgPerson; somePerson; top;
Thats all I can see with LDP.exe. My search base is o=appsdir
.
I try to describe my problem further:
Currently using filter:
(|(&(objectclass=person)(uid=%v))(&(objectcategory=person)(uid=%v)))
Works fine with my code and techusers
.
When using user users
I get The useruser entity was not found. Specify the correct entity or create the missing entity.
from the method registry.getUserSecurityName("useruser")
.
Removing objectcategory
part from my filter: (|(&(objectclass=person)(uid=%v))(&(uid=%v)))
or by just using (uid=%v)
gives me results, but then fails at the method registry.isValidUser(registry.getUserSecurityName("useruser"))
(returns false although it's a valid user). And this also fails for techusers
although with the objectgategory
part in the filter it returned true.
I also tried the following filter:
(|(uid=%v)(&(objectclass=person)(uid=%v))(&(objectcategory=person)(uid=%v)))
with the same result as without the added (uid=%v)
part.