Exemplo n.º 1
0
        private void Complete1(AsyncTask task)
        {
            GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Completed GetFolder requests.", new object[]
            {
                TraceContext.Get()
            });
            this.CheckResultsOfGetFolder();
            QueryList queryList = new QueryList(base.QueryList.Count);

            foreach (BaseQuery baseQuery in ((IEnumerable <BaseQuery>)base.QueryList))
            {
                if (baseQuery.Result == null || baseQuery.Result.ExceptionInfo == null)
                {
                    queryList.Add(baseQuery);
                }
            }
            if (queryList.Count == 0)
            {
                GetFolderAndProxyRequest.GetFolderRequestTracer.TraceDebug((long)this.GetHashCode(), "{0}: Completed and no ProxyWebRequest is necessary.", new object[]
                {
                    TraceContext.Get()
                });
                base.Complete();
                return;
            }
            this.proxyWebRequest = new ProxyWebRequest(base.Application, base.ClientContext, base.RequestType, base.RequestLogger, base.QueryList, this.targetVersion, this.proxyAuthenticator, this.webServiceUri, this.webServiceUri.Source);
            this.proxyWebRequest.BeginInvoke(new TaskCompleteCallback(this.Complete2));
        }
Exemplo n.º 2
0
        protected QueryList GetQueryListFromQueryItems(AutoDiscoverQueryItem[] queryItems)
        {
            QueryList queryList = new QueryList();

            foreach (AutoDiscoverQueryItem autoDiscoverQueryItem in queryItems)
            {
                if (autoDiscoverQueryItem.SourceQuery != null)
                {
                    queryList.Add(autoDiscoverQueryItem.SourceQuery);
                }
            }
            return(queryList);
        }
Exemplo n.º 3
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));
        }
Exemplo n.º 4
0
        protected override AutoDiscoverQuery CreateAutoDiscoverQuery(string domain, AutoDiscoverQueryItem[] queryItems, int redirectionDepth)
        {
            AutoDiscoverQuery.AutoDiscoverTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Search for OrganizationRelationship for domain {1}", TraceContext.Get(), domain);
            OrganizationIdCacheValue organizationIdCacheValue = OrganizationIdCache.Singleton.Get(base.ClientContext.OrganizationId);
            OrganizationRelationship organizationRelationship = organizationIdCacheValue.GetOrganizationRelationship(domain);

            if (organizationRelationship == null)
            {
                AutoDiscoverQuery.AutoDiscoverTracer.TraceError <object, string>((long)this.GetHashCode(), "{0}: OrganizationRelationship lookup for domain {1} found nothing", TraceContext.Get(), domain);
                throw new AutoDiscoverFailedException(Strings.descConfigurationInformationNotFound(domain), 54588U);
            }
            if (organizationRelationship.TargetAutodiscoverEpr == null)
            {
                AutoDiscoverQuery.AutoDiscoverTracer.TraceError <object, string, ADObjectId>((long)this.GetHashCode(), "{0}: OrganizationRelationship lookup for domain {1} found {2}, but it doesn't have TargetAutodiscoverEpr set", TraceContext.Get(), domain, organizationRelationship.Id);
                throw new AutoDiscoverFailedException(Strings.descMisconfiguredOrganizationRelationship(organizationRelationship.Id.ToString()), 42300U);
            }
            AutoDiscoverQuery.AutoDiscoverTracer.TraceDebug <object, string, ADObjectId>((long)this.GetHashCode(), "{0}: OrganizationRelationship lookup for domain {1} found {2}", TraceContext.Get(), domain, organizationRelationship.Id);
            QueryList queryListFromQueryItems = base.GetQueryListFromQueryItems(queryItems);

            return(new AutoDiscoverQueryExternal(base.Application, base.ClientContext, base.RequestLogger, organizationRelationship.TargetAutodiscoverEpr, base.Authenticator, queryItems, redirectionDepth, base.CreateAutoDiscoverRequest, queryListFromQueryItems));
        }
