Compare Operation

Determines if an entry contains a specific attribute and value. An LDAP attribute may contain sensitive information which a client is not allowed to read, but is allowed to compare.

Compares the mail: attribute on the entry uid=dfisher,ou=people,dc=ldaptive,dc=org

CompareOperation compare = new CompareOperation(new DefaultConnectionFactory("ldap://"));
CompareResponse res = compare.execute(CompareRequest.builder()
if (res.isTrue()) {
  // compare succeeded
} else {
  // compare failed