@Test public void testProcessAuth() { String expectedOperation = "Authentication attempt"; ConnectionResource resource = ConnectionResource.root(); String expectedSubject = "bob-the-subject"; AuditEntry.Builder auditBuilder = AuditEntry.newBuilder().permissions(PERMISSIONS).resource(resource); when(mockAuditEntryBuilderFactory.createAuthenticationEntryBuilder()).thenReturn(auditBuilder); auditAdapter.auditAuth(USER, expectedSubject, Status.ATTEMPT, TIMESTAMP); AuditEntry entry = getAuditEntry(); assertThat(entry.getClientAddress()).isNull(); assertThat(entry.getCoordinatorAddress()).isEqualTo(FBUtilities.getBroadcastAddress()); assertThat(entry.getUser()).isEqualTo(USER); assertThat(entry.getOperation().getOperationString()).isEqualTo(expectedOperation); assertThat(entry.getStatus()).isEqualTo(Status.ATTEMPT); assertThat(entry.getBatchId()).isEmpty(); assertThat(entry.getPermissions()).isEqualTo(PERMISSIONS); assertThat(entry.getResource()).isEqualTo(resource); assertThat(entry.getTimestamp()).isEqualTo(TIMESTAMP); assertThat(entry.getSubject()).isEqualTo(Optional.of(expectedSubject)); }
public void auditAuth(String username, Status status, long timestamp) throws AuthenticationException { auditAuth(username, null, status, timestamp); }
AuditAdapter { public void auditAuth(String username, Status status, long timestamp) throws AuthenticationException { auditAuth(username, null, status, timestamp); } }
AuditAdapter { public void auditAuth(String username, Status status, long timestamp) throws AuthenticationException { auditAuth(username, null, status, timestamp); } AuditAdapter(Auditor auditor, AuditEntryBuilderFactory entryBuilderFactory, BoundValueSuppressor boundValueSuppressor); }
AuditAdapter { public void auditAuth(String username, Status status, long timestamp) throws AuthenticationException { auditAuth(username, null, status, timestamp); } AuditAdapter(Auditor auditor, AuditEntryBuilderFactory entryBuilderFactory, BoundValueSuppressor boundValueSuppressor); static AuditAdapter getInstance(); void setup(); void auditRegular(String operation, ClientState state, Status status, long timestamp); void auditPrepared(MD5Digest id, CQLStatement statement, ClientState state, QueryOptions options, Status status, long timestamp); void auditBatch(BatchStatement statement, UUID uuid, ClientState state, BatchQueryOptions options, Status status, long timestamp); void auditAuth(String username, Status status, long timestamp); void auditAuth(String userName, String subject, Status status, long timestamp); void mapIdToQuery(MD5Digest id, String query); Auditor getAuditor(); @VisibleForTesting void setBoundValueSuppressor(BoundValueSuppressor suppressor); @VisibleForTesting BoundValueSuppressor getBoundValueSuppressor(); }
AuditAdapter { public void auditAuth(String username, Status status, long timestamp) throws AuthenticationException { auditAuth(username, null, status, timestamp); } AuditAdapter(Auditor auditor, AuditEntryBuilderFactory entryBuilderFactory, BoundValueSuppressor boundValueSuppressor); static AuditAdapter getInstance(); void setup(); void auditRegular(String operation, ClientState state, Status status, long timestamp); void auditPrepared(MD5Digest id, CQLStatement statement, ClientState state, QueryOptions options, Status status, long timestamp); void auditBatch(BatchStatement statement, UUID uuid, ClientState state, BatchQueryOptions options, Status status, long timestamp); void auditAuth(String username, Status status, long timestamp); void auditAuth(String userName, String subject, Status status, long timestamp); void mapIdToQuery(MD5Digest id, String query); Auditor getAuditor(); @VisibleForTesting void setBoundValueSuppressor(BoundValueSuppressor suppressor); @VisibleForTesting BoundValueSuppressor getBoundValueSuppressor();  }