Search in sources :

Example 1 with CACHE_READ

use of org.apache.ignite.plugin.security.SecurityPermission.CACHE_READ in project ignite by apache.

the class EntryProcessorPermissionCheckTest method test.

/**
 */
@Test
public void test() throws Exception {
    IgniteEx verifierNode = startGrid("verifier_node", SecurityPermissionSetBuilder.create().appendCachePermissions(CACHE_NAME, CACHE_READ).appendCachePermissions(FORBIDDEN_CACHE, CACHE_READ).build(), false);
    IgniteEx srvNode = startGrid("server_node", SecurityPermissionSetBuilder.create().appendCachePermissions(CACHE_NAME, CACHE_READ, CACHE_PUT).appendCachePermissions(FORBIDDEN_CACHE, EMPTY_PERMS).build(), false);
    IgniteEx clientNode = startGrid("client_node", SecurityPermissionSetBuilder.create().appendCachePermissions(CACHE_NAME, CACHE_PUT, CACHE_READ).appendCachePermissions(FORBIDDEN_CACHE, EMPTY_PERMS).build(), true);
    awaitPartitionMapExchange();
    Stream.of(srvNode, clientNode).forEach(n -> operations(n).forEach(c -> {
        runOperation(verifierNode, c);
        runForbiddenOperation(verifierNode, c);
    }));
}
Also used : Arrays(java.util.Arrays) CACHE_PUT(org.apache.ignite.plugin.security.SecurityPermission.CACHE_PUT) GridTestUtils.assertThrowsWithCause(org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause) SecurityPermissionSetBuilder(org.apache.ignite.plugin.security.SecurityPermissionSetBuilder) RunWith(org.junit.runner.RunWith) IgniteEx(org.apache.ignite.internal.IgniteEx) Test(org.junit.Test) Ignite(org.apache.ignite.Ignite) JUnit4(org.junit.runners.JUnit4) CACHE_READ(org.apache.ignite.plugin.security.SecurityPermission.CACHE_READ) AbstractCacheOperationPermissionCheckTest(org.apache.ignite.internal.processors.security.AbstractCacheOperationPermissionCheckTest) T2(org.apache.ignite.internal.util.typedef.T2) Assert.assertThat(org.junit.Assert.assertThat) List(java.util.List) Stream(java.util.stream.Stream) CacheEntryProcessor(org.apache.ignite.cache.CacheEntryProcessor) Collections.singleton(java.util.Collections.singleton) BiConsumer(java.util.function.BiConsumer) Is.is(org.hamcrest.core.Is.is) SecurityException(org.apache.ignite.plugin.security.SecurityException) IgniteEx(org.apache.ignite.internal.IgniteEx) Test(org.junit.Test) AbstractCacheOperationPermissionCheckTest(org.apache.ignite.internal.processors.security.AbstractCacheOperationPermissionCheckTest)

Aggregations

Arrays (java.util.Arrays)1 Collections.singleton (java.util.Collections.singleton)1 List (java.util.List)1 BiConsumer (java.util.function.BiConsumer)1 Stream (java.util.stream.Stream)1 Ignite (org.apache.ignite.Ignite)1 CacheEntryProcessor (org.apache.ignite.cache.CacheEntryProcessor)1 IgniteEx (org.apache.ignite.internal.IgniteEx)1 AbstractCacheOperationPermissionCheckTest (org.apache.ignite.internal.processors.security.AbstractCacheOperationPermissionCheckTest)1 T2 (org.apache.ignite.internal.util.typedef.T2)1 SecurityException (org.apache.ignite.plugin.security.SecurityException)1 CACHE_PUT (org.apache.ignite.plugin.security.SecurityPermission.CACHE_PUT)1 CACHE_READ (org.apache.ignite.plugin.security.SecurityPermission.CACHE_READ)1 SecurityPermissionSetBuilder (org.apache.ignite.plugin.security.SecurityPermissionSetBuilder)1 GridTestUtils.assertThrowsWithCause (org.apache.ignite.testframework.GridTestUtils.assertThrowsWithCause)1 Is.is (org.hamcrest.core.Is.is)1 Assert.assertThat (org.junit.Assert.assertThat)1 Test (org.junit.Test)1 RunWith (org.junit.runner.RunWith)1 JUnit4 (org.junit.runners.JUnit4)1