Exemplo n.º 5
0
        protected override AutoDiscoverQuery CreateAutoDiscoverQuery(string domain, AutoDiscoverQueryItem[] queryItems, int redirectionDepth)
        {
            AutoDiscoverQuery.AutoDiscoverTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Search for OrganizationRelationship for domain {1}", TraceContext.Get(), domain);
            OrganizationIdCacheValue   organizationIdCacheValue   = OrganizationIdCache.Singleton.Get(base.ClientContext.OrganizationId);
            IntraOrganizationConnector intraOrganizationConnector = organizationIdCacheValue.GetIntraOrganizationConnector(domain);

            if (intraOrganizationConnector == null)
            {
                AutoDiscoverQuery.AutoDiscoverTracer.TraceError <object, string>((long)this.GetHashCode(), "{0}: IntraOrganizationConnector lookup for domain {1} found nothing", TraceContext.Get(), domain);
                throw new AutoDiscoverFailedException(Strings.descConfigurationInformationNotFound(domain), 58684U);
            }
            if (intraOrganizationConnector.DiscoveryEndpoint == null)
            {
                AutoDiscoverQuery.AutoDiscoverTracer.TraceError <object, string, ADObjectId>((long)this.GetHashCode(), "{0}: IntraOrganizationConnector lookup for domain {1} found {2}, but it doesn't have DiscoveryEndpoint set", TraceContext.Get(), domain, intraOrganizationConnector.Id);
                throw new AutoDiscoverFailedException(Strings.descMisconfiguredIntraOrganizationConnector(intraOrganizationConnector.Id.ToString()), 34108U);
            }
            AutoDiscoverQuery.AutoDiscoverTracer.TraceDebug <object, string, ADObjectId>((long)this.GetHashCode(), "{0}: IntraOrganizationConnector lookup for domain {1} found {2}", TraceContext.Get(), domain, intraOrganizationConnector.Id);
            QueryList queryListFromQueryItems = base.GetQueryListFromQueryItems(queryItems);

            return(new AutoDiscoverQueryExternalByOAuth(base.Application, base.ClientContext, base.RequestLogger, intraOrganizationConnector.DiscoveryEndpoint, base.Authenticator, queryItems, redirectionDepth, base.CreateAutoDiscoverRequest, queryListFromQueryItems));
        }
