use of org.neo4j.bolt.v1.transport.socket.client.TransportConnection in project neo4j by neo4j.
the class AuthProceduresInteractionTestBase method shouldTerminateConnectionsOnUserSuspension.
@Test
public void shouldTerminateConnectionsOnUserSuspension() throws Exception {
TransportConnection conn = startBoltSession("writeSubject", "abc");
Map<String, Long> boltConnections = countBoltConnectionsByUsername();
assertThat(boltConnections.get("writeSubject"), equalTo(IS_BOLT ? 2L : 1L));
assertEmpty(adminSubject, "CALL dbms.security.suspendUser( 'writeSubject' )");
boltConnections = countBoltConnectionsByUsername();
assertThat(boltConnections.get("writeSubject"), equalTo(null));
conn.disconnect();
}
use of org.neo4j.bolt.v1.transport.socket.client.TransportConnection in project neo4j by neo4j.
the class LdapAuthIT method clearAuthCacheFromDifferentConnection.
private void clearAuthCacheFromDifferentConnection() throws Exception {
TransportConnection adminClient = cf.newInstance();
// Login as admin
Map<String, Object> authToken = authToken("neo4j", "abc123", null);
adminClient.connect(address).send(TransportTestUtil.acceptedVersions(1, 0, 0, 0)).send(TransportTestUtil.chunk(init("TestClient/1.1", authToken)));
assertThat(adminClient, eventuallyReceives(new byte[] { 0, 0, 0, 1 }));
assertThat(adminClient, eventuallyReceives(msgSuccess()));
// Clear auth cache
adminClient.send(TransportTestUtil.chunk(run("CALL dbms.security.clearAuthCache()"), pullAll()));
assertThat(adminClient, eventuallyReceives(msgSuccess(), msgSuccess()));
}
use of org.neo4j.bolt.v1.transport.socket.client.TransportConnection in project neo4j by neo4j.
the class TransportTestUtil method eventuallyReceives.
public static Matcher<TransportConnection> eventuallyReceives(final Matcher<ResponseMessage>... messages) {
return new TypeSafeMatcher<TransportConnection>() {
@Override
protected boolean matchesSafely(TransportConnection conn) {
try {
for (Matcher<ResponseMessage> matchesMessage : messages) {
final ResponseMessage message = receiveOneResponseMessage(conn);
assertThat(message, matchesMessage);
}
return true;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
@Override
public void describeTo(Description description) {
description.appendValueList("Messages[", ",", "]", messages);
}
};
}
Aggregations