Skip to content

Commit

Permalink
for #75
Browse files Browse the repository at this point in the history
  • Loading branch information
mlbiam committed Mar 9, 2020
1 parent f75960b commit 34bd27b
Show file tree
Hide file tree
Showing 4 changed files with 603 additions and 3 deletions.
17 changes: 14 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,20 @@
<repositories>
<repository>
<id>tremolosecurity-dependencies</id>
<name>Tremolo Security Inc Custom Repository</name>
<!-- <url>https://nexus.tremolo.io/repository/betas/</url> -->
<url>https://nexus.tremolo.io/repository/dependencies/</url>
</repository>


</repositories>

<distributionManagement>
<repository>
<!-- <id>nexus.tremolo.io</id> -->
<id>nexus.tremolo.io</id>
<name>tremolo.io-releases</name>
<url>https://nexus.tremolo.io/repository/releases/</url>
<url>s3://tremolosecurity-maven/repository/betas</url>
<!-- <url>https://nexus.tremolo.io/repository/betas/</url> -->
</repository>

</distributionManagement>
Expand Down Expand Up @@ -241,6 +245,13 @@
</dependencies>

<build>
<extensions>
<extension>
<groupId>com.gkatzioura.maven.cloud</groupId>
<artifactId>s3-storage-wagon</artifactId>
<version>2.3</version>
</extension>
</extensions>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
Expand Down Expand Up @@ -268,7 +279,7 @@
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<version>1.8</version>
<executions>
<execution>
<phase>package</phase>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,62 @@ public void testUidSearch() throws LDAPException {
con.disconnect();

}

@Test
public void testUidSearchWithAttributes() throws LDAPException {

LDAPAttributeSet attribs = new LDAPAttributeSet();
attribs.add(new LDAPAttribute("objectClass", "inetOrgPerson"));
// attribs.getAttribute("objectClass").addValue("customPerson");
attribs.add(new LDAPAttribute("cn", "Test User"));
attribs.add(new LDAPAttribute("sn", "User"));
attribs.add(new LDAPAttribute("givenName", "Test"));
// attribs.add(new LDAPAttribute("testAttrib", "testVal"));
attribs.add(new LDAPAttribute("uid", "testmultiuser"));


// attribs.add(new LDAPAttribute("globalTestAttrib","globalTestVal"));
LDAPEntry entry2 = new LDAPEntry("uid=testmultiuser,cn=users2,dc=ad,dc=com", attribs);

LDAPConnection con = new LDAPConnection();
con.connect("localhost", 50983);
// con.bind(3,"cn=admin,o=mycompany","manager".getBytes());
LDAPSearchResults res = con.search("cn=users2,dc=ad,dc=com", 2, "(&(objectclass=inetorgperson)(uid=testmultiuser))", new String[] {"uid","sn"}, false);

int size = 0;

while (res.hasMore()) {
LDAPEntry fromDir = res.next();
LDAPEntry controlEntry = null;// control.get(fromDir.getEntry().getDN());

if (size == 0) {
controlEntry = entry2;
} else if (size == 1) {
controlEntry = null;
} else {
controlEntry = null;
}

if (controlEntry == null) {
fail("Entry " + fromDir.getDN() + " should not be returned");
return;
}

if (!Util.compareEntry(fromDir, controlEntry)) {
fail("The entry was not correct : " + fromDir.toString());
return;
}

size++;
}

if (size != 1) {
fail("Not the correct number of entries : " + size);
}

con.disconnect();

}

@Test
public void testOCSearch() throws LDAPException {
Expand Down
Loading

0 comments on commit 34bd27b

Please sign in to comment.