security/subsystem/src/main/java/org/jboss/as/security/plugins/JNDIBasedSecurityManagement.java
public SecurityDomainContext createSecurityDomainContext(String securityDomain,
                                                                    AuthenticationCacheFactory cacheFactory,
                                                                    JSSESecurityDomain jsseSecurityDomain) 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);
        }

        return new SecurityDomainContext(am,
                createAuthorizationManager(securityDomain),
                createAuditManager(securityDomain),
                createIdentityTrustManager(securityDomain), createMappingManager(securityDomain),
                jsseSecurityDomain);
    }
public SecurityDomainContext createSecurityDomainContext(String securityDomain,
                                                                    AuthenticationCacheFactory cacheFactory,
                                                                    JSSESecurityDomain jsseSecurityDomain) 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);
        }

        return new SecurityDomainContext(am,
                createAuthorizationManager(securityDomain),
                createAuditManager(securityDomain),
                createIdentityTrustManager(securityDomain), createMappingManager(securityDomain),
                jsseSecurityDomain);
    }
Creates a {@code SecurityDomainContext} optionally including a {@link JSSESecurityDomain}

@param securityDomain name of the security domain. Cannot be {@code null}
@param cacheFactory creates a cache implementation. Cannot be {@code null}
@param jsseSecurityDomain a JSSE security domain. May be {@code null}
@return an instance of {@code SecurityDomainContext}
@throws Exception if an error occurs during creation