Exemplo n.º 6
0
        public override void EndProxyWebRequest(ProxyWebRequest proxyWebRequest, QueryList queryList, IService service, IAsyncResult asyncResult)
        {
            GetUserAvailabilityResponse getUserAvailabilityResponse = service.EndGetUserAvailability(asyncResult);

            FreeBusyResponse[] array = null;
            if (getUserAvailabilityResponse != null)
            {
                array = getUserAvailabilityResponse.FreeBusyResponseArray;
            }
            if (array == null)
            {
                Application.ProxyWebRequestTracer.TraceError((long)proxyWebRequest.GetHashCode(), "{0}: Proxy web request returned NULL FreeBusyResponseArray.", new object[]
                {
                    TraceContext.Get()
                });
            }
            for (int i = 0; i < queryList.Count; i++)
            {
                FreeBusyQuery    freeBusyQuery    = (FreeBusyQuery)queryList[i];
                FreeBusyResponse freeBusyResponse = null;
                if (array != null && i < array.Length)
                {
                    freeBusyResponse = array[i];
                    if (freeBusyResponse == null)
                    {
                        Application.ProxyWebRequestTracer.TraceDebug <object, EmailAddress>((long)proxyWebRequest.GetHashCode(), "{0}: Proxy web request returned NULL FreeBusyResponse for mailbox {1}.", TraceContext.Get(), freeBusyQuery.Email);
                    }
                }
                FreeBusyQueryResult resultOnFirstCall;
                if (freeBusyResponse == null)
                {
                    resultOnFirstCall = new FreeBusyQueryResult(new ProxyNoResultException(Strings.descProxyNoResultError(freeBusyQuery.Email.Address, service.Url), 60732U));
                }
                else
                {
                    resultOnFirstCall = FreeBusyApplication.CopyViewAndResponseToResult(service.Url, freeBusyResponse.FreeBusyView, freeBusyResponse.ResponseMessage, freeBusyQuery.Email);
                }
                freeBusyQuery.SetResultOnFirstCall(resultOnFirstCall);
            }
        }
 public DispatcherWithAutoDiscoverResults(Application application, QueryList queryList, IList <AutoDiscoverQueryItem> autoDiscoverQueryItems, ProxyAuthenticator proxyAuthenticator, RequestType requestType, DispatcherWithAutoDiscoverResults.CreateRequestWithQueryListDelegate createRequestDelegate)
 {
     DispatcherWithAutoDiscoverResults < > 4__this = this;
     this.createRequestDelegate = createRequestDelegate;
     for (int i = 0; i < queryList.Count; i++)
     {
         BaseQuery          baseQuery          = queryList[i];
         AutoDiscoverResult autoDiscoverResult = autoDiscoverQueryItems[i].Result;
         if (autoDiscoverResult.Exception != null)
         {
             DispatcherWithAutoDiscoverResults.RequestRoutingTracer.TraceError <object, EmailAddress>((long)this.GetHashCode(), "{0}: autodiscover for {1} failed and it will not be dispatched for query", TraceContext.Get(), baseQuery.Email);
             baseQuery.SetResultOnFirstCall(application.CreateQueryResult(autoDiscoverResult.Exception));
         }
         else
         {
             string key = autoDiscoverResult.WebServiceUri.Uri.ToString();
             if (autoDiscoverResult.WebServiceUri.EmailAddress != null)
             {
                 baseQuery.RecipientData.EmailAddress = autoDiscoverResult.WebServiceUri.EmailAddress;
             }
             base.Add(key, baseQuery, requestType, (QueryList perRequestQueryList) => < > 4__this.createRequestDelegate(perRequestQueryList, proxyAuthenticator ?? autoDiscoverResult.ProxyAuthenticator, autoDiscoverResult.WebServiceUri, UriSource.EmailDomain));
         }
     }
 }
 private AsyncRequest CreateRequest(QueryList queryList, ProxyAuthenticator proxyAuthenticator, WebServiceUri webServiceUri, UriSource source)
 {
     return(new ProxyWebRequest(base.Application, base.ClientContext, RequestType.FederatedCrossForest, base.RequestLogger, queryList, TargetServerVersion.Unknown, proxyAuthenticator, webServiceUri, source));
 }
 public ExternalProxyWebRequestWithAutoDiscover(Application application, InternalClientContext clientContext, RequestLogger requestLogger, QueryList queryList, ExternalAuthenticationRequest autoDiscoverExternalAuthenticationRequest, ExternalAuthenticationRequest webProxyExternalAuthenticationRequest, Uri autoDiscoverUrl, SmtpAddress sharingKey, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest) : base(application, clientContext, RequestType.FederatedCrossForest, requestLogger, queryList)
 {
     this.autoDiscoverExternalAuthenticationRequest = autoDiscoverExternalAuthenticationRequest;
     this.webProxyExternalAuthenticationRequest     = webProxyExternalAuthenticationRequest;
     this.autoDiscoverUrl           = autoDiscoverUrl;
     this.sharingKey                = sharingKey;
     this.createAutoDiscoverRequest = createAutoDiscoverRequest;
 }
Exemplo n.º 10
0
 public GetFolderAndProxyRequestWithAutoDiscover(Application application, InternalClientContext clientContext, RequestLogger requestLogger, QueryList queryList, TargetForestConfiguration targetForestConfiguration) : base(application, clientContext, RequestType.CrossForest, requestLogger, queryList)
 {
     this.targetForestConfiguration = targetForestConfiguration;
 }
Exemplo n.º 11
0
 private AsyncRequestWithQueryList CreateRequest(QueryList queryList, ProxyAuthenticator proxyAuthenticator, WebServiceUri webServiceUri, UriSource source)
 {
     return(new GetFolderAndProxyRequest(base.Application, (InternalClientContext)base.ClientContext, RequestType.CrossForest, base.RequestLogger, queryList, TargetServerVersion.Unknown, proxyAuthenticator, webServiceUri));
 }
