use of org.infinispan.server.hotrod.test.TestCallbackHandler in project infinispan by infinispan.
the class AuthenticationTest method testAuthenticationFailWrongAuth.
@Test(expectedExceptions = TransportException.class)
public void testAuthenticationFailWrongAuth() {
ConfigurationBuilder clientBuilder = newClientBuilder();
clientBuilder.security().authentication().callbackHandler(new TestCallbackHandler("user", "realm", "foobar"));
remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
remoteCacheManager.getCache();
}
use of org.infinispan.server.hotrod.test.TestCallbackHandler in project infinispan by infinispan.
the class AuthenticationTest method testAuthentication.
@Test
public void testAuthentication() {
ConfigurationBuilder clientBuilder = newClientBuilder();
clientBuilder.security().authentication().callbackHandler(new TestCallbackHandler("user", "realm", "password"));
remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
RemoteCache<String, String> defaultRemote = remoteCacheManager.getCache();
defaultRemote.put("a", "a");
assertEquals("a", defaultRemote.get("a"));
}
use of org.infinispan.server.hotrod.test.TestCallbackHandler in project infinispan by infinispan.
the class SecureExecTest method testSimpleScriptExecutionWithInvalidAuth.
@Test(expectedExceptions = HotRodClientException.class, expectedExceptionsMessageRegExp = ".*Unauthorized access.*")
public void testSimpleScriptExecutionWithInvalidAuth() throws IOException, PrivilegedActionException {
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = newClientBuilder();
clientBuilder.security().authentication().callbackHandler(new TestCallbackHandler("RWEuser", "realm", "password".toCharArray()));
runTestWithGivenScript(clientBuilder.build(), "/testRole.js");
}
use of org.infinispan.server.hotrod.test.TestCallbackHandler in project infinispan by infinispan.
the class SecureExecTest method testSimpleScriptExecutionWithoutExecPerm.
@Test(expectedExceptions = HotRodClientException.class, expectedExceptionsMessageRegExp = ".*Unauthorized access.*")
public void testSimpleScriptExecutionWithoutExecPerm() throws IOException, PrivilegedActionException {
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = newClientBuilder();
clientBuilder.security().authentication().callbackHandler(new TestCallbackHandler("RWuser", "realm", "password".toCharArray()));
runTestWithGivenScript(clientBuilder.build(), "/testWithoutRole.js");
}
use of org.infinispan.server.hotrod.test.TestCallbackHandler in project infinispan by infinispan.
the class SecureExecTest method testUploadWithoutScriptManagerRole.
@Test(expectedExceptions = HotRodClientException.class, expectedExceptionsMessageRegExp = ".*Unauthorized access.*")
public void testUploadWithoutScriptManagerRole() throws IOException, PrivilegedActionException {
org.infinispan.client.hotrod.configuration.ConfigurationBuilder clientBuilder = newClientBuilder();
clientBuilder.security().authentication().callbackHandler(new TestCallbackHandler("RWEuser", "realm", "password".toCharArray()));
remoteCacheManager = new RemoteCacheManager(clientBuilder.build());
remoteCacheManager.getCache(ScriptingManager.SCRIPT_CACHE).put("shouldFail", "1+1");
}
Aggregations