APISonar


org.infinispan.configuration.global.GlobalConfiguration.security

> org > infinispan > configuration > global > GlobalConfiguration > security
org APIs infinispan APIs configuration APIs global APIs GlobalConfiguration APIs security APIs

Example 1
protected final GlobalConfiguration globalConfiguration;

   public void start() {
      authzHelper.checkPermission(AuthorizationPermission.LIFECYCLE);
      if (globalConfiguration.security().authorization().enabled() && System.getSecurityManager() == null) {
         log.authorizationEnabledWithoutSecurityManager();
      }
      globalComponentRegistry.getComponent(CacheManagerJmxRegistration.class).start();
      String clusterName = globalConfiguration.transport().clusterName();
      String nodeName = globalConfiguration.transport().nodeName();
      if (globalConfiguration.security().authorization().enabled()) {
         globalConfiguration.security().authorization().principalRoleMapper().setContext(new PrincipalRoleMapperContextImpl(this));
      }
      log.debugf("Started cache manager %s on %s", clusterName, nodeName);
   }
Example 2
public void init(Cache<?, ?> cache, GlobalConfiguration globalConfiguration, Configuration configuration,
         ClusterRegistry<String, Subject, Integer> clusterRegistry) {
      this.globalConfiguration = globalConfiguration.security();
      this.configuration = configuration.security().authorization();
      this.subjectRoleMaskCache = clusterRegistry;
      authCacheScope = String.format("%s_%s", AuthorizationManager.class.getName(), cache.getName());
      this.authzHelper = new AuthorizationHelper(this.globalConfiguration, AuditContext.CACHE, cache.getName());
   }
Example 3
private ConfigurationBuilder getScriptCacheConfiguration(GlobalConfiguration globalConfiguration) {
      ConfigurationBuilder cfg = new ConfigurationBuilder();
      cfg.encoding().key().mediaType(APPLICATION_OBJECT_TYPE);
      cfg.encoding().value().mediaType(APPLICATION_OBJECT_TYPE);
      if (globalConfiguration.security().authorization().enabled()) {
         globalConfiguration.security().authorization().roles()
                            .put(SCRIPT_MANAGER_ROLE,
                                 new CacheRoleImpl(SCRIPT_MANAGER_ROLE, AuthorizationPermission.ALL));
         cfg.security().authorization().enable().role(SCRIPT_MANAGER_ROLE);
      }
      return cfg;
   }
Example 4
private void initializeSecurity(GlobalConfiguration globalConfiguration) {
      GlobalAuthorizationConfiguration authorizationConfig = globalConfiguration.security().authorization();
      if (authorizationConfig.enabled() && System.getSecurityManager() == null) {
         CONFIG.authorizationEnabledWithoutSecurityManager();
      }
      if (authorizationConfig.enabled()) {
         authorizationConfig.principalRoleMapper().setContext(new PrincipalRoleMapperContextImpl(this));
      }
   }
Example 5
public void init(@ComponentName(KnownComponentNames.CACHE_NAME) String cacheName,
                    GlobalConfiguration globalConfiguration, Configuration configuration,
                    GlobalSecurityManager globalSecurityManager, EmbeddedCacheManager cacheManager) {
      this.configuration = configuration.security().authorization();
      Cache<CachePrincipalPair, SubjectACL> globalACLCache =
            (Cache<CachePrincipalPair, SubjectACL>) globalSecurityManager.globalACLCache();
      this.authzHelper = new AuthorizationHelper(globalConfiguration.security(), AuditContext.CACHE, cacheName,
            globalACLCache);
      if (globalACLCache != null) {
         SecurityActions.addCacheDependency(cacheManager, cacheName, globalACLCache.getName());
      }
   }
Example 6
public void validate(GlobalConfiguration globalConfig) {
      if (attributes.attribute(ENABLED).get() && !globalConfig.security().authorization().enabled())
         throw CONFIG.globalSecurityAuthShouldBeEnabled();
   }
Example 7
private void registerGlobalACLCacheConfiguration(GlobalConfiguration globalConfiguration, InternalCacheRegistry internalCacheRegistry) {
      long timeout = globalConfiguration.security().securityCacheTimeout();
      if (timeout != 0) {
         ConfigurationBuilder cfg = new ConfigurationBuilder();
         cfg.simpleCache(true);
         if (timeout > 0)
            cfg.expiration().lifespan(timeout);
         internalCacheRegistry.registerInternalCache(ACL_CACHE, cfg.build());
         cacheEnabled = true;
      } else {
         cacheEnabled = false;
      }
   }
Example 8
public DefaultCacheManager(GlobalConfiguration globalConfiguration, Configuration defaultConfiguration,
                              boolean start) {
      globalConfiguration = globalConfiguration == null ? new GlobalConfigurationBuilder().build() : globalConfiguration;
      defaultConfiguration = defaultConfiguration == null ? new ConfigurationBuilder().build() : defaultConfiguration;
      this.configurationManager = new ConfigurationManager(globalConfiguration, defaultConfiguration);
      this.globalComponentRegistry = new GlobalComponentRegistry(globalConfiguration, this, caches.keySet());
      this.globalComponentRegistry.registerComponent(configurationManager, ConfigurationManager.class);
      this.globalComponentRegistry.registerComponent(cacheDependencyGraph, CACHE_DEPENDENCY_GRAPH, false);
      this.authzHelper = new AuthorizationHelper(globalConfiguration.security(), AuditContext.CACHEMANAGER, globalConfiguration.globalJmxStatistics().cacheManagerName());
      this.globalComponentRegistry.registerComponent(authzHelper, AuthorizationHelper.class);
      this.stats = new CacheContainerStatsImpl(this);
      if (start)
         start();
   }