Exemplo n.º 12
0
        protected override AutoDiscoverQuery CreateAutoDiscoverQuery(Uri autoDiscoverUrl, AutoDiscoverQueryItem[] queryItems, int redirectionDepth)
        {
            QueryList queryListFromQueryItems = base.GetQueryListFromQueryItems(queryItems);

            return(new AutoDiscoverQueryExternal(base.Application, base.ClientContext, base.RequestLogger, autoDiscoverUrl, base.Authenticator, queryItems, redirectionDepth, base.CreateAutoDiscoverRequest, queryListFromQueryItems));
        }
 public ExternalProxyWebRequest(Application application, ClientContext clientContext, RequestLogger requestLogger, QueryList queryList, ExternalAuthenticationRequest externalAuthenticationRequest, WebServiceUri webServiceUri, SmtpAddress sharingKey) : base(application, clientContext, RequestType.FederatedCrossForest, requestLogger, queryList)
 {
     this.externalAuthenticationRequest = externalAuthenticationRequest;
     this.webServiceUri = webServiceUri;
     this.sharingKey    = sharingKey;
 }
Exemplo n.º 14
0
 public override AsyncRequestWithQueryList CreateExternalByOAuthAsyncRequestWithAutoDiscover(InternalClientContext clientContext, RequestLogger requestLogger, QueryList queryList, Uri autoDiscoverUrl)
 {
     return(new ExternalByOAuthProxyWebRequestWithAutoDiscover(this, clientContext, requestLogger, queryList, autoDiscoverUrl, new CreateAutoDiscoverRequestDelegate(AutoDiscoverRequestByUser.Create)));
 }
Exemplo n.º 15
0
        public void Add(string key, BaseQuery query, RequestType requestType, BaseRequestDispatcher.CreateRequestDelegate createRequestDelegate)
        {
            BaseRequestDispatcher.RequestRoutingTracer.TraceDebug((long)this.GetHashCode(), "{0}: Adding a proxy web request of type {1} for mailbox {2} to request key {3}", new object[]
            {
                TraceContext.Get(),
                requestType,
                query.Email,
                key
            });
            query.Type = new RequestType?(requestType);
            QueryList queryList;

            if (!this.queryListDictionary.TryGetValue(key, out queryList))
            {
                BaseRequestDispatcher.RequestRoutingTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: key {1} was not found. Creating new request for it", TraceContext.Get(), key);
                queryList = new QueryList();
                queryList.Add(query);
                this.requests.Add(createRequestDelegate(queryList));
                this.queryListDictionary.Add(key, queryList);
            }
            else
            {
                BaseRequestDispatcher.RequestRoutingTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: key {1} was found.", TraceContext.Get(), key);
                queryList.Add(query);
            }
            switch (requestType)
            {
            case RequestType.Local:
                PerformanceCounters.IntraSiteCalendarQueriesPerSecond.Increment();
                this.intraSiteQueryCount++;
                return;

            case RequestType.IntraSite:
                PerformanceCounters.IntraSiteProxyFreeBusyQueriesPerSecond.Increment();
                this.intraSiteProxyQueryCount++;
                return;

            case RequestType.CrossSite:
                PerformanceCounters.CrossSiteCalendarQueriesPerSecond.Increment();
                this.crossSiteQueryCount++;
                return;

            case RequestType.CrossForest:
                PerformanceCounters.CrossForestCalendarQueriesPerSecond.Increment();
                this.crossForestQueryCount++;
                return;

            case RequestType.FederatedCrossForest:
                PerformanceCounters.FederatedFreeBusyQueriesPerSecond.Increment();
                this.federatedCrossForestQueryCount++;
                return;

            case RequestType.PublicFolder:
                PerformanceCounters.PublicFolderQueriesPerSecond.Increment();
                this.publicFolderQueryCount++;
                return;

            default:
                return;
            }
        }
Exemplo n.º 16
0
 public override AsyncRequestWithQueryList CreateCrossForestAsyncRequestWithAutoDiscover(ClientContext clientContext, RequestLogger requestLogger, QueryList queryList, TargetForestConfiguration targetForestConfiguration)
 {
     return(new ProxyWebRequestWithAutoDiscover(this, clientContext, requestLogger, queryList, targetForestConfiguration, new CreateAutoDiscoverRequestDelegate(AutoDiscoverRequestXmlByUser.Create)));
 }
