コード例 #1
0
 private GlobalConfigurationBuilder getSecureGlobalConfiguration() {
   GlobalConfigurationBuilder global = new GlobalConfigurationBuilder();
   global
       .security()
       .authorization()
       .enable()
       .principalRoleMapper(new IdentityRoleMapper())
       .role("admin")
       .permission(AuthorizationPermission.ALL)
       .role("query")
       .permission(AuthorizationPermission.READ)
       .permission(AuthorizationPermission.WRITE)
       .permission(AuthorizationPermission.BULK_READ)
       .role("noquery")
       .permission(AuthorizationPermission.READ)
       .permission(AuthorizationPermission.WRITE);
   return global;
 }
コード例 #2
0
 @Override
 protected void createCacheManagers() throws Throwable {
   final GlobalConfigurationBuilder global = GlobalConfigurationBuilder.defaultClusteredBuilder();
   final ConfigurationBuilder builder = getDefaultClusteredCacheConfig(getCacheMode());
   global
       .security()
       .authorization()
       .enable()
       .principalRoleMapper(new IdentityRoleMapper())
       .role("admin")
       .permission(AuthorizationPermission.ALL);
   builder.security().authorization().enable().role("admin");
   Security.doAs(
       ADMIN,
       new PrivilegedExceptionAction<Void>() {
         @Override
         public Void run() throws Exception {
           createCluster(global, builder, 2);
           waitForClusterToForm();
           return null;
         }
       });
 }