* @return an instance of {@code SecurityDomainContext}
* @throws Exception if an error occurs during creation
*/
public SecurityDomainContext createSecurityDomainContext(String securityDomain, AuthenticationCacheFactory cacheFactory) throws Exception {
log.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" })