public static TargetForestConfiguration FindByDomain(OrganizationId organizationId, string domainName)
 {
     if (!VariantConfiguration.GetSnapshot(MachineSettingsContext.Local, null, null).Global.MultiTenancy.Enabled)
     {
         TargetForestConfiguration result;
         if (!TargetForestConfigurationCache.cache.TryGetValue(domainName, out result))
         {
             TargetForestConfigurationCache.ConfigurationTracer.TraceError <object, string>(0L, "{0}: TargetForestConfiguration for domain {1} could not be found in cache", TraceContext.Get(), domainName);
             throw new AddressSpaceNotFoundException(Strings.descConfigurationInformationNotFound(domainName), 51004U);
         }
         return(result);
     }
     else
     {
         if (organizationId == null)
         {
             OrganizationId forestWideOrgId = OrganizationId.ForestWideOrgId;
         }
         OrganizationIdCacheValue organizationIdCacheValue = OrganizationIdCache.Singleton.Get(organizationId);
         if (organizationIdCacheValue == null)
         {
             TargetForestConfigurationCache.ConfigurationTracer.TraceError <object, OrganizationId>(0L, "{0}: Unable to find organization {1} in the OrgId cache", TraceContext.Get(), organizationId);
             throw new AddressSpaceNotFoundException(Strings.descConfigurationInformationNotFound(domainName), 64316U);
         }
         AvailabilityAddressSpace availabilityAddressSpace = organizationIdCacheValue.GetAvailabilityAddressSpace(domainName);
         if (availabilityAddressSpace != null)
         {
             TargetForestConfiguration result = TargetForestConfigurationCache.ConstructTargetForestConfiguration(availabilityAddressSpace, null);
             return(result);
         }
         TargetForestConfigurationCache.ConfigurationTracer.TraceError <object, string, OrganizationId>(0L, "{0}: TargetForestConfiguration for domain {1} could not be found in cache for organization {2}", TraceContext.Get(), domainName, organizationId);
         throw new AddressSpaceNotFoundException(Strings.descConfigurationInformationNotFound(domainName), 47932U);
     }
 }
Example #2
0
        protected override AutoDiscoverQuery CreateAutoDiscoverQuery(string domain, AutoDiscoverQueryItem[] queryItems, int redirectionDepth)
        {
            AutoDiscoverQuery.AutoDiscoverTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Search for TargetForestConfiguration for domain {1}", TraceContext.Get(), domain);
            TargetForestConfiguration targetForestConfiguration = TargetForestConfigurationCache.FindByDomain(base.ClientContext.OrganizationId, domain);

            if (targetForestConfiguration.Exception != null)
            {
                AutoDiscoverQuery.AutoDiscoverTracer.TraceError <object, string, LocalizedException>((long)this.GetHashCode(), "{0}: Found TargetForestConfiguration lookup for domain {1}, but it is in failed state due exception: {2}", TraceContext.Get(), domain, targetForestConfiguration.Exception);
                throw targetForestConfiguration.Exception;
            }
            QueryList queryListFromQueryItems = base.GetQueryListFromQueryItems(queryItems);

            return(new AutoDiscoverQueryInternal(base.Application, base.ClientContext, base.RequestLogger, targetForestConfiguration.AutoDiscoverUrl, new AutoDiscoverAuthenticator(targetForestConfiguration.GetCredentialCache(targetForestConfiguration.AutoDiscoverUrl), targetForestConfiguration.Credentials), queryItems, redirectionDepth, base.CreateAutoDiscoverRequest, targetForestConfiguration, queryListFromQueryItems));
        }
Example #3
0
 public GetFolderAndProxyRequestWithAutoDiscover(Application application, InternalClientContext clientContext, RequestLogger requestLogger, QueryList queryList, TargetForestConfiguration targetForestConfiguration) : base(application, clientContext, RequestType.CrossForest, requestLogger, queryList)
 {
     this.targetForestConfiguration = targetForestConfiguration;
 }
 public ProxyWebRequestWithAutoDiscover(Application application, ClientContext clientContext, RequestLogger requestLogger, QueryList queryList, TargetForestConfiguration targetForestConfiguration, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest) : base(application, clientContext, RequestType.CrossForest, requestLogger, queryList)
 {
     this.targetForestConfiguration = targetForestConfiguration;
     this.createAutoDiscoverRequest = createAutoDiscoverRequest;
 }
 public override AsyncRequestWithQueryList CreateCrossForestAsyncRequestWithAutoDiscover(ClientContext clientContext, RequestLogger requestLogger, QueryList queryList, TargetForestConfiguration targetForestConfiguration)
 {
     return(new ProxyWebRequestWithAutoDiscover(this, clientContext, requestLogger, queryList, targetForestConfiguration, new CreateAutoDiscoverRequestDelegate(AutoDiscoverRequestXmlByUser.Create)));
 }
Example #6
0
 public AutoDiscoverQueryInternal(Application application, ClientContext clientContext, RequestLogger requestLogger, TargetForestConfiguration targetForestConfiguration, AutoDiscoverQueryItem[] queryItems, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest, QueryList queryList) : this(application, clientContext, requestLogger, targetForestConfiguration.AutoDiscoverUrl, new AutoDiscoverAuthenticator(targetForestConfiguration.GetCredentialCache(targetForestConfiguration.AutoDiscoverUrl), targetForestConfiguration.Credentials), queryItems, 0, createAutoDiscoverRequest, targetForestConfiguration, queryList)
 {
 }
Example #7
0
 private AutoDiscoverQueryInternal(Application application, ClientContext clientContext, RequestLogger requestLogger, Uri autoDiscoverUrl, AutoDiscoverAuthenticator authenticator, AutoDiscoverQueryItem[] queryItems, int redirectionDepth, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest, TargetForestConfiguration targetForestConfiguration, QueryList queryList) : base(application, clientContext, requestLogger, autoDiscoverUrl, authenticator, queryItems, redirectionDepth, createAutoDiscoverRequest, AutodiscoverType.Internal, queryList)
 {
     this.targetForestConfiguration = targetForestConfiguration;
 }
Example #8
0
 public virtual AsyncRequestWithQueryList CreateCrossForestAsyncRequestWithAutoDiscover(ClientContext clientContext, RequestLogger requestLogger, QueryList queryList, TargetForestConfiguration targetForestConfiguration)
 {
     return(new ProxyWebRequestWithAutoDiscover(this, clientContext, requestLogger, queryList, targetForestConfiguration, new CreateAutoDiscoverRequestDelegate(AutoDiscoverRequestByDomain.CreateForCrossForest)));
 }