use of org.apache.ignite.internal.processors.security.impl.TestSecurityPluginProvider in project ignite by apache.
the class IgnitionComponentProxyTest method testStart.
/**
*/
@Test
public void testStart() {
Supplier<Ignite> s = new Supplier<Ignite>() {
@Override
public Ignite get() {
try {
Permissions perms = new Permissions();
perms.add(new AllPermission());
AccessControlContext acc = AccessController.doPrivileged((PrivilegedAction<AccessControlContext>) () -> new AccessControlContext(AccessController.getContext(), new IgniteDomainCombiner(perms)));
return AccessController.doPrivileged((PrivilegedExceptionAction<Ignite>) () -> {
String login = "node_" + G.allGrids().size();
return Ignition.start(optimize(getConfiguration(login, new TestSecurityPluginProvider(login, "", ALLOW_ALL, perms, globalAuth))));
}, acc);
} catch (Exception e) {
throw new IgniteException(e);
}
}
};
check(s);
}
use of org.apache.ignite.internal.processors.security.impl.TestSecurityPluginProvider in project ignite by apache.
the class ServiceAuthorizationTest method configuration.
/**
* @return Ignite node configuration.
*/
private IgniteConfiguration configuration(int idx, SecurityPermission... perms) throws Exception {
String name = getTestIgniteInstanceName(idx);
IgniteConfiguration cfg = getConfiguration(name, new TestSecurityPluginProvider(name, "", create().defaultAllowAll(false).appendSystemPermissions(JOIN_AS_SERVER).appendCachePermissions(DEFAULT_CACHE_NAME, CACHE_CREATE).appendTaskPermissions("org.apache.ignite.internal.processors.affinity.GridAffinityUtils$AffinityJob", TASK_EXECUTE, TASK_CANCEL).appendServicePermissions(TEST_SERVICE_NAME, perms).build(), null, false)).setClientMode(isClient);
if (authErrLatch != null) {
cfg.setFailureHandler(new FailureHandler() {
@Override
public boolean onFailure(Ignite ignite, FailureContext failureCtx) {
assertTrue(failureCtx.error() instanceof SecurityException);
assertTrue(failureCtx.error().getMessage().startsWith("Authorization failed [perm=SERVICE_DEPLOY, name=test-service-name"));
authErrLatch.countDown();
return true;
}
});
}
return cfg;
}
Aggregations