use of org.simbasecurity.dwclient.dropwizard.credentials.SimbaCredentials in project simba-os by cegeka.
the class SimbaAuthRule method before.
protected void before(ResourceTest currentTest) throws AuthenticationException {
SimbaAuthenticator authenticatorMock = mock(SimbaAuthenticator.class);
SimbaCredentialsFactory simbaCredentialsFactoryMock = mock(SimbaCredentialsFactory.class);
SimbaAuthenticatedProvider simbaAuthenticatedProvider = new SimbaAuthenticatedProvider(authenticatorMock, simbaCredentialsFactoryMock, domainProvider);
SimbaCredentials simbaCredentials = new SimbaCredentialsBuilderForTests().build();
when(simbaCredentialsFactoryMock.create(any(ContainerRequest.class))).thenReturn(simbaCredentials);
when(authenticatorMock.authenticate(simbaCredentials)).thenReturn(Optional.fromNullable(new SimbaPrincipal("user", "ssoToken")));
currentTest.addProvider(simbaAuthenticatedProvider);
}
Aggregations