Spring 启动 LDAP 模板查询

Spring Boot LDAP template query

如何在 LDAP 模板中为以下 AD 查询编写查询:

(&(objectcategory=person)(objectclass=user)(userAccountControl:1.2.840.113556.1.4.803:=2)(|(extensionAttribute2=fte)(extensionAttribute2=intern)(extensionAttribute2=awf))(whenchanged>=20200512064756.0Z))

这是我形成的东西,但似乎不起作用:

query().where("whenchanged").is(20200512064756.0Z),
      .and(query().where("extensionAttribute2").is("fte").or("extensionAttribute2").is("intern").or("extensionAttribute2").is("awf")),
      .and(query().where("objectcategory").is("person").and("objectclass").is("user").and("userAccountControl:1.2.840.113556.1.4.803:").is(2))
ZonedDateTime zdt = ZonedDateTime.now(ZoneId.of("UTC")).minusHours(inactiveHours);
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMddHHmmss[.S]'Z'");
        AndFilter af = new AndFilter();
        af.and(new EqualsFilter("objectcategory", "person")).and(new EqualsFilter("objectclass", "user"))
                .and(new EqualsFilter("userAccountControl:1.2.840.113556.1.4.803:", 2));
        OrFilter of = new OrFilter();
        of.or(new EqualsFilter(AD_EXTENSIONATTRIBUTE2, "fte")).or(new EqualsFilter(AD_EXTENSIONATTRIBUTE2, "awf"))
                .or(new EqualsFilter(AD_EXTENSIONATTRIBUTE2, "intern"));
        af.append(of).append(new GreaterThanOrEqualsFilter("whenchanged", zdt.format(formatter)));