Search in sources :

Example 1 with AuditLogFactory

use of org.cloudfoundry.credhub.audit.AuditLogFactory in project credhub by cloudfoundry-incubator.

the class AuditInterceptorTest method setup.

@Before
public void setup() {
    requestAuditRecordDataService = mock(RequestAuditRecordDataService.class);
    securityEventsLogService = mock(SecurityEventsLogService.class);
    auditLogFactory = mock(AuditLogFactory.class);
    userContextFactory = mock(UserContextFactory.class);
    userContext = mock(UserContext.class);
    requestUuid = new RequestUuid();
    subject = new AuditInterceptor(requestAuditRecordDataService, securityEventsLogService, auditLogFactory, userContextFactory);
    request = mock(HttpServletRequest.class);
    response = mock(HttpServletResponse.class);
    final Authentication authentication = mock(Authentication.class);
    when(request.getUserPrincipal()).thenReturn(authentication);
    userContext = mock(UserContext.class);
    when(userContextFactory.createUserContext(any())).thenReturn(userContext);
    when(userContext.getActor()).thenReturn("user");
}
Also used : HttpServletRequest(javax.servlet.http.HttpServletRequest) UserContext(org.cloudfoundry.credhub.auth.UserContext) Authentication(org.springframework.security.core.Authentication) AuditLogFactory(org.cloudfoundry.credhub.audit.AuditLogFactory) HttpServletResponse(javax.servlet.http.HttpServletResponse) UserContextFactory(org.cloudfoundry.credhub.auth.UserContextFactory) RequestAuditRecordDataService(org.cloudfoundry.credhub.data.RequestAuditRecordDataService) RequestUuid(org.cloudfoundry.credhub.audit.RequestUuid) SecurityEventsLogService(org.cloudfoundry.credhub.service.SecurityEventsLogService) Before(org.junit.Before)

Aggregations

HttpServletRequest (javax.servlet.http.HttpServletRequest)1 HttpServletResponse (javax.servlet.http.HttpServletResponse)1 AuditLogFactory (org.cloudfoundry.credhub.audit.AuditLogFactory)1 RequestUuid (org.cloudfoundry.credhub.audit.RequestUuid)1 UserContext (org.cloudfoundry.credhub.auth.UserContext)1 UserContextFactory (org.cloudfoundry.credhub.auth.UserContextFactory)1 RequestAuditRecordDataService (org.cloudfoundry.credhub.data.RequestAuditRecordDataService)1 SecurityEventsLogService (org.cloudfoundry.credhub.service.SecurityEventsLogService)1 Before (org.junit.Before)1 Authentication (org.springframework.security.core.Authentication)1