Exemplo n.º 17
0
 public override AsyncRequestWithQueryList CreateExternalAsyncRequestWithAutoDiscover(InternalClientContext clientContext, RequestLogger requestLogger, QueryList queryList, ExternalAuthenticationRequest autoDiscoverExternalAuthenticationRequest, ExternalAuthenticationRequest webProxyExternalAuthenticationRequest, Uri autoDiscoverUrl, SmtpAddress sharingKey)
 {
     return(new ExternalProxyWebRequestWithAutoDiscover(this, clientContext, requestLogger, queryList, autoDiscoverExternalAuthenticationRequest, webProxyExternalAuthenticationRequest, autoDiscoverUrl, sharingKey, new CreateAutoDiscoverRequestDelegate(AutoDiscoverRequestByUser.Create)));
 }
Exemplo n.º 18
0
 public ExternalByOAuthProxyWebRequestWithAutoDiscover(Application application, InternalClientContext clientContext, RequestLogger requestLogger, QueryList queryList, Uri autoDiscoverUrl, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest) : base(application, clientContext, RequestType.FederatedCrossForest, requestLogger, queryList)
 {
     this.autoDiscoverUrl           = autoDiscoverUrl;
     this.createAutoDiscoverRequest = createAutoDiscoverRequest;
 }
Exemplo n.º 19
0
 public AutoDiscoverQueryExternal(Application application, ClientContext clientContext, RequestLogger requestLogger, Uri autoDiscoverUrl, ProxyAuthenticator proxyAuthenticator, AutoDiscoverQueryItem[] queryItems, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest, QueryList queryList) : this(application, clientContext, requestLogger, autoDiscoverUrl, new AutoDiscoverAuthenticator(proxyAuthenticator), queryItems, 0, createAutoDiscoverRequest, queryList)
 {
 }
Exemplo n.º 20
0
        public static AutoDiscoverQueryItem[] CreateAutoDiscoverQueryItems(Application application, QueryList queryList, Uri autoDiscoverUrl)
        {
            AutoDiscoverQueryItem[] array = new AutoDiscoverQueryItem[queryList.Count];
            string target = autoDiscoverUrl.ToString();

            for (int i = 0; i < queryList.Count; i++)
            {
                queryList[i].Target = target;
                array[i]            = new AutoDiscoverQueryItem(queryList[i].RecipientData, application.Name, queryList[i]);
            }
            return(array);
        }
 protected AsyncRequestWithQueryList(Application application, ClientContext clientContext, RequestType requestType, RequestLogger requestLogger, QueryList queryList) : base(application, clientContext, requestLogger)
 {
     this.QueryList   = queryList;
     this.RequestType = requestType;
 }
Exemplo n.º 22
0
 public ExternalByOAuthProxyWebRequest(Application application, ClientContext clientContext, RequestLogger requestLogger, QueryList queryList, WebServiceUri webServiceUri) : base(application, clientContext, RequestType.FederatedCrossForest, requestLogger, queryList)
 {
     this.webServiceUri = webServiceUri;
 }
Exemplo n.º 23
0
 public QueryList(QueryList existing) : this(new List <BaseQuery>(existing))
 {
 }
Exemplo n.º 24
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)
 {
 }
