//global setup
globalConfig = new GlobalConfigurationBuilder();
globalConfig.globalJmxStatistics().disable();
globalConfig.globalJmxStatistics().mBeanServerLookup(null); //TODO remove once WFLY-3124 is fixed, for now fail JMX registration
GlobalAuthorizationConfigurationBuilder globalRoles = globalConfig.security().authorization()
.principalRoleMapper(getPrincipalRoleMapper());
//cache setup
cacheConfig = new ConfigurationBuilder();
cacheConfig.transaction().lockingMode(LockingMode.PESSIMISTIC);
cacheConfig.invocationBatching().enable();
cacheConfig.jmxStatistics().disable();
AuthorizationConfigurationBuilder authConfig = cacheConfig.security().authorization().enable();
//authorization setup
Map<String, AuthorizationPermission[]> rolePermissionMap = getRolePermissionMap();
for (Entry<String, AuthorizationPermission[]> role : rolePermissionMap.entrySet()) {
authConfig = authConfig.role(role.getKey());
GlobalRoleConfigurationBuilder roleBuilder = globalRoles.role(role.getKey());
for (AuthorizationPermission permission : role.getValue()) {
roleBuilder = roleBuilder.permission(permission);
}
}