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);
}
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);
}
};
}
};
}
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);
}
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);
}
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);
}
Aggregations