Exemplo n.º 25
0
        internal ProxyWebRequest(Application application, ClientContext clientContext, RequestType requestType, RequestLogger requestLogger, QueryList queryList, TargetServerVersion targetVersion, ProxyAuthenticator proxyAuthenticator, WebServiceUri webServiceUri, UriSource source) : base(application, clientContext, requestLogger, "ProxyWebRequest")
        {
            this.proxyAuthenticator = proxyAuthenticator;
            this.url         = webServiceUri.Uri.OriginalString;
            this.protocol    = webServiceUri.Protocol;
            this.source      = source;
            this.queryList   = queryList;
            this.requestType = requestType;
            this.service     = application.CreateService(webServiceUri, targetVersion, requestType);
            if (proxyAuthenticator.AuthenticatorType == AuthenticatorType.WSSecurity || proxyAuthenticator.AuthenticatorType == AuthenticatorType.OAuth)
            {
                if (webServiceUri.ServerVersion >= Globals.E15Version && clientContext.RequestSchemaVersion >= ExchangeVersionType.Exchange2012)
                {
                    this.service.RequestServerVersionValue = new RequestServerVersion
                    {
                        Version = ExchangeVersionType.Exchange2012
                    };
                }
                else
                {
                    this.service.RequestServerVersionValue = new RequestServerVersion
                    {
                        Version = ExchangeVersionType.Exchange2009
                    };
                }
            }
            else if (targetVersion >= TargetServerVersion.E15 && clientContext.RequestSchemaVersion == ExchangeVersionType.Exchange2012)
            {
                this.service.RequestServerVersionValue = new RequestServerVersion
                {
                    Version = ExchangeVersionType.Exchange2012
                };
            }
            this.service.CookieContainer  = new CookieContainer();
            this.service.requestTypeValue = new RequestTypeHeader();
            if (requestType == RequestType.CrossSite || requestType == RequestType.IntraSite)
            {
                if (Configuration.BypassProxyForCrossSiteRequests)
                {
                    this.service.Proxy = new WebProxy();
                }
                this.service.requestTypeValue.RequestType = ProxyRequestType.CrossSite;
                if (requestType == RequestType.CrossSite)
                {
                    this.failedCounter = PerformanceCounters.CrossSiteCalendarFailuresPerSecond;
                    this.averageProcessingTimeCounter     = PerformanceCounters.AverageCrossSiteFreeBusyRequestProcessingTime;
                    this.averageProcessingTimeCounterBase = PerformanceCounters.AverageCrossSiteFreeBusyRequestProcessingTimeBase;
                    this.requestStatisticsType            = RequestStatisticsType.CrossSiteProxy;
                }
                else
                {
                    this.failedCounter = PerformanceCounters.IntraSiteProxyFreeBusyFailuresPerSecond;
                    this.averageProcessingTimeCounter     = PerformanceCounters.AverageIntraSiteProxyFreeBusyRequestProcessingTime;
                    this.averageProcessingTimeCounterBase = PerformanceCounters.AverageIntraSiteProxyFreeBusyRequestProcessingTimeBase;
                    this.requestStatisticsType            = RequestStatisticsType.IntraSiteProxy;
                }
            }
            else
            {
                bool flag = false;
                if (Configuration.BypassProxyForCrossForestRequests)
                {
                    this.service.Proxy = new WebProxy();
                    flag = true;
                }
                this.service.requestTypeValue.RequestType = ProxyRequestType.CrossForest;
                if (requestType == RequestType.FederatedCrossForest)
                {
                    if (proxyAuthenticator.AuthenticatorType == AuthenticatorType.OAuth)
                    {
                        this.failedCounter = PerformanceCounters.FederatedByOAuthFreeBusyFailuresPerSecond;
                        this.averageProcessingTimeCounter     = PerformanceCounters.AverageFederatedByOAuthFreeBusyRequestProcessingTime;
                        this.averageProcessingTimeCounterBase = PerformanceCounters.AverageFederatedByOAuthFreeBusyRequestProcessingTimeBase;
                        this.requestStatisticsType            = RequestStatisticsType.OAuthProxy;
                        this.service.requestTypeValue         = null;
                    }
                    else
                    {
                        this.failedCounter = PerformanceCounters.FederatedFreeBusyFailuresPerSecond;
                        this.averageProcessingTimeCounter     = PerformanceCounters.AverageFederatedFreeBusyRequestProcessingTime;
                        this.averageProcessingTimeCounterBase = PerformanceCounters.AverageFederatedFreeBusyRequestProcessingTimeBase;
                        this.requestStatisticsType            = RequestStatisticsType.FederatedProxy;
                    }
                    if (!flag)
                    {
                        Server localServer = LocalServerCache.LocalServer;
                        if (localServer != null && localServer.InternetWebProxy != null)
                        {
                            ProxyWebRequest.ProxyWebRequestTracer.TraceDebug <object, Uri>((long)this.GetHashCode(), "{0}: Using custom InternetWebProxy {1}", TraceContext.Get(), localServer.InternetWebProxy);
                            this.service.Proxy = new WebProxy(localServer.InternetWebProxy);
                        }
                    }
                }
                else
                {
                    this.failedCounter = PerformanceCounters.CrossForestCalendarFailuresPerSecond;
                    this.averageProcessingTimeCounter     = PerformanceCounters.AverageCrossForestFreeBusyRequestProcessingTime;
                    this.averageProcessingTimeCounterBase = PerformanceCounters.AverageCrossForestFreeBusyRequestProcessingTimeBase;
                    this.requestStatisticsType            = RequestStatisticsType.CrossForestProxy;
                }
            }
            if (!Configuration.DisableGzipForProxyRequests)
            {
                this.service.EnableDecompression = true;
            }
            string address = this.queryList[0].Email.Address;

            ProxyWebRequest.ProxyWebRequestTracer.TraceDebug <object, string, WebServiceUri>((long)this.GetHashCode(), "{0}: Adding Anchor Mailbox Header {1} to the request to {2}.", TraceContext.Get(), address, webServiceUri);
            this.service.HttpHeaders.Add("X-AnchorMailbox", address);
            if (!string.IsNullOrEmpty(base.ClientContext.RequestId))
            {
                this.service.HttpHeaders.Add("client-request-id", base.ClientContext.RequestId);
            }
        }
