use of org.cloudfoundry.credhub.auth.UserContextFactory in project credhub by cloudfoundry-incubator.
the class UserContextInterceptorTest method setup.
@Before
public void setup() {
userContextFactory = mock(UserContextFactory.class);
userContext = mock(UserContext.class);
userContextHolder = new UserContextHolder();
subject = new UserContextInterceptor(userContextFactory, userContextHolder);
when(userContextFactory.createUserContext(any())).thenReturn(userContext);
request = mock(HttpServletRequest.class);
}
use of org.cloudfoundry.credhub.auth.UserContextFactory 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");
}
Aggregations