Search in sources :

Example 1 with TestSecurityData

use of org.apache.ignite.internal.processors.security.impl.TestSecurityData in project ignite by apache.

the class PlatformStartIgniteUtils method startWithSecurity.

/**
 * Starts an Ignite instance with test security plugin provider.
 *
 * @param name Ignite instance name.
 * @throws IgniteException Exception.
 */
public static void startWithSecurity(String name) throws IgniteException {
    TestSecurityPluginProvider securityPluginProvider = new TestSecurityPluginProvider("login1", "pass1", ALLOW_ALL, false, new TestSecurityData("CLIENT", "pass1", SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions("DEFAULT_CACHE", CACHE_READ, CACHE_PUT, CACHE_REMOVE).appendCachePermissions("FORBIDDEN_CACHE").build(), new Permissions()));
    IgniteConfiguration cfg = new IgniteConfiguration().setPluginProviders(securityPluginProvider).setDiscoverySpi(new TcpDiscoverySpi().setIpFinder(GridAbstractTest.LOCAL_IP_FINDER)).setLocalHost("127.0.0.1").setIgniteInstanceName(name);
    Ignition.start(cfg);
}
Also used : TestSecurityData(org.apache.ignite.internal.processors.security.impl.TestSecurityData) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TestSecurityPluginProvider(org.apache.ignite.internal.processors.security.impl.TestSecurityPluginProvider) Permissions(java.security.Permissions) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 2 with TestSecurityData

use of org.apache.ignite.internal.processors.security.impl.TestSecurityData in project ignite by apache.

the class RestProcessorAuthorizationTest method getPluginProvider.

/**
 * {@inheritDoc}
 */
@Override
protected PluginProvider<?> getPluginProvider(String name) {
    return new TestSecurityPluginProvider(name, null, ALLOW_ALL, globalAuth, clientData()) {

        /**
         * {@inheritDoc}
         */
        @Override
        protected GridSecurityProcessor securityProcessor(GridKernalContext ctx) {
            return new TestSecurityProcessor(ctx, new TestSecurityData(login, pwd, perms, new Permissions()), Arrays.asList(clientData), globalAuth) {

                /**
                 * {@inheritDoc}
                 */
                @Override
                public void authorize(String name, SecurityPermission perm, SecurityContext securityCtx) throws SecurityException {
                    authorizationCtxList.add(F.t(name, perm, securityCtx));
                    super.authorize(name, perm, securityCtx);
                }
            };
        }
    };
}
Also used : TestSecurityData(org.apache.ignite.internal.processors.security.impl.TestSecurityData) TestSecurityProcessor(org.apache.ignite.internal.processors.security.impl.TestSecurityProcessor) TestSecurityPluginProvider(org.apache.ignite.internal.processors.security.impl.TestSecurityPluginProvider) GridKernalContext(org.apache.ignite.internal.GridKernalContext) Permissions(java.security.Permissions) SecurityContext(org.apache.ignite.internal.processors.security.SecurityContext) SecurityPermission(org.apache.ignite.plugin.security.SecurityPermission)

Example 3 with TestSecurityData

use of org.apache.ignite.internal.processors.security.impl.TestSecurityData in project ignite by apache.

the class JdbcAuthorizationTest method beforeTestsStarted.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTestsStarted() throws Exception {
    super.beforeTestsStarted();
    Ignite srv = startSecurityGrid(0, new TestSecurityData(EMPTY_PERMS_USER, new SecurityBasicPermissionSet()), new TestSecurityData(CACHE_CREATE_SYS_PERM_USER, systemPermissions(CACHE_CREATE)), new TestSecurityData(CACHE_DESTROY_SYS_PERMS_USER, systemPermissions(CACHE_DESTROY)), new TestSecurityData(CACHE_CREATE_CACHE_PERMS_USER, cachePermissions(TEST_CREATE_TABLE_CACHE, CACHE_CREATE)), new TestSecurityData(CACHE_DESTROY_CACHE_PERMS_USER, cachePermissions(TEST_DROP_TABLE_CACHE, CACHE_DESTROY)), new TestSecurityData(CACHE_READ_USER, cachePermissions(DEFAULT_CACHE_NAME, CACHE_READ)), new TestSecurityData(CACHE_PUT_USER, create().defaultAllowAll(false).appendCachePermissions(DEFAULT_CACHE_NAME, CACHE_PUT).appendCachePermissions(TEST_BULKLOAD_CACHE, CACHE_PUT).build()), new TestSecurityData(CACHE_REMOVE_USER, cachePermissions(DEFAULT_CACHE_NAME, CACHE_REMOVE)));
    startSecurityGrid(1);
    srv.cluster().state(ACTIVE);
    CacheConfiguration<Integer, Integer> ccfg = new CacheConfiguration<>(DEFAULT_CACHE_NAME);
    ccfg.setIndexedTypes(Integer.class, Integer.class);
    ccfg.setCacheMode(REPLICATED);
    ccfg.setSqlSchema(TEST_DML_SCHEMA);
    srv.createCache(ccfg);
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) TestSecurityData(org.apache.ignite.internal.processors.security.impl.TestSecurityData) Ignite(org.apache.ignite.Ignite) SecurityBasicPermissionSet(org.apache.ignite.plugin.security.SecurityBasicPermissionSet) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration)

