use of org.cloudfoundry.credhub.domain.SecurityEventAuditRecord in project credhub by cloudfoundry-incubator.
the class SecurityEventsLogServiceTest method log_whenTheQueryParamStringIsEmpty_shouldSpecifyOnlyThePathInTheRequest.
@Test
public void log_whenTheQueryParamStringIsEmpty_shouldSpecifyOnlyThePathInTheRequest() {
RequestAuditRecord requestAuditRecord = makeOperationAuditRecord("", AUTH_METHOD_UAA);
subject.log(new SecurityEventAuditRecord(requestAuditRecord, "actor-id"));
assertThat(fakeVersion, notNullValue());
assertThat(fakeVersion.length(), greaterThan(0));
verify(securityEventsLogger).info(contains("request=/api/some-path requestMethod=GET"));
}
use of org.cloudfoundry.credhub.domain.SecurityEventAuditRecord in project credhub by cloudfoundry-incubator.
the class SecurityEventsLogServiceTest method log_whenTheQueryParamStringIsNull_shouldSpecifyOnlyThePathInTheRequest.
@Test
public void log_whenTheQueryParamStringIsNull_shouldSpecifyOnlyThePathInTheRequest() {
RequestAuditRecord requestAuditRecord = makeOperationAuditRecord(null, AUTH_METHOD_UAA);
subject.log(new SecurityEventAuditRecord(requestAuditRecord, "actor-id"));
assertThat(fakeVersion, notNullValue());
assertThat(fakeVersion.length(), greaterThan(0));
verify(securityEventsLogger).info(contains("request=/api/some-path requestMethod=GET"));
}
use of org.cloudfoundry.credhub.domain.SecurityEventAuditRecord in project credhub by cloudfoundry-incubator.
the class SecurityEventsLogServiceTest method log_shouldLogAnOperationAuditRecordToTheSysLogWhenUsingOAuth.
@Test
public void log_shouldLogAnOperationAuditRecordToTheSysLogWhenUsingOAuth() {
RequestAuditRecord requestAuditRecord = makeOperationAuditRecord("foo=bar", AUTH_METHOD_UAA);
subject.log(new SecurityEventAuditRecord(requestAuditRecord, "actor-id"));
verify(securityEventsLogger).info("CEF:0|cloud_foundry|credhub|" + fakeVersion + "|GET /api/some-path|" + "GET /api/some-path|0|rt=" + String.valueOf(now.toEpochMilli()) + " suser=user-name " + "suid=actor-id " + "cs1Label=userAuthenticationMechanism " + "cs1=oauth-access-token " + "request=/api/some-path?foo=bar " + "requestMethod=GET " + "cs3Label=result " + "cs3=success " + "cs4Label=httpStatusCode " + "cs4=200 " + "src=127.0.0.1 " + "dst=host.example.com");
}
Aggregations