// Bind as the proxy user with an alternate authorization identity, and use
// the "Who Am I?" operation.
AtomicInteger nextMessageID = new AtomicInteger(1);
LDAPAuthenticationHandler authHandler =
new LDAPAuthenticationHandler(reader, writer, "localhost",
nextMessageID);
HashMap<String,List<String>> saslProperties =
new HashMap<String,List<String>>(2);
ArrayList<String> authIDList = new ArrayList<String>(1);
authIDList.add("dn:uid=proxy.user,o=test");
saslProperties.put("authID", authIDList);
ArrayList<String> authzIDList = new ArrayList<String>(1);
authzIDList.add("dn:uid=test.user,o=test");
saslProperties.put("authzID", authzIDList);
authHandler.doSASLPlain(ByteString.empty(),
ByteString.valueOf("password"), saslProperties,
new ArrayList<Control>(),
new ArrayList<Control>());
ByteString authzID = authHandler.requestAuthorizationIdentity();
assertNotNull(authzID);
assertEquals(authzID.toString(), "dn:uid=test.user,o=test");
// Close the connection to the server.