Example 4 with TestSecurityData

use of org.apache.ignite.internal.processors.security.impl.TestSecurityData in project ignite by apache.

the class ThinClientPermissionCheckTest method beforeTestsStarted.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTestsStarted() throws Exception {
    IgniteEx ignite = startGrid(getConfiguration(new TestSecurityData(CLIENT, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions(CACHE, CACHE_READ, CACHE_PUT, CACHE_REMOVE).appendCachePermissions(FORBIDDEN_CACHE, EMPTY_PERMS).build()), new TestSecurityData(CLIENT_READ, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions(CACHE, CACHE_READ).build()), new TestSecurityData(CLIENT_PUT, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions(CACHE, CACHE_PUT).appendCachePermissions(EXPIRATION_TEST_CACHE, CACHE_PUT).appendCachePermissions(EVICTION_TEST_CACHE, CACHE_PUT).build()), new TestSecurityData(CLIENT_REMOVE, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions(CACHE, CACHE_REMOVE).build()), new TestSecurityData(CLIENT_SYS_PERM, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendSystemPermissions(CACHE_CREATE, CACHE_DESTROY).build()), new TestSecurityData(CLIENT_CACHE_TASK_OPER, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions(CACHE, CACHE_REMOVE).appendTaskPermissions(REMOVE_ALL_TASK, TASK_EXECUTE).appendTaskPermissions(CLEAR_TASK, TASK_EXECUTE).build())));
    ignite.cluster().state(ClusterState.ACTIVE);
}
Also used : TestSecurityData(org.apache.ignite.internal.processors.security.impl.TestSecurityData) IgniteEx(org.apache.ignite.internal.IgniteEx)

Example 5 with TestSecurityData

use of org.apache.ignite.internal.processors.security.impl.TestSecurityData in project ignite by apache.

the class ThinClientSslPermissionCheckTest method beforeTestsStarted.

/**
 * {@inheritDoc}
 */
@Override
protected void beforeTestsStarted() throws Exception {
    IgniteEx ignite = startGrid(getConfiguration(new TestSecurityData(CLIENT, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions(CACHE, CACHE_READ, CACHE_PUT, CACHE_REMOVE).appendCachePermissions(FORBIDDEN_CACHE, EMPTY_PERMS).build()), new TestSecurityData(CLIENT_SYS_PERM, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendSystemPermissions(CACHE_CREATE, CACHE_DESTROY).build()), new TestSecurityData(CLIENT_CACHE_TASK_OPER, SecurityPermissionSetBuilder.create().defaultAllowAll(false).appendCachePermissions(CACHE, CACHE_REMOVE).appendTaskPermissions(REMOVE_ALL_TASK, TASK_EXECUTE).appendTaskPermissions(CLEAR_TASK, TASK_EXECUTE).build())));
    ignite.cluster().active(true);
}
Also used : TestSecurityData(org.apache.ignite.internal.processors.security.impl.TestSecurityData) IgniteEx(org.apache.ignite.internal.IgniteEx)

Aggregations

TestSecurityData (org.apache.ignite.internal.processors.security.impl.TestSecurityData)5 Permissions (java.security.Permissions)2 IgniteEx (org.apache.ignite.internal.IgniteEx)2 TestSecurityPluginProvider (org.apache.ignite.internal.processors.security.impl.TestSecurityPluginProvider)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Ignite (org.apache.ignite.Ignite)1 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)1 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)1 GridKernalContext (org.apache.ignite.internal.GridKernalContext)1 SecurityContext (org.apache.ignite.internal.processors.security.SecurityContext)1 TestSecurityProcessor (org.apache.ignite.internal.processors.security.impl.TestSecurityProcessor)1 SecurityBasicPermissionSet (org.apache.ignite.plugin.security.SecurityBasicPermissionSet)1 SecurityPermission (org.apache.ignite.plugin.security.SecurityPermission)1 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)1