use of org.apache.ignite.plugin.security.SecurityBasicPermissionSet in project ignite by apache.
the class TestSecurityProcessor method authenticate.
/**
* {@inheritDoc}
*/
@Override
public SecurityContext authenticate(AuthenticationContext ctx) throws IgniteCheckedException {
if (ctx.credentials() == null || ctx.credentials().getLogin() == null)
return null;
SecurityPermissionSet perms = PERMS.get(ctx.credentials());
if (perms == null) {
perms = new SecurityBasicPermissionSet();
((SecurityBasicPermissionSet) perms).setDefaultAllowAll(true);
}
SecurityContext res = new TestSecurityContext(new TestSecuritySubject().setType(ctx.subjectType()).setId(ctx.subjectId()).setAddr(ctx.address()).setLogin(ctx.credentials().getLogin()).setPerms(perms).setCerts(ctx.certificates()).sandboxPermissions(SANDBOX_PERMS.get(ctx.credentials())));
SECURITY_CONTEXTS.put(res.subject().id(), res);
return res;
}
use of org.apache.ignite.plugin.security.SecurityBasicPermissionSet 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);
}
Aggregations