Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -419,10 +419,11 @@ public void testLdapRealmMapsUserDNToRole() throws Exception {
PlainActionFuture<AuthenticationResult<User>> future = new PlainActionFuture<>();
ldap.authenticate(new UsernamePasswordToken("Horatio Hornblower", new SecureString(PASSWORD)), future);
final AuthenticationResult<User> result = future.actionGet();
assertThat(result.getStatus(), is(AuthenticationResult.Status.SUCCESS));
assertThat(result, notNullValue());
assertThat(result.toString(), result.getStatus(), is(AuthenticationResult.Status.SUCCESS));
User user = result.getValue();
assertThat(user, notNullValue());
assertThat(user.roles(), arrayContaining("avenger"));
assertThat(user.toString(), user.roles(), arrayContaining("avenger"));
}

/**
Expand Down Expand Up @@ -488,7 +489,8 @@ protected void loadMappings(ActionListener<List<ExpressionRoleMapping>> listener
PlainActionFuture<AuthenticationResult<User>> future = new PlainActionFuture<>();
ldap.authenticate(new UsernamePasswordToken("Horatio Hornblower", new SecureString(PASSWORD)), future);
final AuthenticationResult<User> result = future.actionGet();
assertThat(result.getStatus(), is(AuthenticationResult.Status.SUCCESS));
assertThat(result, notNullValue());
assertThat(result.toString(), result.getStatus(), is(AuthenticationResult.Status.SUCCESS));
User user = result.getValue();
assertThat(user, notNullValue());
assertThat(user.roles(), arrayContainingInAnyOrder("_user_hhornblo", "sales_admin"));
Expand Down Expand Up @@ -519,7 +521,8 @@ public void testLdapConnectionFailureIsTreatedAsAuthenticationFailure() throws E
PlainActionFuture<AuthenticationResult<User>> future = new PlainActionFuture<>();
ldap.authenticate(new UsernamePasswordToken(VALID_USERNAME, new SecureString(PASSWORD)), future);
final AuthenticationResult<User> result = future.actionGet();
assertThat(result.getStatus(), is(AuthenticationResult.Status.CONTINUE));
assertThat(result, notNullValue());
assertThat(result.toString(), result.getStatus(), is(AuthenticationResult.Status.CONTINUE));
assertThat(result.getValue(), nullValue());
assertThat(result.getMessage(), is("authenticate failed"));
assertThat(result.getException(), notNullValue());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class SearchGroupsResolverInMemoryTests extends LdapTestCase {
@After
public void closeConnection() {
if (connection != null) {
connection.close();
connection.closeWithoutUnbind();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ protected void failed(Throwable e, Description description) {
}

public void configure(InMemoryDirectoryServerConfig config) {
targetLogger.info("Configuring debug logging for LDAP server [{}]", config);
config.setLDAPDebugLogHandler(logHandler);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ void tryConnect(InMemoryDirectoryServer ds) {
AccessController.doPrivileged((PrivilegedExceptionAction<Void>) () -> {
try (var c = ds.getConnection()) {
assertThat("Failed to connect to " + ds + " - ", c.isConnected(), is(true));
logger.info("Test connection to [{}] was successful ({})", ds, c);
logger.info("Test connection to [{}](port {}) was successful ({})", ds, ds.getListenPort(), c);
} catch (LDAPException e) {
throw new AssertionError("Failed to connect to " + ds, e);
}
Expand Down