Deno Agüero
Deno Agüero

Reputation: 599

LDAP Search Filter for uid in Java

I want to define a search filter for the user id in java, but I don't understand the right syntax. Here is my code:

 String searchFilter = searchAttribute + "=(|(" + "in" + ")(" + "ex" + "))" + name;

The filter should search e.g. after "in12345" or "ex12345" My searchAttribute in this case would be the uid. How can I achieve this?

Upvotes: 1

Views: 985

Answers (1)

James Watson
James Watson

Reputation: 464

Not really a Java question but I think the resulting String is something like this:

(|(uid=in12345)(uid=ex12345))

You should probably get an LDAP browser and figure out the syntax and then figure out how to build it in Java. This is also a place where format strings will help.

Upvotes: 2

Related Questions