Search in sources :

Example 1 with SecurityDomain

use of org.infinispan.rest.authentication.SecurityDomain in project infinispan by infinispan.

the class AuthenticationTest method beforeMethod.

@BeforeMethod(alwaysRun = true)
public void beforeMethod() {
    SecurityDomain securityDomainMock = mock(SecurityDomain.class);
    Subject user = TestingUtil.makeSubject("test");
    doReturn(user).when(securityDomainMock).authenticate(eq("test"), eq("test"));
    BasicAuthenticator basicAuthenticator = new BasicAuthenticator(securityDomainMock, REALM);
    restServer = RestServerHelper.defaultRestServer().withAuthenticator(basicAuthenticator).start(TestResourceTracker.getCurrentTestShortName());
    RestClientConfigurationBuilder configurationBuilder = new RestClientConfigurationBuilder();
    configurationBuilder.addServer().host(restServer.getHost()).port(restServer.getPort());
    client = RestClient.forConfiguration(configurationBuilder.build());
}
Also used : RestClientConfigurationBuilder(org.infinispan.client.rest.configuration.RestClientConfigurationBuilder) BasicAuthenticator(org.infinispan.rest.authentication.impl.BasicAuthenticator) Subject(javax.security.auth.Subject) SecurityDomain(org.infinispan.rest.authentication.SecurityDomain) BeforeMethod(org.testng.annotations.BeforeMethod)

Aggregations

Subject (javax.security.auth.Subject)1 RestClientConfigurationBuilder (org.infinispan.client.rest.configuration.RestClientConfigurationBuilder)1 SecurityDomain (org.infinispan.rest.authentication.SecurityDomain)1 BasicAuthenticator (org.infinispan.rest.authentication.impl.BasicAuthenticator)1 BeforeMethod (org.testng.annotations.BeforeMethod)1