Exemplo n.º 26
0
        protected AutoDiscoverQuery(Application application, ClientContext clientContext, RequestLogger requestLogger, Uri autoDiscoverUrl, AutoDiscoverAuthenticator authenticator, AutoDiscoverQueryItem[] queryItems, int redirectionDepth, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest, AutodiscoverType autodiscoverType, QueryList queryList)
        {
            this.application               = application;
            this.clientContext             = clientContext;
            this.requestLogger             = requestLogger;
            this.autoDiscoverUrl           = autoDiscoverUrl;
            this.authenticator             = authenticator;
            this.queryItems                = queryItems;
            this.redirectionDepth          = redirectionDepth;
            this.createAutoDiscoverRequest = createAutoDiscoverRequest;
            this.autodiscoverType          = autodiscoverType;
            this.queryList      = queryList;
            this.emailAddresses = new EmailAddress[queryItems.Length];
            for (int i = 0; i < queryItems.Length; i++)
            {
                this.emailAddresses[i] = queryItems[i].EmailAddress;
            }
            StringBuilder stringBuilder = new StringBuilder(200);

            foreach (AutoDiscoverQueryItem autoDiscoverQueryItem in this.queryItems)
            {
                if (stringBuilder.Length > 0)
                {
                    stringBuilder.Append(",");
                }
                stringBuilder.Append(autoDiscoverQueryItem.EmailAddress.ToString());
            }
            this.emailAddressesString = stringBuilder.ToString();
            AutoDiscoverQuery.AutoDiscoverTracer.TraceDebug <object, string>((long)this.GetHashCode(), "{0}: Created AutoDiscoverQuery for {1}", TraceContext.Get(), this.emailAddressesString);
        }
Exemplo n.º 27
0
 public override void EndProxyWebRequest(ProxyWebRequest proxyWebRequest, QueryList queryList, IService service, IAsyncResult asyncResult)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 28
0
 private AutoDiscoverQueryExternal(Application application, ClientContext clientContext, RequestLogger requestLogger, Uri autoDiscoverUrl, AutoDiscoverAuthenticator authenticator, AutoDiscoverQueryItem[] queryItems, int redirectionDepth, CreateAutoDiscoverRequestDelegate createAutoDiscoverRequest, QueryList queryList) : base(application, clientContext, requestLogger, autoDiscoverUrl, authenticator, queryItems, redirectionDepth, createAutoDiscoverRequest, AutodiscoverType.External, queryList)
 {
 }
Exemplo n.º 29
0
        public LocalRequest(Application application, ClientContext clientContext, RequestLogger requestLogger, QueryList queryList, DateTime deadline) : base(application, LocalRequest.CloneIfInternalContext(clientContext), RequestType.Local, requestLogger, queryList)
        {
            this.localQuery = application.CreateLocalQuery(base.ClientContext, deadline);
            int num = LimitedThreadPool.MaximumThreads / 2;

            if (num <= 0)
            {
                num = 1;
            }
            LocalRequest.RequestRoutingTracer.TraceDebug <object, int>((long)this.GetHashCode(), "{0}: Initializing LimitedThreadPool with {1} threads to process mailboxes", TraceContext.Get(), num);
            this.threadPool = new LimitedThreadPool(num, new WaitCallback(this.Execute));
        }
 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;
 }