Search in sources :

Example 6 with AuthorizationConfigurationBuilder

use of org.infinispan.configuration.cache.AuthorizationConfigurationBuilder in project infinispan by infinispan.

the class SecureListenerTest method createCacheManager.

@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
    GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
    GlobalAuthorizationConfigurationBuilder globalRoles = global.security().authorization().enable().principalRoleMapper(new IdentityRoleMapper());
    ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    AuthorizationConfigurationBuilder authConfig = config.security().authorization().enable();
    globalRoles.role("listener").permission(AuthorizationPermission.LISTEN).role("admin").permission(AuthorizationPermission.ALL);
    authConfig.role("listener").role("admin");
    return TestCacheManagerFactory.createCacheManager(global, config);
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) IdentityRoleMapper(org.infinispan.security.mappers.IdentityRoleMapper) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder)

Example 7 with AuthorizationConfigurationBuilder

use of org.infinispan.configuration.cache.AuthorizationConfigurationBuilder in project infinispan by infinispan.

the class BaseAuthorizationTest method createCacheConfiguration.

protected ConfigurationBuilder createCacheConfiguration(GlobalConfigurationBuilder global) {
    final ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    config.transaction().lockingMode(LockingMode.PESSIMISTIC).invocationBatching().enable();
    AuthorizationConfigurationBuilder authConfig = config.security().authorization().enable();
    for (AuthorizationPermission perm : AuthorizationPermission.values()) {
        authConfig.role(perm.toString());
    }
    return config;
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder)

Example 8 with AuthorizationConfigurationBuilder

use of org.infinispan.configuration.cache.AuthorizationConfigurationBuilder in project infinispan by infinispan.

the class DynamicRBACTest method getConfigurationBuilder.

private ConfigurationBuilder getConfigurationBuilder() {
    ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    config.clustering().cacheMode(CacheMode.DIST_SYNC);
    AuthorizationConfigurationBuilder authConfig = config.security().authorization().enable();
    authConfig.role("reader").role("writer").role("admin");
    return config;
}
Also used : ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder)

Example 9 with AuthorizationConfigurationBuilder

use of org.infinispan.configuration.cache.AuthorizationConfigurationBuilder in project infinispan by infinispan.

the class RolePermissionNoACLCacheTest method createCacheManager.

@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
    GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
    GlobalAuthorizationConfigurationBuilder globalRoles = global.security().securityCacheTimeout(0, TimeUnit.SECONDS).authorization().enable().principalRoleMapper(new IdentityRoleMapper());
    ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    AuthorizationConfigurationBuilder authConfig = config.security().authorization().enable();
    globalRoles.role("role1").permission(AuthorizationPermission.EXEC).role("role2").permission(AuthorizationPermission.EXEC).role("admin").permission(AuthorizationPermission.ALL);
    authConfig.role("role1").role("role2").role("admin");
    return TestCacheManagerFactory.createCacheManager(global, config);
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) IdentityRoleMapper(org.infinispan.security.mappers.IdentityRoleMapper) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder)

Example 10 with AuthorizationConfigurationBuilder

use of org.infinispan.configuration.cache.AuthorizationConfigurationBuilder in project infinispan by infinispan.

the class SecureScriptingTaskManagerTest method createCacheManager.

@Override
protected EmbeddedCacheManager createCacheManager() throws Exception {
    GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
    GlobalAuthorizationConfigurationBuilder globalRoles = global.security().authorization().enable().principalRoleMapper(new IdentityRoleMapper());
    ConfigurationBuilder config = TestCacheManagerFactory.getDefaultCacheConfiguration(true);
    AuthorizationConfigurationBuilder authConfig = config.security().authorization().enable();
    globalRoles.role("runner").permission(AuthorizationPermission.EXEC).permission(AuthorizationPermission.READ).permission(AuthorizationPermission.WRITE).role("pheidippides").permission(AuthorizationPermission.EXEC).permission(AuthorizationPermission.READ).permission(AuthorizationPermission.WRITE).role("admin").permission(AuthorizationPermission.ALL);
    authConfig.role("runner").role("pheidippides").role("admin");
    return TestCacheManagerFactory.createCacheManager(global, config);
}
Also used : GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) IdentityRoleMapper(org.infinispan.security.mappers.IdentityRoleMapper) ConfigurationBuilder(org.infinispan.configuration.cache.ConfigurationBuilder) GlobalConfigurationBuilder(org.infinispan.configuration.global.GlobalConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) GlobalAuthorizationConfigurationBuilder(org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder) AuthorizationConfigurationBuilder(org.infinispan.configuration.cache.AuthorizationConfigurationBuilder)

Aggregations

AuthorizationConfigurationBuilder (org.infinispan.configuration.cache.AuthorizationConfigurationBuilder)14 ConfigurationBuilder (org.infinispan.configuration.cache.ConfigurationBuilder)12 GlobalAuthorizationConfigurationBuilder (org.infinispan.configuration.global.GlobalAuthorizationConfigurationBuilder)10 GlobalConfigurationBuilder (org.infinispan.configuration.global.GlobalConfigurationBuilder)10 IdentityRoleMapper (org.infinispan.security.mappers.IdentityRoleMapper)6 ConfigurationBuilder (org.infinispan.client.hotrod.configuration.ConfigurationBuilder)2 RestClientConfigurationBuilder (org.infinispan.client.rest.configuration.RestClientConfigurationBuilder)2 GlobalAuthorizationConfiguration (org.infinispan.configuration.global.GlobalAuthorizationConfiguration)2 AuthorizationPermission (org.infinispan.security.AuthorizationPermission)2 CreatePermissionConfigurationBuilder (org.infinispan.security.impl.CreatePermissionConfigurationBuilder)2 Subject (javax.security.auth.Subject)1 CacheMode (org.infinispan.configuration.cache.CacheMode)1 GlobalRoleConfigurationBuilder (org.infinispan.configuration.global.GlobalRoleConfigurationBuilder)1 DefaultCacheManager (org.infinispan.manager.DefaultCacheManager)1 EmbeddedCacheManager (org.infinispan.manager.EmbeddedCacheManager)1 Before (org.junit.Before)1