// Token: 0x0600053A RID: 1338 RVA: 0x0001D034 File Offset: 0x0001B234
        protected override Uri GetTargetBackEndServerUrl()
        {
            Uri uri = base.GetTargetBackEndServerUrl();

            if (base.AnchoredRoutingTarget.BackEndServer.Version < Server.E15MinVersion)
            {
                throw new HttpException(500, string.Format("Version < E14 and a WOPI request?  Should not happen....  AnchorMailbox: {0}", base.AnchoredRoutingTarget.AnchorMailbox));
            }
            if (uri.Query.Length == 0)
            {
                throw new HttpException(400, "Unexpected query string format");
            }
            if (!string.IsNullOrEmpty(this.targetMailboxId))
            {
                UriBuilder uriBuilder = new UriBuilder(uri);
                uriBuilder.Path  = AuthenticatedWopiRequestPathHandler.StripMailboxId(HttpUtility.UrlDecode(uriBuilder.Path), this.targetMailboxId);
                uriBuilder.Query = uri.Query.Substring(1) + "&UserEmail=" + HttpUtility.UrlEncode(this.targetMailboxId);
                uri = uriBuilder.Uri;
            }
            if (HttpProxySettings.DFPOWAVdirProxyEnabled.Value)
            {
                return(UrlUtilities.FixDFPOWAVdirUrlForBackEnd(uri, HttpUtility.ParseQueryString(uri.Query)["vdir"]));
            }
            return(uri);
        }
        // Token: 0x06000539 RID: 1337 RVA: 0x0001CFAC File Offset: 0x0001B1AC
        protected override AnchorMailbox ResolveAnchorMailbox()
        {
            UriBuilder uriBuilder = new UriBuilder(base.ClientRequest.Url);

            uriBuilder.Scheme = "https";
            uriBuilder.Port   = 444;
            string mailboxId = AuthenticatedWopiRequestPathHandler.GetMailboxId(base.ClientRequest);

            if (!string.IsNullOrEmpty(mailboxId))
            {
                this.targetMailboxId = mailboxId;
                AnchorMailbox result;
                if (AnchorMailboxFactory.TryCreateFromMailboxGuid(this, mailboxId, out result))
                {
                    return(result);
                }
                if (SmtpAddress.IsValidSmtpAddress(mailboxId))
                {
                    base.Logger.Set(3, "Url-SMTP");
                    return(new SmtpAnchorMailbox(mailboxId, this));
                }
            }
            return(base.ResolveAnchorMailbox());
        }
示例#3
0
        // Token: 0x060005F4 RID: 1524 RVA: 0x000213C0 File Offset: 0x0001F5C0
        private IHttpHandler SelectHandlerForAuthenticatedRequest(HttpContext httpContext)
        {
            IHttpHandler result;

            try
            {
                IHttpHandler httpHandler;
                if (HttpProxyGlobals.ProtocolType == 14)
                {
                    httpHandler = new MapiProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 1)
                {
                    if (SiteMailboxCreatingProxyRequestHandler.IsSiteMailboxCreatingProxyRequest(httpContext.Request))
                    {
                        httpHandler = new SiteMailboxCreatingProxyRequestHandler();
                    }
                    else if (EDiscoveryExportToolProxyRequestHandler.IsEDiscoveryExportToolProxyRequest(httpContext.Request))
                    {
                        httpHandler = new EDiscoveryExportToolProxyRequestHandler();
                    }
                    else if (BEResourceRequestHandler.CanHandle(httpContext.Request))
                    {
                        httpHandler = new BEResourceRequestHandler();
                    }
                    else
                    {
                        httpHandler = new EcpProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == 9)
                {
                    httpHandler = new AutodiscoverProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 2)
                {
                    if (EwsUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request))
                    {
                        httpHandler = new EwsUserPhotoProxyRequestHandler();
                    }
                    else if (MrsProxyRequestHandler.IsMrsRequest(httpContext.Request))
                    {
                        httpHandler = new MrsProxyRequestHandler();
                    }
                    else if (MessageTrackingRequestHandler.IsMessageTrackingRequest(httpContext.Request))
                    {
                        httpHandler = new MessageTrackingRequestHandler();
                    }
                    else
                    {
                        httpHandler = new EwsProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == 27)
                {
                    httpHandler = new RestProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 8)
                {
                    if (RpcHttpRequestHandler.CanHandleRequest(httpContext.Request))
                    {
                        httpHandler = new RpcHttpRequestHandler();
                    }
                    else
                    {
                        httpHandler = new RpcHttpProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == null)
                {
                    httpHandler = new EasProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 3)
                {
                    httpHandler = new OabProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 6 || HttpProxyGlobals.ProtocolType == 7)
                {
                    httpHandler = new RemotePowerShellProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 10)
                {
                    httpHandler = new ReportingWebServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 11)
                {
                    httpHandler = new PswsProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 12)
                {
                    httpHandler = new XRopProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 4)
                {
                    string absolutePath = httpContext.Request.Url.AbsolutePath;
                    if (OWAUserPhotoProxyRequestHandler.IsUserPhotoRequest(httpContext.Request))
                    {
                        httpHandler = new OWAUserPhotoProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaEwsJsonRequest(absolutePath))
                    {
                        httpHandler = new EwsJsonProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaOeh2Request(absolutePath))
                    {
                        httpHandler = new OwaOeh2ProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaSpeechRecoRequest(absolutePath))
                    {
                        httpHandler = new SpeechRecoProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaLanguagePostRequest(absolutePath))
                    {
                        httpHandler = new OwaLanguagePostProxyRequestHandler();
                    }
                    else if (RequestPathParser.IsOwaE14ProxyRequest(absolutePath, httpContext.Request.RawUrl))
                    {
                        httpHandler = new EwsProxyRequestHandler(true);
                    }
                    else if (AuthenticatedWopiRequestPathHandler.IsAuthenticatedWopiRequest(httpContext.Request, AuthCommon.IsFrontEnd))
                    {
                        httpHandler = new AuthenticatedWopiProxyRequestHandler();
                    }
                    else
                    {
                        httpHandler = new OwaProxyRequestHandler();
                    }
                }
                else if (HttpProxyGlobals.ProtocolType == 13)
                {
                    httpHandler = new PushNotificationsProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 16)
                {
                    httpHandler = new OutlookServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 17)
                {
                    httpHandler = new SnackyServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 18)
                {
                    httpHandler = new MicroServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 15)
                {
                    httpHandler = new E4eProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 20)
                {
                    httpHandler = new O365SuiteServiceProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 21)
                {
                    httpHandler = new MailboxDeliveryProxyRequestHandler();
                }
                else if (HttpProxyGlobals.ProtocolType == 22)
                {
                    httpHandler = new ComplianceServiceProxyRequestHandler();
                }
                else
                {
                    if (HttpProxyGlobals.ProtocolType != 24)
                    {
                        throw new InvalidOperationException("Unknown protocol type " + HttpProxyGlobals.ProtocolType);
                    }
                    httpHandler = new LogExportProxyHandler();
                }
                result = httpHandler;
            }
            finally
            {
                long currentLatency = LatencyTracker.FromHttpContext(httpContext).GetCurrentLatency(LatencyTrackerKey.ProxyModuleLatency);
                if (currentLatency > 100L)
                {
                    RequestDetailsLoggerBase <RequestDetailsLogger> .SafeAppendGenericInfo(RequestDetailsLoggerBase <RequestDetailsLogger> .GetCurrent(httpContext), "SelectHandler", currentLatency);
                }
            }
            return(result);
        }