Search in sources :

Example 1 with CacheableManager

use of org.jboss.security.CacheableManager in project wildfly by wildfly.

the class JNDIBasedSecurityManagement method createSecurityDomainContext.

/**
     * Creates a {@code SecurityDomainContext}
     *
     * @param securityDomain name of the security domain
     * @param cacheFactory creates a cache implementation
     * @return an instance of {@code SecurityDomainContext}
     * @throws Exception if an error occurs during creation
     */
public SecurityDomainContext createSecurityDomainContext(String securityDomain, AuthenticationCacheFactory cacheFactory) throws Exception {
    SecurityLogger.ROOT_LOGGER.debugf("Creating SDC for domain = %s", securityDomain);
    AuthenticationManager am = createAuthenticationManager(securityDomain);
    if (cacheFactory != null && am instanceof CacheableManager) {
        // create authentication cache
        final Map<Principal, ?> cache = cacheFactory.getCache();
        if (cache != null) {
            @SuppressWarnings({ "unchecked", "rawtypes" }) CacheableManager<Map, Principal> cm = (CacheableManager<Map, Principal>) am;
            cm.setCache(cache);
        }
    }
    // set DeepCopySubject option if supported
    if (deepCopySubjectMode) {
        setDeepCopySubjectMode(am);
    }
    SecurityDomainContext securityDomainContext = new SecurityDomainContext(am);
    securityDomainContext.setAuthorizationManager(createAuthorizationManager(securityDomain));
    securityDomainContext.setAuditManager(createAuditManager(securityDomain));
    securityDomainContext.setIdentityTrustManager(createIdentityTrustManager(securityDomain));
    securityDomainContext.setMappingManager(createMappingManager(securityDomain));
    return securityDomainContext;
}
Also used : AuthenticationManager(org.jboss.security.AuthenticationManager) CacheableManager(org.jboss.security.CacheableManager) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Map(java.util.Map) Principal(java.security.Principal)

Aggregations

Principal (java.security.Principal)1 Map (java.util.Map)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 AuthenticationManager (org.jboss.security.AuthenticationManager)1 CacheableManager (org.jboss.security.CacheableManager)1