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;
}
Aggregations